mirror of
https://github.com/ansible/awx-operator.git
synced 2026-04-12 20:01:05 +00:00
Compare commits
8 Commits
feature_re
...
2.16.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fa60853a2 | ||
|
|
f8bbe9f55a | ||
|
|
c7c7171110 | ||
|
|
b7370d0e48 | ||
|
|
0b37f76225 | ||
|
|
e6e1025206 | ||
|
|
a5d5028dae | ||
|
|
413b7003a2 |
9
.github/workflows/ci.yaml
vendored
9
.github/workflows/ci.yaml
vendored
@@ -17,6 +17,7 @@ jobs:
|
|||||||
- -t replicas
|
- -t replicas
|
||||||
env:
|
env:
|
||||||
DOCKER_API_VERSION: "1.41"
|
DOCKER_API_VERSION: "1.41"
|
||||||
|
DEBUG_OUTPUT_DIR: /tmp/awx_operator_molecule_test
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
@@ -37,10 +38,18 @@ jobs:
|
|||||||
MOLECULE_VERBOSITY: 3
|
MOLECULE_VERBOSITY: 3
|
||||||
PY_COLORS: '1'
|
PY_COLORS: '1'
|
||||||
ANSIBLE_FORCE_COLOR: '1'
|
ANSIBLE_FORCE_COLOR: '1'
|
||||||
|
STORE_DEBUG_OUTPUT: true
|
||||||
run: |
|
run: |
|
||||||
sudo rm -f $(which kustomize)
|
sudo rm -f $(which kustomize)
|
||||||
make kustomize
|
make kustomize
|
||||||
KUSTOMIZE_PATH=$(readlink -f bin/kustomize) molecule test -s kind -- ${{ matrix.ansible_args }}
|
KUSTOMIZE_PATH=$(readlink -f bin/kustomize) molecule test -s kind -- ${{ matrix.ansible_args }}
|
||||||
|
|
||||||
|
- name: Upload artifacts for failed tests if Run Molecule fails
|
||||||
|
if: failure()
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: awx_operator_molecule_test
|
||||||
|
path: ${{ env.DEBUG_OUTPUT_DIR }}
|
||||||
helm:
|
helm:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: helm
|
name: helm
|
||||||
|
|||||||
@@ -1940,26 +1940,36 @@ spec:
|
|||||||
description: Metrics-Utility Image PullPolicy
|
description: Metrics-Utility Image PullPolicy
|
||||||
type: string
|
type: string
|
||||||
metrics_utility_configmap:
|
metrics_utility_configmap:
|
||||||
description: Metrics-Utlity ConfigMap
|
description: Metrics-Utility ConfigMap
|
||||||
|
type: string
|
||||||
|
metrics_utility_secret:
|
||||||
|
description: Metrics-Utility Secret
|
||||||
type: string
|
type: string
|
||||||
metrics_utility_cronjob_gather_schedule:
|
metrics_utility_cronjob_gather_schedule:
|
||||||
description: Metrics-Utlity Gather Data CronJob Schedule
|
description: Metrics-Utility Gather Data CronJob Schedule
|
||||||
type: string
|
type: string
|
||||||
default: '@hourly'
|
default: '@hourly'
|
||||||
metrics_utility_cronjob_report_schedule:
|
metrics_utility_cronjob_report_schedule:
|
||||||
description: Metrics-Utlity Report CronJob Schedule
|
description: Metrics-Utility Report CronJob Schedule
|
||||||
type: string
|
type: string
|
||||||
default: '@monthly'
|
default: '@monthly'
|
||||||
|
metrics_utility_ship_target:
|
||||||
|
description: Metrics-Utility Ship Target
|
||||||
|
type: string
|
||||||
metrics_utility_pvc_claim:
|
metrics_utility_pvc_claim:
|
||||||
description: Metrics-Utlity PVC Claim
|
description: Metrics-Utility PVC Claim
|
||||||
type: string
|
type: string
|
||||||
metrics_utility_pvc_claim_size:
|
metrics_utility_pvc_claim_size:
|
||||||
description: Metrics-Utlity PVC Claim Size
|
description: Metrics-Utility PVC Claim Size
|
||||||
type: string
|
type: string
|
||||||
default: 5Gi
|
default: 5Gi
|
||||||
metrics_utility_pvc_claim_storage_class:
|
metrics_utility_pvc_claim_storage_class:
|
||||||
description: Metrics-Utlity PVC Claim Storage Class
|
description: Metrics-Utility PVC Claim Storage Class
|
||||||
type: string
|
type: string
|
||||||
|
metrics_utility_console_enabled:
|
||||||
|
description: Enable metrics utility shipping to Red Hat Hybrid Cloud Console
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
type: object
|
type: object
|
||||||
status:
|
status:
|
||||||
properties:
|
properties:
|
||||||
|
|||||||
@@ -1039,7 +1039,7 @@ spec:
|
|||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
- urn:alm:descriptor:com.tectonic.ui:text
|
- urn:alm:descriptor:com.tectonic.ui:text
|
||||||
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
||||||
- displayName: Metrics-Utlity Image Version
|
- displayName: Metrics-Utility Image Version
|
||||||
path: metrics_utility_image_version
|
path: metrics_utility_image_version
|
||||||
x-descriptors:
|
x-descriptors:
|
||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
@@ -1051,42 +1051,60 @@ spec:
|
|||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
- urn:alm:descriptor:com.tectonic.ui:imagePullPolicy
|
- urn:alm:descriptor:com.tectonic.ui:imagePullPolicy
|
||||||
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
||||||
- displayName: Metrics-Utlity ConfigMap
|
- displayName: Metrics-Utility ConfigMap
|
||||||
path: metrics_utility_configmap
|
path: metrics_utility_configmap
|
||||||
x-descriptors:
|
x-descriptors:
|
||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
- urn:alm:descriptor:io.kubernetes:ConfigMap
|
- urn:alm:descriptor:io.kubernetes:ConfigMap
|
||||||
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
||||||
- displayName: Metrics-Utlity Gather Data CronJob Schedule
|
- displayName: Metrics-Utility Secret
|
||||||
|
path: metrics_utility_secret
|
||||||
|
x-descriptors:
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
|
- urn:alm:descriptor:io.kubernetes:Secret
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
||||||
|
- displayName: Metrics-Utility Gather Data CronJob Schedule
|
||||||
path: metrics_utility_cronjob_gather_schedule
|
path: metrics_utility_cronjob_gather_schedule
|
||||||
x-descriptors:
|
x-descriptors:
|
||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
- urn:alm:descriptor:com.tectonic.ui:text
|
- urn:alm:descriptor:com.tectonic.ui:text
|
||||||
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
||||||
- displayName: Metrics-Utlity Report CronJob Schedule
|
- displayName: Metrics-Utility Report CronJob Schedule
|
||||||
path: metrics_utility_cronjob_report_schedule
|
path: metrics_utility_cronjob_report_schedule
|
||||||
x-descriptors:
|
x-descriptors:
|
||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
- urn:alm:descriptor:com.tectonic.ui:text
|
- urn:alm:descriptor:com.tectonic.ui:text
|
||||||
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
||||||
- displayName: Metrics-Utlity PVC Claim
|
- displayName: Metrics-Utility Ship Target
|
||||||
|
path: metrics_utility_ship_target
|
||||||
|
x-descriptors:
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:text
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
||||||
|
- displayName: Metrics-Utility PVC Claim
|
||||||
path: metrics_utility_pvc_claim
|
path: metrics_utility_pvc_claim
|
||||||
x-descriptors:
|
x-descriptors:
|
||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
- urn:alm:descriptor:com.tectonic.ui:text
|
- urn:alm:descriptor:com.tectonic.ui:text
|
||||||
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
||||||
- displayName: Metrics-Utlity PVC Claim Size
|
- displayName: Metrics-Utility PVC Claim Size
|
||||||
path: metrics_utility_pvc_claim_size
|
path: metrics_utility_pvc_claim_size
|
||||||
x-descriptors:
|
x-descriptors:
|
||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
- urn:alm:descriptor:com.tectonic.ui:text
|
- urn:alm:descriptor:com.tectonic.ui:text
|
||||||
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
||||||
- displayName: Metrics-Utlity PVC Claim Storage Class
|
- displayName: Metrics-Utility PVC Claim Storage Class
|
||||||
path: metrics_utility_pvc_claim_storage_class
|
path: metrics_utility_pvc_claim_storage_class
|
||||||
x-descriptors:
|
x-descriptors:
|
||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
- urn:alm:descriptor:io.kubernetes:StorageClass
|
- urn:alm:descriptor:io.kubernetes:StorageClass
|
||||||
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
||||||
|
- displayName: Metrics-Utility Enabled Shipping to Red Hat Hybrid Cloud Console
|
||||||
|
path: metrics_utility_console_enabled
|
||||||
|
x-descriptors:
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
|
||||||
statusDescriptors:
|
statusDescriptors:
|
||||||
- description: Route to access the instance deployed
|
- description: Route to access the instance deployed
|
||||||
displayName: URL
|
displayName: URL
|
||||||
|
|||||||
@@ -2,9 +2,15 @@
|
|||||||
|
|
||||||
To build the AWX Operator docs locally:
|
To build the AWX Operator docs locally:
|
||||||
|
|
||||||
1. Clone the AWX operator repository.
|
1. Clone the AWX operator repository.
|
||||||
2. From the root directory:
|
1. Preferrably, create a virtual environment for installing the dependencies.
|
||||||
a. pip install --user -r docs/requirements.txt
|
a. `python3 -m venv venv`
|
||||||
b. mkdocs build
|
b. `source venv/bin/activate`
|
||||||
|
1. From the root directory:
|
||||||
|
a. `pip install -r docs/requirements.txt`
|
||||||
|
b. `mkdocs build`
|
||||||
|
1. View the docs in your browser:
|
||||||
|
a. `mkdocs serve`
|
||||||
|
b. Open your browser and navigate to `http://127.0.0.1:8000/`
|
||||||
|
|
||||||
This will create a new directory called `site/` in the root of your clone containing the index.html and static files. To view the docs in your browser, navigate there in your file explorer and double-click on the `index.html` file. This should open the docs site in your browser.
|
This will create a new directory called `site/` in the root of your clone containing the index.html and static files.
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ idna==3.6
|
|||||||
jinja2==3.1.3
|
jinja2==3.1.3
|
||||||
# via
|
# via
|
||||||
# mkdocs
|
# mkdocs
|
||||||
|
# mkdocs-macros-plugin
|
||||||
# mkdocs-material
|
# mkdocs-material
|
||||||
# mkdocstrings
|
# mkdocstrings
|
||||||
jsmin==3.0.1
|
jsmin==3.0.1
|
||||||
@@ -88,18 +89,21 @@ mkdocs==1.5.3
|
|||||||
# mkdocs-autorefs
|
# mkdocs-autorefs
|
||||||
# mkdocs-gen-files
|
# mkdocs-gen-files
|
||||||
# mkdocs-htmlproofer-plugin
|
# mkdocs-htmlproofer-plugin
|
||||||
|
# mkdocs-macros-plugin
|
||||||
# mkdocs-material
|
# mkdocs-material
|
||||||
# mkdocs-minify-plugin
|
# mkdocs-minify-plugin
|
||||||
# mkdocs-monorepo-plugin
|
# mkdocs-monorepo-plugin
|
||||||
# mkdocstrings
|
# mkdocstrings
|
||||||
mkdocs-ansible==24.2.1
|
mkdocs-ansible==24.3.0
|
||||||
# via -r docs/requirements.in
|
# via -r requirements.in
|
||||||
mkdocs-autorefs==0.5.0
|
mkdocs-autorefs==0.5.0
|
||||||
# via mkdocstrings
|
# via mkdocstrings
|
||||||
mkdocs-gen-files==0.5.0
|
mkdocs-gen-files==0.5.0
|
||||||
# via mkdocs-ansible
|
# via mkdocs-ansible
|
||||||
mkdocs-htmlproofer-plugin==1.0.0
|
mkdocs-htmlproofer-plugin==1.0.0
|
||||||
# via mkdocs-ansible
|
# via mkdocs-ansible
|
||||||
|
mkdocs-macros-plugin==1.0.5
|
||||||
|
# via mkdocs-ansible
|
||||||
mkdocs-material==9.2.6
|
mkdocs-material==9.2.6
|
||||||
# via mkdocs-ansible
|
# via mkdocs-ansible
|
||||||
mkdocs-material-extensions==1.3.1
|
mkdocs-material-extensions==1.3.1
|
||||||
@@ -145,12 +149,15 @@ pymdown-extensions==10.0.1
|
|||||||
pyquery==2.0.0
|
pyquery==2.0.0
|
||||||
# via readtime
|
# via readtime
|
||||||
python-dateutil==2.8.2
|
python-dateutil==2.8.2
|
||||||
# via ghp-import
|
# via
|
||||||
|
# ghp-import
|
||||||
|
# mkdocs-macros-plugin
|
||||||
python-slugify==8.0.4
|
python-slugify==8.0.4
|
||||||
# via mkdocs-monorepo-plugin
|
# via mkdocs-monorepo-plugin
|
||||||
pyyaml==6.0.1
|
pyyaml==6.0.1
|
||||||
# via
|
# via
|
||||||
# mkdocs
|
# mkdocs
|
||||||
|
# mkdocs-macros-plugin
|
||||||
# pymdown-extensions
|
# pymdown-extensions
|
||||||
# pyyaml-env-tag
|
# pyyaml-env-tag
|
||||||
pyyaml-env-tag==0.1
|
pyyaml-env-tag==0.1
|
||||||
@@ -168,6 +175,8 @@ six==1.16.0
|
|||||||
# via python-dateutil
|
# via python-dateutil
|
||||||
soupsieve==2.5
|
soupsieve==2.5
|
||||||
# via beautifulsoup4
|
# via beautifulsoup4
|
||||||
|
termcolor==2.4.0
|
||||||
|
# via mkdocs-macros-plugin
|
||||||
text-unidecode==1.3
|
text-unidecode==1.3
|
||||||
# via python-slugify
|
# via python-slugify
|
||||||
tinycss2==1.2.1
|
tinycss2==1.2.1
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
### Upgrading
|
### Upgrading
|
||||||
|
|
||||||
To upgrade AWX, it is recommended to upgrade the awx-operator to the version that maps to the desired version of AWX. To find the version of AWX that will be installed by the awx-operator by default, check the version specified in the `DEFAULT_AWX_VERSION` variable for that particular release. You can do so by running the following command
|
To upgrade AWX, it is recommended to upgrade the awx-operator to the version that maps to the desired version of AWX. To find the version of AWX that will be installed by the awx-operator by default, check the version specified in the `DEFAULT_AWX_VERSION` variable for that particular release. You can do so by running the following command
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
AWX_OPERATOR_VERSION=2.8.0
|
AWX_OPERATOR_VERSION=2.8.0
|
||||||
docker run --entrypoint="" quay.io/ansible/awx-operator:$AWX_OPERATOR_VERSION bash -c "env | grep DEFAULT_AWX_VERSION"
|
docker run --entrypoint="" quay.io/ansible/awx-operator:$AWX_OPERATOR_VERSION bash -c "env | grep DEFAULT_AWX_VERSION"
|
||||||
@@ -12,26 +13,23 @@ Apply the awx-operator.yml for that release to upgrade the operator, and in turn
|
|||||||
|
|
||||||
The first part of any upgrade should be a backup. Note, there are secrets in the pod which work in conjunction with the database. Having just a database backup without the required secrets will not be sufficient for recovering from an issue when upgrading to a new version. See the [backup role documentation](https://github.com/ansible/awx-operator/tree/devel/roles/backup) for information on how to backup your database and secrets.
|
The first part of any upgrade should be a backup. Note, there are secrets in the pod which work in conjunction with the database. Having just a database backup without the required secrets will not be sufficient for recovering from an issue when upgrading to a new version. See the [backup role documentation](https://github.com/ansible/awx-operator/tree/devel/roles/backup) for information on how to backup your database and secrets.
|
||||||
|
|
||||||
In the event you need to recover the backup see the [restore role documentation](https://github.com/ansible/awx-operator/tree/devel/roles/restore). *Before Restoring from a backup*, be sure to:
|
In the event you need to recover the backup see the [restore role documentation](https://github.com/ansible/awx-operator/tree/devel/roles/restore). _Before Restoring from a backup_, be sure to:
|
||||||
* delete the old existing AWX CR
|
|
||||||
* delete the persistent volume claim (PVC) for the database from the old deployment, which has a name like `postgres-15-<deployment-name>-postgres-15-0`
|
- delete the old existing AWX CR
|
||||||
|
- delete the persistent volume claim (PVC) for the database from the old deployment, which has a name like `postgres-15-<deployment-name>-postgres-15-0`
|
||||||
|
|
||||||
**Note**: Do not delete the namespace/project, as that will delete the backup and the backup's PVC as well.
|
**Note**: Do not delete the namespace/project, as that will delete the backup and the backup's PVC as well.
|
||||||
|
|
||||||
|
|
||||||
#### PostgreSQL Upgrade Considerations
|
#### PostgreSQL Upgrade Considerations
|
||||||
|
|
||||||
If there is a PostgreSQL major version upgrade, after the data directory on the PVC is migrated to the new version, the old PVC is kept by default.
|
If there is a PostgreSQL major version upgrade, after the data directory on the PVC is migrated to the new version, the old PVC is kept by default.
|
||||||
This provides the ability to roll back if needed, but can take up extra storage space in your cluster unnecessarily. You can configure it to be deleted automatically
|
This provides the ability to roll back if needed, but can take up extra storage space in your cluster unnecessarily. You can configure it to be deleted automatically after a successful upgrade by setting the following variable on the AWX spec.
|
||||||
after a successful upgrade by setting the following variable on the AWX spec.
|
|
||||||
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
spec:
|
spec:
|
||||||
postgres_keep_pvc_after_upgrade: False
|
postgres_keep_pvc_after_upgrade: False
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### v0.14.0
|
#### v0.14.0
|
||||||
|
|
||||||
##### Cluster-scope to Namespace-scope considerations
|
##### Cluster-scope to Namespace-scope considerations
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ In a scenario where custom volumes and volume mounts are required to either over
|
|||||||
| init_container_extra_commands | Specify additional commands for Init container | '' |
|
| init_container_extra_commands | Specify additional commands for Init container | '' |
|
||||||
|
|
||||||
|
|
||||||
> :warning: The `ee_extra_volume_mounts` and `extra_volumes` will only take effect to the globally available Execution Environments. For custom `ee`, please [customize the Pod spec](https://docs.ansible.com/ansible-tower/latest/html/administration/external_execution_envs.html#customize-the-pod-spec).
|
!!! warning
|
||||||
|
The `ee_extra_volume_mounts` and `extra_volumes` will only take effect to the globally available Execution Environments. For custom `ee`, please [customize the Pod spec](https://docs.ansible.com/ansible-tower/latest/html/administration/external_execution_envs.html#customize-the-pod-spec).
|
||||||
|
|
||||||
Example configuration for ConfigMap
|
Example configuration for ConfigMap
|
||||||
|
|
||||||
@@ -26,62 +27,68 @@ metadata:
|
|||||||
namespace: <target namespace>
|
namespace: <target namespace>
|
||||||
data:
|
data:
|
||||||
ansible.cfg: |
|
ansible.cfg: |
|
||||||
[defaults]
|
[defaults]
|
||||||
remote_tmp = /tmp
|
remote_tmp = /tmp
|
||||||
[ssh_connection]
|
[ssh_connection]
|
||||||
ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s
|
ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s
|
||||||
custom.py: |
|
custom.py: |
|
||||||
INSIGHTS_URL_BASE = "example.org"
|
INSIGHTS_URL_BASE = "example.org"
|
||||||
AWX_CLEANUP_PATHS = True
|
AWX_CLEANUP_PATHS = True
|
||||||
```
|
```
|
||||||
Example spec file for volumes and volume mounts
|
Example spec file for volumes and volume mounts
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
---
|
---
|
||||||
spec:
|
spec:
|
||||||
...
|
...
|
||||||
extra_volumes: |
|
extra_volumes: |
|
||||||
- name: ansible-cfg
|
- name: ansible-cfg
|
||||||
configMap:
|
configMap:
|
||||||
defaultMode: 420
|
defaultMode: 420
|
||||||
items:
|
items:
|
||||||
- key: ansible.cfg
|
- key: ansible.cfg
|
||||||
path: ansible.cfg
|
path: ansible.cfg
|
||||||
name: <resourcename>-extra-config
|
name: <resourcename>-extra-config
|
||||||
- name: custom-py
|
- name: custom-py
|
||||||
configMap:
|
configMap:
|
||||||
defaultMode: 420
|
defaultMode: 420
|
||||||
items:
|
items:
|
||||||
- key: custom.py
|
- key: custom.py
|
||||||
path: custom.py
|
path: custom.py
|
||||||
name: <resourcename>-extra-config
|
name: <resourcename>-extra-config
|
||||||
- name: shared-volume
|
- name: shared-volume
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: my-external-volume-claim
|
claimName: my-external-volume-claim
|
||||||
|
|
||||||
init_container_extra_volume_mounts: |
|
init_container_extra_volume_mounts: |
|
||||||
- name: shared-volume
|
- name: shared-volume
|
||||||
mountPath: /shared
|
mountPath: /shared
|
||||||
|
|
||||||
init_container_extra_commands: |
|
init_container_extra_commands: |
|
||||||
# set proper permissions (rwx) for the awx user
|
# set proper permissions (rwx) for the awx user
|
||||||
chmod 775 /shared
|
chmod 775 /shared
|
||||||
chgrp 1000 /shared
|
chgrp 1000 /shared
|
||||||
|
|
||||||
ee_extra_volume_mounts: |
|
ee_extra_volume_mounts: |
|
||||||
- name: ansible-cfg
|
- name: ansible-cfg
|
||||||
mountPath: /etc/ansible/ansible.cfg
|
mountPath: /etc/ansible/ansible.cfg
|
||||||
subPath: ansible.cfg
|
subPath: ansible.cfg
|
||||||
|
|
||||||
task_extra_volume_mounts: |
|
web_extra_volume_mounts: |
|
||||||
- name: custom-py
|
- name: custom-py
|
||||||
mountPath: /etc/tower/conf.d/custom.py
|
mountPath: /etc/tower/conf.d/custom.py
|
||||||
subPath: custom.py
|
subPath: custom.py
|
||||||
- name: shared-volume
|
|
||||||
mountPath: /shared
|
task_extra_volume_mounts: |
|
||||||
|
- name: custom-py
|
||||||
|
mountPath: /etc/tower/conf.d/custom.py
|
||||||
|
subPath: custom.py
|
||||||
|
- name: shared-volume
|
||||||
|
mountPath: /shared
|
||||||
```
|
```
|
||||||
|
|
||||||
> :warning: **Volume and VolumeMount names cannot contain underscores(_)**
|
!!! warning
|
||||||
|
**Volume and VolumeMount names cannot contain underscores(_)**
|
||||||
|
|
||||||
##### Custom UWSGI Configuration
|
##### Custom UWSGI Configuration
|
||||||
We allow the customization of two UWSGI parameters:
|
We allow the customization of two UWSGI parameters:
|
||||||
@@ -143,7 +150,9 @@ $ oc create configmap favicon-configmap --from-file favicon.ico
|
|||||||
Then specify the extra_volume and web_extra_volume_mounts on your AWX CR spec
|
Then specify the extra_volume and web_extra_volume_mounts on your AWX CR spec
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
---
|
||||||
spec:
|
spec:
|
||||||
|
...
|
||||||
extra_volumes: |
|
extra_volumes: |
|
||||||
- name: favicon
|
- name: favicon
|
||||||
configMap:
|
configMap:
|
||||||
|
|||||||
@@ -24,3 +24,7 @@ Example configuration of `extra_settings` parameter
|
|||||||
```
|
```
|
||||||
|
|
||||||
Note for some settings, such as `LOG_AGGREGATOR_LEVEL`, the value may need double quotes.
|
Note for some settings, such as `LOG_AGGREGATOR_LEVEL`, the value may need double quotes.
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
Alternatively, you can pass any additional settings by mounting ConfigMaps or Secrets of the python files (`*.py`) that contain custom settings to under `/etc/tower/conf.d/` in the web and task pods.
|
||||||
|
See the example of `custom.py` in the [Custom Volume and Volume Mount Options](custom-volume-and-volume-mount-options.md) section.
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ spec:
|
|||||||
!!! tip
|
!!! tip
|
||||||
AWX Operator supports both API groups `traefik.io` and `traefik.containo.us` in `ingress_api_version` for Traefik, but it is recommended to use `traefik.io` since `traefik.containo.us` is deprecated in Traefik v2.10 and is removed in Traefik v3. Refer to [Traefik documentation](https://doc.traefik.io/traefik/migration/v2/#v210) for more information about deprecation.
|
AWX Operator supports both API groups `traefik.io` and `traefik.containo.us` in `ingress_api_version` for Traefik, but it is recommended to use `traefik.io` since `traefik.containo.us` is deprecated in Traefik v2.10 and is removed in Traefik v3. Refer to [Traefik documentation](https://doc.traefik.io/traefik/migration/v2/#v210) for more information about deprecation.
|
||||||
|
|
||||||
If you can't see any IngressRouteTCP resources by `kubectl` command after deploying mesh ingress, you should fully qualify the resource name with API group, `kubectl get ingressroutetcp.traefik.io` or `kubectl get traefik.containo.us` for example.
|
If you can't see any IngressRouteTCP resources by `kubectl` command after deploying mesh ingress, you should fully qualify the resource name with API group, `kubectl get ingressroutetcp.traefik.io` or `kubectl get ingressroutetcp.traefik.containo.us` for example.
|
||||||
|
|
||||||
### On Kubernetes with User managed Ingress
|
### On Kubernetes with User managed Ingress
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ provisioner:
|
|||||||
namespace: ${TEST_OPERATOR_NAMESPACE:-osdk-test}
|
namespace: ${TEST_OPERATOR_NAMESPACE:-osdk-test}
|
||||||
host_vars:
|
host_vars:
|
||||||
localhost:
|
localhost:
|
||||||
|
awx_ee_image: ${AWX_EE_TEST_IMAGE:-""}
|
||||||
awx_image: ${AWX_TEST_IMAGE:-""}
|
awx_image: ${AWX_TEST_IMAGE:-""}
|
||||||
awx_version: ${AWX_TEST_VERSION:-""}
|
awx_version: ${AWX_TEST_VERSION:-""}
|
||||||
default_awx_version: "{{ lookup('url', 'https://api.github.com/repos/ansible/awx/releases/latest') | from_json | json_query('tag_name') }}"
|
default_awx_version: "{{ lookup('url', 'https://api.github.com/repos/ansible/awx/releases/latest') | from_json | json_query('tag_name') }}"
|
||||||
@@ -30,6 +31,8 @@ provisioner:
|
|||||||
operator_image: ${OPERATOR_IMAGE:-""}
|
operator_image: ${OPERATOR_IMAGE:-""}
|
||||||
operator_pull_policy: ${OPERATOR_PULL_POLICY:-"Always"}
|
operator_pull_policy: ${OPERATOR_PULL_POLICY:-"Always"}
|
||||||
kustomize: ${KUSTOMIZE_PATH:-kustomize}
|
kustomize: ${KUSTOMIZE_PATH:-kustomize}
|
||||||
|
store_debug_output: ${STORE_DEBUG_OUTPUT:-false}
|
||||||
|
debug_output_dir: ${DEBUG_OUTPUT_DIR:-"/tmp/awx_operator_molecule_test"}
|
||||||
env:
|
env:
|
||||||
K8S_AUTH_KUBECONFIG: ${KUBECONFIG:-"~/.kube/config"}
|
K8S_AUTH_KUBECONFIG: ${KUBECONFIG:-"~/.kube/config"}
|
||||||
verifier:
|
verifier:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Create or update the awx.ansible.com/v1alpha1.AWX
|
- name: Create or update the awx.ansible.com/v1beta1.AWX
|
||||||
k8s:
|
k8s:
|
||||||
state: present
|
state: present
|
||||||
namespace: '{{ namespace }}'
|
namespace: '{{ namespace }}'
|
||||||
|
|||||||
@@ -1,98 +1,8 @@
|
|||||||
---
|
---
|
||||||
- include_tasks: apply_awx_spec.yml
|
- include_tasks: apply_awx_spec.yml
|
||||||
|
|
||||||
- name: Obtain generated admin password
|
- name: Validate AWX deployment
|
||||||
k8s_info:
|
block:
|
||||||
namespace: '{{ namespace }}'
|
|
||||||
kind: Secret
|
|
||||||
name: example-awx-admin-password
|
|
||||||
register: admin_pw_secret
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: Get web pod details
|
|
||||||
k8s_info:
|
|
||||||
namespace: '{{ namespace }}'
|
|
||||||
kind: Pod
|
|
||||||
label_selectors:
|
|
||||||
- app.kubernetes.io/name = example-awx-web
|
|
||||||
register: awx_web_pod
|
|
||||||
when: not awx_version
|
|
||||||
|
|
||||||
- name: Get task pod details
|
|
||||||
k8s_info:
|
|
||||||
namespace: '{{ namespace }}'
|
|
||||||
kind: Pod
|
|
||||||
label_selectors:
|
|
||||||
- app.kubernetes.io/name = example-awx-task
|
|
||||||
register: awx_task_pod
|
|
||||||
when: not awx_version
|
|
||||||
|
|
||||||
- name: Extract tags from images from web pod
|
|
||||||
set_fact:
|
|
||||||
web_image_tags: |
|
|
||||||
{{ awx_web_pod.resources[0].spec.containers |
|
|
||||||
map(attribute='image') |
|
|
||||||
map('regex_search', default_awx_version) }}
|
|
||||||
when: not awx_version
|
|
||||||
|
|
||||||
- name: Extract tags from images from task pod
|
|
||||||
set_fact:
|
|
||||||
task_image_tags: |
|
|
||||||
{{ awx_task_pod.resources[0].spec.containers |
|
|
||||||
map(attribute='image') |
|
|
||||||
map('regex_search', default_awx_version) }}
|
|
||||||
when: not awx_version
|
|
||||||
|
|
||||||
- fail:
|
|
||||||
msg: |
|
|
||||||
It looks like you may have broken the DEFAULT_AWX_VERSION functionality.
|
|
||||||
This is an environment variable that is set via build arg when releasing awx-operator.
|
|
||||||
when:
|
|
||||||
- not awx_version
|
|
||||||
- default_awx_version not in web_image_tags
|
|
||||||
- default_awx_version not in task_image_tags
|
|
||||||
|
|
||||||
- name: Launch Demo Job Template
|
|
||||||
awx.awx.job_launch:
|
|
||||||
name: Demo Job Template
|
|
||||||
wait: yes
|
|
||||||
validate_certs: no
|
|
||||||
controller_host: localhost/awx/
|
|
||||||
controller_username: admin
|
|
||||||
controller_password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
|
|
||||||
rescue:
|
|
||||||
- name: Get list of project updates and jobs
|
|
||||||
uri:
|
|
||||||
url: "http://localhost/awx/api/v2/{{ resource }}/"
|
|
||||||
user: admin
|
|
||||||
password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
|
|
||||||
force_basic_auth: yes
|
|
||||||
register: job_lists
|
|
||||||
loop:
|
|
||||||
- project_updates
|
|
||||||
- jobs
|
|
||||||
loop_control:
|
|
||||||
loop_var: resource
|
|
||||||
|
|
||||||
- name: Get all job and project details
|
|
||||||
uri:
|
|
||||||
url: "http://localhost{{ endpoint }}"
|
|
||||||
user: admin
|
|
||||||
password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
|
|
||||||
force_basic_auth: yes
|
|
||||||
loop: |
|
|
||||||
{{ job_lists.results | map(attribute='json') | map(attribute='results') | flatten | map(attribute='url') }}
|
|
||||||
loop_control:
|
|
||||||
loop_var: endpoint
|
|
||||||
|
|
||||||
- name: Re-emit failure
|
|
||||||
vars:
|
|
||||||
failed_task:
|
|
||||||
result: '{{ ansible_failed_result }}'
|
|
||||||
fail:
|
|
||||||
msg: '{{ failed_task }}'
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: Look up details for this AWX instance
|
- name: Look up details for this AWX instance
|
||||||
k8s_info:
|
k8s_info:
|
||||||
namespace: "{{ namespace }}"
|
namespace: "{{ namespace }}"
|
||||||
@@ -117,65 +27,90 @@
|
|||||||
- app.kubernetes.io/name = example-awx-task
|
- app.kubernetes.io/name = example-awx-task
|
||||||
register: awx_task_pod
|
register: awx_task_pod
|
||||||
|
|
||||||
- name: Extract additional_labels from AWX spec
|
- name: Validate DEFAULT_AWX_VERSION
|
||||||
set_fact:
|
block:
|
||||||
awx_additional_labels: >-
|
- name: Extract tags from images from web pod
|
||||||
{{ this_awx.resources[0].metadata.labels
|
set_fact:
|
||||||
| dict2items | selectattr('key', 'in', this_awx.resources[0].spec.additional_labels)
|
web_image_tags: |
|
||||||
| list
|
{{ awx_web_pod.resources[0].spec.containers |
|
||||||
}}
|
map(attribute='image') |
|
||||||
|
map('regex_search', default_awx_version) }}
|
||||||
|
- name: Extract tags from images from task pod
|
||||||
|
set_fact:
|
||||||
|
task_image_tags: |
|
||||||
|
{{ awx_task_pod.resources[0].spec.containers |
|
||||||
|
map(attribute='image') |
|
||||||
|
map('regex_search', default_awx_version) }}
|
||||||
|
- fail:
|
||||||
|
msg: |
|
||||||
|
It looks like you may have broken the DEFAULT_AWX_VERSION functionality.
|
||||||
|
This is an environment variable that is set via build arg when releasing awx-operator.
|
||||||
|
when:
|
||||||
|
- default_awx_version not in web_image_tags
|
||||||
|
- default_awx_version not in task_image_tags
|
||||||
|
when: not awx_version
|
||||||
|
|
||||||
- name: Extract additional_labels from AWX web Pod
|
- name: Validate additional_labels
|
||||||
set_fact:
|
block:
|
||||||
awx_web_pod_additional_labels: >-
|
- name: Extract additional_labels from AWX spec
|
||||||
{{ awx_web_pod.resources[0].metadata.labels
|
set_fact:
|
||||||
| dict2items | selectattr('key', 'in', this_awx.resources[0].spec.additional_labels)
|
awx_additional_labels: >-
|
||||||
| list
|
{{ this_awx.resources[0].metadata.labels
|
||||||
}}
|
|
||||||
|
|
||||||
- name: Extract additional_labels from AWX task Pod
|
|
||||||
set_fact:
|
|
||||||
awx_task_pod_additional_labels: >-
|
|
||||||
{{ awx_task_pod.resources[0].metadata.labels
|
|
||||||
| dict2items | selectattr('key', 'in', this_awx.resources[0].spec.additional_labels)
|
| dict2items | selectattr('key', 'in', this_awx.resources[0].spec.additional_labels)
|
||||||
| list
|
| list
|
||||||
}}
|
}}
|
||||||
|
|
||||||
- name: Assert AWX web Pod contains additional_labels
|
- name: Extract additional_labels from AWX web Pod
|
||||||
ansible.builtin.assert:
|
set_fact:
|
||||||
that:
|
awx_web_pod_additional_labels: >-
|
||||||
- awx_web_pod_additional_labels == awx_additional_labels
|
{{ awx_web_pod.resources[0].metadata.labels
|
||||||
|
| dict2items | selectattr('key', 'in', this_awx.resources[0].spec.additional_labels)
|
||||||
|
| list
|
||||||
|
}}
|
||||||
|
|
||||||
- name: Assert AWX task Pod contains additional_labels
|
- name: Extract additional_labels from AWX task Pod
|
||||||
ansible.builtin.assert:
|
set_fact:
|
||||||
that:
|
awx_task_pod_additional_labels: >-
|
||||||
- awx_task_pod_additional_labels == awx_additional_labels
|
{{ awx_task_pod.resources[0].metadata.labels
|
||||||
|
| dict2items | selectattr('key', 'in', this_awx.resources[0].spec.additional_labels)
|
||||||
|
| list
|
||||||
|
}}
|
||||||
|
|
||||||
- name: Extract web Pod labels which shouldn't have been propagated to it from AWX
|
- name: Assert AWX web Pod contains additional_labels
|
||||||
set_fact:
|
ansible.builtin.assert:
|
||||||
awx_web_pod_extra_labels: >-
|
that:
|
||||||
{{ awx_web_pod.resources[0].metadata.labels
|
- awx_web_pod_additional_labels == awx_additional_labels
|
||||||
| dict2items | selectattr('key', 'in', ["my/do-not-inherit"])
|
|
||||||
| list
|
|
||||||
}}
|
|
||||||
|
|
||||||
- name: AWX web Pod doesn't contain AWX labels not in additional_labels
|
- name: Assert AWX task Pod contains additional_labels
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- awx_web_pod_extra_labels == []
|
- awx_task_pod_additional_labels == awx_additional_labels
|
||||||
|
|
||||||
- name: Extract task Pod labels which shouldn't have been propagated to it from AWX
|
- name: Extract web Pod labels which shouldn't have been propagated to it from AWX
|
||||||
set_fact:
|
set_fact:
|
||||||
awx_task_pod_extra_labels: >-
|
awx_web_pod_extra_labels: >-
|
||||||
{{ awx_task_pod.resources[0].metadata.labels
|
{{ awx_web_pod.resources[0].metadata.labels
|
||||||
| dict2items | selectattr('key', 'in', ["my/do-not-inherit"])
|
| dict2items | selectattr('key', 'in', ["my/do-not-inherit"])
|
||||||
| list
|
| list
|
||||||
}}
|
}}
|
||||||
|
|
||||||
- name: AWX task Pod doesn't contain AWX labels not in additional_labels
|
- name: AWX web Pod doesn't contain AWX labels not in additional_labels
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- awx_task_pod_extra_labels == []
|
- awx_web_pod_extra_labels == []
|
||||||
|
|
||||||
|
- name: Extract task Pod labels which shouldn't have been propagated to it from AWX
|
||||||
|
set_fact:
|
||||||
|
awx_task_pod_extra_labels: >-
|
||||||
|
{{ awx_task_pod.resources[0].metadata.labels
|
||||||
|
| dict2items | selectattr('key', 'in', ["my/do-not-inherit"])
|
||||||
|
| list
|
||||||
|
}}
|
||||||
|
|
||||||
|
- name: AWX task Pod doesn't contain AWX labels not in additional_labels
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- awx_task_pod_extra_labels == []
|
||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
- name: Re-emit failure
|
- name: Re-emit failure
|
||||||
@@ -184,3 +119,76 @@
|
|||||||
result: '{{ ansible_failed_result }}'
|
result: '{{ ansible_failed_result }}'
|
||||||
fail:
|
fail:
|
||||||
msg: '{{ failed_task }}'
|
msg: '{{ failed_task }}'
|
||||||
|
|
||||||
|
- name: Obtain generated admin password
|
||||||
|
k8s_info:
|
||||||
|
namespace: '{{ namespace }}'
|
||||||
|
kind: Secret
|
||||||
|
name: example-awx-admin-password
|
||||||
|
register: admin_pw_secret
|
||||||
|
|
||||||
|
- name: Validate demo job launch
|
||||||
|
block:
|
||||||
|
- name: Launch Demo Job Template
|
||||||
|
awx.awx.job_launch:
|
||||||
|
name: Demo Job Template
|
||||||
|
wait: yes
|
||||||
|
validate_certs: no
|
||||||
|
controller_host: localhost/awx/
|
||||||
|
controller_username: admin
|
||||||
|
controller_password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
|
||||||
|
|
||||||
|
rescue:
|
||||||
|
- name: Get list of project updates and jobs
|
||||||
|
uri:
|
||||||
|
url: "http://localhost/awx/api/v2/{{ resource }}/"
|
||||||
|
user: admin
|
||||||
|
password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
|
||||||
|
force_basic_auth: yes
|
||||||
|
register: job_lists
|
||||||
|
loop:
|
||||||
|
- project_updates
|
||||||
|
- jobs
|
||||||
|
loop_control:
|
||||||
|
loop_var: resource
|
||||||
|
|
||||||
|
- name: Store job_lists debug output
|
||||||
|
copy:
|
||||||
|
content: "{{ job_lists | to_nice_json }}"
|
||||||
|
dest: "{{ debug_output_dir }}/job_lists.json"
|
||||||
|
when: store_debug_output | default(false)
|
||||||
|
|
||||||
|
- name: Get all job and project details
|
||||||
|
uri:
|
||||||
|
url: "http://localhost{{ endpoint }}"
|
||||||
|
user: admin
|
||||||
|
password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
|
||||||
|
force_basic_auth: yes
|
||||||
|
loop: |
|
||||||
|
{{ job_lists.results | map(attribute='json') | map(attribute='results') | flatten | map(attribute='url') }}
|
||||||
|
loop_control:
|
||||||
|
loop_var: endpoint
|
||||||
|
register: job_details
|
||||||
|
|
||||||
|
- name: Store job_details debug output
|
||||||
|
copy:
|
||||||
|
content: "{{ job_details | to_nice_json }}"
|
||||||
|
dest: "{{ debug_output_dir }}/job_details.json"
|
||||||
|
when: store_debug_output | default(false)
|
||||||
|
|
||||||
|
## TODO: figure out why this doesn't work
|
||||||
|
# - name: Store debug outputs
|
||||||
|
# copy:
|
||||||
|
# content: '{{ item }}'
|
||||||
|
# dest: "{{ debug_output_dir }}/{{ item }}.json"
|
||||||
|
# loop:
|
||||||
|
# - job_lists
|
||||||
|
# - job_details
|
||||||
|
# when: store_debug_output | default(false)
|
||||||
|
|
||||||
|
- name: Re-emit failure
|
||||||
|
vars:
|
||||||
|
failed_task:
|
||||||
|
result: '{{ ansible_failed_result }}'
|
||||||
|
fail:
|
||||||
|
msg: '{{ failed_task }}'
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ spec:
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if awx_version %}
|
{% if awx_version %}
|
||||||
image_version: {{ awx_version }}
|
image_version: {{ awx_version }}
|
||||||
|
{% endif %}
|
||||||
|
{% if awx_ee_image %}
|
||||||
|
control_plane_ee_image: {{ awx_ee_image }}
|
||||||
|
ee_images:
|
||||||
|
- image: {{ awx_ee_image }}
|
||||||
|
name: AWX EE
|
||||||
{% endif %}
|
{% endif %}
|
||||||
ingress_type: ingress
|
ingress_type: ingress
|
||||||
ingress_path: /awx
|
ingress_path: /awx
|
||||||
|
|||||||
15
molecule/default/utils/output_all_container_logs_for_pod.yml
Normal file
15
molecule/default/utils/output_all_container_logs_for_pod.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
- name: Get all container log in pod
|
||||||
|
kubernetes.core.k8s_log:
|
||||||
|
namespace: '{{ namespace }}'
|
||||||
|
name: '{{ item.metadata.name }}'
|
||||||
|
all_containers: true
|
||||||
|
register: all_container_logs
|
||||||
|
|
||||||
|
- name: Store logs in file
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: "{{ all_container_logs.log_lines | join('\n') }}"
|
||||||
|
dest: '{{ debug_output_dir }}/{{ item.metadata.name }}.log'
|
||||||
|
|
||||||
|
# TODO: all_containser option dump all of the output in a single output make it hard to read we probably should iterate through each of the container to get specific logs
|
||||||
|
# also we should probably investigate toolings to do OpenShift style sosreport/must-gather for kind cluster or switch to microshift where sosreport is supported
|
||||||
29
molecule/default/utils/output_k8s_resources.yml
Normal file
29
molecule/default/utils/output_k8s_resources.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
- name: Retrieve relevant k8s resources
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
api_version: '{{ item.api_version }}'
|
||||||
|
kind: '{{ item.kind }}'
|
||||||
|
namespace: '{{ namespace }}'
|
||||||
|
loop:
|
||||||
|
- api_version: v1
|
||||||
|
kind: Pod
|
||||||
|
- api_version: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
- api_version: v1
|
||||||
|
kind: Secret
|
||||||
|
- api_version: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
- api_version: "awx.ansible.com/v1beta1"
|
||||||
|
kind: AWX
|
||||||
|
register: debug_resources
|
||||||
|
|
||||||
|
- name: debug print item.kind and item.metadata.name
|
||||||
|
debug:
|
||||||
|
msg: '{{ item.kind }}-{{ item.metadata.name }}'
|
||||||
|
loop: "{{ debug_resources.results | map(attribute='resources') | flatten }}"
|
||||||
|
|
||||||
|
- name: Output gathered resource to files
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: '{{ item | to_nice_json }}'
|
||||||
|
dest: '{{ debug_output_dir }}/{{ item.kind }}-{{ item.metadata.name }}.json'
|
||||||
|
loop: "{{ debug_resources.results | map(attribute='resources') | flatten }}"
|
||||||
@@ -10,53 +10,41 @@
|
|||||||
ctrl_label: control-plane=controller-manager
|
ctrl_label: control-plane=controller-manager
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- block:
|
- name: Perform awx tests
|
||||||
|
block:
|
||||||
- name: Import all test files from tasks/
|
- name: Import all test files from tasks/
|
||||||
include_tasks: '{{ item }}'
|
ansible.builtin.include_tasks: '{{ item }}'
|
||||||
with_fileglob:
|
with_fileglob:
|
||||||
- tasks/awx_test.yml
|
- tasks/awx_test.yml
|
||||||
- tasks/awx_replicas_test.yml
|
- tasks/awx_replicas_test.yml
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
rescue:
|
rescue:
|
||||||
- name: Retrieve relevant resources
|
- name: Create debug output directory
|
||||||
k8s_info:
|
ansible.builtin.file:
|
||||||
api_version: '{{ item.api_version }}'
|
path: '{{ debug_output_dir }}'
|
||||||
kind: '{{ item.kind }}'
|
state: directory
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
|
- name: Gather and output K8s resources
|
||||||
|
ansible.builtin.include_tasks: utils/output_k8s_resources.yml
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
|
- name: Get all pods
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
api_version: v1
|
||||||
|
kind: Pod
|
||||||
namespace: '{{ namespace }}'
|
namespace: '{{ namespace }}'
|
||||||
loop:
|
register: all_pods
|
||||||
- api_version: v1
|
|
||||||
kind: Pod
|
|
||||||
- api_version: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
- api_version: v1
|
|
||||||
kind: Secret
|
|
||||||
- api_version: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
register: debug_resources
|
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Retrieve Pod logs
|
- name: Get all container logs for all pods
|
||||||
k8s_log:
|
ansible.builtin.include_tasks: utils/output_all_container_logs_for_pod.yml
|
||||||
name: '{{ item.metadata.name }}'
|
loop: '{{ all_pods.resources }}'
|
||||||
namespace: '{{ namespace }}'
|
ignore_errors: yes
|
||||||
container: awx-manager
|
|
||||||
loop: "{{ q('k8s', api_version='v1', kind='Pod', namespace=namespace, label_selector=ctrl_label) }}"
|
|
||||||
register: debug_logs
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
- name: Output gathered resources
|
|
||||||
debug:
|
|
||||||
var: debug_resources
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
- name: Output gathered logs
|
|
||||||
debug:
|
|
||||||
var: item.log_lines
|
|
||||||
loop: '{{ debug_logs.results }}'
|
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
@@ -64,7 +52,7 @@
|
|||||||
vars:
|
vars:
|
||||||
failed_task:
|
failed_task:
|
||||||
result: '{{ ansible_failed_result }}'
|
result: '{{ ansible_failed_result }}'
|
||||||
fail:
|
ansible.builtin.fail:
|
||||||
msg: '{{ failed_task }}'
|
msg: '{{ failed_task }}'
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ provisioner:
|
|||||||
namespace: ${TEST_OPERATOR_NAMESPACE:-osdk-test}
|
namespace: ${TEST_OPERATOR_NAMESPACE:-osdk-test}
|
||||||
host_vars:
|
host_vars:
|
||||||
localhost:
|
localhost:
|
||||||
|
awx_ee_image: ${AWX_EE_TEST_IMAGE:-""}
|
||||||
awx_image: ${AWX_TEST_IMAGE:-""}
|
awx_image: ${AWX_TEST_IMAGE:-""}
|
||||||
awx_version: ${AWX_TEST_VERSION:-""}
|
awx_version: ${AWX_TEST_VERSION:-""}
|
||||||
ansible_python_interpreter: '{{ ansible_playbook_python }}'
|
ansible_python_interpreter: '{{ ansible_playbook_python }}'
|
||||||
@@ -34,6 +35,8 @@ provisioner:
|
|||||||
operator_pull_policy: "Never"
|
operator_pull_policy: "Never"
|
||||||
kubeconfig: "{{ lookup('env', 'KUBECONFIG') }}"
|
kubeconfig: "{{ lookup('env', 'KUBECONFIG') }}"
|
||||||
kustomize: ${KUSTOMIZE_PATH:-kustomize}
|
kustomize: ${KUSTOMIZE_PATH:-kustomize}
|
||||||
|
store_debug_output: ${STORE_DEBUG_OUTPUT:-false}
|
||||||
|
debug_output_dir: ${DEBUG_OUTPUT_DIR:-"/tmp/awx_operator_molecule_test"}
|
||||||
env:
|
env:
|
||||||
K8S_AUTH_KUBECONFIG: ${MOLECULE_EPHEMERAL_DIRECTORY}/kubeconfig
|
K8S_AUTH_KUBECONFIG: ${MOLECULE_EPHEMERAL_DIRECTORY}/kubeconfig
|
||||||
KUBECONFIG: ${MOLECULE_EPHEMERAL_DIRECTORY}/kubeconfig
|
KUBECONFIG: ${MOLECULE_EPHEMERAL_DIRECTORY}/kubeconfig
|
||||||
|
|||||||
@@ -20,9 +20,7 @@
|
|||||||
|
|
||||||
- name: Dump ingress tls secret names from awx spec and data into file
|
- name: Dump ingress tls secret names from awx spec and data into file
|
||||||
include_tasks: dump_ingress_tls_secrets.yml
|
include_tasks: dump_ingress_tls_secrets.yml
|
||||||
with_items:
|
with_items: "{{ awx_spec.spec['ingress_hosts'] | default([]) | selectattr('tls_secret', 'defined') | map(attribute='tls_secret') | list }}"
|
||||||
- "{{ awx_spec.spec['ingress_hosts'] | default('') | map(attribute='tls_secret', default='') | select() | list }}"
|
|
||||||
when: awx_spec.spec['ingress_hosts'] | default('') | map(attribute='tls_secret', default='') | select() | list | length
|
|
||||||
|
|
||||||
- name: Dump receptor secret names and data into file
|
- name: Dump receptor secret names and data into file
|
||||||
include_tasks: dump_receptor_secrets.yml
|
include_tasks: dump_receptor_secrets.yml
|
||||||
|
|||||||
@@ -494,9 +494,11 @@ nginx_listen_queue_size: "{{ uwsgi_listen_queue_size }}"
|
|||||||
# metrics-utility (github.com/ansible/metrics-utility)
|
# metrics-utility (github.com/ansible/metrics-utility)
|
||||||
_metrics_utility_enabled: "{{ metrics_utility_enabled | default(false) }}"
|
_metrics_utility_enabled: "{{ metrics_utility_enabled | default(false) }}"
|
||||||
_metrics_utility_configmap: "{{ metrics_utility_configmap | default(deployment_type + '-metrics-utility-configmap') }}"
|
_metrics_utility_configmap: "{{ metrics_utility_configmap | default(deployment_type + '-metrics-utility-configmap') }}"
|
||||||
|
_metrics_utility_console_enabled: "{{ metrics_utility_console_enabled | default(false) }}"
|
||||||
_metrics_utility_image: "{{ metrics_utility_image | default(_image) }}"
|
_metrics_utility_image: "{{ metrics_utility_image | default(_image) }}"
|
||||||
_metrics_utility_image_version: "{{ metrics_utility_image_version | default(_image_version) }}"
|
_metrics_utility_image_version: "{{ metrics_utility_image_version | default(_image_version) }}"
|
||||||
_metrics_utility_image_pull_policy: "{{ metrics_utility_image_pull_policy | default('IfNotPresent') }}"
|
_metrics_utility_image_pull_policy: "{{ metrics_utility_image_pull_policy | default('IfNotPresent') }}"
|
||||||
|
_metrics_utility_ship_target: "{{ metrics_utility_ship_target | default('directory') }}"
|
||||||
_metrics_utility_pvc_claim: "{{ metrics_utility_pvc_claim | default(deployment_type + '-metrics-utility') }}"
|
_metrics_utility_pvc_claim: "{{ metrics_utility_pvc_claim | default(deployment_type + '-metrics-utility') }}"
|
||||||
_metrics_utility_pvc_claim_size: "{{ metrics_utility_pvc_claim_size | default('5Gi') }}"
|
_metrics_utility_pvc_claim_size: "{{ metrics_utility_pvc_claim_size | default('5Gi') }}"
|
||||||
_metrics_utility_cronjob_gather_schedule: "{{ metrics_utility_cronjob_gather_schedule | default('@hourly') }}"
|
_metrics_utility_cronjob_gather_schedule: "{{ metrics_utility_cronjob_gather_schedule | default('@hourly') }}"
|
||||||
|
|||||||
@@ -1,23 +1,42 @@
|
|||||||
---
|
---
|
||||||
# Check to make sure provided pvc exists, error loudly if not. Otherwise, the management pod will just stay in pending state forever.
|
- name: Setup PVC if using directory ship target
|
||||||
- name: Check provided PVC claim exists
|
block:
|
||||||
kubernetes.core.k8s_info:
|
|
||||||
name: "{{ _metrics_utility_pvc_claim }}"
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
|
||||||
when:
|
|
||||||
- _metrics_utility_pvc_claim | length
|
|
||||||
|
|
||||||
- name: Create PVC for metrics-utility
|
# Check to make sure provided pvc exists
|
||||||
kubernetes.core.k8s:
|
- name: Check provided PVC claim exists
|
||||||
kind: PersistentVolumeClaim
|
kubernetes.core.k8s_info:
|
||||||
definition: "{{ lookup('template', 'storage/metrics-utility.yaml.j2') }}"
|
name: "{{ _metrics_utility_pvc_claim }}"
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||||
|
when:
|
||||||
|
- _metrics_utility_pvc_claim | length
|
||||||
|
|
||||||
- name: Create Kubernetes CronJobs for metrics-utility
|
- name: Create PVC for metrics-utility
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
definition: "{{ lookup('template', 'storage/metrics-utility.yaml.j2') }}"
|
||||||
|
|
||||||
|
when: _metrics_utility_ship_target == "directory"
|
||||||
|
|
||||||
|
- name: Create default metrics-utility Kubernetes CronJobs
|
||||||
kubernetes.core.k8s:
|
kubernetes.core.k8s:
|
||||||
definition: "{{ lookup('template', item) }}"
|
definition: "{{ lookup('template', item.template) }}"
|
||||||
apply: true
|
apply: true
|
||||||
wait: true
|
wait: true
|
||||||
|
vars:
|
||||||
|
cronjob_name: "{{ item.name }}"
|
||||||
loop:
|
loop:
|
||||||
- cronjobs/metrics-utility-gather.yaml.j2
|
- {name: 'metrics-utility-gather', template: 'cronjobs/metrics-utility-gather.yaml.j2'}
|
||||||
- cronjobs/metrics-utility-report.yaml.j2
|
- {name: 'metrics-utility-report', template: 'cronjobs/metrics-utility-report.yaml.j2'}
|
||||||
|
|
||||||
|
- name: Create metrics-utility Kubernetes CronJob for Red Hat Hybrid Cloud Console
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
definition: "{{ lookup('template', item.template) }}"
|
||||||
|
apply: true
|
||||||
|
wait: true
|
||||||
|
vars:
|
||||||
|
cronjob_name: "{{ item.name }}"
|
||||||
|
metrics_utility_ship_target: crc # TODO - Update to console when changed
|
||||||
|
loop:
|
||||||
|
- {name: 'metrics-utility-gather-console', template: 'cronjobs/metrics-utility-gather.yaml.j2'}
|
||||||
|
when: _metrics_utility_console_enabled
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: CronJob
|
kind: CronJob
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ ansible_operator_meta.name }}-metrics-utility-gather
|
name: {{ ansible_operator_meta.name }}-{{ cronjob_name }}
|
||||||
namespace: '{{ ansible_operator_meta.namespace }}'
|
namespace: '{{ ansible_operator_meta.namespace }}'
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}-metrics-utility-gather'
|
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}-{{ cronjob_name }}'
|
||||||
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
|
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
|
||||||
{{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=4) | trim }}
|
{{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=4) | trim }}
|
||||||
spec:
|
spec:
|
||||||
@@ -16,7 +16,7 @@ spec:
|
|||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}-metrics-utility-gather'
|
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}-{{ cronjob_name }}'
|
||||||
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=12) | trim }}
|
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=12) | trim }}
|
||||||
{{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=12) | trim }}
|
{{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=12) | trim }}
|
||||||
spec:
|
spec:
|
||||||
@@ -30,7 +30,7 @@ spec:
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
containers:
|
containers:
|
||||||
- name: {{ ansible_operator_meta.name }}-metrics-utility-gather
|
- name: {{ ansible_operator_meta.name }}-{{ cronjob_name }}
|
||||||
image: "{{ _metrics_utility_image }}"
|
image: "{{ _metrics_utility_image }}"
|
||||||
imagePullPolicy: "{{ image_pull_policy }}"
|
imagePullPolicy: "{{ image_pull_policy }}"
|
||||||
resources:
|
resources:
|
||||||
@@ -41,9 +41,16 @@ spec:
|
|||||||
- /bin/sh
|
- /bin/sh
|
||||||
- -c
|
- -c
|
||||||
- metrics-utility gather_automation_controller_billing_data --ship --until=10m
|
- metrics-utility gather_automation_controller_billing_data --ship --until=10m
|
||||||
|
env:
|
||||||
|
- name: METRICS_UTILITY_SHIP_TARGET
|
||||||
|
value: "{{ _metrics_utility_ship_target }}"
|
||||||
envFrom:
|
envFrom:
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
name: {{ _metrics_utility_configmap }}
|
name: {{ _metrics_utility_configmap }}
|
||||||
|
{% if _metrics_utility_secret is defined %}
|
||||||
|
- secretRef:
|
||||||
|
name: {{ _metrics_utility_secret }}
|
||||||
|
{% endif %}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: {{ ansible_operator_meta.name }}-metrics-utility
|
- name: {{ ansible_operator_meta.name }}-metrics-utility
|
||||||
mountPath: /metrics-utility
|
mountPath: /metrics-utility
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: CronJob
|
kind: CronJob
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ ansible_operator_meta.name }}-metrics-utility-report
|
name: {{ ansible_operator_meta.name }}-{{ cronjob_name }}
|
||||||
namespace: '{{ ansible_operator_meta.namespace }}'
|
namespace: '{{ ansible_operator_meta.namespace }}'
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}-metrics-utility-report'
|
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}-{{ cronjob_name }}'
|
||||||
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
|
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
|
||||||
{{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=4) | trim }}
|
{{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=4) | trim }}
|
||||||
spec:
|
spec:
|
||||||
@@ -16,7 +16,7 @@ spec:
|
|||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}-metrics-utility-report'
|
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}-{{ cronjob_name }}'
|
||||||
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=12) | trim }}
|
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=12) | trim }}
|
||||||
{{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=12) | trim }}
|
{{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=12) | trim }}
|
||||||
spec:
|
spec:
|
||||||
@@ -30,7 +30,7 @@ spec:
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
containers:
|
containers:
|
||||||
- name: {{ ansible_operator_meta.name }}-metrics-utility-report
|
- name: {{ ansible_operator_meta.name }}-{{ cronjob_name }}
|
||||||
image: "{{ _metrics_utility_image }}"
|
image: "{{ _metrics_utility_image }}"
|
||||||
imagePullPolicy: "{{ image_pull_policy }}"
|
imagePullPolicy: "{{ image_pull_policy }}"
|
||||||
resources:
|
resources:
|
||||||
@@ -44,6 +44,10 @@ spec:
|
|||||||
envFrom:
|
envFrom:
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
name: {{ _metrics_utility_configmap }}
|
name: {{ _metrics_utility_configmap }}
|
||||||
|
{% if _metrics_utility_secret is defined %}
|
||||||
|
- secretRef:
|
||||||
|
name: {{ _metrics_utility_secret }}
|
||||||
|
{% endif %}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: {{ ansible_operator_meta.name }}-metrics-utility
|
- name: {{ ansible_operator_meta.name }}-metrics-utility
|
||||||
mountPath: /metrics-utility
|
mountPath: /metrics-utility
|
||||||
|
|||||||
Reference in New Issue
Block a user