Compare commits

...

198 Commits

Author SHA1 Message Date
Hao Liu
d4e12dff8f Merge pull request #1316 from TheRealHaoLiu/tmp-fix-ci
Temporary fix for CI failure for web-task-split
2023-03-30 12:36:54 -04:00
Hao Liu
c4d9970111 Update awx_test.yml 2023-03-30 12:35:24 -04:00
Hao Liu
34f48713a4 Merge pull request #1314 from TheRealHaoLiu/tmp-fix-label-test-failure
Temporary fix for label test failure
2023-03-30 11:50:00 -04:00
Hao Liu
8d2d44dc6d tmp fix for label test failure
validate label only for awx web container

TODO: make this validate both web and task container
2023-03-30 11:47:55 -04:00
Jake Jackson
2f59796caa Merge pull request #1218 from ansible/feature_web-task-split
Deploy web and task component in independent deployment
2023-03-30 10:38:34 -04:00
thedoubl3j
4a6d1855dc remove disktype key from example 2023-03-29 22:00:52 -04:00
Hao Liu
cd3bfbef96 Rename SUPERVISOR_WEB_CONFIG_PATH
SUPERVISOR_WEB_CONFIG_PATH is used in the old deployment for task container to reach into the web container and restart services

this is no longer possible/needed after splitting the deployment

renaming SUPERVISOR_WEB_CONFIG_PATH to SUPERVISOR_CONFIG_PATH
and setting it to the supervisor file for the container

this can still be useful to help run `supervisorctl -c $SUPERVISOR_CONFIG_PATH`
2023-03-29 22:00:52 -04:00
Hao Liu
02328076e5 Update arg for launching web container
related to https://github.com/ansible/awx/pull/13777

