mirror of
https://github.com/ansible/awx-operator.git
synced 2026-03-27 05:43:11 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4c1fda066 | ||
|
|
0d97183bbf | ||
|
|
293f0158e0 | ||
|
|
bb30b3b9fe | ||
|
|
39bebe64ba | ||
|
|
5bd84b3d3e | ||
|
|
76e315d191 | ||
|
|
dd022258b5 | ||
|
|
019fa3d356 | ||
|
|
4a968aa605 | ||
|
|
92639c1e89 | ||
|
|
a7cfbe23da | ||
|
|
16a2b590d6 | ||
|
|
8518e0d1c7 | ||
|
|
6bc101af3e |
19
.github/workflows/feature.yml
vendored
19
.github/workflows/feature.yml
vendored
@@ -29,25 +29,6 @@ jobs:
|
||||
run: |
|
||||
echo "IMAGE_TAG_BASE=ghcr.io/${OWNER_LC}/awx-operator" >>${GITHUB_ENV}
|
||||
|
||||
- name: Set ARCH environment variable
|
||||
run: |
|
||||
echo "ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)" >>${GITHUB_ENV}
|
||||
|
||||
- name: Set OS environment variable
|
||||
run: |
|
||||
echo "OS=$(uname | awk '{print tolower($0)}')" >>${GITHUB_ENV}
|
||||
|
||||
- name: Install operator-sdk
|
||||
run: |
|
||||
echo "Installing operator-sdk ${OPERATOR_SDK_DL_URL}" && \
|
||||
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH} && \
|
||||
chmod +x operator-sdk_${OS}_${ARCH} && \
|
||||
sudo mkdir -p /usr/local/bin/ && \
|
||||
sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk && \
|
||||
operator-sdk version
|
||||
env:
|
||||
OPERATOR_SDK_DL_URL: https://github.com/operator-framework/operator-sdk/releases/download/v1.26.0
|
||||
|
||||
- name: Log in to registry
|
||||
run: |
|
||||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
|
||||
21
.github/workflows/promote.yaml
vendored
21
.github/workflows/promote.yaml
vendored
@@ -22,11 +22,28 @@ jobs:
|
||||
|
||||
- name: Re-tag and promote awx-operator image
|
||||
run: |
|
||||
# Promote operator image
|
||||
docker pull ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
|
||||
docker tag ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} quay.io/${{ github.repository }}:${{ github.event.release.tag_name }}
|
||||
docker tag ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} quay.io/${{ github.repository }}:latest
|
||||
docker tag \
|
||||
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} \
|
||||
quay.io/${{ github.repository }}:${{ github.event.release.tag_name }}
|
||||
docker tag \
|
||||
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} \
|
||||
quay.io/${{ github.repository }}:latest
|
||||
docker push quay.io/${{ github.repository }}:${{ github.event.release.tag_name }}
|
||||
docker push quay.io/${{ github.repository }}:latest
|
||||
# Promote bundle image
|
||||
docker pull ghcr.io/${{ github.repository }}-bundle:v${{ github.event.release.tag_name }}
|
||||
docker tag \
|
||||
ghcr.io/${{ github.repository }}-bundle:v${{ github.event.release.tag_name }} \
|
||||
quay.io/${{ github.repository }}-bundle:v${{ github.event.release.tag_name }}
|
||||
docker push quay.io/${{ github.repository }}-bundle:v${{ github.event.release.tag_name }}
|
||||
# Promote catalog image
|
||||
docker pull ghcr.io/${{ github.repository }}-catalog:v${{ github.event.release.tag_name }}
|
||||
docker tag \
|
||||
ghcr.io/${{ github.repository }}-catalog:v${{ github.event.release.tag_name }} \
|
||||
quay.io/${{ github.repository }}-catalog:v${{ github.event.release.tag_name }}
|
||||
docker push quay.io/${{ github.repository }}-catalog:v${{ github.event.release.tag_name }}
|
||||
|
||||
- name: Release Helm chart
|
||||
run: |
|
||||
|
||||
3
.github/workflows/stage.yml
vendored
3
.github/workflows/stage.yml
vendored
@@ -63,7 +63,8 @@ jobs:
|
||||
BUILD_ARGS="--build-arg DEFAULT_AWX_VERSION=${{ github.event.inputs.default_awx_version }} \
|
||||
--build-arg OPERATOR_VERSION=${{ github.event.inputs.version }}" \
|
||||
IMAGE_TAG_BASE=ghcr.io/${{ github.repository_owner }}/awx-operator \
|
||||
VERSION=${{ github.event.inputs.version }} make docker-build docker-push
|
||||
VERSION=${{ github.event.inputs.version }} \
|
||||
make bundle docker-build docker-push bundle-build bundle-push catalog-build catalog-push
|
||||
|
||||
- name: Run test deployment
|
||||
working-directory: awx-operator
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM quay.io/operator-framework/ansible-operator:v1.28.1
|
||||
FROM quay.io/operator-framework/ansible-operator:v1.31.0
|
||||
|
||||
USER 0
|
||||
|
||||
|
||||
26
Makefile
26
Makefile
@@ -149,6 +149,22 @@ KUSTOMIZE = $(shell which kustomize)
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: operator-sdk
|
||||
OPERATOR_SDK = $(shell pwd)/bin/operator-sdk
|
||||
operator-sdk: ## Download operator-sdk locally if necessary, preferring the $(pwd)/bin path over global if both exist.
|
||||
ifeq (,$(wildcard $(OPERATOR_SDK)))
|
||||
ifeq (,$(shell which operator-sdk 2>/dev/null))
|
||||
@{ \
|
||||
set -e ;\
|
||||
mkdir -p $(dir $(OPERATOR_SDK)) ;\
|
||||
curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/v1.31.0/operator-sdk_$(OS)_$(ARCHA) ;\
|
||||
chmod +x $(OPERATOR_SDK) ;\
|
||||
}
|
||||
else
|
||||
OPERATOR_SDK = $(shell which operator-sdk)
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: ansible-operator
|
||||
ANSIBLE_OPERATOR = $(shell pwd)/bin/ansible-operator
|
||||
ansible-operator: ## Download ansible-operator locally if necessary, preferring the $(pwd)/bin path over global if both exist.
|
||||
@@ -157,7 +173,7 @@ ifeq (,$(shell which ansible-operator 2>/dev/null))
|
||||
@{ \
|
||||
set -e ;\
|
||||
mkdir -p $(dir $(ANSIBLE_OPERATOR)) ;\
|
||||
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.26.0/ansible-operator_$(OS)_$(ARCHA) ;\
|
||||
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.31.0/ansible-operator_$(OS)_$(ARCHA) ;\
|
||||
chmod +x $(ANSIBLE_OPERATOR) ;\
|
||||
}
|
||||
else
|
||||
@@ -166,11 +182,11 @@ endif
|
||||
endif
|
||||
|
||||
.PHONY: bundle
|
||||
bundle: kustomize ## Generate bundle manifests and metadata, then validate generated files.
|
||||
operator-sdk generate kustomize manifests -q
|
||||
bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
|
||||
$(OPERATOR_SDK) generate kustomize manifests -q
|
||||
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
|
||||
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
|
||||
operator-sdk bundle validate ./bundle
|
||||
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
|
||||
$(OPERATOR_SDK) bundle validate ./bundle
|
||||
|
||||
.PHONY: bundle-build
|
||||
bundle-build: ## Build the bundle image.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
[](https://github.com/ansible/awx-operator/actions)
|
||||
[](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html)
|
||||
[](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html)
|
||||
[](https://groups.google.com/g/awx-project)
|
||||
[](https://libera.chat)
|
||||
|
||||
@@ -76,6 +76,7 @@ All of our usage and configuration docs are nested in the `docs/` directory. Bel
|
||||
- [Redis Container Capabilities](./docs/user-guide/advanced-configuration/redis-container-capabilities.md)
|
||||
- [Trusting a Custom Certificate Authority](./docs/user-guide/advanced-configuration/trusting-a-custom-certificate-authority.md)
|
||||
- [Service Account](./docs/user-guide/advanced-configuration/service-account.md)
|
||||
- [Security Context](./docs/user-guide/advanced-configuration/security-context.md)
|
||||
- [Persisting the Projects Directory](./docs/user-guide/advanced-configuration/persisting-projects-directory.md)
|
||||
- Troubleshooting
|
||||
- [General Debugging](./docs/troubleshooting/debugging.md)
|
||||
@@ -110,4 +111,3 @@ We welcome your feedback and ideas. The AWX operator uses the same mailing list
|
||||
|
||||
- Join the [Ansible AWX channel on Matrix](https://matrix.to/#/#awx:ansible.com)
|
||||
- Join the [Ansible Community Forum](https://forum.ansible.com)
|
||||
- Join the [mailing list](https://groups.google.com/forum/#!forum/awx-project)
|
||||
|
||||
@@ -92,7 +92,8 @@ spec:
|
||||
type: string
|
||||
precreate_partition_hours:
|
||||
description: Number of hours worth of events table partitions to precreate before backup to avoid pg_dump locks.
|
||||
type: string
|
||||
type: integer
|
||||
format: int32
|
||||
image_pull_policy:
|
||||
description: The image pull policy
|
||||
type: string
|
||||
|
||||
@@ -1779,6 +1779,10 @@ spec:
|
||||
session_cookie_secure:
|
||||
description: Set session cookie secure mode for web
|
||||
type: string
|
||||
postgres_security_context_settings:
|
||||
description: Key/values that will be set under the pod-level securityContext field
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
receptor_log_level:
|
||||
description: Set log level of receptor service
|
||||
type: string
|
||||
|
||||
@@ -53,7 +53,7 @@ spec:
|
||||
- displayName: Precreate Partition Hours
|
||||
path: precreate_partition_hours
|
||||
x-descriptors:
|
||||
- urn:alm:descriptor:com.tectonic.ui:text
|
||||
- urn:alm:descriptor:com.tectonic.ui:number
|
||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||
- urn:alm:descriptor:com.tectonic.ui:hidden
|
||||
- displayName: Database Backup Label Selector
|
||||
@@ -61,6 +61,11 @@ spec:
|
||||
x-descriptors:
|
||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||
- urn:alm:descriptor:com.tectonic.ui:hidden
|
||||
- displayName: PostgreSQL Security Context Settings
|
||||
path: postgres_security_context_settings
|
||||
x-descriptors:
|
||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||
- urn:alm:descriptor:com.tectonic.ui:hidden
|
||||
- displayName: PostgreSQL Image
|
||||
path: postgres_image
|
||||
x-descriptors:
|
||||
|
||||
@@ -9,7 +9,7 @@ After the draft release is created, publish it and the [Promote AWX Operator ima
|
||||
- Publish image to Quay
|
||||
- Release Helm chart
|
||||
|
||||
After the GHA is complete, the final step is to run the [publish-to-operator-hub.sh](./hack/publish-to-operator-hub.sh) script, which will create a PR in the following repos to add the new awx-operator bundle version to OperatorHub:
|
||||
After the GHA is complete, the final step is to run the [publish-to-operator-hub.sh](https://github.com/ansible/awx-operator/blob/devel/hack/publish-to-operator-hub.sh) script, which will create a PR in the following repos to add the new awx-operator bundle version to OperatorHub:
|
||||
* https://github.com/k8s-operatorhub/community-operators (community operator index)
|
||||
* https://github.com/redhat-openshift-ecosystem/community-operators-prod (operator index shipped with Openshift)
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ spec:
|
||||
service_type: nodeport
|
||||
```
|
||||
|
||||
> It may make sense to create and specify your own secret key for your deployment so that if the k8s secret gets deleted, it can be re-created if needed. If it is not provided, one will be auto-generated, but cannot be recovered if lost. Read more [here](#secret-key-configuration).
|
||||
> It may make sense to create and specify your own secret key for your deployment so that if the k8s secret gets deleted, it can be re-created if needed. If it is not provided, one will be auto-generated, but cannot be recovered if lost. Read more [here](../user-guide/admin-user-account-configuration.md#secret-key-configuration).
|
||||
|
||||
If you are on Openshift, you can take advantage of Routes by specifying the following your spec. This will automatically create a Route for you with a custom hostname. This can be found on the Route section of the Openshift Console.
|
||||
|
||||
|
||||
27
docs/user-guide/advanced-configuration/security-context.md
Normal file
27
docs/user-guide/advanced-configuration/security-context.md
Normal file
@@ -0,0 +1,27 @@
|
||||
#### Service Account
|
||||
|
||||
It is possible to modify some `SecurityContext` proprieties of the various deployments and stateful sets if needed.
|
||||
|
||||
| Name | Description | Default |
|
||||
| ---------------------------------- | -------------------------------------------- | ------- |
|
||||
| security_context_settings | SecurityContext for Task and Web deployments | {} |
|
||||
| postgres_security_context_settings | SecurityContext for Task and Web deployments | {} |
|
||||
|
||||
|
||||
Example configuration securityContext for the Task and Web deployments:
|
||||
|
||||
```yaml
|
||||
spec:
|
||||
security_context_settings:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
```
|
||||
|
||||
|
||||
```yaml
|
||||
spec:
|
||||
postgres_security_context_settings:
|
||||
runAsNonRoot: true
|
||||
```
|
||||
15
hack/publish-to-operator-hub.sh
Normal file → Executable file
15
hack/publish-to-operator-hub.sh
Normal file → Executable file
@@ -15,7 +15,7 @@
|
||||
#
|
||||
# Usage:
|
||||
# First, check out awx-operator tag you intend to release, in this case, 1.0.0
|
||||
# $ VERSION=1.1.2 PREV_VERSION=1.1.1 FORK=<your-fork> ./publish-operator.sh
|
||||
# $ VERSION=1.1.2 PREV_VERSION=1.1.1 FORK=<your-fork> ./hack/publish-to-operator-hub.sh
|
||||
#
|
||||
# Remember to change update the VERSION and PREV_VERSION before running!!!
|
||||
|
||||
@@ -46,12 +46,12 @@ make bundle-build bundle-push BUNDLE_IMG=$BUNDLE_IMG IMG=$IMG
|
||||
make catalog-build catalog-push CATALOG_IMG=$CATALOG_IMG BUNDLE_IMGS=$BUNDLE_IMG BUNDLE_IMG=$BUNDLE_IMG IMG=$IMG
|
||||
|
||||
# Set containerImage & namespace variables in CSV
|
||||
sed -i -e "s|containerImage: quay.io/ansible/awx-operator:devel|containerImage: quay.io/ansible/awx-operator:${VERSION}|g" bundle/manifests/awx-operator.clusterserviceversion.yaml
|
||||
sed -i -e "s|namespace: placeholder|namespace: awx|g" bundle/manifests/awx-operator.clusterserviceversion.yaml
|
||||
sed -i.bak -e "s|containerImage: quay.io/ansible/awx-operator:devel|containerImage: quay.io/ansible/awx-operator:${VERSION}|g" bundle/manifests/awx-operator.clusterserviceversion.yaml
|
||||
sed -i.bak -e "s|namespace: placeholder|namespace: awx|g" bundle/manifests/awx-operator.clusterserviceversion.yaml
|
||||
|
||||
# Add replaces to dependency graph for upgrade path
|
||||
if ! grep -qF 'replaces: awx-operator.v${PREV_VERSION}' bundle/manifests/awx-operator.clusterserviceversion.yaml; then
|
||||
sed -i -e "/version: ${VERSION}/a \\
|
||||
sed -i.bak -e "/version: ${VERSION}/a \\
|
||||
replaces: awx-operator.v$PREV_VERSION" bundle/manifests/awx-operator.clusterserviceversion.yaml
|
||||
fi
|
||||
|
||||
@@ -60,10 +60,13 @@ mv bundle/manifests/awx-operator.clusterserviceversion.yaml bundle/manifests/awx
|
||||
|
||||
# Set Openshift Support Range (bump minKubeVersion in CSV when changing)
|
||||
if ! grep -qF 'openshift.versions' bundle/metadata/annotations.yaml; then
|
||||
sed -i -e "/annotations:/a \\
|
||||
com.redhat.openshift.versions: v4.10-v4.13\n" bundle/metadata/annotations.yaml
|
||||
sed -i.bak -e "/annotations:/a \\
|
||||
com.redhat.openshift.versions: v4.11" bundle/metadata/annotations.yaml
|
||||
fi
|
||||
|
||||
# Remove .bak files from bundle result from sed commands
|
||||
find bundle -name "*.bak" -type f -delete
|
||||
|
||||
# -- Put up community-operators PR
|
||||
cd $OPERATOR_PATH
|
||||
git clone git@github.com:k8s-operatorhub/community-operators.git
|
||||
|
||||
@@ -3,4 +3,4 @@ collections:
|
||||
- name: kubernetes.core
|
||||
version: '>=2.3.2'
|
||||
- name: operator_sdk.util
|
||||
version: "0.4.0"
|
||||
version: "0.5.0"
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
kind: Pod
|
||||
namespace: '{{ ansible_operator_meta.namespace }}'
|
||||
label_selectors:
|
||||
- "app.kubernetes.io/name={{ ansible_operator_meta.name }}-task"
|
||||
- "app.kubernetes.io/name={{ deployment_name }}-task"
|
||||
- "app.kubernetes.io/managed-by={{ deployment_type }}-operator"
|
||||
- "app.kubernetes.io/component={{ deployment_type }}"
|
||||
field_selectors:
|
||||
@@ -134,11 +134,27 @@
|
||||
namespace: "{{ backup_pvc_namespace }}"
|
||||
pod: "{{ ansible_operator_meta.name }}-db-management"
|
||||
command: |
|
||||
bash -c """
|
||||
bash -c "
|
||||
function end_keepalive {
|
||||
rc=$?
|
||||
rm -f \"$1\"
|
||||
kill $(cat /proc/$2/task/$2/children 2>/dev/null) 2>/dev/null || true
|
||||
wait $2 || true
|
||||
exit $rc
|
||||
}
|
||||
keepalive_file=\"$(mktemp)\"
|
||||
while [[ -f \"$keepalive_file\" ]]; do
|
||||
echo 'Dumping data from database...'
|
||||
sleep 60
|
||||
done &
|
||||
keepalive_pid=$!
|
||||
trap 'end_keepalive \"$keepalive_file\" \"$keepalive_pid\"' EXIT SIGINT SIGTERM
|
||||
echo keepalive_pid: $keepalive_pid
|
||||
set -e -o pipefail
|
||||
PGPASSWORD='{{ awx_postgres_pass }}' {{ pgdump }} > {{ backup_dir }}/tower.db
|
||||
set +e +o pipefail
|
||||
echo 'Successful'
|
||||
"""
|
||||
"
|
||||
register: data_migration
|
||||
no_log: "{{ no_log }}"
|
||||
failed_when: "'Successful' not in data_migration.stdout"
|
||||
|
||||
@@ -424,6 +424,7 @@ garbage_collect_secrets: false
|
||||
development_mode: false
|
||||
|
||||
security_context_settings: {}
|
||||
postgres_security_context_settings: {}
|
||||
|
||||
# Set no_log settings on certain tasks
|
||||
no_log: true
|
||||
|
||||
@@ -96,8 +96,26 @@
|
||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||
pod: "{{ awx_task_pod_name }}"
|
||||
container: "{{ ansible_operator_meta.name }}-task"
|
||||
command: >-
|
||||
bash -c "awx-manage migrate --noinput"
|
||||
command: |
|
||||
bash -c "
|
||||
function end_keepalive {
|
||||
rc=$?
|
||||
rm -f \"$1\"
|
||||
kill $(cat /proc/$2/task/$2/children 2>/dev/null) 2>/dev/null || true
|
||||
wait $2 || true
|
||||
exit $rc
|
||||
}
|
||||
keepalive_file=\"$(mktemp)\"
|
||||
while [[ -f \"$keepalive_file\" ]]; do
|
||||
echo 'Database schema migration in progress...'
|
||||
sleep 60
|
||||
done &
|
||||
keepalive_pid=$!
|
||||
trap 'end_keepalive \"$keepalive_file\" \"$keepalive_pid\"' EXIT SIGINT SIGTERM
|
||||
echo keepalive_pid: $keepalive_pid
|
||||
awx-manage migrate --noinput
|
||||
echo 'Successful'
|
||||
"
|
||||
register: migrate_result
|
||||
when:
|
||||
- awx_task_pod_name != ''
|
||||
|
||||
@@ -340,6 +340,10 @@ spec:
|
||||
{% elif affinity %}
|
||||
affinity:
|
||||
{{ affinity | to_nice_yaml | indent(width=8) }}
|
||||
{% endif %}
|
||||
{% if security_context_settings|length %}
|
||||
securityContext:
|
||||
{{ security_context_settings | to_nice_yaml | indent(8) }}
|
||||
{% endif %}
|
||||
volumes:
|
||||
- name: "{{ ansible_operator_meta.name }}-receptor-ca"
|
||||
|
||||
@@ -51,6 +51,10 @@ spec:
|
||||
- image: '{{ _postgres_image }}'
|
||||
imagePullPolicy: '{{ image_pull_policy }}'
|
||||
name: postgres
|
||||
{% if postgres_security_context_settings|length %}
|
||||
securityContext:
|
||||
{{ postgres_security_context_settings | to_nice_yaml | indent(12) }}
|
||||
{% endif %}
|
||||
{% if postgres_extra_args %}
|
||||
args: {{ postgres_extra_args }}
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user