mirror of
https://github.com/ansible/awx-operator.git
synced 2026-05-06 13:22:50 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92639c1e89 | ||
|
|
a7cfbe23da | ||
|
|
16a2b590d6 | ||
|
|
8518e0d1c7 | ||
|
|
6bc101af3e | ||
|
|
31e1914db6 | ||
|
|
aee1b464ed | ||
|
|
61921d40ed | ||
|
|
b5f2c19470 | ||
|
|
8d91a67078 | ||
|
|
3df613346c | ||
|
|
b559e836e4 | ||
|
|
ea5fb823f9 | ||
|
|
4c5429190c | ||
|
|
22a05e8887 | ||
|
|
7012a6acfc | ||
|
|
1dc64b551c | ||
|
|
c949d6e58d | ||
|
|
0e0f413e82 | ||
|
|
7935873746 | ||
|
|
a57b9e0475 | ||
|
|
39eee1370b | ||
|
|
48dcb08c78 | ||
|
|
d60fddebca | ||
|
|
ffd1a4b2ab |
10
.github/workflows/ci.yaml
vendored
10
.github/workflows/ci.yaml
vendored
@@ -18,9 +18,9 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
DOCKER_API_VERSION: "1.41"
|
DOCKER_API_VERSION: "1.41"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.8"
|
python-version: "3.8"
|
||||||
|
|
||||||
@@ -45,12 +45,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: helm
|
name: helm
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Create k8s Kind Cluster
|
- name: Create k8s Kind Cluster
|
||||||
uses: helm/kind-action@v1.2.0
|
uses: helm/kind-action@v1.8.0
|
||||||
|
|
||||||
- name: Build operator image and load into kind
|
- name: Build operator image and load into kind
|
||||||
run: |
|
run: |
|
||||||
@@ -88,7 +88,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Check no_log statements
|
- name: Check no_log statements
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.github/workflows/devel.yaml
vendored
2
.github/workflows/devel.yaml
vendored
@@ -11,7 +11,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Push devel image
|
name: Push devel image
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Build Image
|
- name: Build Image
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.github/workflows/label_issue.yml
vendored
2
.github/workflows/label_issue.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Label Issue - Community
|
name: Label Issue - Community
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
- name: Install python requests
|
- name: Install python requests
|
||||||
run: pip install requests
|
run: pip install requests
|
||||||
|
|||||||
2
.github/workflows/label_pr.yml
vendored
2
.github/workflows/label_pr.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Label PR - Community
|
name: Label PR - Community
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
- name: Install python requests
|
- name: Install python requests
|
||||||
run: pip install requests
|
run: pip install requests
|
||||||
|
|||||||
4
.github/workflows/stage.yml
vendored
4
.github/workflows/stage.yml
vendored
@@ -38,13 +38,13 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
- name: Checkout awx
|
- name: Checkout awx
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: ${{ github.repository_owner }}/awx
|
repository: ${{ github.repository_owner }}/awx
|
||||||
path: awx
|
path: awx
|
||||||
|
|
||||||
- name: Checkout awx-operator
|
- name: Checkout awx-operator
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: ${{ github.repository_owner }}/awx-operator
|
repository: ${{ github.repository_owner }}/awx-operator
|
||||||
path: awx-operator
|
path: awx-operator
|
||||||
|
|||||||
17
.readthedocs.yml
Normal file
17
.readthedocs.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Read the Docs configuration file
|
||||||
|
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||||
|
|
||||||
|
# RTD API version
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
build:
|
||||||
|
os: ubuntu-22.04
|
||||||
|
tools:
|
||||||
|
python: "3.11"
|
||||||
|
|
||||||
|
mkdocs:
|
||||||
|
configuration: mkdocs.yml
|
||||||
|
|
||||||
|
python:
|
||||||
|
install:
|
||||||
|
- requirements: ./docs/requirements.txt
|
||||||
@@ -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
|
USER 0
|
||||||
|
|
||||||
|
|||||||
8
Makefile
8
Makefile
@@ -334,6 +334,14 @@ helm-chart-generate: kustomize helm kubectl-slice yq charts
|
|||||||
for file in charts/$(CHART_NAME)/raw-files/*rolebinding*; do\
|
for file in charts/$(CHART_NAME)/raw-files/*rolebinding*; do\
|
||||||
$(YQ) -i '.subjects[0].namespace = "{{ .Release.Namespace }}"' $${file};\
|
$(YQ) -i '.subjects[0].namespace = "{{ .Release.Namespace }}"' $${file};\
|
||||||
done
|
done
|
||||||
|
# Correct .metadata.name for cluster scoped resources
|
||||||
|
cluster_scoped_files="charts/$(CHART_NAME)/raw-files/clusterrolebinding-awx-operator-proxy-rolebinding.yaml charts/$(CHART_NAME)/raw-files/clusterrole-awx-operator-metrics-reader.yaml charts/$(CHART_NAME)/raw-files/clusterrole-awx-operator-proxy-role.yaml";\
|
||||||
|
for file in $${cluster_scoped_files}; do\
|
||||||
|
$(YQ) -i '.metadata.name += "-{{ .Release.Name }}"' $${file};\
|
||||||
|
done
|
||||||
|
|
||||||
|
# Correct the reference for the clusterrolebinding
|
||||||
|
$(YQ) -i '.roleRef.name += "-{{ .Release.Name }}"' 'charts/$(CHART_NAME)/raw-files/clusterrolebinding-awx-operator-proxy-rolebinding.yaml'
|
||||||
# move all custom resource definitions to crds folder
|
# move all custom resource definitions to crds folder
|
||||||
mkdir charts/$(CHART_NAME)/crds
|
mkdir charts/$(CHART_NAME)/crds
|
||||||
mv charts/$(CHART_NAME)/raw-files/customresourcedefinition*.yaml charts/$(CHART_NAME)/crds/.
|
mv charts/$(CHART_NAME)/raw-files/customresourcedefinition*.yaml charts/$(CHART_NAME)/crds/.
|
||||||
|
|||||||
@@ -47,8 +47,7 @@ All of our usage and configuration docs are nested in the `docs/` directory. Bel
|
|||||||
- [Authors](./docs/contributors-guide/author.md)
|
- [Authors](./docs/contributors-guide/author.md)
|
||||||
- Installation
|
- Installation
|
||||||
- [Basic Install](./docs/installation/basic-install.md)
|
- [Basic Install](./docs/installation/basic-install.md)
|
||||||
- [Creating a Minikube cluster for testing](./docs/creating-a-minikube-cluster-for-testing.md)
|
- [Creating a Minikube cluster for testing](./docs/installation/creating-a-minikube-cluster-for-testing.md)
|
||||||
- [Installation](./docs/installation/installation.md)
|
|
||||||
- [Helm Install](./docs/installation/helm-install-on-existing-cluster.md)
|
- [Helm Install](./docs/installation/helm-install-on-existing-cluster.md)
|
||||||
- [Migration](./docs/migration/migration.md)
|
- [Migration](./docs/migration/migration.md)
|
||||||
- [Uninstall](./docs/uninstall/uninstall.md)
|
- [Uninstall](./docs/uninstall/uninstall.md)
|
||||||
@@ -57,7 +56,7 @@ All of our usage and configuration docs are nested in the `docs/` directory. Bel
|
|||||||
- [Database Configuration](./docs/user-guide/database-configuration.md)
|
- [Database Configuration](./docs/user-guide/database-configuration.md)
|
||||||
- [Network and TLS Configuration](./docs/user-guide/network-and-tls-configuration.md)
|
- [Network and TLS Configuration](./docs/user-guide/network-and-tls-configuration.md)
|
||||||
- Advanced Configuration
|
- Advanced Configuration
|
||||||
- [No Log](./docs/no-log.md)
|
- [No Log](./docs/user-guide/advanced-configuration/no-log.md)
|
||||||
- [Deploy a Specific Version of AWX](./docs/user-guide/advanced-configuration/deploying-a-specific-version-of-awx.md)
|
- [Deploy a Specific Version of AWX](./docs/user-guide/advanced-configuration/deploying-a-specific-version-of-awx.md)
|
||||||
- [Resource Requirements](./docs/user-guide/advanced-configuration/containers-resource-requirements.md)
|
- [Resource Requirements](./docs/user-guide/advanced-configuration/containers-resource-requirements.md)
|
||||||
- [Extra Settings](./docs/user-guide/advanced-configuration/extra-settings.md)
|
- [Extra Settings](./docs/user-guide/advanced-configuration/extra-settings.md)
|
||||||
@@ -77,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)
|
- [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)
|
- [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)
|
- [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)
|
- [Persisting the Projects Directory](./docs/user-guide/advanced-configuration/persisting-projects-directory.md)
|
||||||
- Troubleshooting
|
- Troubleshooting
|
||||||
- [General Debugging](./docs/troubleshooting/debugging.md)
|
- [General Debugging](./docs/troubleshooting/debugging.md)
|
||||||
@@ -109,5 +109,6 @@ We ask all of our community members and contributors to adhere to the [Ansible c
|
|||||||
|
|
||||||
We welcome your feedback and ideas. The AWX operator uses the same mailing list and IRC channel as AWX itself. Here's how to reach us with feedback and questions:
|
We welcome your feedback and ideas. The AWX operator uses the same mailing list and IRC channel as AWX itself. Here's how to reach us with feedback and questions:
|
||||||
|
|
||||||
- Join the `#ansible-awx` channel on irc.libera.chat
|
- 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)
|
- Join the [mailing list](https://groups.google.com/forum/#!forum/awx-project)
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ spec:
|
|||||||
postgres_image_version:
|
postgres_image_version:
|
||||||
description: PostgreSQL container image version to use
|
description: PostgreSQL container image version to use
|
||||||
type: string
|
type: string
|
||||||
|
precreate_partition_hours:
|
||||||
|
description: Number of hours worth of events table partitions to precreate before backup to avoid pg_dump locks.
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
image_pull_policy:
|
image_pull_policy:
|
||||||
description: The image pull policy
|
description: The image pull policy
|
||||||
type: string
|
type: string
|
||||||
|
|||||||
@@ -63,21 +63,29 @@ spec:
|
|||||||
admin_password_secret:
|
admin_password_secret:
|
||||||
description: Secret where the admin password can be found
|
description: Secret where the admin password can be found
|
||||||
type: string
|
type: string
|
||||||
|
maxLength: 255
|
||||||
|
pattern: '^[a-zA-Z0-9][-a-zA-Z0-9]{0,253}[a-zA-Z0-9]$'
|
||||||
postgres_configuration_secret:
|
postgres_configuration_secret:
|
||||||
description: Secret where the database configuration can be found
|
description: Secret where the database configuration can be found
|
||||||
type: string
|
type: string
|
||||||
old_postgres_configuration_secret:
|
old_postgres_configuration_secret:
|
||||||
description: Secret where the old database configuration can be found for data migration
|
description: Secret where the old database configuration can be found for data migration
|
||||||
type: string
|
type: string
|
||||||
|
maxLength: 255
|
||||||
|
pattern: '^[a-zA-Z0-9][-a-zA-Z0-9]{0,253}[a-zA-Z0-9]$'
|
||||||
postgres_label_selector:
|
postgres_label_selector:
|
||||||
description: Label selector used to identify postgres pod for data migration
|
description: Label selector used to identify postgres pod for data migration
|
||||||
type: string
|
type: string
|
||||||
secret_key_secret:
|
secret_key_secret:
|
||||||
description: Secret where the secret key can be found
|
description: Secret where the secret key can be found
|
||||||
type: string
|
type: string
|
||||||
|
maxLength: 255
|
||||||
|
pattern: '^[a-zA-Z0-9][-a-zA-Z0-9]{0,253}[a-zA-Z0-9]$'
|
||||||
broadcast_websocket_secret:
|
broadcast_websocket_secret:
|
||||||
description: Secret where the broadcast websocket secret can be found
|
description: Secret where the broadcast websocket secret can be found
|
||||||
type: string
|
type: string
|
||||||
|
maxLength: 255
|
||||||
|
pattern: '^[a-zA-Z0-9][-a-zA-Z0-9]{0,253}[a-zA-Z0-9]$'
|
||||||
extra_volumes:
|
extra_volumes:
|
||||||
description: Specify extra volumes to add to the application pod
|
description: Specify extra volumes to add to the application pod
|
||||||
type: string
|
type: string
|
||||||
@@ -1771,6 +1779,10 @@ spec:
|
|||||||
session_cookie_secure:
|
session_cookie_secure:
|
||||||
description: Set session cookie secure mode for web
|
description: Set session cookie secure mode for web
|
||||||
type: string
|
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:
|
receptor_log_level:
|
||||||
description: Set log level of receptor service
|
description: Set log level of receptor service
|
||||||
type: string
|
type: string
|
||||||
|
|||||||
@@ -50,11 +50,22 @@ spec:
|
|||||||
x-descriptors:
|
x-descriptors:
|
||||||
- urn:alm:descriptor:com.tectonic.ui:text
|
- urn:alm:descriptor:com.tectonic.ui:text
|
||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
|
- displayName: Precreate Partition Hours
|
||||||
|
path: precreate_partition_hours
|
||||||
|
x-descriptors:
|
||||||
|
- 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
|
- displayName: Database Backup Label Selector
|
||||||
path: postgres_label_selector
|
path: postgres_label_selector
|
||||||
x-descriptors:
|
x-descriptors:
|
||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
- urn:alm:descriptor:com.tectonic.ui:hidden
|
- 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
|
- displayName: PostgreSQL Image
|
||||||
path: postgres_image
|
path: postgres_image
|
||||||
x-descriptors:
|
x-descriptors:
|
||||||
|
|||||||
@@ -8,3 +8,18 @@ After the draft release is created, publish it and the [Promote AWX Operator ima
|
|||||||
|
|
||||||
- Publish image to Quay
|
- Publish image to Quay
|
||||||
- Release Helm chart
|
- 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:
|
||||||
|
* https://github.com/k8s-operatorhub/community-operators (community operator index)
|
||||||
|
* https://github.com/redhat-openshift-ecosystem/community-operators-prod (operator index shipped with Openshift)
|
||||||
|
|
||||||
|
The usage is documented in the script itself, but here is an example of how you would use the script to publish the 2.5.3 awx-opeator bundle to OperatorHub.
|
||||||
|
Note that you need to specify the version being released, as well as the previous version. This is because the bundle has a pointer to the previous version that is it being upgrade from. This is used by OLM to create a dependency graph.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ VERSION=2.5.3 PREV_VERSION=2.5.2 ./publish-operator.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note: There are some quirks with running this on OS X that still need to be fixed, but the script runs smoothly on linux.
|
||||||
|
|
||||||
|
As soon as CI completes successfully, the PR's will be auto-merged. Please remember to monitor those PR's to make sure that CI passes, sometimes it needs a retry.
|
||||||
|
|||||||
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
|
||||||
|
```
|
||||||
125
hack/publish-to-operator-hub.sh
Normal file
125
hack/publish-to-operator-hub.sh
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Create PR to Publish to community-operators and community-operators-prod
|
||||||
|
#
|
||||||
|
# * Create upstream awx-operator release
|
||||||
|
# * Check out tag (1.1.2).
|
||||||
|
# * Run VERSION=1.1.2 make bundle
|
||||||
|
# * Clone https://github.com/k8s-operatorhub/community-operators --branch main
|
||||||
|
# * mkdir -p operators/awx-operator/0.31.0/
|
||||||
|
# * Copy in manifests/ metadata/ and tests/ directories into operators/awx-operator/1.1.2/
|
||||||
|
# * Use sed to add in a replaces or skip entry. replace by default.
|
||||||
|
# * No need to update config.yaml
|
||||||
|
# * Build and Push operator and bundle images
|
||||||
|
# * Open PR or at least push to a branch so that a PR can be manually opened from it.
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Remember to change update the VERSION and PREV_VERSION before running!!!
|
||||||
|
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
VERSION=${VERSION:-blah2}
|
||||||
|
PREV_VERSION=${PREV_VERSION:-blah1}
|
||||||
|
BRANCH=publish-awx-operator-$VERSION
|
||||||
|
FORK=${FORK:-fork}
|
||||||
|
|
||||||
|
IMG=quay.io/ansible/awx-operator:$VERSION
|
||||||
|
CATALOG_IMG=quay.io/ansible/awx-operator-catalog:$VERSION
|
||||||
|
BUNDLE_IMG=quay.io/ansible/awx-operator-bundle:$VERSION
|
||||||
|
|
||||||
|
# Set path variables
|
||||||
|
OPERATOR_PATH=${OPERATOR_PATH:-~/awx-operator}
|
||||||
|
|
||||||
|
# Build & Push Operator Image # Not needed because it is done as part of the GHA release automation
|
||||||
|
# make docker-build docker-push IMG=$IMG
|
||||||
|
|
||||||
|
# Build bundle directory
|
||||||
|
rm -rf bundle/
|
||||||
|
make bundle IMG=$IMG
|
||||||
|
|
||||||
|
# Build bundle and catalog images
|
||||||
|
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
|
||||||
|
|
||||||
|
# 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 \\
|
||||||
|
replaces: awx-operator.v$PREV_VERSION" bundle/manifests/awx-operator.clusterserviceversion.yaml
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rename CSV to contain version in name
|
||||||
|
mv bundle/manifests/awx-operator.clusterserviceversion.yaml bundle/manifests/awx-operator.v${VERSION}.clusterserviceversion.yaml
|
||||||
|
|
||||||
|
# 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
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -- Put up community-operators PR
|
||||||
|
cd $OPERATOR_PATH
|
||||||
|
git clone git@github.com:k8s-operatorhub/community-operators.git
|
||||||
|
|
||||||
|
mkdir -p community-operators/operators/awx-operator/$VERSION/
|
||||||
|
cp -r bundle/* community-operators/operators/awx-operator/$VERSION/
|
||||||
|
cd community-operators/operators/awx-operator/$VERSION/
|
||||||
|
pwd
|
||||||
|
ls -la
|
||||||
|
|
||||||
|
# Commit and push PR
|
||||||
|
git checkout -b $BRANCH
|
||||||
|
git add ./
|
||||||
|
git status
|
||||||
|
|
||||||
|
message='operator [N] [CI] awx-operator'
|
||||||
|
commitMessage="${message} ${VERSION}"
|
||||||
|
git commit -m "$commitMessage" -s
|
||||||
|
|
||||||
|
git remote add upstream git@github.com:$FORK/community-operators.git
|
||||||
|
git push upstream $BRANCH
|
||||||
|
|
||||||
|
|
||||||
|
# -- Put up community-operators-prod PR
|
||||||
|
# Reset directory
|
||||||
|
cd $OPERATOR_PATH
|
||||||
|
|
||||||
|
pwd
|
||||||
|
|
||||||
|
git clone git@github.com:redhat-openshift-ecosystem/community-operators-prod.git
|
||||||
|
|
||||||
|
mkdir -p community-operators-prod/operators/awx-operator/$VERSION/
|
||||||
|
cp -r bundle/* community-operators-prod/operators/awx-operator/$VERSION/
|
||||||
|
cd community-operators-prod/operators/awx-operator/$VERSION/
|
||||||
|
|
||||||
|
pwd
|
||||||
|
ls -la
|
||||||
|
|
||||||
|
# Commit and push PR
|
||||||
|
git checkout -b $BRANCH
|
||||||
|
git add ./
|
||||||
|
git status
|
||||||
|
|
||||||
|
message='operator [N] [CI] awx-operator'
|
||||||
|
commitMessage="${message} ${VERSION}"
|
||||||
|
git commit -m "$commitMessage" -s
|
||||||
|
|
||||||
|
git remote add upstream git@github.com:$FORK/community-operators-prod.git
|
||||||
|
git push upstream $BRANCH
|
||||||
|
|
||||||
|
|
||||||
|
# -- Print Links to Branches
|
||||||
|
echo "Commnity Operators: https://github.com/$FORK/community-operators/pull/new/$BRANCH"
|
||||||
|
echo "Commnity Operators Prod: https://github.com/$FORK/community-operators-prod/pull/new/$BRANCH"
|
||||||
|
|
||||||
|
# -- Cleanup
|
||||||
|
|
||||||
|
rm -rf $OPERATOR_PATH/community-operators
|
||||||
|
rm -rf $OPERATOR_PATH/community-operators-prod
|
||||||
@@ -3,4 +3,4 @@ collections:
|
|||||||
- name: kubernetes.core
|
- name: kubernetes.core
|
||||||
version: '>=2.3.2'
|
version: '>=2.3.2'
|
||||||
- name: operator_sdk.util
|
- name: operator_sdk.util
|
||||||
version: "0.4.0"
|
version: "0.5.0"
|
||||||
|
|||||||
@@ -44,4 +44,7 @@ additional_labels: []
|
|||||||
|
|
||||||
# Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
|
# Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
|
||||||
set_self_labels: true
|
set_self_labels: true
|
||||||
|
|
||||||
|
# Number of whole hours worth of events table partitions to precreate before starting backup to avoid pg_dump locks.
|
||||||
|
precreate_partition_hours: 3
|
||||||
...
|
...
|
||||||
|
|||||||
@@ -82,6 +82,41 @@
|
|||||||
resolvable_db_host: '{{ (awx_postgres_type == "managed") | ternary(awx_postgres_host + "." + ansible_operator_meta.namespace + ".svc.cluster.local", awx_postgres_host) }}' # yamllint disable-line rule:line-length
|
resolvable_db_host: '{{ (awx_postgres_type == "managed") | ternary(awx_postgres_host + "." + ansible_operator_meta.namespace + ".svc.cluster.local", awx_postgres_host) }}' # yamllint disable-line rule:line-length
|
||||||
no_log: "{{ no_log }}"
|
no_log: "{{ no_log }}"
|
||||||
|
|
||||||
|
- name: Get the current resource task pod information.
|
||||||
|
k8s_info:
|
||||||
|
api_version: v1
|
||||||
|
kind: Pod
|
||||||
|
namespace: '{{ ansible_operator_meta.namespace }}'
|
||||||
|
label_selectors:
|
||||||
|
- "app.kubernetes.io/name={{ deployment_name }}-task"
|
||||||
|
- "app.kubernetes.io/managed-by={{ deployment_type }}-operator"
|
||||||
|
- "app.kubernetes.io/component={{ deployment_type }}"
|
||||||
|
field_selectors:
|
||||||
|
- status.phase=Running
|
||||||
|
register: awx_task_pod
|
||||||
|
|
||||||
|
- name: Set the resource pod as a variable.
|
||||||
|
set_fact:
|
||||||
|
awx_task_pod: >-
|
||||||
|
{{ awx_task_pod['resources']
|
||||||
|
| rejectattr('metadata.deletionTimestamp', 'defined')
|
||||||
|
| sort(attribute='metadata.creationTimestamp')
|
||||||
|
| first | default({}) }}
|
||||||
|
|
||||||
|
- name: Set the resource pod name as a variable.
|
||||||
|
set_fact:
|
||||||
|
awx_task_pod_name: "{{ awx_task_pod['metadata']['name'] | default('') }}"
|
||||||
|
|
||||||
|
- name: Precreate database partitions
|
||||||
|
k8s_exec:
|
||||||
|
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||||
|
pod: "{{ awx_task_pod_name }}"
|
||||||
|
container: "{{ deployment_name }}-task"
|
||||||
|
command: awx-manage precreate_partitions --count='{{ precreate_partition_hours }}'
|
||||||
|
when: precreate_partition_hours > 0
|
||||||
|
register: result
|
||||||
|
changed_when: "'Created partitions for' in result.stdout"
|
||||||
|
|
||||||
- name: Set pg_dump command
|
- name: Set pg_dump command
|
||||||
set_fact:
|
set_fact:
|
||||||
pgdump: >-
|
pgdump: >-
|
||||||
@@ -99,11 +134,27 @@
|
|||||||
namespace: "{{ backup_pvc_namespace }}"
|
namespace: "{{ backup_pvc_namespace }}"
|
||||||
pod: "{{ ansible_operator_meta.name }}-db-management"
|
pod: "{{ ansible_operator_meta.name }}-db-management"
|
||||||
command: |
|
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
|
set -e -o pipefail
|
||||||
PGPASSWORD='{{ awx_postgres_pass }}' {{ pgdump }} > {{ backup_dir }}/tower.db
|
PGPASSWORD='{{ awx_postgres_pass }}' {{ pgdump }} > {{ backup_dir }}/tower.db
|
||||||
|
set +e +o pipefail
|
||||||
echo 'Successful'
|
echo 'Successful'
|
||||||
"""
|
"
|
||||||
register: data_migration
|
register: data_migration
|
||||||
no_log: "{{ no_log }}"
|
no_log: "{{ no_log }}"
|
||||||
failed_when: "'Successful' not in data_migration.stdout"
|
failed_when: "'Successful' not in data_migration.stdout"
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ _init_projects_container_image: quay.io/centos/centos:stream9
|
|||||||
|
|
||||||
create_preload_data: true
|
create_preload_data: true
|
||||||
|
|
||||||
replicas: "1"
|
replicas: 1
|
||||||
web_replicas: ''
|
web_replicas: ''
|
||||||
task_replicas: ''
|
task_replicas: ''
|
||||||
|
|
||||||
@@ -424,6 +424,7 @@ garbage_collect_secrets: false
|
|||||||
development_mode: false
|
development_mode: false
|
||||||
|
|
||||||
security_context_settings: {}
|
security_context_settings: {}
|
||||||
|
postgres_security_context_settings: {}
|
||||||
|
|
||||||
# Set no_log settings on certain tasks
|
# Set no_log settings on certain tasks
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|||||||
@@ -59,14 +59,29 @@
|
|||||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||||
pod: "{{ postgres_pod_name }}"
|
pod: "{{ postgres_pod_name }}"
|
||||||
command: |
|
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 'Migrating data from old 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
|
set -e -o pipefail
|
||||||
PGPASSWORD='{{ awx_old_postgres_pass }}' {{ pgdump }} | PGPASSWORD='{{ awx_postgres_pass }}' {{ pg_restore }}
|
PGPASSWORD=\"$PGPASSWORD_OLD\" {{ pgdump }} | PGPASSWORD=\"$POSTGRES_PASSWORD\" {{ pg_restore }}
|
||||||
|
set +e +o pipefail
|
||||||
echo 'Successful'
|
echo 'Successful'
|
||||||
"""
|
"
|
||||||
no_log: "{{ no_log }}"
|
no_log: "{{ no_log }}"
|
||||||
register: data_migration
|
register: data_migration
|
||||||
failed_when: "'Successful' not in data_migration.stdout"
|
|
||||||
|
|
||||||
- name: Set flag signifying that this instance has been migrated
|
- name: Set flag signifying that this instance has been migrated
|
||||||
set_fact:
|
set_fact:
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Check for presence of Deployment
|
- name: Check for presence of Deployment
|
||||||
k8s_info:
|
k8s_info:
|
||||||
api_version: apps/v1
|
api_version: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
name: "{{ ansible_operator_meta.name }}"
|
|
||||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||||
register: this_deployment
|
label_selectors:
|
||||||
|
- 'app.kubernetes.io/part-of={{ ansible_operator_meta.name }}'
|
||||||
|
- 'app.kubernetes.io/managed-by={{ deployment_type }}-operator'
|
||||||
|
- 'app.kubernetes.io/component={{ deployment_type }}'
|
||||||
|
register: _deployments
|
||||||
|
|
||||||
- name: Scale down Deployment for migration
|
- name: Scale down Deployment for migration
|
||||||
kubernetes.core.k8s_scale:
|
kubernetes.core.k8s_scale:
|
||||||
@@ -16,7 +18,5 @@
|
|||||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||||
replicas: 0
|
replicas: 0
|
||||||
wait: yes
|
wait: yes
|
||||||
loop:
|
loop: "{{ _deployments.resources | map(attribute='metadata.name') | list }}"
|
||||||
- "{{ ansible_operator_meta.name }}-task"
|
when: _deployments.resources | length
|
||||||
- "{{ ansible_operator_meta.name }}-web"
|
|
||||||
when: this_deployment['resources'] | length
|
|
||||||
|
|||||||
@@ -91,11 +91,27 @@
|
|||||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||||
pod: "{{ postgres_pod_name }}"
|
pod: "{{ postgres_pod_name }}"
|
||||||
command: |
|
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 'Migrating data to new PostgreSQL {{ supported_postgres_version }} 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
|
set -e -o pipefail
|
||||||
PGPASSWORD='{{ awx_postgres_pass }}' {{ pgdump }} | PGPASSWORD='{{ awx_postgres_pass }}' {{ pg_restore }}
|
PGPASSWORD=\"$POSTGRES_PASSWORD\" {{ pgdump }} | PGPASSWORD=\"$POSTGRES_PASSWORD\" {{ pg_restore }}
|
||||||
|
set +e +o pipefail
|
||||||
echo 'Successful'
|
echo 'Successful'
|
||||||
"""
|
"
|
||||||
no_log: "{{ no_log }}"
|
no_log: "{{ no_log }}"
|
||||||
register: data_migration
|
register: data_migration
|
||||||
failed_when: "'Successful' not in data_migration.stdout"
|
failed_when: "'Successful' not in data_migration.stdout"
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ spec:
|
|||||||
fsGroup: 1000
|
fsGroup: 1000
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if security_context_settings|length %}
|
{% if security_context_settings|length %}
|
||||||
{{ security_context_settings | to_nice_yaml | indent(8) }}
|
{{ security_context_settings | to_nice_yaml | indent(10) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if termination_grace_period_seconds is defined %}
|
{% if termination_grace_period_seconds is defined %}
|
||||||
|
|||||||
@@ -340,6 +340,10 @@ spec:
|
|||||||
{% elif affinity %}
|
{% elif affinity %}
|
||||||
affinity:
|
affinity:
|
||||||
{{ affinity | to_nice_yaml | indent(width=8) }}
|
{{ affinity | to_nice_yaml | indent(width=8) }}
|
||||||
|
{% endif %}
|
||||||
|
{% if security_context_settings|length %}
|
||||||
|
securityContext:
|
||||||
|
{{ security_context_settings | to_nice_yaml | indent(8) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
volumes:
|
volumes:
|
||||||
- name: "{{ ansible_operator_meta.name }}-receptor-ca"
|
- name: "{{ ansible_operator_meta.name }}-receptor-ca"
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ spec:
|
|||||||
- image: '{{ _postgres_image }}'
|
- image: '{{ _postgres_image }}'
|
||||||
imagePullPolicy: '{{ image_pull_policy }}'
|
imagePullPolicy: '{{ image_pull_policy }}'
|
||||||
name: postgres
|
name: postgres
|
||||||
|
{% if postgres_security_context_settings|length %}
|
||||||
|
securityContext:
|
||||||
|
{{ postgres_security_context_settings | to_nice_yaml | indent(12) }}
|
||||||
|
{% endif %}
|
||||||
{% if postgres_extra_args %}
|
{% if postgres_extra_args %}
|
||||||
args: {{ postgres_extra_args }}
|
args: {{ postgres_extra_args }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -94,6 +98,13 @@ spec:
|
|||||||
value: '{{ postgres_initdb_args }}'
|
value: '{{ postgres_initdb_args }}'
|
||||||
- name: POSTGRES_HOST_AUTH_METHOD
|
- name: POSTGRES_HOST_AUTH_METHOD
|
||||||
value: '{{ postgres_host_auth_method }}'
|
value: '{{ postgres_host_auth_method }}'
|
||||||
|
{% if 'resources' in old_pg_config and old_pg_config['resources'] and 'password' in old_pg_config['resources'][0]['data'] %}
|
||||||
|
- name: PGPASSWORD_OLD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: '{{ old_pg_config['resources'][0]['metadata']['name'] }}'
|
||||||
|
key: password
|
||||||
|
{% endif %}
|
||||||
ports:
|
ports:
|
||||||
- containerPort: {{ awx_postgres_port | default('5432')}}
|
- containerPort: {{ awx_postgres_port | default('5432')}}
|
||||||
name: postgres-{{ supported_pg_version }}
|
name: postgres-{{ supported_pg_version }}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
k8s_info:
|
k8s_info:
|
||||||
api_version: apps/v1
|
api_version: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
name: "{{ ansible_operator_meta.namespace }}-task"
|
name: "{{ deployment_name }}-task"
|
||||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||||
register: this_deployment
|
register: this_deployment
|
||||||
|
|
||||||
@@ -63,8 +63,8 @@
|
|||||||
replicas: 0
|
replicas: 0
|
||||||
wait: yes
|
wait: yes
|
||||||
loop:
|
loop:
|
||||||
- "{{ ansible_operator_meta.name }}-task"
|
- "{{ deployment_name }}-task"
|
||||||
- "{{ ansible_operator_meta.name }}-web"
|
- "{{ deployment_name }}-web"
|
||||||
when: this_deployment['resources'] | length
|
when: this_deployment['resources'] | length
|
||||||
|
|
||||||
- name: Set full resolvable host name for postgres pod
|
- name: Set full resolvable host name for postgres pod
|
||||||
@@ -87,11 +87,27 @@
|
|||||||
namespace: "{{ backup_pvc_namespace }}"
|
namespace: "{{ backup_pvc_namespace }}"
|
||||||
pod: "{{ ansible_operator_meta.name }}-db-management"
|
pod: "{{ ansible_operator_meta.name }}-db-management"
|
||||||
command: |
|
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 'Migrating data from old 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
|
set -e -o pipefail
|
||||||
cat {{ backup_dir }}/tower.db | PGPASSWORD='{{ awx_postgres_pass }}' {{ pg_restore }}
|
cat {{ backup_dir }}/tower.db | PGPASSWORD='{{ awx_postgres_pass }}' {{ pg_restore }}
|
||||||
|
set +e +o pipefail
|
||||||
echo 'Successful'
|
echo 'Successful'
|
||||||
"""
|
"
|
||||||
register: data_migration
|
register: data_migration
|
||||||
no_log: "{{ no_log }}"
|
no_log: "{{ no_log }}"
|
||||||
failed_when: "'Successful' not in data_migration.stdout"
|
failed_when: "'Successful' not in data_migration.stdout"
|
||||||
|
|||||||
Reference in New Issue
Block a user