make sure that the launch script name reflect the component that its launching
2023-03-29 22:00:52 -04:00
Lila
4bec3f7098 Removed extra space. 2023-03-29 22:00:52 -04:00
Lila
b7e6987aec Removed errant quotes in main.yml. 2023-03-29 22:00:52 -04:00
Jake Jackson
7218e42771 [web/task split] fix scale down bug (#1295)
- rename scale_down vars to the new deployments since the old one no longer exists
- rename postgres.yml scale down vars as it references the old ones as well
2023-03-29 22:00:52 -04:00
Lila
25dfc97047 Updated task deployment to fix receptor certs issue.
Added the following volume mounts to the web container:
- receptor-work-signing
- receptor-ca
- work-public-key.pem
Also added these corresponding volumes to the web deployments:
- receptor-ca
- receptor-work-signing
2023-03-29 22:00:52 -04:00
Hao Liu
1106ef54ee add AWX_COMPONENT env var
for awx to be able to identify which component it is running in code
2023-03-29 22:00:52 -04:00
thedoubl3j
6fd5ca918b remove any reference to project persistance in web deployment 2023-03-29 22:00:52 -04:00
Hao Liu
942cce05e7 resolve merge error 2023-03-29 22:00:52 -04:00
Hao Liu
c2f0c214eb rename tower_pod to awx_task_pod 2023-03-29 22:00:52 -04:00
Hao Liu
a0fdf653fb enable web container to be restarted when configmap/secret change 2023-03-29 22:00:52 -04:00
thedoubl3j
5894a4ad25 remove old deployment during upgrade 2023-03-29 22:00:52 -04:00
thedoubl3j
3c0ea07a55 update documentation for the new fields added 2023-03-29 22:00:52 -04:00
Hao Liu
84b766ac40 update auto_upgrade logic (#1241)
update logic for determining if install.yml task should be run
to respect the auto_upgrade field in awx resource

conditions and expected behavior
```
  auto_upgrade   awx   awx-web   awx-task   run install.yml
 -------------- ----- --------- ---------- -----------------
  T              -     -         -          T
  F              T     -         -          F
  F              -     T         T          F
  F              -     T         F          T
  F              -     F         T          T
  F              -     F         F          T
```
2023-03-29 22:00:52 -04:00
jessicamack
41e84be0d3 added descriptors for new fields (#1238)
Signed-off-by: jessicamack <jmack@redhat.com>
2023-03-29 22:00:52 -04:00
Jake Jackson
d40683cbb9 add topology constraint for each deployment (#1234) 2023-03-29 22:00:52 -04:00
Hao Liu
918e487422 Add web and task replicas to the CRD (#1227)
add web_replicas and task_replicas

Co-Authored-By: Jake Jackson  <24478650+thedoubl3j@users.noreply.github.com>
2023-03-29 22:00:52 -04:00
Jake Jackson
6192cab653 fix affinity duplicate (#1225) 2023-03-29 22:00:52 -04:00
Jake Jackson
c1bbd85ea9 add nodeSelector work (#1219) 2023-03-29 22:00:52 -04:00
Jake Jackson
d9f3a428d4 [web/task split] split web and task deployment + a few supporting bits (#1189)
* first pass, still WIP, need tolerations etc

* add tolerations that don't work bc idk

* bug hunting

* local push, still a WIP

* affinity still needs testfor to_nice_yaml, tolerations logic is working

* fixed task deployment and affinity for both
2023-03-29 22:00:52 -04:00
Rick Elrod
ebc040fe75 scale web/task replicas separately
This is a breaking change since 'replicas' is no longer used.

Signed-off-by: Rick Elrod <rick@elrod.me>
2023-03-29 22:00:52 -04:00
Rick Elrod
12e51ad9ad add $MY_POD_IP back to web deployment
Signed-off-by: Rick Elrod <rick@elrod.me>
2023-03-29 22:00:52 -04:00
Rick Elrod
6477468729 drop awx-web container from awx-task deployment
Signed-off-by: Rick Elrod <rick@elrod.me>
2023-03-29 22:00:52 -04:00
Shane McDonald
19461fa86c Split web and task containers into separate deployments 2023-03-29 21:59:57 -04:00
Seth Foster
2b3fd833a3 Allow TLS 1.2 for Receptor connections (#1300)
- Required for FIPS environment where TLS 1.3 is
not supported
- TLS 1.3 can still be used if the nodes
both agree to use during handshake.
2023-03-29 19:19:40 -04:00
Guillaume Lefevre
c76ad2cff1 Change ansible k8s_info tasks api_version for Deployment kind to apps/v1 (#1299)
Co-authored-by: Guillaume Lefevre <guillaume.lefevre@agoda.com>
2023-03-29 15:39:41 -04:00
John Westcott IV
aa673de25d Merge pull request #1305 from john-westcott-iv/no_jmes
Modifying stage playbook to not need jmespath
2023-03-27 21:08:32 -04:00
John Westcott IV
f1512e9405 Modifying stage playbook to not need jmespath 2023-03-27 20:56:56 -04:00
John Westcott IV
d853e050cd Merge pull request #1304 from john-westcott-iv/fix_jmes_path
Adding jmespath to workflow for using json_query
2023-03-27 20:40:10 -04:00
John Westcott IV
9f0c5c8ba9 Adding jmespath to workflow for using json_query 2023-03-27 20:26:14 -04:00
John Westcott IV
1d34d86f32 Merge pull request #1303 from john-westcott-iv/fix-playbook
Making helm release playbook more idempotent
2023-03-27 16:18:56 -04:00
John Westcott IV
7164c412f0 Making helm release playbook more idempotent 2023-03-27 16:02:21 -04:00
John Westcott IV
a8a05bb113 Merge pull request #1302 from john-westcott-iv/fix_release
Adding missing \ in promote workflow
2023-03-27 14:40:19 -04:00
John Westcott IV
bf91f32f79 Adding missing \ in promote workflow 2023-03-27 14:28:18 -04:00
Dimitri Savineau
1e453aefd3 Merge pull request #1297 from dsavineau/restore_requires_deployment_name
restore: Set deployment_name as required
2023-03-23 11:14:32 -04:00
Dimitri Savineau
71b950c243 Merge pull request #1298 from dsavineau/fix_restore_backup_source_enum
restore: Fix enum value for backup_source
2023-03-23 11:14:13 -04:00
Dimitri Savineau
b00137cc3e restore: Fix enum value for backup_source
The choice for backup_source are:
- Backup CR
- PVC

This current prevents to create an AWXRestore CR with the Backup CR value
from the OLM UI.

Error "Unsupported value: "Backup CR": supported values: "CR", "PVC"" for
field "spec.backup_source".

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
2023-03-22 18:18:51 -04:00
Dimitri Savineau
2cc398d8d4 restore: Set deployment_name as required
The deployment_name from the AWXRestore CR doesn't requires to set a
value for this parameter.
That parameter is already required for the AWXBackup CR so it should be
the same for AWXRestore.

Creating an AWXRestore CR without deployment_name set results in a failure
during the Secrets restoration.

"reason":"FieldValueInvalid","message":"Invalid value: \\"-receptor-ca\\":
a lowercase RFC 1123 subdomain must consist of lower case alphanumeric
characters, \'-\' or \'.\', and must start and end with an alphanumeric
character (e.g. \'example.com\', regex used for validation is
\'[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\')"

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
2023-03-22 17:59:49 -04:00
Joel
5c91bbd65e restore use k8s_cp module to read backup files (#1212) 2023-03-22 14:27:58 -04:00
Gene Tomilko
88b1a8c125 Add loadbalancerip (#1265)
* Add ability to configure loadbalancerip on service
* Add docs for configuring loadbalancerip
2023-03-22 18:27:17 +00:00
Christian Adams
6fd969633e Document the need for quotes on pg secret port value (#1288) 2023-03-22 14:17:40 -04:00
Christian Adams
9c788ba3bd Add more suggestions to Debugging doc (#1285) 2023-03-16 17:52:29 -04:00
Seth Foster
c2fd14e39a Merge pull request #1281 from trippinnik/patch-1
Update README.md
2023-03-15 14:29:57 -04:00
Seth Foster
6513e93e7f Merge pull request #1287 from sugitk/patch-1
fixes #1286 expand client_max_body_size to 5Mb
2023-03-15 14:17:18 -04:00
Takashi Sugimura
d0f4898aaa fix #1286 2023-03-15 08:20:16 +09:00
trippinnik
3d849d9179 Update README.md
documentation is incorrect for AUTH_LDAP_GROUP_TYPE and paramaters need to be noted with AUTH_LDAP_GROUP_TYPE_PARAMS
2023-03-09 09:46:46 -05:00
aurel333
fe77f1deae Fix awx-manager-role bad match between some apiGroups and resources (#1262)
Co-authored-by: Aurelien Potin <aurelien.potin@michelin.com>
2023-03-08 16:24:03 -05:00
Hao Liu
9156909023 Merge pull request #1263 from rh-dluong/date-format
change date format to avoid :
2023-03-08 15:58:58 -05:00
Christian Adams
03e3b68eeb Helm Release: Need to use shell, not command for multi-line (#1280) 2023-03-08 15:55:30 -05:00
Ravi Teja
6cae8dfa32 fix: use sha1 instead of md5 to make the installer work in FIPS (#1260)
Co-authored-by: RaviTeja Buddabathuni (rbuddaba) <rbuddaba@cisco.com>
2023-03-08 15:10:27 -05:00
Hao Liu
b1ecc89759 Merge pull request #1274 from TheRealHaoLiu/feature-branch-build
Add github workflow for publishing feature branch images
2023-03-07 17:05:08 -05:00
Hao Liu
bb85b31411 Add github workflow to publish feature branch img 2023-03-07 16:50:28 -05:00
Christian Adams
7e7c23e176 Fix helm-release task to work in ansible, not GHA env (#1267) 2023-03-06 15:25:04 -05:00
John Westcott IV
8442cc7ae8 Merge pull request #1268 from john-westcott-iv/ubuntu-change
Changing github actions from ubuntu-18 to ubuntu-latest
2023-03-06 15:06:02 -05:00
John Westcott IV
3faf76d7c9 Changing github actions from ubuntu-18 to ubuntu-latest
See https://github.com/actions/runner-images/issues/6002 for deprication warnings
2023-03-06 14:55:32 -05:00
David Luong
61ef5ef005 change date format to avoid : 2023-03-02 13:54:00 -05:00
Peter Hoffmann
86043361c6 Small fix/adjustment in README (#1257)
* Fix minor typo
2023-02-28 16:20:47 -05:00
Ravi Teja
06194960e9 Bump ansible operator SDK version to v1.26.0 (#1258)
Co-authored-by: RaviTeja Buddabathuni (rbuddaba) <rbuddaba@cisco.com>
2023-02-28 15:45:02 -05:00
Hao Liu
46da413585 Merge pull request #1193 from stanislav-zaprudskiy/add_termination_grace_period_seconds
AWX: Add `termination_grace_period_seconds`
2023-02-28 15:37:51 -05:00
Hao Liu
b5f255cf00 add nodeport_port to instantiate playbook (#1252) 2023-02-22 21:18:12 +00:00
Maxence Button
f328b0adb6 Customization of the init_projects_container_image is now possible (#1248) 2023-02-22 15:05:23 -05:00
Shane McDonald
1bfd3b2028 Merge pull request #1201 from thedoubl3j/debugging_doc_update
Update Installer Debugging Documentation
2023-02-22 14:51:05 -05:00
Christian Adams
edf01f009e Stage and push helm index where gitconfig is set (#1251) 2023-02-22 14:09:35 -05:00
Joel
a3c28be98a [enhancement] restore postgres database if external db (#1211)
* restore postgres fix resolvable_db_host

set the resolvable_db_host ansible variable based on the db deployment
2023-02-22 13:56:38 -05:00
Stanislav Zaprudskiy
49d1f00dbd Do not keep web container running during termination
We could let the web container terminate as usual, as there are no
reasons to keep it running as it doesn't participate in
job control. Additionally, it stops receiving traffic with the beginning
of termination

> At the same time as the kubelet is starting graceful shutdown, the
> control plane removes that shutting-down Pod from EndpointSlice (and
> Endpoints) objects where these represent a Service with a configured
> selector

@ https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination
2023-02-22 10:40:40 +01:00
Christian Adams
81939cb521 K8s cpu value example in README.md needs quotes to be valid (#1220) 2023-02-20 17:37:53 -05:00
Shane McDonald
6b10a8141c Merge pull request #1231 from rooftopcellist/auto-assign-nodeport 2023-02-09 20:27:26 -05:00
Christian M. Adams
1ef1f00b3d Auto-assign NodePort port by default rather than hardcoding a default value
- previously, there was no way to auto-assign a port by default
   which led to conflicts with other deployments at times
 - nodeport_port param can still be used to specify a port if desired
2023-02-09 19:49:46 -05:00
Stanislav Zaprudskiy
336ea58a0a AWX: Add termination_grace_period_seconds 2023-02-07 16:33:00 +01:00
Stanislav Zaprudskiy
f042cb3d00 Fix lint warnings 2023-02-07 16:31:26 +01:00
Stanislav Zaprudskiy
94d68bf382 Make Deployment to be rolled out on CM and Secrets changes
With the previous approach, not all associated (mounted) CM/Secrets
changes caused the Deployment to be rolled out, but also the Deployment
could have been rolled out unnecessary during e.g. Ingress or Service
changes (which do not require Pod restarts).

Previously existing Pod removal (state: absent) was not complete as
other pods continued to exist, but also is not needed with this commit
change due to added Pods annotations.

The added Deployment Pod annotations now cause the new ReplicaSet
version to be rolled out, effectively causing replacement of the
previously existing Pods in accordance with the deployment `strategy`
(https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#deploymentstrategy-v1-apps,
`RollingUpdate`) whenever there is a change in the associated CMs or
Secrets referenced in annotations. This implementation is quite standard
and widely used for Helm workflows -
https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
2023-02-07 11:58:47 +01:00
Stanislav Zaprudskiy
b3a74362af Make AWX Pod variable to be calculated respecting creationTimestamp and deletionTimestamp
Do not consider Pods marked for deletion when calculating tower_pod to
address replicas scale down case - where normally Pods spawned recently
are being taken for removal. As well as the case when operator kicked
off but some old replicas are still terminating.

Respect `creationTimestamp` so to make sure that the newest Pod is taken
after Deployment application, in which case multiple RS Pods (from old
RS and new RS) could be running simultaneously while the rollout is
happening.
2023-02-07 11:47:49 +01:00
Stanislav Zaprudskiy
ad531c8dce Do not wait for a new Pod name after Deployment change
Proper waiting is already performed earlier during Deplyment{apply: yes, wait: yes} -
e6ac874098/plugins/module_utils/k8s/waiter.py (L27).

And also not every Deployment change produces new RS/Pods. For example,
changing Deployment labels won't cause new rollout, but will cause
`until` loop to be invoked unnecessarily (when replicas=1).
2023-02-07 11:43:34 +01:00
Stanislav Zaprudskiy
e589ceb661 When applying Deployment wait up to (timeout * replicas)
There are cases when having a new Deployment may be taking above the
default timeout of 120s.
For instance, when a Deployment has multiple replicas, and each replica
starts on a separate node, and the Deployment specifies new images, then
just pulling these new images for each replica may be taking above the
default timeout of 120s.

Having the default time multiplied by the number of replicas should
provide generally enough time for all replicas to start
2023-02-07 11:41:32 +01:00
Christian Adams
234a10d185 Add a more descriptive AWX CRD description (#1208) 2023-01-31 10:50:12 -05:00
Christian Adams
e0fa1610ca Fix minor typos in test task names (#1209) 2023-01-31 00:05:37 +00:00
Stanislav Zaprudskiy
5a856eeba8 Add additional_labels parameter (#1160)
* Move label templates into `common` role

So that there is single source of labels management, and labels are
unified across the other roles

* Introduce `additional_labels`
* Fix paths for labels templates
* Return `additional_labels_items` as list
* Add molecule tests
2023-01-30 18:51:08 -05:00
Christian Adams
d26a6bf641 Fix minor helm make target syntax error (#1206) 2023-01-27 09:56:40 -05:00
janorn
8d6db0934f Fix helm chart URLs (#1204) 2023-01-27 09:32:46 -05:00
John Westcott IV
c1b2e73123 Merge pull request #1202 from john-westcott-iv/security_requested_change
Nominal change to the pr body check
2023-01-25 17:29:50 -05:00
John Westcott IV
6ac8668ead Nominal change to the pr body check 2023-01-25 17:12:08 -05:00
thedoubl3j
d0516bcdc1 update vars file entry to include over ride examples 2023-01-25 14:41:18 -05:00
Christian Adams
ac5a2538bc Fix helm index.yaml generation error (#1199) 2023-01-24 21:40:42 -05:00
Christian Adams
2bdc87d0a8 Add docs for ingress resource apiVersion configuration (#1198) 2023-01-24 22:42:02 +00:00
Joel
ab566c2530 backup role use k8s_cp module to write files (#1111) 2023-01-24 17:02:05 -05:00
rakesh561
6a7c3ca2de Add docs for disabling IPv6
* Added procedure to disable ipv6 for AWX deployments when needed.
2023-01-24 04:26:25 +00:00
Miles
f6f58d5c6d Setup make index for testing (#1183)
- Reconfigure index file generation
- checkout gh-pages branch in promote.yaml
- fix helm-index make target
- add gh-pages folder in .gitignore

Signed-off-by: Miles Wilson <wilson.mil@icloud.com>
Co-authored-by: Hao Liu <haoli@redhat.com>
Co-authored-by: Christian Adams <rooftopcellist@gmail.com>
2023-01-18 17:53:57 -05:00
kurokobo
b1a547d2a6 fix: add quotes for PGPASSWORD in upgrade_postgres.yml (fixes #1166) (#1167) 2023-01-18 11:59:03 -05:00
Christian Adams
43f98eda77 Fix pr_body_check (#1187) 2023-01-11 22:16:58 -05:00
Christian Adams
007e47e35c Add pre-reqs to the backup and restore docs (#1186) 2023-01-11 17:18:49 -05:00
David Hageman
21eb83b052 Correct admin password updating (#1179)
Corrects an issue with admin passwords failing to be updated due to shell escaping. This aligns the operator with the logic in the normal installer.
2023-01-11 11:41:35 -05:00
Dimitri Savineau
1f8414b8cb molecule: set no_log to false (#1185)
In order to get information during CI debugging then turning off the
no_log statement will help with non hidden output.

FAILED! => {"censored": "the output has been hidden due to the fact that
            'no_log: true' was specified for this result"}

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
2023-01-11 11:21:53 -05:00
Shane McDonald
a199a8c104 Merge pull request #1172 from orcema/orcema-patch-readme-CA
update Trusting a Custom Certificate Authority
2023-01-04 13:18:37 +08:00
Orce MARINKOVSKI
fb1639a5d4 update Trusting a Custom Certificate Authority
I had hard times to identify how to declare to include statement for a custom certifcate bundle within the Kustomize file.
The tricky part for me was to spot the option "disableNameSuffixHash: true" in order to avoid renaming the secret name with an has suffix
2022-12-27 10:43:56 +01:00
Christian Adams
19c6c77c41 Add ability to configmap and include config files for nginx.conf (#1145) 2022-12-16 10:36:29 -05:00
Mathijsvw
4ee523ed69 Added pg_dump_suffix doc and crd property (#1006)
* Added pg_dump_suffix crd property

Signed-off-by: Mathijs van Willigen <mathijs.vanwilligen@student.hu.nl>
2022-12-14 14:56:40 -05:00
Stanislav Zaprudskiy
4c5bae69ef Add possibility specifying affinity of AWX Pods. (#1139)
* Add an option to specify affinity rules for the awx pod

In some cases, you may want to use affinity rules instead of a
 node selector so you can have more flexbility. For example if you want
to have "soft" rules i.e. run my pod on this node if possible otherwise
run it anywhere

* Rename `node_affinity` to `affinity`
* Maintain defaults and CSV
* Add fields validation

Co-authored-by: Olivier <oliverf1ca@yahoo.com>
2022-12-14 10:39:41 -05:00
Dax Kelson
9bf896e37c Update README.md (#1147)
Use awx namespace whent getting AWX instance URL
2022-12-07 14:31:34 -05:00
Christian Adams
cb50f4f3ac Add docs for Openshift install configuration (#1140) 2022-12-07 14:18:06 -05:00
Christian Adams
066e55e179 Bump Ansible Operator SDK version to v1.25.3 (#1146) 2022-12-05 16:04:04 -05:00
dru90i
f35bd7cf83 add default cluster name (#1129)
* add default cluster name

* Update awx.ansible.com_awxrestores.yaml

Co-authored-by: Kirill Smirnov <kirilsmirnov@x5.ru>
2022-11-30 14:29:52 -05:00
Karsten Heymann
95a1fc082b README.md: Add newline after decoded passwords (#1137)
`base64 --decode` prints no new line after its output, resulting in the next shell prompt starting immediately after the password. This makes copying the password difficult. Adding an `echo` at the end of the command fixes this.
2022-11-30 15:59:38 +00:00
dale-mittleman
dbd1e59a55 Added flag to disable ipv6 listener (#1135) 2022-11-30 10:38:44 -05:00
Christian Adams
61f45147f6 Set Minimum K8s cluster version we expect to work (#1126) 2022-11-18 10:27:47 -05:00
Michael Cristina
c20f9b4128 fix default container name (#1048) 2022-11-16 20:33:50 -05:00
Seth Foster
15568fe564 docs show extra setting double quotes (#1123) 2022-11-16 20:25:28 -05:00
Florian LAUNAY
1baf417504 remove helm chart version from labels (#1114) 2022-11-15 16:32:33 -05:00
janorn
7fbf1c42aa Get tags from remote. Local copy not complete. (#1075) 2022-11-10 00:25:51 -05:00
Christian Adams
a5e21b56ae Backup and restore receptor tls secret with expected generated name (#1107) 2022-11-07 11:04:22 -05:00
John Westcott IV
1399504142 Adding community labels on PRs and Issues (#1108) 2022-11-04 11:55:47 -04:00
Shane McDonald
e5896d15ed Merge pull request #1078 from FlorianLaunay/devel
use dedicated image for projects persistence PVC init tasks
2022-11-03 19:37:58 -04:00
Christian Adams
6b01ff09ce Amend permissions for backup dir (#1109) 2022-11-03 12:52:48 -04:00
Florian LAUNAY
c708cef4dc use dedicated image for projects persistence PVC init tasks 2022-11-03 17:26:00 +01:00
Christian Adams
1cf466def2 Add expected postgres version and usage docs (#1103) 2022-10-28 15:54:14 -04:00
sivateja04
0fc145b6aa Enable configuration of route and ingress api versions (#1098)
* Introduce ingress_api_version and route_api_version
2022-10-26 08:51:15 -04:00
Shane McDonald
e30d26cf7b Merge pull request #1100 from AlanCoding/still_not_fixed
Version 4.0.3 still not fixed, pin to before
2022-10-25 16:50:34 -04:00
Alan Rominger
7c4a731995 Version 4.0.3 still not fixed, pin to before 2022-10-25 16:10:33 -04:00
Dimitri Savineau
d2efea08e6 ci: Add check for no_log statement (#1096)
Since e966e92 we're using the `no_log` variable to control the no_log
statement value.
This job will check if the no_log statements are correctly set.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
2022-10-24 14:37:27 -04:00
Julen Landa Alustiza
23e94f82c0 Merge pull request #1091 from Zokormazo/pin-molecule
Avoid molecule 4.0.2
2022-10-18 12:43:40 +02:00
Julen Landa Alustiza
de2e58f222 Avoid molecule 4.0.2
Signed-off-by: Julen Landa Alustiza <jlanda@redhat.com>
2022-10-18 12:29:19 +02:00
Christian Adams
1c7c89efb3 Use Task container resource requirements for init container (#1084) 2022-10-13 12:27:51 -04:00
Ompragash Viswanathan
096fe100f7 Update config/manifests/bases/awx-operator.clusterserviceversion.yaml (#1083) 2022-10-12 14:12:06 -04:00
Christian Adams
58ee2f0c74 Be consistent when naming form entries and with capitalization (#1082) 2022-10-12 11:52:45 -04:00
Shane McDonald
93f7484f38 Merge pull request #1077 from chris93111/patch-1
fix templating config 0.30
2022-10-06 19:37:42 -04:00
chris93111
225c47dbbc fix templating config
indent the comment and remove last -
2022-10-06 13:21:52 +02:00
Christian Adams
2daf8a1320 Add CSV description for OperatorHub (#1072) 2022-10-05 09:17:18 -04:00
Julen Landa Alustiza
5772c706d3 Merge pull request #1073 from Zokormazo/truncate-labels
Fix version label truncating
2022-10-05 11:02:26 +02:00
Julen Landa Alustiza
ae0a74bea3 Fix version label truncating
Signed-off-by: Julen Landa Alustiza <jlanda@redhat.com>
2022-10-05 10:49:47 +02:00
Christian Adams
97cd7a9b7a Clarify Restore options in Openshift UI interface (#924) 2022-10-05 00:40:40 -04:00
Dimitri Savineau
0975663a52 csv: Use booleanSwitch for no_log parameter (#1071)
Set the no_log default value in the CRDs and switch from hidden to
boolean in the CSV file so this can be display properly in the UI.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
2022-10-04 23:59:43 -04:00
Dimitri Savineau
efdbd61860 csv: Add missing no_log to backup/restore (#1070)
e966e92 adds the configurable no_log parameter to all CRDs (install, backup
and restore) but only once in the CSV file (for installer).

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
2022-10-04 14:10:07 -04:00
Dimitri Savineau
13b45cbb12 Merge pull request #1069 from rooftopcellist/no_log_more
More no_log default updates
2022-10-04 11:49:54 -04:00
Christian M. Adams
d3ca9c57c9 One more no_log default update 2022-10-04 11:36:56 -04:00
Christian Adams
9b1b5e676d Change no_log type to boolean (#1068) 2022-10-04 10:48:51 -04:00
Hao Liu
17eb9cf8e8 Merge pull request #1061 from fosterseth/add_custom_ca_docs
Add docs for adding execution nodes and custom CA
2022-10-03 16:23:42 -04:00
Seth Foster
ed7e2b2a28 Add docs for adding execution nodes and custom CA 2022-09-29 15:54:29 -04:00
Hao Liu
5b7589accd Merge pull request #1063 from TheRealHaoLiu/receptor-ca-secret-alternative 2022-09-29 02:04:50 -04:00
janorn
a1e289e189 Add workaround to populate index.yaml (#1065)
This will download all releases before cr index is being run.
fixes #1053
2022-09-28 23:51:05 -04:00
Hao Liu
0611f3efaa add migration code for receptor ca secret
Signed-off-by: Hao Liu <haoli@redhat.com>
2022-09-28 16:22:20 -04:00
Hao Liu
a94a6f045d change receptor ca secret to tls secret
change the type of secret use for receptor ca to tls secret, to be more "proper"

Signed-off-by: Hao Liu <haoli@redhat.com>
2022-09-27 21:38:07 -04:00
Christian Adams
1892b8f0ea Explicitly set kind value to AWX (#1056) 2022-09-20 23:09:13 -04:00
Christian Adams
57b5795aab Determine if k8s or ocp and set var accordingly (#1051)
* conditionally set fsGroup for projects_persistence based on cluster
    type
2022-09-20 23:03:05 -04:00
Christian Adams
e8096a5f33 Pre-create dummy rh secret to avoid errors (#952) 2022-09-14 19:04:32 -04:00
Israel Blancas
271bce48bd Upgrade operator-sdk version from 1.22.2 to 1.23.0 (#1038)
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
2022-09-12 10:04:07 -04:00
Hao Liu
d64c34f8a4 Add receptor firewall rules to control nodes (#1012)
Support external execution nodes

- Allow receptor.conf to be editable at runtime
- Create CA cert and key as a k8s secret
- Create work signing RSA keypair as a k8s secret
- Setup volume mounts for containers to have access to the needed
  Receptor keys / certs to facilitate generating the install bundle
  for a new execution node
- added firewall rule, work signing and tls cert configuration to default receptor.conf

The volume mount changes in this PR fulfill the following:
- `receptor.conf` need to be shared between task container and ee container
  - **task** container writes the `receptor.conf`
  - **ee** consume the `receptor.conf`
- receptor ca cert/key need to be mounted by both ee container and web container
  - **ee** container need the ca cert
  - **web** container will need the ca key to sign client cert for remote execution node
  - **web** container will need the ca cert to generate install bundle for remote execution node
- receptor work private/public key need to be mounted by both ee container and web container
  - **ee** container need to private key to sign the work
  - **web** container need the public key to generate install bundle  for remote execution node
  - **task** container need the private key to sign the work

Signed-off-by: Hao Liu <haoli@redhat.com>
Co-Authored-By: Seth Foster <fosterbseth@gmail.com>
Co-Authored-By: Shane McDonald <me@shanemcd.com>

Signed-off-by: Hao Liu <haoli@redhat.com>
Co-authored-by: Shane McDonald <me@shanemcd.com>
Co-authored-by: Seth Foster <fosterbseth@gmail.com>
2022-09-09 15:13:05 -04:00
Christian Adams
1bddb98476 Update requirements.yml and vendor new collections (#1045) 2022-08-31 18:46:33 -04:00
Christian Adams
5f183999d0 Fix restore resource requirements field name for management pod resources (#1044) 2022-08-31 17:06:01 -04:00
Shane McDonald
3769897131 Merge pull request #1041 from shanemcd/ignore-pycache
Add __pycache__ to gitignore
2022-08-30 11:26:02 -04:00
Shane McDonald
7f86231009 Add __pycache__ to gitignore 2022-08-30 11:14:49 -04:00
Shane McDonald
f59dac829a Merge pull request #1040 from shanemcd/reusable-labels
Move labels into reusable templates
2022-08-30 11:13:47 -04:00
Shane McDonald
edecf4d2fe Move labels into reusable templates 2022-08-30 11:00:43 -04:00
Shane McDonald
4120b5e2b0 Merge pull request #977 from somebadcode/add-ingress-class-name-to-ingress-template
Adding ingress class name to ingress template (#716)
2022-08-29 09:12:52 -04:00
Tobias Dahlberg
8dabca5418 Adding ingress class name to ingress template (#716) 2022-08-29 11:11:19 +02:00
Fedor V
1d341a21d0 feat(readme): remove use of NAMESPACE var (#1028)
- it was used previously, but not anymore
2022-08-25 16:21:58 -04:00
Shane McDonald
f8719db954 Merge pull request #1013 from miles-w-3/debug-helm
Streamlined chart build
2022-08-25 11:59:04 -04:00
SweetGeneral
89425826e8 AWX.enable corrected to AWX.enabled (#1035)
Co-authored-by: sandesh.gupta <sandesh.gupta@olacabs.com>
2022-08-25 09:26:26 -04:00
Shane McDonald
5c572a9ba6 Merge pull request #1033 from mateuszdrab/patch-1
Remove reference to cluster.local
2022-08-25 08:44:32 -04:00
Shane McDonald
b7bbfd432d Merge pull request #1034 from whitej6/jlw-jinj3-filter-update
Fixes #1032 - Update filter to jinja 3.x format
2022-08-25 08:42:42 -04:00
Shane McDonald
b17cd16fb7 Merge pull request #1008 from rooftopcellist/fix-helm-pkg-build
Fix helm package build redundancy and release automation
2022-08-25 08:38:09 -04:00
Mac Chaffee
dc6cbab501 Import all ldap config classes in settings.py (#961)
* Import all ldap config classes in settings.py
* Add AUTH_LDAP_GROUP_TYPE example to readme

Signed-off-by: Mac Chaffee <machaffe@renci.org>
2022-08-24 18:00:08 -04:00
Jeremy White
a81be586db update filter to jinja 3.x format 2022-08-24 14:56:08 -05:00
Mateusz Drab
f2a9e967cc Remove reference to cluster.local 2022-08-24 20:07:11 +01:00
Christian Adams
9f017d03e6 Make Backup & restore requests and limits configurable (#1030)
* Add resource specification options to the backup objects
* Add resource specification options to the restore object

Co-authored-by: Ivan Aragonés <26822043+ivarmu@users.noreply.github.com>
Co-authored-by: silvinux <silvinux7@gmail.com>
Co-authored-by: Ivan Aragonés Muniesa <iaragone@redhat.com>
2022-08-23 23:23:01 -04:00
Christian Adams
7d2d1b3c5e Upgrade to Operator SDK v1.22.2 (#1001)
* Upgrade to Operator SDK 1.16.0

* Upgrade Operator SDK to v1.22.2 & bump base image version
2022-08-22 18:54:56 -04:00
Shane McDonald
5d0ebd0121 Merge pull request #1029 from shanemcd/delete-logging-code
Delete logging overrides in configmap
2022-08-22 11:48:05 -04:00
Shane McDonald
f368a539a9 Delete logging overrides in configmap 2022-08-22 10:56:37 -04:00
Shane McDonald
0aef4cc35f Merge pull request #1026 from shanemcd/respect-LOG_AGGREGATOR_LEVEL
Respect LOG_AGGREGATOR_LEVEL
2022-08-19 13:25:33 -04:00
Shane McDonald
e3701dd3db Respect LOG_AGGREGATOR_LEVEL 2022-08-18 19:10:54 -04:00
Elijah DeLee
cf98edc282 Merge pull request #976 from jainnikhil30/scale_callback_receiver_workers
configure callback receiver workers based on CPU
2022-08-09 07:23:08 -04:00
Nikhil
58a4778c89 configure callback receiver workers based on CPU 2022-08-09 13:18:41 +05:30
Shane McDonald
8e50bdde9b Merge pull request #1015 from shanemcd/installer-templates-cleanup
Organize installer templates into subdirectories
2022-08-05 12:49:51 -04:00
Shane McDonald
60386bc928 Organize installer templates into subdirectories 2022-08-05 10:45:15 -04:00
kurokobo
f1df88dc53 fix: change to safely skip task if backupDirectory is not defined (#1003) (#1004) 2022-08-04 10:42:43 -04:00
Miles Wilson
8de6179ac7 Streamlined chart build 2022-08-03 22:48:27 -04:00
Dimitri Savineau
8a3c8e727a Merge pull request #929 from dsavineau/undefined_limits_key
installer: fix undefined limit key in config
2022-08-02 10:05:47 -04:00
Christian Adams
c230016819 Fix helm package build redundancy and release automation (#1010) 2022-08-01 21:27:15 +00:00
Christian M. Adams
bea05c97ee Fix helm package build redundancy and release automation 2022-08-01 16:00:51 -04:00
John Westcott IV
3a6040e0cd Adding GitHub check to ensure PRs have the proper X/Y/Z flags 2022-08-01 14:09:56 -04:00
John Westcott IV
24f3f440f1 Adding GitHub check to ensure PRs have the proper X/Y/Z flags 2022-08-01 13:04:38 -04:00
Christian Adams
87b0511997 Use new postgres pod label when migrating from old instance (#1005) 2022-07-29 16:38:04 -04:00
Christian Adams
fde4a47a14 Bump dependencies stream (#841)
* Bump Postgresql, Nginx and Redis versions
* pg12 --> pg13 upgrade path
* Set supported pg version as a variable to remain DRY
* Make deleting the old db data pvc after upgrade configurable
* Use labels to find the postgres pod

* backup/restore: fix postgres label selector value

We need to use the deployment_name variable for the postgres instance
name.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>

* backup/restore: add missing default supported_pg_version variable

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>

* restore: update database_host fact with pg suffix

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>

Co-authored-by: Dimitri Savineau <dsavinea@redhat.com>
2022-07-29 13:21:51 -04:00
John Westcott IV
af2e681f1e Please backup before attempting an upgrade (#1002) 2022-07-28 16:19:57 -04:00
lutskevich
82ffa3d348 Restore not managed external postgresql (#877)
* Restore not managed external postgresql

Update postgres.yml for restore from backup not managed external postgresql db.

* Update postgres.yml

* rm trailing spaces #48

Co-authored-by: Viktor Lutskevich <lutskevich.v@mail366.com>
2022-07-27 16:23:51 -04:00
Ming Quah
db6a5b53ed Move custom resource definitions into a CRDs folder (#994)
* Add missing quote for port parameter

* Add step to move CRDs into the correct folder
2022-07-26 18:48:20 -04:00
Shane McDonald
0be17476cd Merge pull request #979 from stanislav-zaprudskiy/allow_skipping_labels_patching_on_awx_resource
Introduce `set_self_labels` in CRDs
2022-07-20 12:41:20 -04:00
Shane McDonald
f4a781ccc5 Merge pull request #984 from bewing/makefile-logic
fix helm-chart Makefile issue
2022-07-20 12:40:20 -04:00
John Westcott IV
fcd2c4c023 Merge pull request #982 from john-westcott-iv/pr_template
Adding PR template
2022-07-19 04:22:41 -04:00
John Westcott IV
8e30a17a77 Adding PR template 2022-07-19 04:12:38 -04:00
Christian Adams
b3037c1067 Deprecate the backup_pvc_namespace field (#988)
- Removes backup_pvc_namespace field from OLM forms
  - This field has created confusion for users and there is no strong
    case for needing this functionality
  - Users will still be able to add it to the yaml for the CR if they
    want to use it with the cluster-scoped AWX operator
  - Remove unneeded advanced descriptors to avoid empty Advanced
    configuration expander

fixes AAP-1176
2022-07-18 17:35:11 -04:00
Brandon Ewing
f7ff132a2e fix helm-chart Makefile issue
GNU make resolves the $(wildcard ) macro when starting a block, and
caches it for the duration of the run.  In order to correctly remove
namespace references from the generated helm charts, we have to split
the generation and editing into two makefile targets.
2022-07-14 14:38:09 -05:00
Stanislav Zaprudskiy
36355b6a15 Introduce set_self_labels in CRDs
To allow skipping labels maintenance on CRs processed by the operator.
Resolves https://github.com/ansible/awx-operator/issues/756
2022-07-12 10:48:16 +02:00
Dimitri Savineau
ba3b6f5436 installer: fix undefined limit key in config
When the task_resource_requirements variable has no "limits" key (which
is the default value) then the config template generation fails

----------------------------------
looking for "config.yaml.j2" at "/opt/ansible/roles/installer/templates/config.yaml.j2"
File lookup using /opt/ansible/roles/installer/templates/config.yaml.j2 as file
fatal: [localhost]: FAILED! => {
"msg": "The task includes an option with an undefined variable. The error was: the inline if-expression on line 36 evaluated to false and no else section was defined.

The error appears to be in /opt/ansible/roles/installer/tasks/resources_configuration.yml: line 30, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Apply Resources
 ^ here
----------------------------------

The current condition doesn't have a else statement so the template fails
when the "limits" key isn't present.
This rewrite the current if/else statement in jinja template.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
2022-05-24 09:29:36 -04:00
151 changed files with 5663 additions and 1774 deletions

26
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,26 @@
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
<!---
If you are fixing an existing issue, please include "fixes #nnn" in your
commit message and your description; but you should still explain what
the change does.
-->
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Breaking Change
- New or Enhanced Feature
- Bug, Docs Fix or other nominal change
##### ADDITIONAL INFORMATION
<!---
Include additional information to help people understand the change here.
For bugs that don't have a linked bug report, a step-by-step reproduction
of the problem is helpful.
-->
<!--- Paste verbatim command output below, e.g. before and after your change -->
```
```

View File

@@ -11,7 +11,7 @@ on:
jobs:
molecule:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
name: molecule
env:
DOCKER_API_VERSION: "1.38"
@@ -40,7 +40,7 @@ jobs:
make kustomize
KUSTOMIZE_PATH=$(readlink -f bin/kustomize) molecule test -s kind
helm:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
name: helm
steps:
- uses: actions/checkout@v2
@@ -82,3 +82,18 @@ jobs:
- name: Install helm chart
run: |
helm install --wait my-awx-operator --namespace awx --create-namespace ./charts/awx-operator
no-log:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Check no_log statements
run: |
set +e
no_log=$(grep -nr ' no_log:' roles | grep -v '"{{ no_log }}"')
if [ -n "${no_log}" ]; then
echo 'Please update the following no_log statement(s) with the "{{ no_log }}" value'
echo "${no_log}"
exit 1
fi

View File

@@ -8,7 +8,7 @@ on:
jobs:
release:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
name: Push devel image
steps:
- uses: actions/checkout@v2

75
.github/workflows/feature.yml vendored Normal file
View File

@@ -0,0 +1,75 @@
---
name: Feature Branch Image Build and Push
on:
push:
branches: [feature_*]
jobs:
release:
runs-on: ubuntu-18.04
name: Push devel image
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # needed so that git describe --tag works
- name: Set VERSION
run: |
echo "VERSION=$(git describe --tags)" >>${GITHUB_ENV}
- name: Set lower case owner name
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: '${{ github.repository_owner }}'
- name: Set IMAGE_TAG_BASE
run: |
echo "IMAGE_TAG_BASE=ghcr.io/${OWNER_LC}/awx-operator" >>${GITHUB_ENV}
- name: Set ARCH environment variable
run: |
echo "ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)" >>${GITHUB_ENV}
- name: Set OS environment variable
run: |
echo "OS=$(uname | awk '{print tolower($0)}')" >>${GITHUB_ENV}
- name: Install operator-sdk
run: |
echo "Installing operator-sdk ${OPERATOR_SDK_DL_URL}" && \
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH} && \
chmod +x operator-sdk_${OS}_${ARCH} && \
sudo mkdir -p /usr/local/bin/ && \
sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk && \
operator-sdk version
env:
OPERATOR_SDK_DL_URL: https://github.com/operator-framework/operator-sdk/releases/download/v1.26.0
- name: Log in to registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and Push awx-operator Image
run: |
make docker-build docker-push
docker tag ${IMAGE_TAG_BASE}:${VERSION} ${IMAGE_TAG_BASE}:${GITHUB_REF##*/}
docker push ${IMAGE_TAG_BASE}:${GITHUB_REF##*/}
- name: Build bundle manifests
run: |
make bundle
- name: Build and Push awx-operator Bundle
run: |
make bundle-build bundle-push
docker tag ${IMAGE_TAG_BASE}-bundle:v${VERSION} ${IMAGE_TAG_BASE}-bundle:${GITHUB_REF##*/}
docker push ${IMAGE_TAG_BASE}-bundle:${GITHUB_REF##*/}
- name: Build and Push awx-operator Catalog
run: |
make catalog-build catalog-push
docker tag ${IMAGE_TAG_BASE}-catalog:v${VERSION} ${IMAGE_TAG_BASE}-catalog:${GITHUB_REF##*/}
docker push ${IMAGE_TAG_BASE}-catalog:${GITHUB_REF##*/}

54
.github/workflows/label_issue.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
---
name: Label Issues
on:
issues:
types:
- opened
- reopened
jobs:
triage:
runs-on: ubuntu-latest
name: Label
steps:
- name: Label Issue - Needs Triage
uses: github/issue-labeler@v2.4.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
not-before: 2021-12-07T07:00:00Z
configuration-path: .github/issue_labeler.yml
enable-versioned-regex: 0
if: github.event_name == 'issues'
community:
runs-on: ubuntu-latest
name: Label Issue - Community
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- name: Install python requests
run: pip install requests
- name: Check if user is a member of Ansible org
uses: jannekem/run-python-script-action@v1
id: check_user
with:
script: |
import requests
headers = {'Accept': 'application/vnd.github+json', 'Authorization': 'token ${{ secrets.GITHUB_TOKEN }}'}
response = requests.get('${{ fromJson(toJson(github.event.issue.user.url)) }}/orgs?per_page=100', headers=headers)
is_member = False
for org in response.json():
if org['login'] == 'ansible':
is_member = True
if is_member:
print("User is member")
else:
print("User is community")
- name: Add community label if not a member
if: contains(steps.check_user.outputs.stdout, 'community')
uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90
with:
add-labels: "community"
repo-token: ${{ secrets.GITHUB_TOKEN }}

40
.github/workflows/label_pr.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: Label PR
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
jobs:
community:
runs-on: ubuntu-latest
name: Label PR - Community
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- name: Install python requests
run: pip install requests
- name: Check if user is a member of Ansible org
uses: jannekem/run-python-script-action@v1
id: check_user
with:
script: |
import requests
headers = {'Accept': 'application/vnd.github+json', 'Authorization': 'token ${{ secrets.GITHUB_TOKEN }}'}
response = requests.get('${{ fromJson(toJson(github.event.pull_request.user.url)) }}/orgs?per_page=100', headers=headers)
is_member = False
for org in response.json():
if org['login'] == 'ansible':
is_member = True
if is_member:
print("User is member")
else:
print("User is community")
- name: Add community label if not a member
if: contains(steps.check_user.outputs.stdout, 'community')
uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90
with:
add-labels: "community"
repo-token: ${{ secrets.GITHUB_TOKEN }}

37
.github/workflows/pr_body_check.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
---
name: PR Check
env:
BRANCH: ${{ github.base_ref || 'devel' }}
on:
pull_request:
types: [opened, edited, reopened, synchronize]
jobs:
pr-check:
name: Scan PR description for semantic versioning keywords
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check for each of the lines
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
echo "$PR_BODY" | grep "Bug, Docs Fix or other nominal change" > Z
echo "$PR_BODY" | grep "New or Enhanced Feature" > Y
echo "$PR_BODY" | grep "Breaking Change" > X
exit 0
# We exit 0 and set the shell to prevent the returns from the greps from failing this step
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
shell: bash {0}
- name: Check for exactly one item
run: |
if [ $(cat X Y Z | wc -l) != 1 ] ; then
echo "The PR body must contain exactly one of [ 'Bug, Docs Fix or other nominal change', 'New or Enhanced Feature', 'Breaking Change' ]"
echo "We counted $(cat X Y Z | wc -l)"
echo "See the default PR body for examples"
exit 255;
else
exit 0;
fi

View File

@@ -8,7 +8,14 @@ jobs:
promote:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
depth: 0
- uses: actions/checkout@v3
with:
ref: gh-pages
path: gh-pages
- name: Log in to GHCR
run: |
@@ -26,15 +33,11 @@ jobs:
docker push quay.io/${{ github.repository }}:${{ github.event.release.tag_name }}
docker push quay.io/${{ github.repository }}:latest
- name: Configure git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Release Helm chart
run: |
ansible-playbook ansible/helm-release.yml -v \
-e operator_image=quay.io/${{ github.repository }} \
-e chart_owner=${{ github.repository_owner }} \
-e tag=${{ github.event.release.tag_name }} \
-e gh_token=${{ secrets.GITHUB_TOKEN }}
-e gh_token=${{ secrets.GITHUB_TOKEN }} \
-e gh_user=${{ github.actor }}

View File

@@ -1,22 +0,0 @@
---
name: Triage
on:
issues:
types:
- opened
jobs:
triage:
runs-on: ubuntu-latest
name: Label
steps:
- name: Label issues
uses: github/issue-labeler@v2.4.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
not-before: 2021-12-07T07:00:00Z
configuration-path: .github/issue_labeler.yml
enable-versioned-regex: 0
if: github.event_name == 'issues'

2
.gitignore vendored
View File

@@ -1,4 +1,5 @@
*~
gh-pages/
.cache/
/bin
/bundle
@@ -7,3 +8,4 @@
/charts
/.cr-release-packages
.vscode/
__pycache__

View File

@@ -1,14 +1,14 @@
# AWX Operator Helm Chart
This chart installs the AWX Operator resources configured in [this](https://github.com/ansible/awx-operator) repository.
This chart installs the AWX Operator resources configured in [this](https://github.com/ansible/awx-operator) repository.
## Getting Started
To configure your AWX resource using this chart, create your own `yaml` values file. The name is up to personal preference since it will explicitly be passed into the helm chart. Helm will merge whatever values you specify in your file with the default `values.yaml`, overriding any settings you've changed while allowing you to fall back on defaults. Because of this functionality, `values.yaml` should not be edited directly.
In your values config, enable `AWX.enable` and add `AWX.spec` values based on the awx operator's [documentation](https://github.com/ansible/awx-operator/blob/devel/README.md). Consult the docs below for additional functionality.
In your values config, enable `AWX.enabled` and add `AWX.spec` values based on the awx operator's [documentation](https://github.com/ansible/awx-operator/blob/devel/README.md). Consult the docs below for additional functionality.
### Installing
The operator's [helm install](https://github.com/ansible/awx-operator/blob/devel/README.md#helm-install-on-existing-cluster) guide provides key installation instructions.
The operator's [helm install](https://github.com/ansible/awx-operator/blob/devel/README.md#helm-install-on-existing-cluster) guide provides key installation instructions.
Example:
```
@@ -27,10 +27,10 @@ To update an existing installation, use `helm upgrade` instead of `install`. The
## Configuration
The goal of adding helm configurations is to abstract out and simplify the creation of multi-resource configs. The `AWX.spec` field maps directly to the spec configs of the `AWX` resource that the operator provides, which are detailed in the [main README](https://github.com/ansible/awx-operator/blob/devel/README.md). Other sub-config can be added with the goal of simplifying more involved setups that require additional resources to be specified.
These sub-headers aim to be a more intuitive entrypoint into customizing your deployment, and are easier to manage in the long-term. By design, the helm templates will defer to the manually defined specs to avoid configuration conflicts. For example, if `AWX.spec.postgres_configuration_secret` is being used, the `AWX.postgres` settings will not be applied, even if enabled.
These sub-headers aim to be a more intuitive entrypoint into customizing your deployment, and are easier to manage in the long-term. By design, the helm templates will defer to the manually defined specs to avoid configuration conflicts. For example, if `AWX.spec.postgres_configuration_secret` is being used, the `AWX.postgres` settings will not be applied, even if enabled.
### External Postgres
The `AWX.postgres` section simplifies the creation of the external postgres secret. If enabled, the configs provided will automatically be placed in a `postgres-config` secret and linked to the `AWX` resource. For proper secret management, the `AWX.postgres.password` value, and any other sensitive values, can be passed in at the command line rather than specified in code. Use the `--set` argument with `helm install`.
The `AWX.postgres` section simplifies the creation of the external postgres secret. If enabled, the configs provided will automatically be placed in a `postgres-config` secret and linked to the `AWX` resource. For proper secret management, the `AWX.postgres.password` value, and any other sensitive values, can be passed in at the command line rather than specified in code. Use the `--set` argument with `helm install`. Supplying the password this way is not recommended for production use, but may be helpful for initial PoC.
## Values Summary
@@ -44,13 +44,24 @@ The `AWX.postgres` section simplifies the creation of the external postgres secr
| `AWX.postgres` | configurations for the external postgres secret | - |
# Contributing
# Contributing
## Adding abstracted sections
Where possible, defer to `AWX.spec` configs before applying the abstracted configs to avoid collision. This can be facilitated by the `(hasKey .spec what_i_will_abstract)` check.
Where possible, defer to `AWX.spec` configs before applying the abstracted configs to avoid collision. This can be facilitated by the `(hasKey .spec what_i_will_abstract)` check.
## Building and Testing
This chart is built using the Makefile in the [awx-operator repo](https://github.com/ansible/awx-operator). Clone the repo and run `make helm-chart`. This will create the awx-operator chart in the `charts/awx-operator` directory. In this process, the contents of the `.helm/starter` directory will be added to the chart.
## Future Goals
All values under the `AWX` header are focused on configurations that use the operator. Configurations that relate to the Operator itself could be placed under an `Operator` heading, but that may add a layer of complication over current development.
# Chart Publishing
The chart is currently hosted on the gh-pages branch of the repo. During the release pipeline, the `index.yaml` stored in that branch is generated with helm chart entries from all valid tags. We are currently unable to use the `chart-releaser` pipeline due to the fact that the complete helm chart is not committed to the repo and is instead built during the release process. Therefore, the cr action is unable to compare against previous versions.
Instead of CR, we use `helm repo index` to generate an index from all locally pulled chart versions. Since we build from scratch every time, the timestamps of all entries will be updated. This could be improved by using yq or something similar to detect which tags are already in the index.yaml file, and only merge in tags that are not present.
Not using CR could be addressed in the future by keeping the chart built as a part of releases, as long as CR compares the chart to previous release packages rather than previous commits. If the latter is the case, then we would not have the necessary history for comparison.

View File

@@ -7,7 +7,7 @@ metadata:
{{- with $.Values.AWX.postgres }}
stringData:
host: {{ .host }}
port: {{ .port }}
port: {{ .port | quote }}
database: {{ .dbName }}
username: {{ .username }}
password: {{ .password }}

View File

@@ -12,3 +12,8 @@ rules:
truthy: disable
line-length:
max: 170
document-start: disable
comments-indentation: disable
indentation:
level: warning
indent-sequences: consistent

View File

@@ -1,4 +1,10 @@
FROM quay.io/operator-framework/ansible-operator:v1.12.0
FROM quay.io/operator-framework/ansible-operator:v1.26.0
USER 0
RUN dnf install -y openssl
USER 1001
ARG DEFAULT_AWX_VERSION
ARG OPERATOR_VERSION
@@ -12,3 +18,8 @@ RUN ansible-galaxy collection install -r ${HOME}/requirements.yml \
COPY watches.yaml ${HOME}/watches.yaml
COPY roles/ ${HOME}/roles/
COPY playbooks/ ${HOME}/playbooks/
ENTRYPOINT ["/tini", "--", "/usr/local/bin/ansible-operator", "run", \
"--watches-file=./watches.yaml", \
"--reconcile-period=0s" \
]

146
Makefile
View File

@@ -44,6 +44,17 @@ IMAGE_TAG_BASE ?= quay.io/ansible/awx-operator
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
# You can enable this value if you would like to use SHA Based Digests
# To enable set flag to true
USE_IMAGE_DIGESTS ?= false
ifeq ($(USE_IMAGE_DIGESTS), true)
BUNDLE_GEN_FLAGS += --use-image-digests
endif
# Image URL to use all building/pushing image targets
IMG ?= $(IMAGE_TAG_BASE):$(VERSION)
NAMESPACE ?= awx
@@ -56,6 +67,7 @@ CHART_REPO ?= awx-operator
CHART_BRANCH ?= gh-pages
CHART_INDEX ?= index.yaml
.PHONY: all
all: docker-build
##@ General
@@ -71,38 +83,47 @@ all: docker-build
# More info on the awk command:
# http://linuxcommand.org/lc3_adv_awk.php
.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Build
.PHONY: run
run: ansible-operator ## Run against the configured Kubernetes cluster in ~/.kube/config
ANSIBLE_ROLES_PATH="$(ANSIBLE_ROLES_PATH):$(shell pwd)/roles" $(ANSIBLE_OPERATOR) run
.PHONY: docker-build
docker-build: ## Build docker image with the manager.
${CONTAINER_CMD} build $(BUILD_ARGS) -t ${IMG} .
.PHONY: docker-push
docker-push: ## Push docker image with the manager.
${CONTAINER_CMD} push ${IMG}
##@ Deployment
.PHONY: install
install: kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -
.PHONY: uninstall
uninstall: kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete -f -
.PHONY: gen-resources
gen-resources: kustomize ## Generate resources for controller and print to stdout
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
@cd config/default && $(KUSTOMIZE) edit set namespace ${NAMESPACE}
@$(KUSTOMIZE) build config/default
.PHONY: deploy
deploy: kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
@cd config/default && $(KUSTOMIZE) edit set namespace ${NAMESPACE}
@$(KUSTOMIZE) build config/default | kubectl apply -f -
.PHONY: undeploy
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
@cd config/default && $(KUSTOMIZE) edit set namespace ${NAMESPACE}
$(KUSTOMIZE) build config/default | kubectl delete -f -
@@ -119,7 +140,7 @@ ifeq (,$(shell which kustomize 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(KUSTOMIZE)) ;\
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.2/kustomize_v4.5.2_$(OS)_$(ARCHA).tar.gz | \
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.7/kustomize_v4.5.7_$(OS)_$(ARCHA).tar.gz | \
tar xzf - -C bin/ ;\
}
else
@@ -135,7 +156,7 @@ ifeq (,$(shell which ansible-operator 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(ANSIBLE_OPERATOR)) ;\
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.12.0/ansible-operator_$(OS)_$(ARCHA) ;\
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.26.0/ansible-operator_$(OS)_$(ARCHA) ;\
chmod +x $(ANSIBLE_OPERATOR) ;\
}
else
@@ -166,7 +187,7 @@ ifeq (,$(shell which opm 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(OPM)) ;\
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.15.1/$(OS)-$(ARCHA)-opm ;\
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.26.0/$(OS)-$(ARCHA)-opm ;\
chmod +x $(OPM) ;\
}
else
@@ -269,55 +290,108 @@ charts:
mkdir -p $@
.PHONY: helm-chart
helm-chart: kustomize helm kubectl-slice yq charts
@echo "== KUSTOMIZE (image and namespace) =="
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
helm-chart: helm-chart-generate
@echo "== HELM =="
.PHONY: helm-chart-generate
helm-chart-generate: kustomize helm kubectl-slice yq charts
@echo "== KUSTOMIZE: Set image and chart label =="
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
cd config/manager && $(KUSTOMIZE) edit set label helm.sh/chart:$(CHART_NAME)
cd config/default && $(KUSTOMIZE) edit set label helm.sh/chart:$(CHART_NAME)
@echo "== Gather Helm Chart Metadata =="
# remove the existing chart if it exists
rm -rf charts/$(CHART_NAME)
# create new chart metadata in Chart.yaml
cd charts && \
$(HELM) create awx-operator --starter $(shell pwd)/.helm/starter ;\
$(YQ) -i '.version = "$(VERSION)"' $(CHART_NAME)/Chart.yaml ;\
$(YQ) -i '.appVersion = "$(VERSION)" | .appVersion style="double"' $(CHART_NAME)/Chart.yaml ;\
$(YQ) -i '.description = "$(CHART_DESCRIPTION)"' $(CHART_NAME)/Chart.yaml ;\
@echo "Generated chart metadata:"
@cat charts/$(CHART_NAME)/Chart.yaml
@echo "== KUSTOMIZE (annotation) =="
cd config/manager && $(KUSTOMIZE) edit set annotation helm.sh/chart:$(CHART_NAME)-$(VERSION)
cd config/default && $(KUSTOMIZE) edit set annotation helm.sh/chart:$(CHART_NAME)-$(VERSION)
@echo "== SLICE =="
@echo "== KUSTOMIZE: Generate resources and slice into templates =="
# place in raw-files directory so they can be modified while they are valid yaml - as soon as they are in templates/,
# wild cards pick up the actual templates, which are not real yaml and can't have yq run on them.
$(KUSTOMIZE) build --load-restrictor LoadRestrictionsNone config/default | \
$(KUBECTL_SLICE) --input-file=- \
--output-dir=charts/$(CHART_NAME)/templates \
--output-dir=charts/$(CHART_NAME)/raw-files \
--sort-by-kind
@echo "== GIT: Reset kustomize configs =="
# reset kustomize configs following kustomize build
git checkout -f config/.
@echo "== Build Templates and CRDS =="
# Delete metadata.namespace, release namespace will be automatically inserted by helm
for file in charts/$(CHART_NAME)/raw-files/*; do\
$(YQ) -i 'del(.metadata.namespace)' $${file};\
done
# Correct namespace for rolebinding to be release namespace, this must be explicit
for file in charts/$(CHART_NAME)/raw-files/*rolebinding*; do\
$(YQ) -i '.subjects[0].namespace = "{{ .Release.Namespace }}"' $${file};\
done
# move all custom resource definitions to crds folder
mkdir charts/$(CHART_NAME)/crds
mv charts/$(CHART_NAME)/raw-files/customresourcedefinition*.yaml charts/$(CHART_NAME)/crds/.
# remove any namespace definitions
rm -f charts/$(CHART_NAME)/raw-files/namespace*.yaml
# move remaining resources to helm templates
mv charts/$(CHART_NAME)/raw-files/* charts/$(CHART_NAME)/templates/.
# remove the raw-files folder
rm -rf charts/$(CHART_NAME)/raw-files
# create and populate NOTES.txt
@echo "AWX Operator installed with Helm Chart version $(VERSION)" > charts/$(CHART_NAME)/templates/NOTES.txt
$(foreach file, $(wildcard charts/$(CHART_NAME)/templates/*),$(YQ) -i 'del(.. | select(has("namespace")).namespace)' $(file);)
$(foreach file, $(wildcard charts/$(CHART_NAME)/templates/*rolebinding*),$(YQ) -i '.subjects[0].namespace = "{{ .Release.Namespace }}"' $(file);)
rm -f charts/$(CHART_NAME)/templates/namespace*.yaml
@echo "Helm chart successfully configured for $(CHART_NAME) version $(VERSION)"
.PHONY: helm-package
helm-package: cr helm-chart
@echo "== CHART RELEASER (package) =="
$(CR) package ./charts/awx-operator
helm-package: helm-chart
@echo "== Package Current Chart Version =="
mkdir -p .cr-release-packages
# package the chart and put it in .cr-release-packages dir
$(HELM) package ./charts/awx-operator -d .cr-release-packages
# The actual release happens in ansible/helm-release.yml
# until https://github.com/helm/chart-releaser/issues/122 happens
# List all tags oldest to newest.
TAGS := $(shell git ls-remote --tags --sort=version:refname --refs -q | cut -d/ -f3)
# The actual release happens in ansible/helm-release.yml, which calls this targer
# until https://github.com/helm/chart-releaser/issues/122 happens, chart-releaser is not ideal for a chart
# that is contained within a larger repo, where a tag may not require a new chart version
.PHONY: helm-index
helm-index: cr helm-chart
@echo "== CHART RELEASER (httpsorigin) =="
git remote add httpsorigin "https://github.com/$(CHART_OWNER)/$(CHART_REPO).git"
git fetch httpsorigin
helm-index:
# when running in CI this gh-pages are already checked out with github action to 'gh-pages' directory
# TODO: test if gh-pages directory exists and if not exist
@echo "== CHART RELEASER (index) =="
$(CR) index \
--owner "$(CHART_OWNER)" \
--git-repo "$(CHART_REPO)" \
--token "$(CR_TOKEN)" \
--pages-branch "$(CHART_BRANCH)" \
--index-path "./charts/$(CHART_INDEX)" \
--charts-repo "https://$(CHART_OWNER).github.io/$(CHART_REPO)/$(CHART_INDEX)" \
--remote httpsorigin \
--release-name-template="{{ .Version }}" \
--push
@echo "== GENERATE INDEX FILE =="
# This step to workaround issues with old releases being dropped.
# Until https://github.com/helm/chart-releaser/issues/133 happens
@echo "== CHART FETCH previous releases =="
# Download all old releases
mkdir -p .cr-release-packages
for tag in $(TAGS); do\
dl_url="https://github.com/$(CHART_OWNER)/$(CHART_REPO)/releases/download/$${tag}/$(CHART_REPO)-$${tag}.tgz";\
echo "Downloading $${tag} from $${dl_url}";\
curl -RLOs -z "$(CHART_REPO)-$${tag}.tgz" --fail $${dl_url};\
result=$$?;\
if [ $${result} -eq 0 ]; then\
echo "Downloaded $${dl_url}";\
mkdir -p .cr-release-packages/$${tag};\
mv ./$(CHART_REPO)-$${tag}.tgz .cr-release-packages/$${tag};\
else\
echo "Skipping release $${tag}; No helm chart present";\
rm -rf "$(CHART_REPO)-$${tag}.tgz";\
fi;\
done;\
# generate the index file in the root of the gh-pages branch
# --merge will leave any values in index.yaml that don't get generated by this command, but
# it is likely that all values are overridden
$(HELM) repo index .cr-release-packages --url https://github.com/$(CHART_OWNER)/$(CHART_REPO)/releases/download/ --merge gh-pages/index.yaml
mv .cr-release-packages/index.yaml gh-pages/index.yaml

14
PROJECT
View File

@@ -13,4 +13,18 @@ resources:
group: awx
kind: AWX
version: v1beta1
- api:
crdVersion: v1
namespaced: true
domain: ansible.com
group: awx
kind: AWXBackup
version: v1beta1
- api:
crdVersion: v1
namespaced: true
domain: ansible.com
group: awx
kind: AWXRestore
version: v1beta1
version: "3"

304
README.md
View File

@@ -48,12 +48,18 @@ An [Ansible AWX](https://github.com/ansible/awx) operator for Kubernetes built w
* [Auto Upgrade](#auto-upgrade)
* [Upgrade of instances without auto upgrade](#upgrade-of-instances-without-auto-upgrade)
* [Service Account](#service-account)
* [Labeling operator managed objects](#labeling-operator-managed-objects)
* [Pods termination grace period](#pods-termination-grace-period)
* [Uninstall](#uninstall)
* [Upgrading](#upgrading)
* [Backup](#backup)
* [v0.14.0](#v0140)
* [Cluster-scope to Namespace-scope considerations](#cluster-scope-to-namespace-scope-considerations)
* [Project is now based on v1.x of the operator-sdk project](#project-is-now-based-on-v1x-of-the-operator-sdk-project)
* [Steps to upgrade](#steps-to-upgrade)
* [Disable IPV6](#disable-ipv6)
* [Add Execution Nodes](#adding-execution-nodes)
* [Custom Receptor CA](#custom-receptor-ca)
* [Contributing](#contributing)
* [Release Process](#release-process)
* [Author](#author)
@@ -194,12 +200,24 @@ metadata:
name: awx-demo
spec:
service_type: nodeport
# default nodeport_port is 30080
nodeport_port: <nodeport_port>
```
> It may make sense to create and specify your own secret key for your deployment so that if the k8s secret gets deleted, it can be re-created if needed. If it is not provided, one will be auto-generated, but cannot be recovered if lost. Read more [here](#secret-key-configuration).
If you are on Openshift, you can take advantage of Routes by specifying the following your spec. This will automatically create a Route for you with a custom hostname. This can be found on the Route section of the Openshift Console.
```yaml
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: awx-demo
spec:
service_type: clusterip
ingress_type: Route
```
Make sure to add this new file to the list of "resources" in your `kustomization.yaml` file:
```yaml
@@ -240,19 +258,19 @@ awx-demo-service NodePort 10.109.40.38 <none> 80:31006/TCP 3m56
Once deployed, the AWX instance will be accessible by running:
```
$ minikube service awx-demo-service --url -n $NAMESPACE
$ minikube service -n awx awx-demo-service --url
```
By default, the admin user is `admin` and the password is available in the `<resourcename>-admin-password` secret. To retrieve the admin password, run:
```
$ kubectl get secret awx-demo-admin-password -o jsonpath="{.data.password}" | base64 --decode
$ kubectl get secret awx-demo-admin-password -o jsonpath="{.data.password}" | base64 --decode ; echo
yDL2Cx5Za94g9MvBP6B73nzVLlmfgPjR
```
You just completed the most basic install of an AWX instance via this operator. Congratulations!!!
For an example using the Nginx Controller in Minukube, don't miss our [demo video](https://asciinema.org/a/416946).
For an example using the Nginx Ingress Controller in Minikube, don't miss our [demo video](https://asciinema.org/a/416946).
### Helm Install on existing cluster
@@ -300,7 +318,7 @@ There are three variables that are customizable for the admin user account creat
If `admin_password_secret` is not provided, the operator will look for a secret named `<resourcename>-admin-password` for the admin password. If it is not present, the operator will generate a password and create a Secret from it named `<resourcename>-admin-password`.
To retrieve the admin password, run `kubectl get secret <resourcename>-admin-password -o jsonpath="{.data.password}" | base64 --decode`
To retrieve the admin password, run `kubectl get secret <resourcename>-admin-password -o jsonpath="{.data.password}" | base64 --decode ; echo`
The secret that is expected to be passed should be formatted as follow:
@@ -385,12 +403,14 @@ The following variables are customizable only when `service_type=LoadBalancer`
| --------------------- | ---------------------------------------- | ------- |
| loadbalancer_protocol | Protocol to use for Loadbalancer ingress | http |
| loadbalancer_port | Port used for Loadbalancer ingress | 80 |
| loadbalancer_ip | Assign Loadbalancer IP | '' |
```yaml
---
spec:
...
service_type: LoadBalancer
loadbalancer_ip: '192.168.10.25'
loadbalancer_protocol: https
loadbalancer_port: 443
service_annotations: |
@@ -441,9 +461,11 @@ The following variables are customizable when `ingress_type=ingress`. The `ingre
| ------------------- | ---------------------------------------- | --------------------------- |
| ingress_annotations | Ingress annotations | Empty string |
| ingress_tls_secret | Secret that contains the TLS information | Empty string |
| ingress_class_name | Define the ingress class name | Cluster default |
| hostname | Define the FQDN | {{ meta.name }}.example.com |
| ingress_path | Define the ingress path to the service | / |
| ingress_path_type | Define the type of the path (for LBs) | Prefix |
| ingress_api_version | Define the Ingress resource apiVersion | 'networking.k8s.io/v1' |
```yaml
---
@@ -464,6 +486,7 @@ The following variables are customizable when `ingress_type=route`
| route_host | Common name the route answers for | `<instance-name>-<namespace>-<routerCanonicalHostname>` |
| route_tls_termination_mechanism | TLS Termination mechanism (Edge, Passthrough) | Edge |
| route_tls_secret | Secret that contains the TLS information | Empty string |
| route_api_version | Define the Route resource apiVersion | 'route.openshift.io/v1' |
```yaml
---
@@ -477,6 +500,12 @@ spec:
### Database Configuration
#### Postgres Version
The default Postgres version for the version of AWX bundled with the latest version of the awx-operator is Postgres 13. You can find this default for a given version by at the default value for [_postgres_image_version](./roles/installer/defaults/main.yml#L138).
We only have coverage for the default version of Postgres. Newer versions of Postgres (14+) will likely work, but should only be configured as an external database. If your database is managed by the awx-operator (default if you don't specify a `postgres_configuration_secret`), then you should not override the default version as this may cause issues when awx-operator tries to upgrade your postgresql pod.
#### External PostgreSQL Service
To configure AWX to use an external database, the Custom Resource needs to know about the connection details. To do this, create a k8s secret with those connection details and specify the name of the secret as `postgres_configuration_secret` at the CR spec level.
@@ -502,7 +531,7 @@ stringData:
type: Opaque
```
> Please ensure that the value for the variable `password` should _not_ contain single or double quotes (`'`, `"`) or backslashes (`\`) to avoid any issues during deployment, backup or restoration.
> Please ensure that the value for the variable `password` should _not_ contain single or double quotes (`'`, `"`) or backslashes (`\`) to avoid any issues during deployment, [backup](https://github.com/ansible/awx-operator/tree/devel/roles/backup) or [restoration](https://github.com/ansible/awx-operator/tree/devel/roles/restore).
> It is possible to set a specific username, password, port, or database, but still have the database managed by the operator. In this case, when creating the postgres-configuration secret, the `type: managed` field should be added.
@@ -548,7 +577,7 @@ spec:
cpu: 500m
memory: 2Gi
limits:
cpu: 1
cpu: '1'
memory: 4Gi
postgres_storage_requirements:
requests:
@@ -687,25 +716,44 @@ spec:
control_plane_priority_class: awx-demo-high-priority
postgres_priority_class: awx-demo-medium-priority
```
#### Scaling the Web and Task Pods independently
You can scale replicas up or down for each deployment by using the `web_replicas` or `task_replicas` respectively. You can scale all pods across both deployments by using `replicas` as well. The logic behind these CRD keys acts as such:
- If you specify the `replicas` field, the key passed will scale both the `web` and `task` replicas to the same number.
- If `web_replicas` or `task_replicas` is ever passed, it will override the existing `replicas` field on the specific deployment with the new key value.
These new replicas can be constrained in a similar manner to previous single deployments by appending the particular deployment name in front of the constraint used. More about those new constraints can be found below in the [Assigning AWX pods to specific nodes](#assigning-awx-pods-to-specific-nodes) section.
#### Assigning AWX pods to specific nodes
You can constrain the AWX pods created by the operator to run on a certain subset of nodes. `node_selector` and `postgres_selector` constrains
the AWX pods to run only on the nodes that match all the specified key/value pairs. `tolerations` and `postgres_tolerations` allow the AWX
pods to be scheduled onto nodes with matching taints.
The ability to specify topologySpreadConstraints is also allowed through `topology_spread_constraints`
If you want to use affinity rules for your AWX pod you can use the `affinity` option.
If you want to constrain the web and task pods individually, you can do so by specificying the deployment type before the specific setting. For
example, specifying `task_tolerations` will allow the AWX task pod to be scheduled onto nodes with matching taints.
| Name | Description | Default |
| --------------------------- | ----------------------------------- | ------- |
| postgres_image | Path of the image to pull | 12 |
| postgres_image_version | Image version to pull | 12 |
| node_selector | AWX pods' nodeSelector | '' |
| topology_spread_constraints | AWX pods' topologySpreadConstraints | '' |
| tolerations | AWX pods' tolerations | '' |
| annotations | AWX pods' annotations | '' |
| postgres_selector | Postgres pods' nodeSelector | '' |
| postgres_tolerations | Postgres pods' tolerations | '' |
| Name | Description | Default |
| -------------------------------- | ---------------------------------------- | ------- |
| postgres_image | Path of the image to pull | postgres |
| postgres_image_version | Image version to pull | 13 |
| node_selector | AWX pods' nodeSelector | '' |
| web_node_selector | AWX web pods' nodeSelector | '' |
| task_node_selector | AWX task pods' nodeSelector | '' |
| topology_spread_constraints | AWX pods' topologySpreadConstraints | '' |
| web_topology_spread_constraints | AWX web pods' topologySpreadConstraints | '' |
| task_topology_spread_constraints | AWX task pods' topologySpreadConstraints | '' |
| affinity | AWX pods' affinity rules | '' |
| web_affinity | AWX web pods' affinity rules | '' |
| task_affinity | AWX task pods' affinity rules | '' |
| tolerations | AWX pods' tolerations | '' |
| web_tolerations | AWX web pods' tolerations | '' |
| task_tolerations | AWX task pods' tolerations | '' |
| annotations | AWX pods' annotations | '' |
| postgres_selector | Postgres pods' nodeSelector | '' |
| postgres_tolerations | Postgres pods' tolerations | '' |
Example of customization could be:
@@ -729,6 +777,11 @@ spec:
operator: "Equal"
value: "AWX"
effect: "NoSchedule"
task_tolerations: |
- key: "dedicated"
operator: "Equal"
value: "AWX_task"
effect: "NoSchedule"
postgres_selector: |
disktype: ssd
kubernetes.io/arch: amd64
@@ -738,6 +791,28 @@ spec:
operator: "Equal"
value: "AWX"
effect: "NoSchedule"
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: another-node-label-key
operator: In
values:
- another-node-label-value
- another-node-label-value
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: security
operator: In
values:
- S2
topologyKey: topology.kubernetes.io/zone
```
#### Trusting a Custom Certificate Authority
@@ -765,7 +840,22 @@ spec:
bundle_cacert_secret: <resourcename>-custom-certs
```
To create the secrets, you can use the commands below:
Create the secret with `kustomization.yaml` file:
```yaml
....
secretGenerator:
- name: <resourcename>-custom-certs
files:
- bundle-ca.crt=<path+filename>
options:
disableNameSuffixHash: true
...
```
Create the secret with CLI:
* Certificate Authority secret
@@ -784,7 +874,9 @@ To create the secrets, you can use the commands below:
#### Enabling LDAP Integration at AWX bootstrap
A sample of extra settings can be found as below:
A sample of extra settings can be found as below. All possible options can be found here: https://django-auth-ldap.readthedocs.io/en/latest/reference.html#settings
> **NOTE:** These values are inserted into a Python file, so pay close attention to which values need quotes and which do not.
```yaml
- setting: AUTH_LDAP_SERVER_URI
@@ -801,6 +893,9 @@ A sample of extra settings can be found as below:
- setting: AUTH_LDAP_GROUP_SEARCH
value: 'LDAPSearch("OU=Groups,DC=abc,DC=com",ldap.SCOPE_SUBTREE,"(objectClass=group)",)'
- setting: AUTH_LDAP_GROUP_TYPE
value: 'GroupOfNamesType'
- setting: AUTH_LDAP_USER_ATTR_MAP
value: '{"first_name": "givenName","last_name": "sn","email": "mail"}'
@@ -942,11 +1037,22 @@ Example spec file for volumes and volume mounts
> :warning: **Volume and VolumeMount names cannot contain underscores(_)**
##### Custom Nginx Configuration
Using the [extra_volumes feature](#custom-volume-and-volume-mount-options), it is possible to extend the nginx.conf.
1. Create a ConfigMap with the extra settings you want to include in the nginx.conf
2. Create an extra_volumes entry in the AWX spec for this ConfigMap
3. Create an web_extra_volume_mounts entry in the AWX spec to mount this volume
The AWX nginx config automatically includes /etc/nginx/conf.d/*.conf if present.
#### Default execution environments from private registries
In order to register default execution environments from private registries, the Custom Resource needs to know about the pull credentials. Those credentials should be stored as a secret and either specified as `ee_pull_credentials_secret` at the CR spec level, or simply be present on the namespace under the name `<resourcename>-ee-pull-credentials` . Instance initialization will register a `Container registry` type credential on the deployed instance and assign it to the registered default execution environments.
The secret should be formated as follows:
The secret should be formatted as follows:
```yaml
---
@@ -970,7 +1076,7 @@ You can create `image_pull_secret`
```
kubectl create secret <resoucename>-cp-pull-credentials regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
```
If you need more control (for example, to set a namespace or a label on the new secret) then you can customise the Secret before storing it
If you need more control (for example, to set a namespace or a label on the new secret) then you can customize the Secret before storing it
Example spec file extra-config
@@ -1061,8 +1167,14 @@ Example configuration of `extra_settings` parameter
- setting: AUTH_LDAP_BIND_DN
value: "cn=admin,dc=example,dc=com"
- setting: LOG_AGGREGATOR_LEVEL
value: "'DEBUG'"
```
Note for some settings, such as `LOG_AGGREGATOR_LEVEL`, the value may need double quotes.
#### No Log
Configure no_log for tasks with no_log
@@ -1074,11 +1186,11 @@ Example configuration of `no_log` parameter
```yaml
spec:
no_log: 'true'
no_log: true
```
#### Auto upgrade
With this parameter you can influence the behaviour during an operator upgrade.
With this parameter you can influence the behavior during an operator upgrade.
If set to `true`, the operator will upgrade the specific instance directly.
When the value is set to `false`, and we have a running deployment, the operator will not update the AWX instance.
This can be useful when you have multiple AWX instances which you want to upgrade step by step instead of all at once.
@@ -1130,6 +1242,74 @@ Example configuration of environment variables
eks.amazonaws.com/role-arn: arn:aws:iam::<ACCOUNT_ID>:role/<IAM_ROLE_NAME>
```
#### Labeling operator managed objects
In certain situations labeling of Kubernetes objects managed by the operator
might be desired (e.g. for owner identification purposes). For that
`additional_labels` parameter could be used
| Name | Description | Default |
| --------------------------- | ---------------------------------------------------------------------------------------- | ------- |
| additional_labels | Additional labels defined on the resource, which should be propagated to child resources | [] |
Example configuration where only `my/team` and `my/service` labels will be
propagated to child objects (`Deployment`, `Secret`s, `ServiceAccount`, etc):
```yaml
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: awx-demo
labels:
my/team: "foo"
my/service: "bar"
my/do-not-inherit: "yes"
spec:
additional_labels:
- my/team
- my/service
...
```
#### Pods termination grace period
During deployment restarts or new rollouts, when old ReplicaSet Pods are being
terminated, the corresponding jobs which are managed (executed or controlled)
by old AWX Pods may end up in `Error` state as there is no mechanism to
transfer them to the newly spawned AWX Pods. To work around the problem one
could set `termination_grace_period_seconds` in AWX spec, which does the
following:
* It sets the corresponding
[`terminationGracePeriodSeconds`](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination)
Pod spec of the AWX Deployment to the value provided
> The grace period is the duration in seconds after the processes running in
> the pod are sent a termination signal and the time when the processes are
> forcibly halted with a kill signal
* It adds a
[`PreStop`](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#hook-handler-execution)
hook script, which will keep AWX Pods in terminating state until it finished,
up to `terminationGracePeriodSeconds`.
> This grace period applies to the total time it takes for both the PreStop
> hook to execute and for the Container to stop normally
While the hook script just waits until the corresponding AWX Pod (instance)
no longer has any managed jobs, in which case it finishes with success and
hands over the overall Pod termination process to normal AWX processes.
One may want to set this value to the maximum duration they accept to wait for
the affected Jobs to finish. Keeping in mind that such finishing jobs may
increase Pods termination time in such situations as `kubectl rollout restart`,
AWX upgrade by the operator, or Kubernetes [API-initiated
evictions](https://kubernetes.io/docs/concepts/scheduling-eviction/api-eviction/).
| Name | Description | Default |
| -------------------------------- | --------------------------------------------------------------- | ------- |
| termination_grace_period_seconds | Optional duration in seconds pods needs to terminate gracefully | not set |
### Uninstall ###
@@ -1142,12 +1322,38 @@ awx.awx.ansible.com "awx-demo" deleted
Deleting an AWX instance will remove all related deployments and statefulsets, however, persistent volumes and secrets will remain. To enforce secrets also getting removed, you can use `garbage_collect_secrets: true`.
**Note**: If you ever intend to recover an AWX from an existing database you will need a copy of the secrets in order to perform a successful recovery.
### 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 `image_version` variable in `roles/installer/defaults/main.yml` for that particular release.
Apply the awx-operator.yml for that release to upgrade the operator, and in turn also upgrade your AWX deployment.
#### Backup
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:
* 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-13-<deployment-name>-postgres-13-0`
**Note**: Do not delete the namespace/project, as that will delete the backup and the backup's PVC as well.
#### 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.
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.
```yaml
spec:
postgres_keep_pvc_after_upgrade: False
```
#### v0.14.0
##### Cluster-scope to Namespace-scope considerations
@@ -1174,6 +1380,52 @@ Then install the new AWX Operator by following the instructions in [Basic Instal
Once the new AWX Operator is up and running, your AWX deployment will also be upgraded.
### Disable IPV6
Starting with AWX Operator release 0.24.0,[IPV6 was enabled in ngnix configuration](https://github.com/ansible/awx-operator/pull/950) which causes
upgrades and installs to fail in environments where IPv6 is not allowed. Starting in 1.1.1 release, you can set the `ipv6_disabled` flag on the AWX
spec. If you need to use an AWX operator version between 0.24.0 and 1.1.1 in an IPv6 disabled environment, it is suggested to enabled ipv6 on worker
nodes.
In order to disable ipv6 on ngnix configuration (awx-web container), add following to the AWX spec.
The following variables are customizable
| Name | Description | Default |
| ------------- | ---------------------- | ------- |
| ipv6_disabled | Flag to disable ipv6 | false |
```yaml
spec:
ipv6_disabled: true
```
### Adding Execution Nodes
Starting with AWX Operator v0.30.0 and AWX v21.7.0, standalone execution nodes can be added to your deployments.
See [AWX execution nodes docs](https://github.com/ansible/awx/blob/devel/docs/execution_nodes.md) for information about this feature.
#### Custom Receptor CA
The control nodes on the K8S cluster will communicate with execution nodes via mutual TLS TCP connections, running via Receptor.
Execution nodes will verify incoming connections by ensuring the x509 certificate was issued by a trusted Certificate Authority (CA).
A user may wish to provide their own CA for this validation. If no CA is provided, AWX Operator will automatically generate one using OpenSSL.
Given custom `ca.crt` and `ca.key` stored locally, run the following,
```bash
kubectl create secret tls awx-demo-receptor-ca \
--cert=/path/to/ca.crt --key=/path/to/ca.key
```
The secret should be named `{AWX Custom Resource name}-receptor-ca`. In the above the AWX CR name is "awx-demo". Please replace "awx-demo" with your AWX Custom Resource name.
If this secret is created after AWX is deployed, run the following to restart the deployment,
```bash
kubectl rollout restart deployment awx-demo
```
**Important Note**, changing the receptor CA will break connections to any existing execution nodes. These nodes will enter an `unavailable` state, and jobs will not be able to run on them. Users will need to download and re-run the install bundle for each execution node. This will replace the TLS certificate files with those signed by the new CA. The execution nodes should then appear in a `ready` state after a few minutes.
## Contributing
Please visit [our contributing guidelines](https://github.com/ansible/awx-operator/blob/devel/CONTRIBUTING.md).
@@ -1181,7 +1433,7 @@ Please visit [our contributing guidelines](https://github.com/ansible/awx-operat
## Release Process
The first step is to create a draft release. Typically this will happen in the [Stage Release](https://github.com/ansible/awx/blob/devel/.github/workflows/stage.yml) workflow for AWX and you dont need to do it as a separate step.
The first step is to create a draft release. Typically this will happen in the [Stage Release](https://github.com/ansible/awx/blob/devel/.github/workflows/stage.yml) workflow for AWX and you don't need to do it as a separate step.
If you need to do an independent release of the operator, you can run the [Stage Release](https://github.com/ansible/awx-operator/blob/devel/.github/workflows/stage.yml) in the awx-operator repo. Both of these workflows will run smoke tests, so there is no need to do this manually.
@@ -1200,7 +1452,7 @@ We ask all of our community members and contributors to adhere to the [Ansible c
## Get Involved
We welcome your feedback and ideas. The AWX operator uses the same mailing list and IRC chanel 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 [mailing list](https://groups.google.com/forum/#!forum/awx-project)

View File

@@ -14,34 +14,78 @@
Release must exist before running this playbook
when: release is not success
- name: Build and package helm chart
command: |
make helm-chart helm-package
environment:
VERSION: "{{ tag }}"
IMAGE_TAG_BASE: "{{ operator_image }}"
args:
chdir: "{{ playbook_dir }}/../"
- name: Set helm filename and commit message
set_fact:
asset_already_attached: False
helm_file_name: "awx-operator-{{ tag }}.tgz"
commit_message: "Updated index.yaml for release {{ release.json.tag_name }}"
# Move to chart releaser after https://github.com/helm/chart-releaser/issues/122 exists
- name: Upload helm chart
uri:
url: "https://uploads.github.com/repos/{{ chart_owner }}/{{ chart_repo }}/releases/{{ release.json.id }}/assets?name=awx-operator-{{ tag }}.tgz"
src: "{{ playbook_dir }}/../.cr-release-packages/awx-operator-{{ tag }}.tgz"
headers:
Authorization: "token {{ gh_token }}"
Content-Type: "application/octet-stream"
status_code:
- 200
- 201
register: asset_upload
changed_when: asset_upload.json.state == "uploaded"
- name: See if file is already attached
set_fact:
asset_already_attached: True
loop: "{{ release.json.get('assets', []) }}"
loop_control:
label: "{{ item.name }}"
when: item.name == helm_file_name
- name: Publish helm index
command: |
make helm-index
environment:
CHART_OWNER: "{{ chart_owner }}"
CR_TOKEN: "{{ gh_token }}"
args:
chdir: "{{ playbook_dir }}/../"
- when: not asset_already_attached
block:
- name: Build and package helm chart
command: |
make helm-package
environment:
VERSION: "{{ tag }}"
IMAGE_TAG_BASE: "{{ operator_image }}"
args:
chdir: "{{ playbook_dir }}/../"
# Move to chart releaser after https://github.com/helm/chart-releaser/issues/122 exists
- name: Upload helm chart
uri:
url: "https://uploads.github.com/repos/{{ chart_owner }}/{{ chart_repo }}/releases/{{ release.json.id }}/assets?name={{ helm_file_name }}"
src: "{{ playbook_dir }}/../.cr-release-packages/awx-operator-{{ tag }}.tgz"
headers:
Authorization: "token {{ gh_token }}"
Content-Type: "application/octet-stream"
status_code:
- 200
- 201
register: asset_upload
changed_when: asset_upload.json.state == "uploaded"
- name: Ensure gh-pages exists
file:
state: directory
path: "{{ playbook_dir }}/../gh-pages"
- name: Check if we have published the release
command:
cmd: "git log --grep='{{ commit_message }}'"
chdir: "{{ playbook_dir }}/../gh-pages"
register: commits_for_release
- when: commits_for_release.stdout == ''
block:
- name: Configure git config
shell: |
git config user.name {{ gh_user }}
git config user.email {{ gh_user }}@users.noreply.github.com
args:
chdir: "{{ playbook_dir }}/../gh-pages"
- name: Publish helm index
command: |
make helm-index
environment:
CHART_OWNER: "{{ chart_owner }}"
CR_TOKEN: "{{ gh_token }}"
args:
chdir: "{{ playbook_dir }}/../"
- name: Stage and Push commit to gh-pages branch
shell: |
git add index.yaml
git commit -m "{{ commit_message }}"
git push
args:
chdir: "{{ playbook_dir }}/../gh-pages"

View File

@@ -26,6 +26,7 @@
image_version: "{{ image_version | default(omit) }}"
development_mode: "{{ development_mode | default(omit) | bool }}"
image_pull_policy: "{{ image_pull_policy | default(omit) }}"
nodeport_port: "{{ nodeport_port | default(omit) }}"
# ee_images:
# - name: test-ee
# image: quay.io/<user>/awx-ee

View File

@@ -0,0 +1,129 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: awxbackups.awx.ansible.com
spec:
group: awx.ansible.com
names:
kind: AWXBackup
listKind: AWXBackupList
plural: awxbackups
singular: awxbackup
scope: Namespaced
versions:
- name: v1beta1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
type: object
description: Schema validation for the AWXBackup CRD
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- deployment_name
properties:
deployment_name:
description: Name of the deployment to be backed up
type: string
backup_pvc:
description: Name of the backup PVC
type: string
backup_pvc_namespace:
description: (Deprecated) Namespace the PVC is in
type: string
backup_storage_requirements:
description: Storage requirements for backup PVC (may be similar to existing postgres PVC backing up from)
type: string
backup_resource_requirements:
description: Resource requirements for the management pod used to create a backup
properties:
requests:
properties:
cpu:
type: string
memory:
type: string
type: object
limits:
properties:
cpu:
type: string
memory:
type: string
type: object
type: object
backup_storage_class:
description: Storage class to use when creating PVC for backup
type: string
clean_backup_on_delete:
description: Flag to indicate if backup should be deleted on PVC if AWXBackup object is deleted
type: boolean
pg_dump_suffix:
description: Additional parameters for the pg_dump command
type: string
postgres_label_selector:
description: Label selector used to identify postgres pod for backing up data
type: string
postgres_image:
description: Registry path to the PostgreSQL container to use
type: string
postgres_image_version:
description: PostgreSQL container image version to use
type: string
no_log:
description: Configure no_log for no_log tasks
type: boolean
default: true
additional_labels:
description: Additional labels defined on the resource, which should be propagated to child resources
type: array
items:
type: string
set_self_labels:
description: Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
type: boolean
default: true
status:
type: object
x-kubernetes-preserve-unknown-fields: true
properties:
conditions:
description: The resulting conditions when a Service Telemetry is instantiated
items:
properties:
lastTransitionTime:
type: string
reason:
type: string
status:
type: string
type:
type: string
type: object
type: array
backupDirectory:
description: Backup directory name on the specified pvc
type: string
backupClaim:
description: Backup persistent volume claim
type: string

View File

@@ -0,0 +1,130 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: awxrestores.awx.ansible.com
spec:
group: awx.ansible.com
names:
kind: AWXRestore
listKind: AWXRestoreList
plural: awxrestores
singular: awxrestore
scope: Namespaced
versions:
- name: v1beta1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
type: object
description: Schema validation for the AWXRestore CRD
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- deployment_name
properties:
backup_source:
description: Backup source
type: string
enum:
- Backup CR
- PVC
deployment_name:
description: Name of the restored deployment. This should be different from the original deployment name
if the original deployment still exists.
type: string
cluster_name:
description: Cluster name
type: string
backup_name:
description: AWXBackup object name
type: string
backup_pvc:
description: Name of the PVC to be restored from, set as a status found on the awxbackup object (backupClaim)
type: string
backup_pvc_namespace:
description: (Deprecated) Namespace the PVC is in
type: string
backup_dir:
description: Backup directory name, set as a status found on the awxbackup object (backupDirectory)
type: string
restore_resource_requirements:
description: Resource requirements for the management pod that restores AWX from a backup
properties:
requests:
properties:
cpu:
type: string
memory:
type: string
type: object
limits:
properties:
cpu:
type: string
memory:
type: string
type: object
type: object
postgres_label_selector:
description: Label selector used to identify postgres pod for backing up data
type: string
postgres_image:
description: Registry path to the PostgreSQL container to use
type: string
postgres_image_version:
description: PostgreSQL container image version to use
type: string
no_log:
description: Configure no_log for no_log tasks
type: boolean
default: true
additional_labels:
description: Additional labels defined on the resource, which should be propagated to child resources
type: array
items:
type: string
set_self_labels:
description: Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
type: boolean
default: true
status:
type: object
x-kubernetes-preserve-unknown-fields: true
properties:
conditions:
description: The resulting conditions when a Service Telemetry is instantiated
items:
properties:
lastTransitionTime:
type: string
reason:
type: string
status:
type: string
type:
type: string
type: object
type: array
restoreComplete:
description: Restore process complete
type: boolean

File diff suppressed because it is too large Load Diff

View File

@@ -1,83 +0,0 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: awxbackups.awx.ansible.com
spec:
group: awx.ansible.com
names:
kind: AWXBackup
listKind: AWXBackupList
plural: awxbackups
singular: awxbackup
scope: Namespaced
versions:
- name: v1beta1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Schema validation for the AWXBackup CRD
properties:
spec:
type: object
required:
- deployment_name
properties:
deployment_name:
description: Name of the deployment to be backed up
type: string
backup_pvc:
description: Name of the PVC to be used for storing the backup
type: string
backup_pvc_namespace:
description: Namespace the PVC is in
type: string
backup_storage_requirements:
description: Storage requirements for the PostgreSQL container
type: string
backup_storage_class:
description: Storage class to use when creating PVC for backup
type: string
clean_backup_on_delete:
description: Flag to indicate if backup should be deleted on PVC if AWXBackup object is deleted
type: boolean
postgres_label_selector:
description: Label selector used to identify postgres pod for backing up data
type: string
postgres_image:
description: Registry path to the PostgreSQL container to use
type: string
postgres_image_version:
description: PostgreSQL container image version to use
type: string
no_log:
description: Configure no_log for no_log tasks
type: string
status:
type: object
properties:
conditions:
description: The resulting conditions when a Service Telemetry is instantiated
items:
properties:
lastTransitionTime:
type: string
reason:
type: string
status:
type: string
type:
type: string
type: object
type: array
backupDirectory:
description: Backup directory name on the specified pvc
type: string
backupClaim:
description: Backup persistent volume claim
type: string

View File

@@ -1,81 +0,0 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: awxrestores.awx.ansible.com
spec:
group: awx.ansible.com
names:
kind: AWXRestore
listKind: AWXRestoreList
plural: awxrestores
singular: awxrestore
scope: Namespaced
versions:
- name: v1beta1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Schema validation for the AWXRestore CRD
properties:
spec:
type: object
properties:
backup_source:
description: Backup source
type: string
enum:
- CR
- PVC
deployment_name:
description: Name of the deployment to be restored to
type: string
backup_name:
description: AWXBackup object name
type: string
backup_pvc:
description: Name of the PVC to be restored from, set as a status found on the awxbackup object (backupClaim)
type: string
backup_pvc_namespace:
description: Namespace the PVC is in
type: string
backup_dir:
description: Backup directory name, set as a status found on the awxbackup object (backupDirectory)
type: string
postgres_label_selector:
description: Label selector used to identify postgres pod for backing up data
type: string
postgres_image:
description: Registry path to the PostgreSQL container to use
type: string
postgres_image_version:
description: PostgreSQL container image version to use
type: string
no_log:
description: Configure no_log for no_log tasks
type: string
status:
type: object
properties:
conditions:
description: The resulting conditions when a Service Telemetry is instantiated
items:
properties:
lastTransitionTime:
type: string
reason:
type: string
status:
type: string
type:
type: string
type: object
type: array
restoreComplete:
description: Restore process complete
type: boolean

View File

@@ -1,9 +1,8 @@
---
# This kustomization.yaml is not intended to be run by itself,
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/awx.ansible.com_awxs.yaml
- bases/awxbackup.ansible.com_awxbackups.yaml
- bases/awxrestore.ansible.com_awxrestores.yaml
# +kubebuilder:scaffold:crdkustomizeresource
- bases/awx.ansible.com_awxs.yaml
- bases/awx.ansible.com_awxbackups.yaml
- bases/awx.ansible.com_awxrestores.yaml
#+kubebuilder:scaffold:crdkustomizeresource

View File

@@ -1,24 +1,32 @@
# Adds namespace to all resources.
namespace: awx
# Value of this field is prepended to the
# names of all resources, e.g. a deployment named
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: awx-operator-
# Labels to add to all resources and selectors.
# commonLabels:
# someName: someValue
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
# - ../prometheus
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
patchesStrategicMerge:
- manager_auth_proxy_patch.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
#labels:
#- includeSelectors: true
# pairs:
# someName: someValue
resources:
- ../crd
- ../rbac
- ../manager
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
#- ../prometheus
patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml
# Mount the controller config file for loading manager configurations
# through a ComponentConfig type
#- manager_config_patch.yaml

View File

@@ -1,4 +1,3 @@
---
# This patch inject a sidecar container which is a HTTP proxy for the
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
apiVersion: apps/v1
@@ -10,20 +9,33 @@ spec:
template:
spec:
containers:
- name: kube-rbac-proxy
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--v=10"
ports:
- containerPort: 8443
protocol: TCP
name: https
- name: awx-manager
args:
- "--health-probe-bind-address=:6789"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
- "--leader-election-id=awx-operator"
- name: kube-rbac-proxy
securityContext:
allowPrivilegeEscalation: false
# TODO(user): uncomment for common cases that do not require escalating privileges
# capabilities:
# drop:
# - "ALL"
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--v=0"
ports:
- containerPort: 8443
protocol: TCP
name: https
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
- name: awx-manager
args:
- "--health-probe-bind-address=:6789"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
- "--leader-election-id=awx-operator"

View File

@@ -1,4 +1,3 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -8,14 +7,14 @@ spec:
template:
spec:
containers:
- name: awx-manager
args:
- "--config=controller_manager_config.yaml"
volumeMounts:
- name: awx-manager-config
mountPath: /controller_manager_config.yaml
subPath: controller_manager_config.yaml
volumes:
- name: awx-manager
args:
- "--config=controller_manager_config.yaml"
volumeMounts:
- name: awx-manager-config
configMap:
name: awx-manager-config
mountPath: /controller_manager_config.yaml
subPath: controller_manager_config.yaml
volumes:
- name: awx-manager-config
configMap:
name: awx-manager-config

View File

@@ -1,10 +1,20 @@
---
apiVersion: controller-runtime.sigs.k8s.io/v1beta1
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
kind: ControllerManagerConfig
health:
healthProbeBindAddress: :6789
metrics:
bindAddress: 127.0.0.1:8080
leaderElection:
leaderElect: true
resourceName: 811c9dc5.ansible.com
# leaderElectionReleaseOnCancel defines if the leader should step down volume
# when the Manager ends. This requires the binary to immediately end when the
# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly
# speeds up voluntary leader transitions as the new leader don't have to wait
# LeaseDuration time first.
# In the default scaffold provided, the program ends immediately after
# the manager stops, so would be fine to enable this option. However,
# if you are doing or is intended to do any operation such as perform cleanups
# after the manager stops then its usage might be unsafe.
# leaderElectionReleaseOnCancel: true

View File

@@ -1,11 +1,14 @@
resources:
- manager.yaml
generatorOptions:
disableNameSuffixHash: true
configMapGenerator:
- files:
- name: awx-manager-config
files:
- controller_manager_config.yaml
name: awx-manager-config
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:

View File

@@ -20,48 +20,62 @@ spec:
replicas: 1
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: awx-manager
labels:
control-plane: controller-manager
spec:
securityContext:
runAsNonRoot: true
# For common cases that do not require escalating privileges
# it is recommended to ensure that all your Pods/Containers are restrictive.
# More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted
# Please uncomment the following code if your project does NOT have to work on old Kubernetes
# versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ).
# seccompProfile:
# type: RuntimeDefault
containers:
- args:
- --leader-elect
- --leader-election-id=awx-operator
image: controller:latest
name: awx-manager
env:
- name: ANSIBLE_GATHERING
value: explicit
- name: ANSIBLE_DEBUG_LOGS
value: 'false'
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
allowPrivilegeEscalation: false
livenessProbe:
httpGet:
path: /healthz
port: 6789
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: 6789
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
memory: "32Mi"
cpu: "50m"
limits:
memory: "4096Mi"
cpu: "2000m"
- args:
- --leader-elect
- --leader-election-id=awx-operator
image: controller:latest
name: awx-manager
env:
- name: ANSIBLE_GATHERING
value: explicit
- name: ANSIBLE_DEBUG_LOGS
value: 'false'
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
allowPrivilegeEscalation: false
# TODO(user): uncomment for common cases that do not require escalating privileges
capabilities:
drop:
- "ALL"
livenessProbe:
httpGet:
path: /healthz
port: 6789
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: 6789
initialDelaySeconds: 5
periodSeconds: 10
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
resources:
requests:
memory: "32Mi"
cpu: "50m"
limits:
memory: "4096Mi"
cpu: "2000m"
serviceAccountName: controller-manager
imagePullSecrets:
- name: redhat-operators-pull-secret
- name: redhat-operators-pull-secret
terminationGracePeriodSeconds: 10

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +1,7 @@
---
# These resources constitute the fully configured set of manifests
# used to generate the 'manifests/' directory in a bundle.
resources:
- bases/awx-operator.clusterserviceversion.yaml
- ../default
- ../samples
- ../scorecard
- bases/awx-operator.clusterserviceversion.yaml
- ../default
- ../samples
- ../scorecard

View File

@@ -1,3 +1,2 @@
---
resources:
- monitor.yaml
- monitor.yaml

View File

@@ -1,4 +1,3 @@
---
# Prometheus Monitor Service (Metrics)
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor

View File

@@ -1,10 +1,9 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: metrics-reader
rules:
- nonResourceURLs:
- "/metrics"
verbs:
- get
- nonResourceURLs:
- "/metrics"
verbs:
- get

View File

@@ -1,18 +1,17 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: proxy-role
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create

View File

@@ -1,4 +1,3 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
@@ -8,6 +7,6 @@ roleRef:
kind: ClusterRole
name: proxy-role
subjects:
- kind: ServiceAccount
name: controller-manager
namespace: system
- kind: ServiceAccount
name: controller-manager
namespace: system

View File

@@ -1,4 +1,3 @@
---
apiVersion: v1
kind: Service
metadata:
@@ -8,9 +7,9 @@ metadata:
namespace: system
spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: controller-manager

View File

@@ -1,25 +1,24 @@
---
# permissions for end users to edit awxs.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: awx-editor-role
rules:
- apiGroups:
- awx.ansible.com
resources:
- awxs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- awx.ansible.com
resources:
- awxs/status
verbs:
- get
- apiGroups:
- awx.ansible.com
resources:
- awxs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- awx.ansible.com
resources:
- awxs/status
verbs:
- get

View File

@@ -1,21 +1,20 @@
---
# permissions for end users to view awxs.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: awx-viewer-role
rules:
- apiGroups:
- awx.ansible.com
resources:
- awxs
verbs:
- get
- list
- watch
- apiGroups:
- awx.ansible.com
resources:
- awxs/status
verbs:
- get
- apiGroups:
- awx.ansible.com
resources:
- awxs
verbs:
- get
- list
- watch
- apiGroups:
- awx.ansible.com
resources:
- awxs/status
verbs:
- get

View File

@@ -0,0 +1,24 @@
# permissions for end users to edit awxbackups.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: awxbackup-editor-role
rules:
- apiGroups:
- awx.ansible.com
resources:
- awxbackups
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- awx.ansible.com
resources:
- awxbackups/status
verbs:
- get

View File

@@ -0,0 +1,20 @@
# permissions for end users to view awxbackups.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: awxbackup-viewer-role
rules:
- apiGroups:
- awx.ansible.com
resources:
- awxbackups
verbs:
- get
- list
- watch
- apiGroups:
- awx.ansible.com
resources:
- awxbackups/status
verbs:
- get

View File

@@ -0,0 +1,24 @@
# permissions for end users to edit awxrestores.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: awxrestore-editor-role
rules:
- apiGroups:
- awx.ansible.com
resources:
- awxrestores
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- awx.ansible.com
resources:
- awxrestores/status
verbs:
- get

View File

@@ -0,0 +1,20 @@
# permissions for end users to view awxrestores.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: awxrestore-viewer-role
rules:
- apiGroups:
- awx.ansible.com
resources:
- awxrestores
verbs:
- get
- list
- watch
- apiGroups:
- awx.ansible.com
resources:
- awxrestores/status
verbs:
- get

View File

@@ -1,19 +1,18 @@
---
resources:
# All RBAC will be applied under this service account in
# the deployment namespace. You may comment out this resource
# if your manager will use a service account that exists at
# runtime. Be sure to update RoleBinding and ClusterRoleBinding
# subjects if changing service account names.
- service_account.yaml
- role.yaml
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml
# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
- auth_proxy_service.yaml
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml
# All RBAC will be applied under this service account in
# the deployment namespace. You may comment out this resource
# if your manager will use a service account that exists at
# runtime. Be sure to update RoleBinding and ClusterRoleBinding
# subjects if changing service account names.
- service_account.yaml
- role.yaml
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml
# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
- auth_proxy_service.yaml
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml

View File

@@ -1,38 +1,37 @@
---
# permissions to do leader election.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: leader-election-role
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch

View File

@@ -1,4 +1,3 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
@@ -8,6 +7,6 @@ roleRef:
kind: Role
name: leader-election-role
subjects:
- kind: ServiceAccount
name: controller-manager
namespace: system
- kind: ServiceAccount
name: controller-manager
namespace: system

View File

@@ -20,7 +20,6 @@ rules:
- watch
- apiGroups:
- ""
- "rbac.authorization.k8s.io"
resources:
- pods
- services
@@ -31,6 +30,17 @@ rules:
- events
- configmaps
- secrets
verbs:
- get
- list
- create
- delete
- patch
- update
- watch
- apiGroups:
- "rbac.authorization.k8s.io"
resources:
- roles
- rolebindings
verbs:
@@ -43,12 +53,22 @@ rules:
- watch
- apiGroups:
- apps
- networking.k8s.io
resources:
- deployments
- daemonsets
- replicasets
- statefulsets
verbs:
- get
- list
- create
- delete
- patch
- update
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- get

View File

@@ -1,4 +1,3 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:

View File

@@ -0,0 +1,13 @@
apiVersion: awx.ansible.com/v1beta1
kind: AWXBackup
metadata:
name: example-awx-backup
spec:
deployment_name: example-awx
backup_resource_requirements:
limits:
cpu: "1000m"
memory: "4096Mi"
requests:
cpu: "25m"
memory: "32Mi"

View File

@@ -0,0 +1,14 @@
apiVersion: awx.ansible.com/v1beta1
kind: AWXRestore
metadata:
name: awxrestore-sample
spec:
deployment_name: example-awx-2
backup_name: example-awx-backup
restore_resource_requirements:
limits:
cpu: "1000m"
memory: "4096Mi"
requests:
cpu: "25m"
memory: "32Mi"

View File

@@ -1,5 +1,6 @@
---
## Append samples you want in your CSV to this file as resources ##
resources:
- awx_v1beta1_awx.yaml
# +kubebuilder:scaffold:manifestskustomizesamples
- awx_v1beta1_awx.yaml
- awx_v1beta1_awxbackup.yaml
- awx_v1beta1_awxrestore.yaml
#+kubebuilder:scaffold:manifestskustomizesamples

View File

@@ -1,8 +1,7 @@
---
apiVersion: scorecard.operatorframework.io/v1alpha3
kind: Configuration
metadata:
name: config
stages:
- parallel: true
tests: []
- parallel: true
tests: []

View File

@@ -1,17 +1,16 @@
---
resources:
- bases/config.yaml
- bases/config.yaml
patchesJson6902:
- path: patches/basic.config.yaml
target:
group: scorecard.operatorframework.io
version: v1alpha3
kind: Configuration
name: config
- path: patches/olm.config.yaml
target:
group: scorecard.operatorframework.io
version: v1alpha3
kind: Configuration
name: config
# +kubebuilder:scaffold:patchesJson6902
- path: patches/basic.config.yaml
target:
group: scorecard.operatorframework.io
version: v1alpha3
kind: Configuration
name: config
- path: patches/olm.config.yaml
target:
group: scorecard.operatorframework.io
version: v1alpha3
kind: Configuration
name: config
#+kubebuilder:scaffold:patchesJson6902

View File

@@ -1,11 +1,10 @@
---
- op: add
path: /stages/0/tests/-
value:
entrypoint:
- scorecard-test
- basic-check-spec
image: quay.io/operator-framework/scorecard-test:v1.12.0
- scorecard-test
- basic-check-spec
image: quay.io/operator-framework/scorecard-test:v1.26.0
labels:
suite: basic
test: basic-check-spec-test

View File

@@ -1,11 +1,10 @@
---
- op: add
path: /stages/0/tests/-
value:
entrypoint:
- scorecard-test
- olm-bundle-validation
image: quay.io/operator-framework/scorecard-test:v1.12.0
- scorecard-test
- olm-bundle-validation
image: quay.io/operator-framework/scorecard-test:v1.26.0
labels:
suite: olm
test: olm-bundle-validation-test
@@ -13,9 +12,9 @@
path: /stages/0/tests/-
value:
entrypoint:
- scorecard-test
- olm-crds-have-validation
image: quay.io/operator-framework/scorecard-test:v1.12.0
- scorecard-test
- olm-crds-have-validation
image: quay.io/operator-framework/scorecard-test:v1.26.0
labels:
suite: olm
test: olm-crds-have-validation-test
@@ -23,9 +22,9 @@
path: /stages/0/tests/-
value:
entrypoint:
- scorecard-test
- olm-crds-have-resources
image: quay.io/operator-framework/scorecard-test:v1.12.0
- scorecard-test
- olm-crds-have-resources
image: quay.io/operator-framework/scorecard-test:v1.26.0
labels:
suite: olm
test: olm-crds-have-resources-test
@@ -33,9 +32,9 @@
path: /stages/0/tests/-
value:
entrypoint:
- scorecard-test
- olm-spec-descriptors
image: quay.io/operator-framework/scorecard-test:v1.12.0
- scorecard-test
- olm-spec-descriptors
image: quay.io/operator-framework/scorecard-test:v1.26.0
labels:
suite: olm
test: olm-spec-descriptors-test
@@ -43,9 +42,9 @@
path: /stages/0/tests/-
value:
entrypoint:
- scorecard-test
- olm-status-descriptors
image: quay.io/operator-framework/scorecard-test:v1.12.0
- scorecard-test
- olm-status-descriptors
image: quay.io/operator-framework/scorecard-test:v1.26.0
labels:
suite: olm
test: olm-status-descriptors-test

View File

@@ -1,13 +1,17 @@
# Adds namespace to all resources.
namespace: osdk-test
namePrefix: osdk-
# Labels to add to all resources and selectors.
# commonLabels:
# someName: someValue
#commonLabels:
# someName: someValue
patchesStrategicMerge:
- manager_image.yaml
- debug_logs_patch.yaml
- ../default/manager_auth_proxy_patch.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
@@ -17,5 +21,3 @@ resources:
images:
- name: testing
newName: testing-operator
patches:
- path: pull_policy/Never.yaml

View File

@@ -1,4 +1,67 @@
# Iterating on the installer without deploying the operator
# Debugging the AWX Operator
## General Debugging
When the operator is deploying AWX, it is running the `installer` role inside the operator container. If the AWX CR's status is `Failed`, it is often useful to look at the awx-operator container logs, which shows the output of the installer role. To see these logs, run:
```
kubectl logs deployments/awx-operator-controller-manager -c awx-manager -f
```
### Inspect k8s Resources
Past that, it is often useful to inspect various resources the AWX Operator manages like:
* awx
* awxbackup
* awxrestore
* pod
* deployment
* pvc
* service
* ingress
* route
* secrets
* serviceaccount
And if installing via OperatorHub and OLM:
* subscription
* csv
* installPlan
* catalogSource
To inspect these resources you can use these commands
```
# Inspecting k8s resources
kubectl describe -n <namespace> <resource> <resource-name>
kubectl get -n <namespace> <resource> <resource-name> -o yaml
kubectl logs -n <namespace> <resource> <resource-name>
# Inspecting Pods
kubectl exec -it -n <namespace> <pod> <pod-name>
```
### Configure No Log
It is possible to show task output for debugging by setting no_log to false on the AWX CR spec.
This will show output in the awx-operator logs for any failed tasks where no_log was set to true.
For example:
```
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: awx-demo
spec:
service_type: nodeport
no_log: false # <------------
```
## Iterating on the installer without deploying the operator
Go through the [normal basic install](https://github.com/ansible/awx-operator/blob/devel/README.md#basic-install) steps.
@@ -35,6 +98,19 @@ ansible_operator_meta:
namespace: awx
service_type: nodeport
```
The vars file will replace the awx resource so any value that you wish to over ride using the awx resource, put in the vars file. For example, if you wish to use your own image, version and pull policy, you can specify it like below:
```yaml
# vars.yml
---
ansible_operator_meta:
name: awx
namespace: awx
service_type: nodeport
image: $DEV_DOCKER_TAG_BASE/awx_kube_devel
image_pull_policy: Always
image_version: $COMPOSE_TAG
```
Run the installer:

View File

@@ -34,7 +34,7 @@ metadata:
namespace: <target namespace>
stringData:
host: <external ip or url resolvable by the cluster>
port: <external port, this usually defaults to 5432>
port: "<external port, this usually defaults to 5432>" # quotes are required
database: <desired database name>
username: <username to connect as>
password: <password to connect with>

View File

@@ -19,6 +19,6 @@
state: absent
- name: Unset pull policy
command: '{{ kustomize }} edit remove patch pull_policy/{{ operator_pull_policy }}.yaml'
command: '{{ kustomize }} edit remove patch --path pull_policy/{{ operator_pull_policy }}.yaml'
args:
chdir: '{{ config_dir }}/testing'

View File

@@ -1,6 +1,6 @@
---
- name: Build kustomize testing overlay
# load_restrictor must be set to none so we can load patch files from the default overlay
# load-restrictor must be set to none so we can load patch files from the default overlay
command: '{{ kustomize }} build --load-restrictor LoadRestrictionsNone .'
args:
chdir: '{{ config_dir }}/testing'

View File

@@ -24,11 +24,11 @@
namespace: '{{ namespace }}'
kind: Pod
label_selectors:
- app.kubernetes.io/name = example-awx
- app.kubernetes.io/name = example-awx-web
register: awx_pod
when: not awx_version
- name: Exract tags from images
- name: Extract tags from images
set_fact:
image_tags: |
{{ awx_pod.resources[0].spec.containers |
@@ -83,3 +83,61 @@
result: '{{ ansible_failed_result }}'
fail:
msg: '{{ failed_task }}'
- block:
- name: Look up details for this AWX instance
k8s_info:
namespace: "{{ namespace }}"
api_version: "awx.ansible.com/v1beta1"
kind: AWX
name: example-awx
register: this_awx
- name: Get pod details
k8s_info:
namespace: '{{ namespace }}'
kind: Pod
label_selectors:
- app.kubernetes.io/name = example-awx-web
register: awx_pod
- name: Extract additional_labels from AWX spec
set_fact:
awx_additional_labels: >-
{{ this_awx.resources[0].metadata.labels
| dict2items | selectattr('key', 'in', this_awx.resources[0].spec.additional_labels)
| list
}}
- name: Extract additional_labels from AWX Pod
set_fact:
pod_additional_labels: >-
{{ awx_pod.resources[0].metadata.labels
| dict2items | selectattr('key', 'in', this_awx.resources[0].spec.additional_labels)
| list
}}
- name: AWX Pod contains additional_labels
ansible.builtin.assert:
that:
- pod_additional_labels == awx_additional_labels
- name: Extract Pod labels which shouldn't have been propagated to it from AWX
set_fact:
pod_extra_labels: >-
{{ awx_pod.resources[0].metadata.labels
| dict2items | selectattr('key', 'in', ["my/do-not-inherit"])
| list
}}
- name: AWX Pod doesn't contain AWX labels not in additional_labels
ansible.builtin.assert:
that:
- pod_extra_labels == []
rescue:
- name: Re-emit failure
vars:
failed_task:
result: '{{ ansible_failed_result }}'
fail:
msg: '{{ failed_task }}'

View File

@@ -0,0 +1,18 @@
---
# - name: Create the awx.ansible.com/v1beta1.AWXBackup
# k8s:
# state: present
# namespace: '{{ namespace }}'
# definition: "{{ lookup('template', '/'.join([samples_dir, cr_file])) | from_yaml }}"
# wait: yes
# wait_timeout: 300
# wait_condition:
# type: Successful
# status: "True"
# vars:
# cr_file: 'awx_v1beta1_awxbackup.yaml'
#
# - name: Add assertions here
# assert:
# that: false
# fail_msg: FIXME Add real assertions for your operator

View File

@@ -0,0 +1,18 @@
---
# - name: Create the awx.ansible.com/v1beta1.AWXRestore
# k8s:
# state: present
# namespace: '{{ namespace }}'
# definition: "{{ lookup('template', '/'.join([samples_dir, cr_file])) | from_yaml }}"
# wait: yes
# wait_timeout: 300
# wait_condition:
# type: Successful
# status: "True"
# vars:
# cr_file: 'awx_v1beta1_awxrestore.yaml'
#
# - name: Add assertions here
# assert:
# that: false
# fail_msg: FIXME Add real assertions for your operator

View File

@@ -3,6 +3,10 @@ apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: example-awx
labels:
my/team: "foo"
my/service: "bar"
my/do-not-inherit: "yes"
spec:
{% if awx_image %}
image: {{ awx_image }}
@@ -26,6 +30,10 @@ spec:
requests:
cpu: 50m
memory: 16M
no_log: false
postgres_resource_requirements: {}
postgres_init_container_resource_requirements: {}
redis_resource_requirements: {}
additional_labels:
- my/team
- my/service

View File

@@ -11,6 +11,6 @@
command: kind delete cluster --name osdk-test --kubeconfig {{ kubeconfig }}
- name: Unset pull policy
command: '{{ kustomize }} edit remove patch pull_policy/{{ operator_pull_policy }}.yaml'
command: '{{ kustomize }} edit remove patch --path pull_policy/{{ operator_pull_policy }}.yaml'
args:
chdir: '{{ config_dir }}/testing'

View File

@@ -1,4 +1,4 @@
molecule
molecule<4.0.2
molecule-docker
yamllint
ansible-lint

View File

@@ -2,7 +2,7 @@
collections:
- name: community.general
- name: kubernetes.core
version: 1.2.1
version: 2.3.2
- name: operator_sdk.util
- name: community.docker
- name: awx.awx

31
playbooks/awx.yml Normal file
View File

@@ -0,0 +1,31 @@
---
- hosts: localhost
gather_facts: no
collections:
- kubernetes.core
- operator_sdk.util
vars:
no_log: true
pre_tasks:
- name: Verify imagePullSecrets
k8s_info:
kind: Secret
namespace: '{{ ansible_operator_meta.namespace }}'
name: redhat-operators-pull-secret
register: _rh_ops_secret
no_log: "{{ no_log }}"
- name: Create imagePullSecret
k8s:
state: present
definition:
apiVersion: v1
kind: Secret
metadata:
name: redhat-operators-pull-secret
namespace: '{{ ansible_operator_meta.namespace }}'
stringData:
operator: awx
when:
- (_rh_ops_secret is not defined) or not (_rh_ops_secret['resources'] | length)
roles:
- installer

View File

@@ -1,6 +1,6 @@
---
collections:
- name: kubernetes.core
version: '==1.2.1'
version: '>=2.3.2'
- name: operator_sdk.util
version: "0.2.0"
version: "0.4.0"

View File

@@ -45,7 +45,7 @@ The resulting pvc will contain a backup tar that can be used to restore to a new
Role Variables
--------------
A custom, pre-created pvc can be used by setting the following variables.
A custom, pre-created pvc can be used by setting the following variables.
```
backup_pvc: 'awx-backup-volume-claim'
@@ -62,14 +62,15 @@ backup_storage_requirements: '20Gi'
By default, the backup pvc will be created in the same namespace the awxbackup object is created in. If you want your backup to be stored
in a specific namespace, you can do so by specifying `backup_pvc_namespace`. Keep in mind that you will
need to provide the same namespace when restoring.
need to provide the same namespace when restoring.
```
backup_pvc_namespace: 'custom-namespace'
```
The backup pvc will be created in the same namespace the awxbackup object is created in.
If a custom postgres configuration secret was used when deploying AWX, it will automatically be used by the backup role.
To check the name of this secret, look at the postgresConfigurationSecret status on your AWX object.
If a custom postgres configuration secret was used when deploying AWX, it will automatically be used by the backup role.
To check the name of this secret, look at the postgresConfigurationSecret status on your AWX object.
The postgresql pod for the old deployment is used when backing up data to the new postgresql pod. If your postgresql pod has a custom label,
you can pass that via the `postgres_label_selector` variable to make sure the postgresql pod can be found.
@@ -80,6 +81,24 @@ It is also possible to tie the lifetime of the backup files to that of the AWXBa
```
clean_backup_on_delete: true
```
Variable to define resources limits and request for backup CR.
```
backup_resource_requirements:
limits:
cpu: "1000m"
memory: "4096Mi"
requests:
cpu: "25m"
memory: "32Mi"
```
To customize the pg_dump command that will be executed on a backup use the `pg_dump_suffix` variable. This variable will append your provided pg_dump parameters to the end of the 'standard' command. For example to exclude the data from 'main_jobevent' and 'main_job' to decrease the size of the backup use:
```
pg_dump_suffix: "--exclude-table-data 'main_jobevent*' --exclude-table-data 'main_job'"
```
Testing
----------------

View File

@@ -12,7 +12,7 @@ backup_pvc_namespace: "{{ ansible_operator_meta.namespace }}"
backup_storage_requirements: ''
# Set no_log settings on certain tasks
no_log: 'true'
no_log: true
# Variable to set when you want backups to be cleaned up when the CRD object is deleted
clean_backup_on_delete: false
@@ -20,5 +20,20 @@ clean_backup_on_delete: false
# Variable to signal that this role is being run as a finalizer
finalizer_run: false
# Default resource requirements
backup_resource_requirements:
limits:
cpu: "1000m"
memory: "4096Mi"
requests:
cpu: "25m"
memory: "32Mi"
# Allow additional parameters to be added to the pg_dump backup command
pg_dump_suffix: ''
# Labels defined on the resource, which should be propagated to child resources
additional_labels: []
# Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
set_self_labels: true
...

View File

@@ -24,7 +24,8 @@ galaxy_info:
- backup
- automation
dependencies: []
dependencies:
- role: common
collections:
- kubernetes.core

View File

@@ -25,10 +25,11 @@
set_fact:
awx_spec:
spec: "{{ _awx }}"
previous_deployment_name: "{{ this_awx['resources'][0]['metadata']['name'] }}"
- name: Write awx object to pvc
k8s_exec:
k8s_cp:
namespace: "{{ backup_pvc_namespace }}"
pod: "{{ ansible_operator_meta.name }}-db-management"
command: >-
bash -c 'echo "$0" > {{ backup_dir }}/awx_object' {{ awx_spec | to_yaml | quote }}
remote_path: "{{ backup_dir }}/awx_object"
content: "{{ awx_spec | to_yaml }}"

View File

@@ -10,12 +10,8 @@
metadata:
name: "{{ ansible_operator_meta.name }}"
namespace: "{{ ansible_operator_meta.namespace }}"
labels:
app.kubernetes.io/name: "{{ ansible_operator_meta.name }}"
app.kubernetes.io/part-of: "{{ ansible_operator_meta.name }}"
app.kubernetes.io/managed-by: "{{ deployment_type }}-operator"
app.kubernetes.io/component: "{{ deployment_type }}"
app.kubernetes.io/operator-version: '{{ lookup("env", "OPERATOR_VERSION") }}'
labels: '{{ lookup("template", "../common/templates/labels/common.yaml.j2") | from_yaml }}'
when: set_self_labels | bool
- name: Look up details for this backup object
k8s_info:
@@ -25,23 +21,33 @@
namespace: "{{ ansible_operator_meta.namespace }}"
register: this_backup
- name: Build `additional_labels_items` labels from `additional_labels`
set_fact:
additional_labels_items: >-
{{ this_backup['resources'][0]['metadata']['labels']
| dict2items | selectattr('key', 'in', additional_labels)
}}
when:
- additional_labels | length
- this_backup['resources'][0]['metadata']['labels']
- block:
- include_tasks: init.yml
- include_tasks: init.yml
- include_tasks: postgres.yml
- include_tasks: postgres.yml
- include_tasks: awx-cro.yml
- include_tasks: awx-cro.yml
- include_tasks: secrets.yml
- include_tasks: secrets.yml
- name: Set flag signifying this backup was successful
set_fact:
backup_complete: true
- name: Set flag signifying this backup was successful
set_fact:
backup_complete: true
- include_tasks: cleanup.yml
- include_tasks: cleanup.yml
when:
- this_backup['resources'][0]['status']['backupDirectory'] is not defined
- this_backup['resources'][0]['status']['backupDirectory'] is not defined
- name: Update status variables
include_tasks: update_status.yml

View File

@@ -0,0 +1,24 @@
---
- name: Get secret
k8s_info:
version: v1
kind: Secret
namespace: '{{ ansible_operator_meta.namespace }}'
name: "{{ item }}"
register: _secret
no_log: "{{ no_log }}"
- name: Backup secret if exists
block:
- name: Set secret key
set_fact:
_data: "{{ _secret['resources'][0]['data'] }}"
_type: "{{ _secret['resources'][0]['type'] }}"
no_log: "{{ no_log }}"
- name: Create and Add secret names and data to dictionary
set_fact:
secret_dict: "{{ secret_dict | default({}) | combine({item: { 'name': item, 'data': _data, 'type': _type }}) }}"
no_log: "{{ no_log }}"
when: _secret | length

View File

@@ -14,6 +14,7 @@
- include_tasks: cleanup.yml
vars:
backup_dir: "{{ this_backup['resources'][0]['status']['backupDirectory'] }}"
backup_dir: "{{ this_backup['resources'][0]['status']['backupDirectory'] | default() }}"
when:
- clean_backup_on_delete and backup_dir is defined
- clean_backup_on_delete
- backup_dir | length > 0

View File

@@ -26,7 +26,7 @@
- block:
- name: Delete pod to reload a resource configuration
set_fact:
postgres_label_selector: "app.kubernetes.io/instance=postgres-{{ deployment_name }}"
postgres_label_selector: "app.kubernetes.io/instance=postgres-{{ supported_pg_version }}-{{ deployment_name }}"
when: postgres_label_selector is not defined
- name: Get the postgres pod information
@@ -50,7 +50,7 @@
- name: Determine the timestamp for the backup once for all nodes
set_fact:
now: '{{ lookup("pipe", "date +%F-%T") }}'
now: '{{ lookup("pipe", "date +%F-%H%M%S") }}'
- name: Set backup directory name
set_fact:
@@ -75,7 +75,7 @@
namespace: "{{ backup_pvc_namespace }}"
pod: "{{ ansible_operator_meta.name }}-db-management"
command: >-
bash -c "chmod 0600 {{ backup_dir }}/tower.db && chown postgres:root {{ backup_dir }}/tower.db"
bash -c "chmod 660 {{ backup_dir }}/tower.db && chown :root {{ backup_dir }}/tower.db"
- name: Set full resolvable host name for postgres pod
set_fact:

View File

@@ -1,11 +1,5 @@
---
- name: Create Temporary secrets file
tempfile:
state: file
suffix: .json
register: tmp_secrets
- name: Dump (generated) secret names from statuses and data into file
include_tasks: dump_generated_secret.yml
with_items:
@@ -23,6 +17,12 @@
- bundle_cacert_secret
- ee_pull_credentials_secret
- name: Dump receptor secret names and data into file
include_tasks: dump_receptor_secrets.yml
loop:
- '{{ deployment_name }}-receptor-ca'
- '{{ deployment_name }}-receptor-work-signing'
# image_pull_secret is deprecated in favor of image_pull_secrets
- name: Dump image_pull_secret into file
include_tasks: dump_secret.yml
@@ -42,9 +42,9 @@
no_log: "{{ no_log }}"
- name: Write postgres configuration to pvc
k8s_exec:
k8s_cp:
namespace: "{{ backup_pvc_namespace }}"
pod: "{{ ansible_operator_meta.name }}-db-management"
command: >-
bash -c "echo '{{ secrets | to_yaml }}' > {{ backup_dir }}/secrets.yml"
remote_path: "{{ backup_dir }}/secrets.yml"
content: "{{ secrets | to_yaml }}"
no_log: "{{ no_log }}"

View File

@@ -6,11 +6,7 @@ metadata:
namespace: {{ backup_pvc_namespace }}
ownerReferences: null
labels:
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
app.kubernetes.io/component: '{{ deployment_type }}'
app.kubernetes.io/operator-version: '{{ lookup("env", "OPERATOR_VERSION") }}'
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
spec:
accessModes:
- ReadWriteOnce

View File

@@ -5,11 +5,7 @@ metadata:
name: {{ ansible_operator_meta.name }}-db-management
namespace: {{ backup_pvc_namespace }}
labels:
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
app.kubernetes.io/component: '{{ deployment_type }}'
app.kubernetes.io/operator-version: '{{ lookup("env", "OPERATOR_VERSION") }}'
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
spec:
containers:
- name: {{ ansible_operator_meta.name }}-db-management
@@ -20,6 +16,10 @@ spec:
- name: {{ ansible_operator_meta.name }}-backup
mountPath: /backups
readOnly: false
{% if backup_resource_requirements is defined %}
resources:
{{ backup_resource_requirements | to_nice_yaml(indent=2) | indent(width=6, first=False) }}
{%- endif %}
volumes:
- name: {{ ansible_operator_meta.name }}-backup
persistentVolumeClaim:

View File

@@ -1,6 +1,7 @@
---
deployment_type: "awx"
_postgres_image: postgres
_postgres_image_version: 12
_postgres_image_version: 13
backup_complete: false
database_type: "unmanaged"
supported_pg_version: 13

View File

@@ -0,0 +1,8 @@
---
deployment_type: awx
kind: 'AWX'
api_version: '{{ deployment_type }}.ansible.com/v1beta1'
# Used to determine some cluster specific logic regarding projects_persistence pvc permissions
is_k8s: false
is_openshift: false

View File

@@ -0,0 +1,32 @@
---
galaxy_info:
author: Ansible
description: AWX role for AWX Operator for Kubernetes.
company: Red Hat, Inc.
license: MIT
min_ansible_version: 2.8
platforms:
- name: EL
versions:
- all
- name: Debian
versions:
- all
galaxy_tags:
- tower
- awx
- ansible
- automation
- ci
- cd
- deployment
dependencies: []
collections:
- kubernetes.core
- operator_sdk.util

View File

@@ -0,0 +1,20 @@
---
- name: Get information about the cluster
set_fact:
api_groups: "{{ lookup('k8s', cluster_info='api_groups') }}"
when:
- not is_openshift | bool
- not is_k8s | bool
- name: Determine the cluster type
set_fact:
is_openshift: "{{ True if 'route.openshift.io' in api_groups else False }}"
is_k8s: "{{ False if 'route.openshift.io' in api_groups else True }}"
when:
- not is_openshift | bool
- not is_k8s | bool
# Indicate what kind of cluster we are in (OpenShift or Kubernetes).
- debug:
msg: "CLUSTER TYPE: is_openshift={{ is_openshift }}; is_k8s={{ is_k8s }}"

View File

@@ -0,0 +1,3 @@
{% for item in additional_labels_items | default([]) %}
{{ item.key }}: '{{ item.value }}'
{% endfor %}

View File

@@ -0,0 +1,6 @@
# https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
app.kubernetes.io/component: '{{ deployment_type }}'
app.kubernetes.io/operator-version: '{{ lookup("env", "OPERATOR_VERSION") }}'
{{ lookup("template", "../common/templates/labels/additional_labels.yaml.j2") }}

View File

@@ -0,0 +1 @@
app.kubernetes.io/version: '{{ _image.split(':')[-1] | truncate(63, True, '', 0) }}'

View File

@@ -1,6 +1,6 @@
---
deployment_type: awx
kind: '{{ deployment_type | upper }}'
kind: 'AWX'
api_version: '{{ deployment_type }}.ansible.com/v1beta1'
database_name: "{{ deployment_type }}"
@@ -9,8 +9,10 @@ database_username: "{{ deployment_type }}"
task_privileged: false
service_type: ClusterIP
ingress_type: none
ingress_class_name: ''
ingress_path: '/'
ingress_path_type: 'Prefix'
ingress_api_version: 'networking.k8s.io/v1'
# Add annotations to the service account. Specify as literal block. E.g.:
# service_account_annotations: |
# eks.amazonaws.com/role-arn: arn:aws:iam::<ACCOUNT_ID>:role/<IAM_ROLE_NAME>
@@ -38,7 +40,9 @@ loadbalancer_protocol: 'http'
loadbalancer_port: '80'
service_annotations: ''
nodeport_port: '30080'
# Port to be used for NodePort configuration, default is to auto-assign a port between 30000-32768
#nodeport_port: '30080'
# The TLS termination mechanism to use to access
# the services. Supported mechanism are: edge, passthrough
#
@@ -49,6 +53,10 @@ route_tls_termination_mechanism: edge
#
route_tls_secret: ''
# Route API Version to support older version
# of the kubernetes services
route_api_version: 'route.openshift.io/v1'
# Host to create the root with.
# If not specific will default to <instance-name>-<namespace>-<routerCanonicalHostname>
#
@@ -59,11 +67,24 @@ hostname: ''
# Add a nodeSelector for the AWX pods. It must match a node's labels for the pod
# to be scheduled on that node. Specify as literal block. E.g.:
# node_selector: |
# disktype: ssd
# kubernetes.io/arch: amd64
# kubernetes.io/os: linux
node_selector: ''
# Add a nodeSelector for the AWX pods. It must match a node's labels for the pod
# to be scheduled on that node. Specify as literal block. E.g.:
# node_selector: |
# kubernetes.io/arch: amd64
# kubernetes.io/os: linux
web_node_selector: ''
# Add a nodeSelector for the AWX pods. It must match a node's labels for the pod
# to be scheduled on that node. Specify as literal block. E.g.:
# node_selector: |
# kubernetes.io/arch: amd64
# kubernetes.io/os: linux
task_node_selector: ''
# Add a topologySpreadConstraints for the AWX pods.
# Specify as literal block. E.g.:
# topology_spread_constraints: |
@@ -75,6 +96,28 @@ node_selector: ''
# app.kubernetes.io/name: "<resourcename>"
topology_spread_constraints: ''
# Add a topologySpreadConstraints for the task pods.
# Specify as literal block. E.g.:
# task_topology_spread_constraints: |
# - maxSkew: 100
# topologyKey: "topology.kubernetes.io/zone"
# whenUnsatisfiable: "ScheduleAnyway"
# labelSelector:
# matchLabels:
# app.kubernetes.io/name: "<resourcename>"
task_topology_spread_constraints: ''
# Add a topologySpreadConstraints for the web pods.
# Specify as literal block. E.g.:
# web_topology_spread_constraints: |
# - maxSkew: 100
# topologyKey: "topology.kubernetes.io/zone"
# whenUnsatisfiable: "ScheduleAnyway"
# labelSelector:
# matchLabels:
# app.kubernetes.io/name: "<resourcename>"
web_topology_spread_constraints: ''
# Add node tolerations for the AWX pods. Specify as literal block. E.g.:
# tolerations: |
# - key: "dedicated"
@@ -83,6 +126,58 @@ topology_spread_constraints: ''
# effect: "NoSchedule"
tolerations: ''
# Add node tolerations for the task pods. Specify as literal block. E.g.:
# task_tolerations: |
# - key: "dedicated"
# operator: "Equal"
# value: "AWXtask"
# effect: "NoSchedule"
task_tolerations: ''
# Add node tolerations for the web pods. Specify as literal block. E.g.:
# web_tolerations: |
# - key: "dedicated"
# operator: "Equal"
# value: "AWXweb"
# effect: "NoSchedule"
web_tolerations: ''
# Add affinities for all pods
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: app.kubernetes.io/component
# operator: In
# values:
# - awx
affinity: {}
# Add affinities for all task pods
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: app.kubernetes.io/name
# operator: In
# values:
# - awx-task
task_affinity: {}
# Add affinities for all web pods
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: app.kubernetes.io/name
# operator: In
# values:
# - awx-web
web_affinity: {}
# Add annotations to awx pods. Specify as literal block. E.g.:
# annotations: |
# my.annotation/1: value
@@ -129,9 +224,7 @@ _image_version: "{{ lookup('env', 'DEFAULT_AWX_VERSION') or 'latest' }}"
_redis_image: docker.io/redis
_redis_image_version: 7
_postgres_image: postgres
_postgres_image_version: 12
_init_container_image: quay.io/centos/centos
_init_container_image_version: stream8
_postgres_image_version: 13
image_pull_policy: IfNotPresent
image_pull_secrets: []
@@ -157,16 +250,26 @@ ee_images:
_control_plane_ee_image: quay.io/ansible/awx-ee:latest
_init_container_image: "{{ _control_plane_ee_image.split(':')[0] }}"
_init_container_image_version: "{{ _control_plane_ee_image.split(':')[1] }}"
_init_projects_container_image: quay.io/centos/centos:stream9
create_preload_data: true
replicas: "1"
web_replicas: ''
task_replicas: ''
task_args:
- /usr/bin/launch_awx_task.sh
task_command: []
web_args:
- /usr/bin/launch_awx.sh
- /usr/bin/launch_awx_web.sh
web_command: []
ryslog_args:
- /usr/bin/launch_awx_rsyslog.sh
rsyslog_command: []
task_resource_requirements:
requests:
@@ -183,6 +286,12 @@ ee_resource_requirements:
cpu: 100m
memory: 64Mi
# TODO: validate default resource requirements
rsyslog_resource_requirements:
requests:
cpu: 100m
memory: 128Mi
# Customize CSRF options
csrf_cookie_secure: False
session_cookie_secure: False
@@ -223,6 +332,9 @@ ee_extra_volume_mounts: ''
# kubernetes.io/os: linux
postgres_selector: ''
# Specify whether or not to keep the old PVC after PostgreSQL upgrades
postgres_keep_pvc_after_upgrade: True
# Add node tolerations for the Postgres pods.
# Specify as literal block. E.g.:
# postgres_tolerations: |
@@ -283,8 +395,17 @@ development_mode: false
security_context_settings: {}
# Set no_log settings on certain tasks
no_log: 'true'
no_log: true
# Should AWX instances be automatically upgraded when operator gets upgraded
#
auto_upgrade: true
# Labels defined on the resource, which should be propagated to child resources
additional_labels: []
# Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
set_self_labels: true
# Disable web container's nginx ipv6 listener
ipv6_disabled: false

View File

@@ -0,0 +1,66 @@
# file, which when exists, indicates that `master` script has successfully
# completed pre-stop script execution
marker_file="${PRE_STOP_MARKER_FILE:-/var/lib/pre-stop/.termination_marker}"
# file which the running `master` script continuously updates (mtime) to
# indicate it's still running. this file is then read by `watcher`s to
# understand if they still have to wait for `termination_marker`
heartbeat_file="${PRE_STOP_HEARTBEAT_FILE:-/var/lib/pre-stop/.heartbeat}"
# file which:
# * `watcher`s create when they bail out because they didn't see the
# `heartbeat_file` to be updated within `$heartbeat_failed_threshold`;
# * `master` creates when its handler command fails;
# when scripts see such file, they also give up
bailout_file="${PRE_STOP_BAILOUT_FILE:-/var/lib/pre-stop/.bailout}"
heartbeat_threshold="${PRE_STOP_HEARTBEAT_THRESHOLD:-60}"
# where the scripts' stdout/stderr are streamed
stdout="${PRE_STOP_STDOUT:-/proc/1/fd/1}"
stderr="${PRE_STOP_STDERR:-/proc/1/fd/2}"
# command the `master` script executes, which when successfully finishes,
# causes the script to create the `marker_file`
handler="${PRE_STOP_HANDLER:-bash -c \"PYTHONUNBUFFERED=x awx-manage disable_instance --wait --retry=inf\"}"
log_prefix="${PRE_STOP_LOG_PREFIX:-preStop.exec}"
[[ -n ${PRE_STOP_LOG_ROLE} ]] && log_prefix="${log_prefix}] [$PRE_STOP_LOG_ROLE"
# interval at which `watcher`s check for `marker_file` presence
recheck_sleep="${PRE_STOP_RECHECK_SLEEP:-1}"
# interval at which `watcher`s report into $stdout that they are still watching
report_every="${PRE_STOP_REPORT_EVERY:-30}"
function log {
printf "[%s] $1\n" "$log_prefix" "${@:2}"
}
function parameters_string {
for param in "$@"; do
printf "%s=\"%s\"\n" "$param" "${!param}"
done | paste -s -d ' '
}
function check_bailout {
if [[ -f $bailout_file ]]; then
log "\"%s\" file has been detected, accepting bail out signal and failing the hook script" \
"$bailout_file"
exit 1
fi
}
function check_heartbeat {
if [[ -f $heartbeat_file ]]; then
delta=$(( $(date +%s) - $(stat -c %Y "$heartbeat_file") ))
else
delta=$(( $(date +%s) - $1 ))
fi
if [[ $delta -gt $heartbeat_threshold ]]; then
log "The heartbeat file hasn't been updated since %ss, which is above the threshold of %ds, assuming the master is not operating and failing the hook script" \
$delta
$heartbeat_threshold
touch "$bailout_file"
exit 1
fi
}

View File

@@ -0,0 +1,50 @@
#/usr/bin/env bash
PRE_STOP_LOG_ROLE="${PRE_STOP_LOG_ROLE:-master}"
source $(dirname "$0")/termination-env
{
log "The hook has started: %s" \
"$(parameters_string \
"marker_file" \
"heartbeat_file" \
"bailout_file" \
"handler" \
)"
touch "$heartbeat_file"
set -o pipefail
eval "$handler" 2>&1 | while IFS= read -r line; do
# we check the files here and break early, but overall script termination
# happens later - as we need to distinguish between files detection and
# command failure, while bash doesn't offer a simple way to do this here
# inside the loop (`exit` does not terminate the script)
[[ -f $bailout_file ]] && break
[[ -f $marker_file ]] && break
log "[handler] %s" "$line"
touch "$heartbeat_file"
done
ec=$?
set +o pipefail
# process various cases in specific order
check_bailout
if [[ -f $marker_file ]]; then
log "Done! The marker file has been detected, assuming some other instance of the script has run to completion"
exit 0
elif [[ $ec -ne 0 ]]; then
log "The handler has failed with \"%d\" exit code, failing the hook script too" \
$ec
# signal others to bail out
touch "$bailout_file"
exit $ec
else
log "Done! Generating the marker file allowing to proceed to termination"
touch "$marker_file"
fi
} > "$stdout" 2> "$stderr"

View File

@@ -0,0 +1,33 @@
#/usr/bin/env bash
PRE_STOP_LOG_ROLE="${PRE_STOP_LOG_ROLE:-waiter}"
source $(dirname "$0")/termination-env
{
log "The hook has started: %s" \
"$(parameters_string \
"marker_file" \
"heartbeat_file" \
"bailout_file" \
"recheck_sleep" \
"report_every" \
)"
n=0
checks_started=$(date +%s)
while ! [[ -f $marker_file ]]; do
check_bailout
check_heartbeat $checks_started
if [[ $(($n % $report_every)) -eq 0 ]]; then
log "Waiting for the marker file to be accessible..."
fi
n=$(($n + 1))
sleep $recheck_sleep
done
log "The marker file found, exiting to proceed to termination"
} > "$stdout" 2> "$stderr"

View File

@@ -0,0 +1,27 @@
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleFilterError
__ERROR_MSG = "Not a valid cpu value. Cannot process value"
class FilterModule(object):
def filters(self):
return {
'cpu_string_to_decimal': self.cpu_string_to_decimal
}
def cpu_string_to_decimal(self, cpu_string):
# verify if task_output is a dict
if not isinstance(cpu_string, str):
raise AnsibleFilterError(__ERROR_MSG)
if cpu_string[-1] == 'm':
cpu = int(cpu_string[:-1])//1000
else:
cpu = int(cpu_string)
return cpu

View File

@@ -25,7 +25,8 @@ galaxy_info:
- cd
- deployment
dependencies: []
dependencies:
- role: common
collections:
- kubernetes.core

View File

@@ -25,7 +25,7 @@
- name: Create admin password secret
k8s:
apply: true
definition: "{{ lookup('template', 'admin_password_secret.yaml.j2') }}"
definition: "{{ lookup('template', 'secrets/admin_password_secret.yaml.j2') }}"
no_log: "{{ no_log }}"
- name: Read admin password secret

View File

@@ -26,7 +26,7 @@
- name: Create broadcast websocket secret
k8s:
apply: true
definition: "{{ lookup('template', 'broadcast_websocket_secret.yaml.j2') }}"
definition: "{{ lookup('template', 'secrets/broadcast_websocket_secret.yaml.j2') }}"
no_log: "{{ no_log }}"
- name: Read broadcast websocket secret

View File

@@ -23,6 +23,8 @@
- '{{ _secret_key }}'
- '{{ _postgres_configuration }}'
- '{{ _broadcast_websocket_secret }}'
- '{{ ansible_operator_meta.name }}-receptor-ca'
- '{{ ansible_operator_meta.name }}-receptor-work-signing'
no_log: "{{ no_log }}"
when: not garbage_collect_secrets | bool

View File

@@ -71,7 +71,7 @@
- name: Create Database configuration
k8s:
apply: true
definition: "{{ lookup('template', 'postgres_secret.yaml.j2') }}"
definition: "{{ lookup('template', 'secrets/postgres_secret.yaml.j2') }}"
no_log: "{{ no_log }}"
- name: Read Database Configuration
@@ -92,11 +92,67 @@
set_fact:
__postgres_configuration_secret: "{{ pg_config['resources'][0]['metadata']['name'] }}"
- name: Store Database Configuration
set_fact:
awx_postgres_user: "{{ pg_config['resources'][0]['data']['username'] | b64decode }}"
awx_postgres_pass: "{{ pg_config['resources'][0]['data']['password'] | b64decode }}"
awx_postgres_database: "{{ pg_config['resources'][0]['data']['database'] | b64decode }}"
awx_postgres_port: "{{ pg_config['resources'][0]['data']['port'] | b64decode }}"
awx_postgres_host: "{{ pg_config['resources'][0]['data']['host'] | b64decode }}"
awx_postgres_sslmode: "{{ pg_config['resources'][0]['data']['sslmode'] | default('prefer'|b64encode) | b64decode }}"
no_log: "{{ no_log }}"
- name: Set database as managed
set_fact:
managed_database: "{{ pg_config['resources'][0]['data']['type'] | default('') | b64decode == 'managed' }}"
- name: Get the old postgres pod information
k8s_info:
kind: Pod
namespace: "{{ ansible_operator_meta.namespace }}"
name: "{{ ansible_operator_meta.name }}-postgres-0"
field_selectors:
- status.phase=Running
register: old_postgres_pod
- name: Look up details for this deployment
k8s_info:
api_version: "{{ api_version }}"
kind: "{{ kind }}"
name: "{{ ansible_operator_meta.name }}"
namespace: "{{ ansible_operator_meta.namespace }}"
register: this_awx
- name: Check if postgres pod is running and version 12
block:
- name: Set path to PG_VERSION file for given container image
set_fact:
path_to_pg_version: '{{ postgres_data_path }}/PG_VERSION'
- name: Get old PostgreSQL version
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ ansible_operator_meta.name }}-postgres-0"
command: |
bash -c """
cat {{ path_to_pg_version }}
"""
register: _old_pg_version
- name: Upgrade data dir from Postgres 12 to 13 if applicable
include_tasks: upgrade_postgres.yml
when:
- _old_pg_version.stdout | default('0') | trim == '12'
when:
- managed_database
- this_awx['resources'][0]['status']['upgradedPostgresVersion'] | default('none') != '12'
- old_postgres_pod['resources'] | length # upgrade is complete and old pg pod has been removed
- block:
- name: Create Database if no database is specified
k8s:
apply: true
definition: "{{ lookup('template', 'postgres.yaml.j2') }}"
definition: "{{ lookup('template', 'statefulsets/postgres.yaml.j2') }}"
register: create_statefulset_result
- name: Scale down Deployment for migration
@@ -111,7 +167,7 @@
kubernetes.core.k8s_scale:
api_version: apps/v1
kind: StatefulSet
name: "{{ ansible_operator_meta.name }}-postgres"
name: "{{ ansible_operator_meta.name }}-postgres-13"
namespace: "{{ ansible_operator_meta.namespace }}"
replicas: 0
wait: yes
@@ -121,7 +177,7 @@
state: absent
api_version: apps/v1
kind: StatefulSet
name: "{{ ansible_operator_meta.name }}-postgres"
name: "{{ ansible_operator_meta.name }}-postgres-13"
namespace: "{{ ansible_operator_meta.namespace }}"
wait: yes
when: create_statefulset_result.error == 422
@@ -129,24 +185,30 @@
- name: Recreate PostgreSQL statefulset with updated values
k8s:
apply: true
definition: "{{ lookup('template', 'postgres.yaml.j2') }}"
when: pg_config['resources'][0]['data']['type'] | default('') | b64decode == 'managed'
definition: "{{ lookup('template', 'statefulsets/postgres.yaml.j2') }}"
when: managed_database
- name: Store Database Configuration
- name: Set Default label selector for custom resource generated postgres
set_fact:
awx_postgres_user: "{{ pg_config['resources'][0]['data']['username'] | b64decode }}"
awx_postgres_pass: "{{ pg_config['resources'][0]['data']['password'] | b64decode }}"
awx_postgres_database: "{{ pg_config['resources'][0]['data']['database'] | b64decode }}"
awx_postgres_port: "{{ pg_config['resources'][0]['data']['port'] | b64decode }}"
awx_postgres_host: "{{ pg_config['resources'][0]['data']['host'] | b64decode }}"
awx_postgres_sslmode: "{{ pg_config['resources'][0]['data']['sslmode'] | default('prefer'|b64encode) | b64decode }}"
no_log: "{{ no_log }}"
postgres_label_selector: "app.kubernetes.io/instance=postgres-{{ supported_pg_version }}-{{ ansible_operator_meta.name }}"
when: postgres_label_selector is not defined
- name: Get the postgres pod information
k8s_info:
kind: Pod
namespace: "{{ ansible_operator_meta.namespace }}"
label_selectors:
- "{{ postgres_label_selector }}"
field_selectors:
- status.phase=Running
register: postgres_pod
- name: Wait for Database to initialize if managed DB
k8s_info:
kind: Pod
namespace: '{{ ansible_operator_meta.namespace }}'
name: '{{ ansible_operator_meta.name }}-postgres-0' # using name to keep compatibility
label_selectors:
- "{{ postgres_label_selector }}"
field_selectors:
- status.phase=Running
register: postgres_pod
@@ -156,11 +218,7 @@
- "postgres_pod['resources'][0]['status']['containerStatuses'][0]['ready'] == true"
delay: 5
retries: 60
when: pg_config['resources'][0]['data']['type'] | default('') | b64decode == 'managed'
- name: Set database as managed
set_fact:
managed_database: "{{ pg_config['resources'][0]['data']['type'] | default('') | b64decode == 'managed' }}"
when: managed_database
- name: Look up details for this deployment
k8s_info:

View File

@@ -2,7 +2,7 @@
- name: Check if there are any super users defined.
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
pod: "{{ awx_task_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: >-
bash -c "echo 'from django.contrib.auth.models import User;
@@ -16,29 +16,41 @@
- name: Create super user via Django if it doesn't exist.
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
pod: "{{ awx_task_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: >-
bash -c "echo \"from django.contrib.auth.models import User;
User.objects.create_superuser('{{ admin_user }}', '{{ admin_email }}', '{{ admin_password }}')\"
| awx-manage shell"
command: awx-manage createsuperuser --username={{ admin_user | quote }} --email={{ admin_email | quote }} --noinput
register: result
changed_when: "'That username is already taken' not in result.stderr"
failed_when: "'That username is already taken' not in result.stderr and 'Superuser created successfully' not in result.stdout"
no_log: "{{ no_log }}"
when: users_result.return_code > 0
- name: Update Django super user password
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ awx_task_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: awx-manage update_password --username='{{ admin_user }}' --password='{{ admin_password }}'
register: result
changed_when: "'Password updated' in result.stdout"
no_log: "{{ no_log }}"
when: users_result.return_code > 0
- name: Check if legacy queue is present
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
pod: "{{ awx_task_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: >-
bash -c "awx-manage list_instances | grep '^\[tower capacity=[0-9]*\]'"
register: legacy_queue
changed_when: false
ignore_errors: true
- name: Unregister legacy queue
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
pod: "{{ awx_task_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: >-
bash -c "awx-manage unregister_queue --queuename=tower"
@@ -62,7 +74,7 @@
- name: Register default execution environments (without authentication)
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
pod: "{{ awx_task_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: >-
bash -c "awx-manage register_default_execution_environments"
@@ -83,7 +95,7 @@
- name: Register default execution environments (with authentication)
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
pod: "{{ awx_task_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: >-
bash -c "awx-manage register_default_execution_environments
@@ -99,7 +111,7 @@
- name: Create preload data if necessary. # noqa 305
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
pod: "{{ awx_task_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: >-
bash -c "awx-manage create_preload_data"

Some files were not shown because too many files have changed in this diff Show More