Compare commits

..

163 Commits

Author SHA1 Message Date
Christian Adams
3da427f31d Look for a specific pull secret when deployed in certain cloud environments (#894) 2022-04-27 15:44:10 -04:00
Shane McDonald
9f2b51a6a9 Fix mistake in debugging docs 2022-04-25 16:32:50 -04:00
Hung Tran
5b73ad172e Load LDAP password from secret and update guideline (#659)
* Load LDAP password from secret and update guideline

* Add pod_labels for custom pod labels

Signed-off-by: Loc Mai <lmai@axon.com>

* Omit tls secret if using wildcard cert

* Resolve conflicts

* Remove the ingress changes

* Remove the config changes

* Load LDAP password from secret and update guideline

* Omit tls secret if using wildcard cert

* Resolve conflicts

* Remove the ingress changes

* Remove the config changes

Co-authored-by: hungts <hungts@axon.com>
Co-authored-by: Loc Mai <lmai@axon.com>
Co-authored-by: Max Bidlingmaier <Max-Florian.Bidlingmaier@sap.com>
Co-authored-by: Max Bidlingmaier <maks@konsolan.de>
2022-04-25 16:16:10 -04:00
Shane McDonald
2227301707 Merge pull request #888 from shanemcd/debugging-docs
Add docs/debugging.md
2022-04-25 16:11:21 -04:00
Shane McDonald
9f63fc0da5 Add docs/debugging.md 2022-04-25 16:02:30 -04:00
Seth Foster
322aea970d Merge pull request #886 from fosterseth/make_csrf_settings_boolean
Render cookie settings as a boolean
2022-04-25 15:45:42 -04:00
Seth Foster
c4bef95662 Render cookie settings as a boolean 2022-04-25 15:31:09 -04:00
Seth Foster
7fd5083c16 Merge pull request #862 from fosterseth/add_priorityclass_option
Add priority class options to high priority pods
2022-04-21 15:40:55 -04:00
Christian M. Adams
daf15a93bf Reduce the resources requests for CI runs
* GitHub Workflows run in a resource constrained environment, we were
    asking too much of it, so pods never got scheduled.
2022-04-21 15:10:09 -04:00
Christian M. Adams
dfa0f6d45e Add docs for priority classes & fix typo 2022-04-21 11:59:15 -04:00
Christian M. Adams
21062f0708 Add default resource requests for postgres containers 2022-04-18 12:30:02 -04:00
Seth Foster
5372771bac Add priority class options to high priority pods
- Add postgres_priority_class
- Add control_plane_priority_class
- Add default requests for postgres pod to ensure at a "Burstable" QoS
2022-04-18 12:29:54 -04:00
Mac Chaffee
8df0969e6a Fix namespace name in readme (#868)
Signed-off-by: Mac Chaffee <machaffe@renci.org>
2022-04-15 16:08:43 -04:00
Jeremy Kimber
5af7e7f4b9 Ensure custom control plane EE is defined prior to creation of application credentials (#873)
Co-authored-by: Jeremy Kimber <jeremy.kimber@garmin.com>
2022-04-15 16:04:47 -04:00
Christian Adams
d8f91d112e Stop updating the admin user password (#874)
* This is overwriting changes the user makes to the admin password via
    the app itself
2022-04-14 16:35:37 -04:00
Christian Adams
379552218d Add back image_pull_secret field for backwards compatibility (#870) 2022-04-14 13:25:54 -04:00
David Luong
1686875321 Customize CSRF options (#825) 2022-04-13 19:42:07 -04:00
Christian Adams
1b41d945e6 Check if image_pull_secrets variable is defined (#865)
* Do not attempt to backup secret if none are defined
2022-04-11 11:10:09 -04:00
Dragutan Alexandr
5e81729bc9 Update README.md (#858)
cut off svg-content, link preserverd.
2022-04-06 21:39:49 -04:00
Christian Adams
575e594314 Wait for the postgres pod to enter the ready state before starting containers (#861) 2022-04-06 08:29:53 -04:00
Christian Adams
5f76d4917e Enable setting a list of image_pull_secrets (#860)
When there are e.g. multiple authenticated container registries used
we need to be able to add multiple imagePullSecrets to the k8s resource

Co-authored-by: Maximilian Meister <maximilian.meister@pm.me>
2022-04-05 11:51:21 -04:00
gamuniz
94c5c41a24 reording the django tasks to avoid race condition aap-2847 (#855)
* Reorder the django init tasks to avoid race condition - aap-2847
2022-04-01 14:55:57 -04:00
Shane McDonald
ee84625107 Merge pull request #843 from mac-chaffee/kustomize-umbrella
Add docs for proper kustomization installs
2022-03-28 16:56:01 -04:00
Mac Chaffee
add76c159b Mention how to install Kustomize.
It's recommended to install the standalone version of kustomize rather
than using the version that ships with kubectl because that version is
typically very old and doesn't match the docs.
2022-03-26 11:53:17 -04:00
Mac Chaffee
375031e1f8 Remove explicit tags to avoid need to bump versions
Signed-off-by: Mac Chaffee <machaffe@renci.org>
2022-03-24 19:18:46 -04:00
Christian Adams
ca6ab0a380 Merge pull request #844 from rooftopcellist/update-changelog
Add Changelog entries for 0.19.0 release
2022-03-23 18:20:00 -04:00
Christian M. Adams
236bce6970 Add Changelog entries for 0.19.0 release 2022-03-23 18:10:23 -04:00
Mac Chaffee
0a9e9722c5 Add docs for proper kustomization installs 2022-03-23 15:42:24 -04:00
Shane McDonald
58ac0cc369 Merge pull request #835 from shanemcd/stream8
Use stream8 for init container
2022-03-22 09:11:19 -04:00
Christian Adams
c3ac2e2cde Merge pull request #838 from kurokobo/quote
fix: add quotes for PGPASSWORD for the backup and restore roles
2022-03-21 10:50:51 -04:00
kurokobo
589a3751e1 fix: add quotes for PGPASSWORD for the backup and restore roles 2022-03-20 16:13:12 +09:00
Shane McDonald
12a58d71fb Use stream8 for init container 2022-03-18 13:56:15 -04:00
Shane McDonald
6b873b05ab Merge pull request #822 from kurokobo/operator_version
fix: add OPERATOR_VERSION as build-arg to pass the version to operator
2022-03-18 11:06:08 -04:00
Christian Adams
5e97ff7c08 Merge pull request #827 from rooftopcellist/rm-inject-params
Add AWX Logo to OLM deployments
2022-03-16 14:15:49 -04:00
Christian M. Adams
86c31a4317 Add AWX Logo to OLM deployments
* Remove unnecessary script for injecting olm params, use bases template instead

Signed-off-by: Christian M. Adams <chadams@redhat.com>
2022-03-16 12:01:28 -04:00
Seth Foster
487727b454 Merge pull request #815 from kurokobo/nodeport
fix: fix corrupted spec for the service with nodeport type (#814)
2022-03-15 14:39:13 -04:00
kurokobo
2f47b907fd fix: add OPERATOR_VERSION as build-arg to pass the version to operator 2022-03-09 22:32:39 +09:00
kurokobo
dbaf64efa0 fix: fix corrupted spec for the service with nodeport type (#814) 2022-03-09 21:00:24 +09:00
Shane McDonald
5375fec77d Merge pull request #811 from shanemcd/format-readme-tables
Reformat markdown tables in README.md
2022-03-05 12:12:25 -05:00
Shane McDonald
9980192d9e Reformat markdown tables in README.md 2022-03-05 12:02:18 -05:00
Shane McDonald
e2fc5f46c0 Merge pull request #803 from rooftopcellist/sts-db-check
Run database-check initContainer on postgres sts instead
2022-03-05 11:59:00 -05:00
Shane McDonald
5b3be06e8d Allow for customizing postgres init container resources 2022-03-05 11:48:13 -05:00
Shane McDonald
3c2405f304 Merge pull request #807 from MrBones757/devel
added support for pod annotations to awx deployment
2022-03-05 10:18:50 -05:00
Christian M. Adams
192611eea8 Run database-check initContainer on postgres sts instead
- This avoids issues with multple initContainers trying to mount the
    postgres pvc at once, as is the case when there are multiple
replicas.

Signed-off-by: Christian M. Adams <chadams@redhat.com>
2022-03-05 10:07:07 -05:00
MrBones757
9ca14cef93 added support for pod annotations to awx deployment 2022-02-25 09:54:55 +08:00
Shane McDonald
fbc2d3475c Merge pull request #800 from ggiinnoo/readme-dummy-proof
Added namespace warning | added apply command for missing namespace
2022-02-23 09:30:19 -05:00
Shane McDonald
58f30fb96c Merge pull request #789 from ubajze/fix-nodeport-port
Fix the custom port specification when service type is NodePort
2022-02-23 09:28:42 -05:00
Gino Jansen
c81b78aad6 Added namespace warning | added apply command for missing namespace 2022-02-18 14:31:29 +01:00
Shane McDonald
c02e05925e Merge pull request #797 from kdelee/sky-is-the-limit
only set mem/cpu setting if limit is set
2022-02-15 15:41:52 -05:00
Elijah DeLee
479c009716 only set mem/cpu setting if limit is set
Otherwise, we get the too-low setting of the request, which
will be a rough experience for folks who have been using the operator
and are used to the experience of having entire underlying node capacity

Users can still set the setting via extra_settings to get the experience
of having each pod with a individualized capacity, or set a limit.
2022-02-15 15:35:36 -05:00
Shane McDonald
7807bc516e Merge pull request #791 from kdelee/set_controlpod_mem_cpu
set memory setting based on resource settings
2022-02-15 14:12:41 -05:00
Elijah DeLee
3afcd7fd89 set memory and cpu setting based on resource settings
This way we can start using this setting in AWX again to help fix
https://github.com/ansible/awx/issues/11640
2022-02-15 14:09:21 -05:00
Shane McDonald
7002131dda Merge pull request #793 from kurokobo/readme
Update TOC in README.md
2022-02-12 13:04:17 -05:00
kurokobo
877943cc27 fix: update TOC in README.md 2022-02-12 16:49:17 +09:00
Shane McDonald
b59a0c5b80 Merge pull request #766 from nodje/Makefile-aarch64-patch
Take into account `aarch64` architecture return from uname
2022-02-11 17:36:10 -05:00
Shane McDonald
26b1eb6c87 Merge pull request #776 from arrase/feature/service_annotations
Allow service annotations not only for LoadBalancer type
2022-02-11 17:30:56 -05:00
Matthias R. Wiora
39437da72b feat(readme): add k8s cluster setup instructions (#592)
Add instructions for using with existing kubernetes cluster
2022-02-11 17:25:37 -05:00
Shane McDonald
e1645a2f8d Merge pull request #593 from kurokobo/upgrading
Add steps to upgrade to 0.14.0
2022-02-11 17:24:10 -05:00
Shane McDonald
224dde769a Merge pull request #536 from siju-vasudevan/patch-1
LDAPSearch Module is missing
2022-02-11 17:20:56 -05:00
Uros Bajzelj
536d7dc842 Fix the NodePort port specification 2022-02-11 10:57:43 +00:00
Shane McDonald
eac2328bd3 Merge pull request #721 from longns1/update-makefile-undeploy
update Makefile undeploy
2022-02-10 10:19:10 -05:00
Shane McDonald
3be986c96c Merge pull request #783 from AlanCoding/loop_control
Add some loop control for ansible warnings
2022-02-10 10:18:26 -05:00
Shane McDonald
768bc2f857 Merge pull request #652 from shanemcd/url-prefix-support
Support running AWX at non-root path
2022-02-09 10:37:07 -05:00
Alan Rominger
f05faaaaa0 Add some loop control for ansible warnings 2022-02-04 16:12:28 -05:00
Shane McDonald
957566993b Merge pull request #782 from AlanCoding/not_that_one
Avoid broken openshift package
2022-02-04 15:36:33 -05:00
Alan Rominger
c95f3299b0 Avoid broken openshift package 2022-02-04 15:24:49 -05:00
Christian Adams
1a0e3cf410 Merge pull request #772 from rooftopcellist/always-run-pg-initContainer
Always run database-check initContainer
2022-02-02 16:16:34 -05:00
Christian Adams
9368b43614 Merge pull request #775 from rooftopcellist/pg-args-advanced
Add OLM params for postgres_extra_vars
2022-02-01 17:02:42 -05:00
Juan Ezquerro LLanes
108addc06e Allow service annotations not only for LoadBalancer 2022-02-01 20:49:37 +01:00
Shane McDonald
3a3260ffb7 Merge pull request #770 from john-westcott-iv/github_meta_changes
Adding triage label to any new issue
2022-02-01 13:15:18 -05:00
Christian M. Adams
960d1f8a32 Fix volume mount syntax error
* conditionally run database-check init container only for managed db
    deployments
Signed-off-by: Christian M. Adams <chadams@redhat.com>
2022-02-01 10:50:48 -05:00
Christian M. Adams
4d8f84eb74 Add OLM params for postgres_extra_vars
* follow-up for https://github.com/ansible/awx-operator/pull/753
Signed-off-by: Christian M. Adams <chadams@redhat.com>
2022-02-01 08:17:11 -05:00
John Westcott IV
1320c9d175 Fixing linting issues 2022-01-31 12:19:31 -05:00
Christian M. Adams
fab71e054e Always run database-check initContainer 2022-01-31 09:40:19 -05:00
John Westcott IV
3eede3c922 Adding triage label to any new issue 2022-01-30 13:59:22 -05:00
Christian Adams
d27ce3c34d Merge pull request #755 from rooftopcellist/mv-data-subPath
Use an Init Container to move the pg data subPath in the pvc
2022-01-27 19:55:48 -05:00
Shane McDonald
18d17f2485 Merge pull request #763 from sooslaca/devel
Fix issue #762
2022-01-27 08:16:33 -05:00
nodje
47d3ef57f2 Take into account aarch64 architecture return from uname 2022-01-26 09:32:16 +01:00
sooslaca
8f8336b25a Fix issue #762
Fix https://github.com/ansible/awx-operator/issues/762
2022-01-23 16:17:24 +01:00
Shane McDonald
4aeeb8db82 Merge pull request #698 from mhrivnak/remove-warning
removes obsolete and confusing warning about project status
2022-01-19 18:21:30 -05:00
Christian M. Adams
5b636bb8ea Use an Init Container to move the pg data subPath in the pvc 2022-01-13 23:17:33 -05:00
Christian Adams
83939ec007 Merge pull request #726 from Skaopap/feature_topology_constraints
Add topology constraints to AWX CRD
2022-01-13 21:16:23 -05:00
bthominet
608478e249 add topolgy_spread_constraints 2022-01-13 09:50:12 +01:00
Christian Adams
cb9e44fd4f Merge pull request #753 from rooftopcellist/pg-extra-config
Add ability to configure extra args for postgres
2022-01-11 14:38:55 -05:00
Christian M. Adams
cbd7da9dcf Add default for postgres_extra_args variable 2022-01-11 14:18:34 -05:00
chris93111
0f07a475b5 Add ability to configure extra args for postgres
* add default extra args postgres

* add postgres_extra_args option to readme
2022-01-11 12:44:18 -05:00
Christian Adams
a2222a9176 Merge pull request #717 from rooftopcellist/scale-down-app
Scale down app pod when database is unavailable
2022-01-07 14:33:58 -05:00
longns1
79152d2417 update to make undeploy in Makefile works correctly when namespace is not awx 2022-01-07 15:57:27 +07:00
Christian M. Adams
fdbe607189 Scale down app pod when database is unavailable 2022-01-04 17:07:39 -05:00
Christian Adams
4a43de5101 Merge pull request #702 from rooftopcellist/truncate-version-label
Truncate image version label so that it avoids the 63 char k8s limit
2021-12-20 21:41:40 -05:00
Christian M. Adams
345738cba3 Truncate image version label so that it avoids the 63 char k8s limit
Signed-off-by: Christian M. Adams <chadams@redhat.com>
2021-12-16 15:18:22 -05:00
Michael Hrivnak
f4995afb39 removes obsolete and confusing warning about project status
This warning originated [two years
ago](6e6cd37ce6 (diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R18)).
The API is now at `v1beta1`, so it's probably not accurate to call it
"alpha" anymore.

Since AWX and awx-operator are both OSS upstream projects, there is
implicitly no vendor support from Red Hat. The warning about support can
lead to confusion, and potentially imply that some other part of AWX is
supported, as demonstrated in a recent [twitter
thread](https://twitter.com/vwbusguy/status/1470902780311212035). When
this warning was written, the operator was self-described as an
"installation method for Ansible Tower or AWX". Since then, it appears
that the operator is focused only on upstream AWX, so that presumably
removes any need to clarify vendor support status.
2021-12-15 17:34:03 -05:00
Christian Adams
35062157e0 Merge pull request #690 from rooftopcellist/wait-for-postgres-2
Do not try to wait for Postgres on external db deployments
2021-12-10 15:03:50 -05:00
Christian M. Adams
3150d55af6 Do not try to wait for Postgres on external db deployments
Signed-off-by: Christian M. Adams <chadams@redhat.com>
2021-12-09 19:31:37 -05:00
Christian Adams
4c51ee28f5 Merge pull request #688 from rooftopcellist/wait-for-postgres
Wait for Postgres to initialize before starting containers
2021-12-08 14:56:48 -05:00
Christian M. Adams
fbd5803f10 Wait for Postgres to initialize before starting containers 2021-12-07 17:42:55 -05:00
Christian Adams
8972cae1cc Merge pull request #686 from rooftopcellist/fix-deploy-target-dev
Fix deploy target for the devel branch
2021-12-07 14:36:52 -05:00
Christian M. Adams
1d8b3d9b4c Fix deploy target for the devel branch
* piping a make target within another target causes issues

Signed-off-by: Christian M. Adams <chadams@redhat.com>
2021-12-07 10:57:33 -05:00
Paul Belanger
57aa585a2e Merge pull request #663 from pabelanger/temp/catalog 2021-11-19 15:03:18 -05:00
Paul Belanger
752813c23e Add CONTAINER_CMD to Makefile
This allows people to use podman if they want.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2021-11-19 14:32:21 -05:00
Christian Adams
48ee59e80f Merge pull request #662 from rooftopcellist/restore-vars
Add in ansible debug logs env var
2021-11-19 13:25:45 -05:00
Christian M. Adams
78fc099c75 Add in ansible debug logs env var
* This will be added to the CSV automatically when make bundle is run

Signed-off-by: Christian M. Adams <chadams@redhat.com>
2021-11-19 10:03:04 -05:00
Shane McDonald
5b577603c8 Merge pull request #627 from steinbrueckri/add-make-task
Add make task to create resources without applying to the cluster
2021-11-19 21:08:27 +08:00
Shane McDonald
e5cfac2ba0 Merge pull request #660 from shanemcd/stage-operator
Allow for independently staging awx-operator
2021-11-19 16:29:31 +08:00
Shane McDonald
5ca536313a Add test for DEFAULT_AWX_VERSION 2021-11-19 08:17:16 +00:00
Shane McDonald
eaaf55e7f0 Drive-by lint fix, actually enforce line length 2021-11-19 08:16:34 +00:00
Shane McDonald
5d934ff2b5 Allow for independently staging awx-operator 2021-11-19 06:34:16 +00:00
Shane McDonald
84ab70f779 Fix secret name 2021-11-19 13:22:36 +08:00
Shane McDonald
d74b5baf45 Delete RELATED_ variables from upstream deployment
I ran into a bug with this when releasing the latest version of AWX. RELATED_IMAGE_AWX always clobbers the version and does not respect `DEFAULT_AWX_VERSION`
2021-11-19 13:16:24 +08:00
Shane McDonald
246bd829ec Merge pull request #658 from shanemcd/promote-releases
Move to promotion-based release process
2021-11-19 12:22:17 +08:00
Shane McDonald
c28e4729e6 Move to promotion-based release process 2021-11-19 02:29:16 +00:00
Christian Adams
da63fe4653 Merge pull request #656 from rooftopcellist/align-descriptions-2
Add back CSV descriptions that got lost
2021-11-18 09:43:19 -05:00
Christian M. Adams
7e2d726b26 Add more descriptions that got lost 2021-11-17 14:46:23 -05:00
Christian Adams
fd38c33f14 Merge pull request #654 from rooftopcellist/security-context-olm-params
Add security_context_settings param to olm-params
2021-11-17 14:35:07 -05:00
Christian M. Adams
a16e05d2f6 Add security_context_settings param to olm-params
Signed-off-by: Christian M. Adams <chadams@redhat.com>
2021-11-17 09:47:43 -05:00
Shane McDonald
1ad5c9e981 Merge pull request #653 from rooftopcellist/align-descriptions
Minor description update
2021-11-17 21:40:39 +08:00
Christian M. Adams
79ee798df7 Align upstream and downstream descriptions 2021-11-16 15:22:27 -05:00
Shane McDonald
c843194cbd Support running AWX at non-root path 2021-11-14 04:26:24 +00:00
Shane McDonald
d1d6785b7d Merge pull request #645 from shanemcd/pod-security-context
Add support for arbitrary pod-level securityContext settings
2021-11-11 06:16:56 +08:00
Shane McDonald
138964f7ab Add support for arbitrary pod-level securityContext settings
This allows for doing stuff like this on the custom resource:

```
security_context_settings:
  runAsUser: 1000
  runAsGroup: 0
```

I added `snakeCaseParameters: False` because without it, variables like `runAsUser` become `run_as_user`... and that doesnt work.
2021-11-10 21:36:42 +08:00
Yanis Guenane
b2479c8014 Merge pull request #632 from Spredzy/fix_control_image
control_plane_ee: Honor proper ordering
2021-11-02 11:02:51 +01:00
Yanis Guenane
277b772c46 control_plane_ee: Honor proper ordering 2021-11-02 10:45:11 +01:00
Yanis Guenane
7d20335cff Merge pull request #630 from Spredzy/fix_handshake
Set default images, but use them as a last resort
2021-11-02 10:13:16 +01:00
Yanis Guenane
fc713e7b73 Properly apply default when env lookup returns empty 2021-11-02 09:57:04 +01:00
Yanis Guenane
26856d528d Merge pull request #629 from Spredzy/hidemoreunhidden
OLM: Mark as advanced more fields
2021-11-01 15:02:18 +01:00
Christian M. Adams
7eb6d0e0f5 Set default images, but use them as a last resort
* Only use them if user did not set an image, or RELATED_IMAGES_ var
    is not set

Signed-off-by: Christian M. Adams <chadams@redhat.com>
(cherry picked from commit bb957be9e6)
2021-11-01 14:58:24 +01:00
Yanis Guenane
fd03731a72 OLM: Mark as advanced more fields 2021-11-01 14:12:14 +01:00
kurokobo
b0824acc48 Add steps to upgrade to 0.14.0 2021-10-29 22:01:10 -04:00
Richard Steinbrück
782f97c42c Add make task to create resources without applying to the cluster 2021-10-29 11:24:14 +02:00
Shane McDonald
09088b5b18 Merge pull request #620 from rooftopcellist/rename-image-vars
Rename related image vars to be distinct across operators
2021-10-27 12:59:02 -04:00
Christian M. Adams
29879f7064 Rename related image vars to be distinct across operators 2021-10-27 11:26:51 -04:00
Christian Adams
b866d682ef Merge pull request #616 from rooftopcellist/disconnected
Use relatedImages to make disconnected deployments possible
2021-10-26 08:37:20 -04:00
Christian M. Adams
8aee279634 Use relatedImages to make disconnected deployments possible
* Add ability to pass images in from the CSV for disconnected installs

Signed-off-by: Christian M. Adams <chadams@redhat.com>
2021-10-26 00:26:16 -04:00
Yanis Guenane
071b67a814 Merge pull request #617 from rooftopcellist/unique-operator-image
Rename operator image name to make it unique from resource & pulp
2021-10-25 21:15:12 +02:00
Christian M. Adams
894b0ffa5f Rename operator image name to make it unique from resource & pulp operators 2021-10-25 14:02:59 -04:00
Shane McDonald
670b1f7d40 Merge pull request #612 from shanemcd/allow-awx-version-override
Allow for overriding default AWX version as env var
2021-10-20 17:13:25 -04:00
Shane McDonald
7b59c36263 Allow for overriding default AWX version as env var 2021-10-20 17:01:23 -04:00
Shane McDonald
c8d4ae16bb Merge pull request #613 from shanemcd/obtain-version-from-git
Obtain version from git
2021-10-18 17:56:01 -04:00
Shane McDonald
2e74c63c9e Obtain version from git tags
If you `git checkout <some-released-tag>` this should just work. If you run this from the HEAD of devel, you will need to run `make docker-build docker-push` and override the appropriate image versions.
2021-10-18 17:37:26 -04:00
Shane McDonald
706dc80f17 Revert "Lookup version from git when building bundle / catalog"
This reverts commit 7fd4d46f6e.
2021-10-18 17:37:26 -04:00
Shane McDonald
3d6094a5b0 Merge pull request #606 from rooftopcellist/generate-csv
Inject OLM parameters when generating bundle
2021-10-15 14:04:40 -04:00
Christian M. Adams
37470a0943 Inject OLM parameters when generating bundle
Signed-off-by: Christian M. Adams <chadams@redhat.com>
2021-10-14 01:18:27 -04:00
Shane McDonald
b65ba92b08 Merge pull request #605 from shanemcd/get-scm-version-for-bundle
Get version from tags when building bundle / catalog
2021-10-13 15:10:25 -04:00
Shane McDonald
7fd4d46f6e Lookup version from git when building bundle / catalog
VERSION = "latest" breaks `make bundle` and `make catalog`.
2021-10-13 14:59:32 -04:00
Shane McDonald
eaff6898a4 Ignore files generated by bundle / catalog Make targets 2021-10-13 14:54:55 -04:00
Shane McDonald
38c64a504d Merge pull request #559 from oliverf1/redis_capabilities
Add an option to specify container capabilities for the redis container
2021-10-13 14:24:23 -04:00
Shane McDonald
563bdd6360 Merge pull request #602 from shanemcd/kind-load-docker-image
Copy awx image into kind cluster in molecule tests
2021-10-11 18:25:02 -04:00
Shane McDonald
9eb0e35861 Copy awx image into kind cluster in molecule tests
This only happens when overriding the AWX image used in tests.
2021-10-11 18:14:57 -04:00
Shane McDonald
21fe2646b4 Merge pull request #598 from shanemcd/show-me-the-errors
Surface any errors that happen while launching demo jt in tests
2021-10-08 14:58:39 -04:00
Shane McDonald
ebbb87f9a6 Surface any errors that happen while launching demo jt in tests 2021-10-08 14:45:57 -04:00
Shane McDonald
ee2980b8bb Merge pull request #589 from shanemcd/override-awx-image-in-tests
Allow for overridding awx image in tests
2021-10-06 20:08:12 -04:00
Shane McDonald
2426956a0a Allow for overridding awx image in tests 2021-10-06 19:57:36 -04:00
Shane McDonald
391e0bb1b8 Merge pull request #587 from shanemcd/no-hardcoded-versions
Introduce latest tag
2021-10-05 21:31:08 -04:00
Shane McDonald
5e7fe9b05f Tag releases as "latest" 2021-10-05 21:20:10 -04:00
Shane McDonald
685c5efc94 Switch to latest tag 2021-10-05 21:20:02 -04:00
Shane McDonald
e3d5827951 Merge pull request #586 from shanemcd/no-hardcoded-versions
Remove hardcoded versions from repo
2021-10-05 21:11:32 -04:00
Shane McDonald
ebb4e76e1c Merge pull request #585 from shanemcd/fix-devel-workflow
Fix devel workflow
2021-10-05 20:58:59 -04:00
Shane McDonald
f62b66d4ae Remove hardcoded versions from repo 2021-10-05 20:56:29 -04:00
Shane McDonald
1f73e2ca32 Fix devel workflow 2021-10-05 20:51:56 -04:00
Shane McDonald
48f990f4a1 Merge pull request #579 from sdigit/devel
Add Ingress path type option
2021-10-04 17:58:14 -04:00
Sean Davis
b1dcf16fc8 Add Ingress path type option (#1)
* make ingress_path_type an option

* add to spec
2021-10-04 10:31:56 -05:00
Olivier
f0c5d1b4e3 Add an option to specify container capabilities for the redis container
With some kubernetes clusters and settings, you might need to specify
some capabilities so the container can start. For example, the CHOWN,
SETUID and SETGID capabilties.
Setting the redis_capabilities option will add the capabilities in
the deployment.
2021-10-02 18:43:37 -04:00
siju-vasudevan
38ec4a3b00 LDAPSearch Module is missing
Since LDAPSearch Module is missing LDAP authentication is not working if you configure the LDAP configuration via extra_settings.
2021-09-09 10:04:30 +05:30
60 changed files with 1749 additions and 357 deletions

3
.github/issue_labeler.yml vendored Normal file
View File

@@ -0,0 +1,3 @@
---
needs_triage:
- '.*'

View File

@@ -13,16 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install Operator-SDK
run: |
mkdir -p $GITHUB_WORKSPACE/bin
wget -O $GITHUB_WORKSPACE/bin/operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/v0.19.4/operator-sdk-v0.19.4-x86_64-linux-gnu
chmod +x $GITHUB_WORKSPACE/bin/operator-sdk
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: Build Image
run: |
operator-sdk build awx-operator:devel
IMG=awx-operator:devel make docker-build
- name: Push To Quay
uses: redhat-actions/push-to-registry@v2.1.1
@@ -30,5 +23,5 @@ jobs:
image: awx-operator
tags: devel
registry: quay.io/ansible/
username: ${{ secrets.QUAY_USERNAME }}
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}

25
.github/workflows/promote.yaml vendored Normal file
View File

@@ -0,0 +1,25 @@
---
name: Promote AWX Operator image
on:
release:
types: [published]
jobs:
promote:
runs-on: ubuntu-latest
steps:
- name: Log in to GHCR
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Log in to Quay
run: |
echo ${{ secrets.QUAY_TOKEN }} | docker login quay.io -u ${{ secrets.QUAY_USER }} --password-stdin
- name: Re-tag and promote awx-operator image
run: |
docker pull ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
docker tag ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} quay.io/${{ github.repository }}:${{ github.event.release.tag_name }}
docker tag ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} quay.io/${{ github.repository }}:latest
docker push quay.io/${{ github.repository }}:${{ github.event.release.tag_name }}
docker push quay.io/${{ github.repository }}:latest

View File

@@ -1,28 +0,0 @@
---
name: Release
on:
release:
types:
- created
jobs:
release:
runs-on: ubuntu-18.04
name: Push tagged image to Quay
steps:
- uses: actions/checkout@v2
- name: Build Image
run: |
IMG=awx-operator:${{ github.event.release.tag_name }} make docker-build
- name: Push To Quay
uses: redhat-actions/push-to-registry@v2.1.1
with:
image: awx-operator
tags: ${{ github.event.release.tag_name }}
registry: quay.io/ansible/
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}

85
.github/workflows/stage.yml vendored Normal file
View File

@@ -0,0 +1,85 @@
---
name: Stage Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to stage'
required: true
default_awx_version:
description: 'Will be injected as the DEFAULT_AWX_VERSION build arg.'
required: true
confirm:
description: 'Are you sure? Set this to yes.'
required: true
default: 'no'
jobs:
stage:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: Verify inputs
run: |
set -e
if [[ ${{ github.event.inputs.confirm }} != "yes" ]]; then
>&2 echo "Confirm must be 'yes'"
exit 1
fi
if [[ ${{ github.event.inputs.version }} == "" ]]; then
>&2 echo "Set version to continue."
exit 1
fi
exit 0
- name: Checkout awx
uses: actions/checkout@v2
with:
repository: ${{ github.repository_owner }}/awx
path: awx
- name: Checkout awx-operator
uses: actions/checkout@v2
with:
repository: ${{ github.repository_owner }}/awx-operator
path: awx-operator
- name: Install playbook dependencies
run: |
python3 -m pip install docker
- name: Log in to GHCR
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and stage awx-operator
working-directory: awx-operator
run: |
BUILD_ARGS="--build-arg DEFAULT_AWX_VERSION=${{ github.event.inputs.default_awx_version }} \
--build-arg OPERATOR_VERSION=${{ github.event.inputs.version }}" \
IMAGE_TAG_BASE=ghcr.io/${{ github.repository_owner }}/awx-operator \
VERSION=${{ github.event.inputs.version }} make docker-build docker-push
- name: Run test deployment
working-directory: awx-operator
run: |
python3 -m pip install -r molecule/requirements.txt
ansible-galaxy collection install -r molecule/requirements.yml
sudo rm -f $(which kustomize)
make kustomize
KUSTOMIZE_PATH=$(readlink -f bin/kustomize) molecule test -s kind
env:
AWX_TEST_VERSION: ${{ github.event.inputs.default_awx_version }}
- name: Create draft release
working-directory: awx
run: |
ansible-playbook tools/ansible/stage.yml \
-e version=${{ github.event.inputs.version }} \
-e repo=${{ github.repository_owner }}/awx-operator \
-e github_token=${{ secrets.GITHUB_TOKEN }}

22
.github/workflows/triage_new.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
---
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'

3
.gitignore vendored
View File

@@ -1,3 +1,6 @@
*~
.cache/
/bin
/bundle
/bundle_tmp*
/bundle.Dockerfile

View File

@@ -11,4 +11,3 @@ rules:
truthy: disable
line-length:
max: 170
level: warning

View File

@@ -2,7 +2,14 @@
This is a list of high-level changes for each release of `awx-operator`. A full list of commits can be found at `https://github.com/ansible/awx-operator/releases/tag/<version>`.
# 0.14.0 (TBA)
# 0.19.0 (Mar 23, 2022)
- Fix corrupted spec for the service with nodeport type (kurokobo) - dbaf64e
- Add ability to deploy with OLM & added logo (Christian Adams) - 86c31a4
- Fix backup & restore issues with special characters in the postgres password (kurokobo) - 589a375
- Use centos:stream8 container where applicable (Shane McDonald)- 12a58d7
# 0.14.0 (Oct 03, 2021)
- Starting with awx-operator 0.14.0, the project is now based on operator-sdk 1.x.
- To avoid a headache, you probably want to delete your existing operator Deployment and follow the README.

View File

@@ -1,5 +1,10 @@
FROM quay.io/operator-framework/ansible-operator:v1.12.0
ARG DEFAULT_AWX_VERSION
ARG OPERATOR_VERSION
ENV DEFAULT_AWX_VERSION=${DEFAULT_AWX_VERSION}
ENV OPERATOR_VERSION=${OPERATOR_VERSION}
COPY requirements.yml ${HOME}/requirements.yml
RUN ansible-galaxy collection install -r ${HOME}/requirements.yml \
&& chmod -R ug+rwx ${HOME}/.ansible

View File

@@ -3,7 +3,9 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.14.0
VERSION ?= $(shell git describe --tags)
CONTAINER_CMD ?= docker
# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
@@ -63,10 +65,10 @@ run: ansible-operator ## Run against the configured Kubernetes cluster in ~/.kub
ANSIBLE_ROLES_PATH="$(ANSIBLE_ROLES_PATH):$(shell pwd)/roles" $(ANSIBLE_OPERATOR) run
docker-build: ## Build docker image with the manager.
docker build -t ${IMG} .
${CONTAINER_CMD} build $(BUILD_ARGS) -t ${IMG} .
docker-push: ## Push docker image with the manager.
docker push ${IMG}
${CONTAINER_CMD} push ${IMG}
##@ Deployment
@@ -76,16 +78,22 @@ install: kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/con
uninstall: kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete -f -
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
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 -
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
@cd config/default && $(KUSTOMIZE) edit set namespace ${NAMESPACE}
@$(KUSTOMIZE) build config/default | kubectl apply -f -
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 -
OS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
ARCH := $(shell uname -m | sed 's/x86_64/amd64/')
ARCH := $(shell uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/')
.PHONY: kustomize
KUSTOMIZE = $(shell pwd)/bin/kustomize
@@ -128,7 +136,7 @@ bundle: kustomize ## Generate bundle manifests and metadata, then validate gener
.PHONY: bundle-build
bundle-build: ## Build the bundle image.
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
${CONTAINER_CMD} build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
.PHONY: bundle-push
bundle-push: ## Push the bundle image.
@@ -167,7 +175,7 @@ endif
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
.PHONY: catalog-build
catalog-build: opm ## Build a catalog image.
$(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
$(OPM) index add --container-tool ${CONTAINER_CMD} --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
# Push the catalog image.
.PHONY: catalog-push

532
README.md
View File

@@ -5,54 +5,62 @@
An [Ansible AWX](https://github.com/ansible/awx) operator for Kubernetes built with [Operator SDK](https://github.com/operator-framework/operator-sdk) and Ansible.
# Table of Contents
<!-- Regenerate this table of contents using https://github.com/ekalinin/github-markdown-toc -->
<!-- gh-md-toc --insert README.md -->
<!--ts-->
* [AWX Operator](#awx-operator)
* [Table of Contents](#table-of-contents)
* [Purpose](#purpose)
* [Usage](#usage)
* [Basic Install](#basic-install)
* [Admin user account configuration](#admin-user-account-configuration)
* [Network and TLS Configuration](#network-and-tls-configuration)
* [Service Type](#service-type)
* [Ingress Type](#ingress-type)
* [Database Configuration](#database-configuration)
* [External PostgreSQL Service](#external-postgresql-service)
* [Migrating data from an old AWX instance](#migrating-data-from-an-old-awx-instance)
* [Managed PostgreSQL Service](#managed-postgresql-service)
* [Advanced Configuration](#advanced-configuration)
* [Deploying a specific version of AWX](#deploying-a-specific-version-of-awx)
* [Privileged Tasks](#privileged-tasks)
* [Containers Resource Requirements](#containers-resource-requirements)
* [Trusting a Custom Certificate Authority](#trusting-a-custom-certificate-authority)
* [Persisting Projects Directory](#persisting-projects-directory)
* [Custom Volume and Volume Mount Options](#custom-volume-and-volume-mount-options)
* [Exporting Environment Variables to Containers](#exporting-environment-variables-to-containers)
* [Extra Settings](#extra-settings)
* [Service Account](#service-account)
* [Uninstall](#uninstall)
* [Upgrading](#upgrading)
* [Contributing](#contributing)
* [Release Process](#release-process)
* [Verifiy Functionality](#verify-functionality)
* [Update Version](#update-version)
* [Commit / Create Release](#commit--create-release)
* [Author](#author)
- [AWX Operator](#awx-operator)
- [Table of Contents](#table-of-contents)
- [Purpose](#purpose)
- [Usage](#usage)
- [Creating a minikube cluster for testing](#creating-a-minikube-cluster-for-testing)
- [Basic Install](#basic-install)
- [Admin user account configuration](#admin-user-account-configuration)
- [Network and TLS Configuration](#network-and-tls-configuration)
- [Service Type](#service-type)
- [Ingress Type](#ingress-type)
- [Database Configuration](#database-configuration)
- [External PostgreSQL Service](#external-postgresql-service)
- [Migrating data from an old AWX instance](#migrating-data-from-an-old-awx-instance)
- [Managed PostgreSQL Service](#managed-postgresql-service)
- [Advanced Configuration](#advanced-configuration)
- [Deploying a specific version of AWX](#deploying-a-specific-version-of-awx)
- [Redis container capabilities](#redis-container-capabilities)
- [Privileged Tasks](#privileged-tasks)
- [Containers Resource Requirements](#containers-resource-requirements)
- [Assigning AWX pods to specific nodes](#assigning-awx-pods-to-specific-nodes)
- [Trusting a Custom Certificate Authority](#trusting-a-custom-certificate-authority)
- [Enabling LDAP Integration at AWX bootstrap](#enabling-ldap-integration-at-awx-bootstrap)
- [Persisting Projects Directory](#persisting-projects-directory)
- [Custom Volume and Volume Mount Options](#custom-volume-and-volume-mount-options)
- [Default execution environments from private registries](#default-execution-environments-from-private-registries)
- [Control plane ee from private registry](#control-plane-ee-from-private-registry)
- [Exporting Environment Variables to Containers](#exporting-environment-variables-to-containers)
- [Extra Settings](#extra-settings)
- [Service Account](#service-account)
- [Uninstall](#uninstall)
- [Upgrading](#upgrading)
- [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)
- [Contributing](#contributing)
- [Release Process](#release-process)
- [Author](#author)
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
<!--te-->
## Purpose
This operator is meant to provide a more Kubernetes-native installation method for AWX via an AWX Custom Resource Definition (CRD).
> :warning: The operator is not supported by Red Hat, and is in **alpha** status. For now, use it at your own risk!
## Usage
### Basic Install
This Kubernetes Operator is meant to be deployed in your Kubernetes cluster(s) and can manage one or more AWX instances in any namespace.
For testing purposes, the `awx-operator` can be deployed on a [Minikube](https://minikube.sigs.k8s.io/docs/) cluster. Due to different OS and hardware environments, please refer to the official Minikube documentation for further information.
### Creating a minikube cluster for testing
If you do not have an existing cluster, the `awx-operator` can be deployed on a [Minikube](https://minikube.sigs.k8s.io/docs/) cluster for testing purposes. Due to different OS and hardware environments, please refer to the official Minikube documentation for further information.
```
$ minikube start --cpus=4 --memory=6g --addons=ingress
@@ -101,26 +109,47 @@ Let's create an alias for easier usage:
$ alias kubectl="minikube kubectl --"
```
Now you need to deploy AWX Operator into your cluster. Clone this repo and `git checkout` the latest version from https://github.com/ansible/awx-operator/releases, and then run the following command:
### Basic Install
Once you have a running Kubernetes cluster, you can deploy AWX Operator into your cluster using [Kustomize](https://kubectl.docs.kubernetes.io/guides/introduction/kustomize/). Follow the instructions here to install the latest version of Kustomize: https://kubectl.docs.kubernetes.io/installation/kustomize/
First, create a file called `kustomization.yaml` with the following content:
```yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
# Find the latest tag here: https://github.com/ansible/awx-operator/releases
- github.com/ansible/awx-operator/config/default?ref=<tag>
# Set the image tags to match the git version from above
images:
- name: quay.io/ansible/awx-operator
newTag: <tag>
# Specify a custom namespace in which to install AWX
namespace: awx
```
> **TIP:** If you need to change any of the default settings for the operator (such as resources.limits), you can add [patches](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patches/) at the bottom of your kustomization.yaml file.
Install the manifests by running this:
```
$ export NAMESPACE=my-namespace
$ make deploy
cd config/manager && /home/user/awx-operator/bin/kustomize edit set image controller=quay.io/ansible/awx-operator:0.14.0
/home/user/awx-operator/bin/kustomize build config/default | kubectl apply -f -
namespace/my-namespace created
$ kustomize build . | kubectl apply -f -
namespace/awx created
customresourcedefinition.apiextensions.k8s.io/awxbackups.awx.ansible.com created
customresourcedefinition.apiextensions.k8s.io/awxrestores.awx.ansible.com created
customresourcedefinition.apiextensions.k8s.io/awxs.awx.ansible.com created
serviceaccount/awx-operator-controller-manager created
role.rbac.authorization.k8s.io/awx-operator-awx-manager-role created
role.rbac.authorization.k8s.io/awx-operator-leader-election-role created
role.rbac.authorization.k8s.io/awx-operator-manager-role created
clusterrole.rbac.authorization.k8s.io/awx-operator-metrics-reader created
clusterrole.rbac.authorization.k8s.io/awx-operator-proxy-role created
rolebinding.rbac.authorization.k8s.io/awx-operator-awx-manager-rolebinding created
rolebinding.rbac.authorization.k8s.io/awx-operator-leader-election-rolebinding created
rolebinding.rbac.authorization.k8s.io/awx-operator-manager-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/awx-operator-proxy-rolebinding created
configmap/awx-operator-manager-config created
configmap/awx-operator-awx-manager-config created
service/awx-operator-controller-manager-metrics-service created
deployment.apps/awx-operator-controller-manager created
```
@@ -128,18 +157,18 @@ deployment.apps/awx-operator-controller-manager created
Wait a bit and you should have the `awx-operator` running:
```
$ kubectl get pods -n $NAMESPACE
$ kubectl get pods -n awx
NAME READY STATUS RESTARTS AGE
awx-operator-controller-manager-66ccd8f997-rhd4z 2/2 Running 0 11s
```
So we don't have to keep repeating `-n $NAMESPACE`, let's set the current namespace for `kubectl`:
So we don't have to keep repeating `-n awx`, let's set the current namespace for `kubectl`:
```
$ kubectl config set-context --current --namespace=$NAMESPACE
$ kubectl config set-context --current --namespace=awx
```
Next, create a file named `awx-demo.yml` with the suggested content below. The `metadata.name` you provide, will be the name of the resulting AWX deployment.
Next, create a file named `awx-demo.yaml` in the same folder with the suggested content below. The `metadata.name` you provide will be the name of the resulting AWX deployment.
**Note:** If you deploy more than one AWX instance to the same namespace, be sure to use unique names.
@@ -153,17 +182,27 @@ spec:
service_type: nodeport
```
Finally, use `kubectl` to create the awx instance in your cluster:
Make sure to add this new file to the list of "resources" in your `kustomization.yaml` file:
```yaml
...
resources:
- github.com/ansible/awx-operator/config/default?ref=<tag>
# Add this extra line:
- awx-demo.yaml
...
```
Finally, run `kustomize` again to create the AWX instance in your cluster:
```
$ kubectl apply -f awx-demo.yml
awx.awx.ansible.com/awx-demo created
kustomize build . | kubectl apply -f -
```
After a few minutes, the new AWX instance will be deployed. You can look at the operator pod logs in order to know where the installation process is at:
```
$ kubectl logs -f deployments/awx-operator-controller-manager -c manager
$ kubectl logs -f deployments/awx-operator-controller-manager -c awx-manager
```
After a few seconds, you should see the operator begin to create new resources:
@@ -197,17 +236,16 @@ You just completed the most basic install of an AWX instance via this operator.
For an example using the Nginx Controller in Minukube, don't miss our [demo video](https://asciinema.org/a/416946).
[![asciicast](https://raw.githubusercontent.com/ansible/awx-operator/devel/docs/awx-demo.svg)](https://asciinema.org/a/416946)
### Admin user account configuration
There are three variables that are customizable for the admin user account creation.
| Name | Description | Default |
| --------------------------- | -------------------------------------------- | ---------------- |
| admin_user | Name of the admin user | admin |
| admin_email | Email of the admin user | test@example.com |
| admin_password_secret | Secret that contains the admin user password | Empty string |
| Name | Description | Default |
| --------------------- | -------------------------------------------- | ---------------- |
| admin_user | Name of the admin user | admin |
| admin_email | Email of the admin user | test@example.com |
| admin_password_secret | Secret that contains the admin user password | Empty string |
> :warning: **admin_password_secret must be a Kubernetes secret and not your text clear password**.
@@ -240,15 +278,18 @@ The `service_type` supported options are: `ClusterIP`, `LoadBalancer` and `NodeP
The following variables are customizable for any `service_type`
| Name | Description | Default |
| ------------------------------------- | --------------------------------------------- | --------------------------------- |
| service_labels | Add custom labels | Empty string |
| Name | Description | Default |
| ------------------- | ----------------------- | ------------ |
| service_labels | Add custom labels | Empty string |
| service_annotations | Add service annotations | Empty string |
```yaml
---
spec:
...
service_type: ClusterIP
service_annotations: |
environment: testing
service_labels: |
environment: testing
```
@@ -257,11 +298,10 @@ spec:
The following variables are customizable only when `service_type=LoadBalancer`
| Name | Description | Default |
| ------------------------------ | ---------------------------------------- | ------------- |
| loadbalancer_annotations | LoadBalancer annotations | Empty string |
| loadbalancer_protocol | Protocol to use for Loadbalancer ingress | http |
| loadbalancer_port | Port used for Loadbalancer ingress | 80 |
| Name | Description | Default |
| --------------------- | ---------------------------------------- | ------- |
| loadbalancer_protocol | Protocol to use for Loadbalancer ingress | http |
| loadbalancer_port | Port used for Loadbalancer ingress | 80 |
```yaml
---
@@ -270,7 +310,7 @@ spec:
service_type: LoadBalancer
loadbalancer_protocol: https
loadbalancer_port: 443
loadbalancer_annotations: |
service_annotations: |
environment: testing
service_labels: |
environment: testing
@@ -284,9 +324,9 @@ The HTTPS Load Balancer also uses SSL termination at the Load Balancer level and
The following variables are customizable only when `service_type=NodePort`
| Name | Description | Default |
| ------------------------------ | ---------------------------------------- | ------------- |
| nodeport_port | Port used for NodePort | 30080 |
| Name | Description | Default |
| ------------- | ---------------------- | ------- |
| nodeport_port | Port used for NodePort | 30080 |
```yaml
---
@@ -314,12 +354,13 @@ spec:
The following variables are customizable when `ingress_type=ingress`. The `ingress` type creates an Ingress resource as [documented](https://kubernetes.io/docs/concepts/services-networking/ingress/) which can be shared with many other Ingress Controllers as [listed](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/).
| Name | Description | Default |
| -------------------------- | ---------------------------------------- | ---------------------------- |
| ingress_annotations | Ingress annotations | Empty string |
| ingress_tls_secret | Secret that contains the TLS information | Empty string |
| hostname | Define the FQDN | {{ meta.name }}.example.com |
| ingress_path | Define the ingress path to the service | / |
| Name | Description | Default |
| ------------------- | ---------------------------------------- | --------------------------- |
| ingress_annotations | Ingress annotations | Empty string |
| ingress_tls_secret | Secret that contains the TLS information | Empty string |
| 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 |
```yaml
---
@@ -335,8 +376,8 @@ spec:
The following variables are customizable when `ingress_type=route`
| Name | Description | Default |
| ------------------------------------- | --------------------------------------------- | --------------------------------------------------------|
| Name | Description | Default |
| ------------------------------- | --------------------------------------------- | ------------------------------------------------------- |
| 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 |
@@ -378,7 +419,7 @@ stringData:
type: Opaque
```
> Please ensure that the value for the variable "password" is wrapped in quotes if the password contains any special characters.
> 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.
> 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.
@@ -394,13 +435,15 @@ If you don't have access to an external PostgreSQL service, the AWX operator can
The following variables are customizable for the managed PostgreSQL service
| Name | Description | Default |
| ------------------------------------ | ------------------------------------------ | --------------------------------- |
| postgres_image | Path of the image to pull | postgres:12 |
| postgres_resource_requirements | PostgreSQL container resource requirements | Empty object |
| postgres_storage_requirements | PostgreSQL container storage requirements | requests: {storage: 8Gi} |
| postgres_storage_class | PostgreSQL PV storage class | Empty string |
| postgres_data_path | PostgreSQL data path | `/var/lib/postgresql/data/pgdata` |
| Name | Description | Default |
| --------------------------------------------- | --------------------------------------------- | ---------------------------------- |
| postgres_image | Path of the image to pull | postgres:12 |
| postgres_init_container_resource_requirements | Database init container resource requirements | requests: {cpu: 10m, memory: 64Mi} |
| postgres_resource_requirements | PostgreSQL container resource requirements | requests: {cpu: 10m, memory: 64Mi} |
| postgres_storage_requirements | PostgreSQL container storage requirements | requests: {storage: 8Gi} |
| postgres_storage_class | PostgreSQL PV storage class | Empty string |
| postgres_data_path | PostgreSQL data path | `/var/lib/postgresql/data/pgdata` |
| postgres_priority_class | Priority class used for PostgreSQL pod | Empty string |
Example of customization could be:
@@ -421,6 +464,9 @@ spec:
limits:
storage: 50Gi
postgres_storage_class: fast-ssd
postgres_extra_args:
- '-c'
- 'max_connections=1000'
```
**Note**: If `postgres_storage_class` is not defined, Postgres will store it's data on a volume using the default storage class for your cluster.
@@ -431,15 +477,15 @@ spec:
There are a few variables that are customizable for awx the image management.
| Name | Description |
| --------------------------| -------------------------- |
| image | Path of the image to pull |
| image_version | Image version to pull |
| image_pull_policy | The pull policy to adopt |
| image_pull_secret | The pull secret to use |
| ee_images | A list of EEs to register |
| redis_image | Path of the image to pull |
| redis_image_version | Image version to pull |
| Name | Description |
| ------------------- | ------------------------- |
| image | Path of the image to pull |
| image_version | Image version to pull |
| image_pull_policy | The pull policy to adopt |
| image_pull_secrets | The pull secrets to use |
| ee_images | A list of EEs to register |
| redis_image | Path of the image to pull |
| redis_image_version | Image version to pull |
Example of customization could be:
@@ -450,7 +496,8 @@ spec:
image: myorg/my-custom-awx
image_version: latest
image_pull_policy: Always
image_pull_secret: pull_secret_name
image_pull_secrets:
- pull_secret_name
ee_images:
- name: my-custom-awx-ee
image: myorg/my-custom-awx-ee
@@ -458,6 +505,20 @@ spec:
**Note**: The `image` and `image_version` are intended for local mirroring scenarios. Please note that using a version of AWX other than the one bundled with the `awx-operator` is **not** supported. For the default values, check the [main.yml](https://github.com/ansible/awx-operator/blob/devel/roles/installer/defaults/main.yml) file.
#### Redis container capabilities
Depending on your kubernetes cluster and settings you might need to grant some capabilities to the redis container so it can start. Set the `redis_capabilities` option so the capabilities are added in the deployment.
```yaml
---
spec:
...
redis_capabilities:
- CHOWN
- SETUID
- SETGID
```
#### Privileged Tasks
Depending on the type of tasks that you'll be running, you may find that you need the task pod to run as `privileged`. This can open yourself up to a variety of security concerns, so you should be aware (and verify that you have the privileges) to do this if necessary. In order to toggle this feature, you can add the following to your custom resource:
@@ -482,11 +543,11 @@ Again, this is the most relaxed SCC that is provided by OpenShift, so be sure to
The resource requirements for both, the task and the web containers are configurable - both the lower end (requests) and the upper end (limits).
| Name | Description | Default |
| -------------------------------- | ------------------------------------------------ | ----------------------------------- |
| web_resource_requirements | Web container resource requirements | requests: {cpu: 1000m, memory: 2Gi} |
| task_resource_requirements | Task container resource requirements | requests: {cpu: 500m, memory: 1Gi} |
| ee_resource_requirements | EE control plane container resource requirements | requests: {cpu: 500m, memory: 1Gi} |
| Name | Description | Default |
| -------------------------- | ------------------------------------------------ | ------------------------------------ |
| web_resource_requirements | Web container resource requirements | requests: {cpu: 100m, memory: 128Mi} |
| task_resource_requirements | Task container resource requirements | requests: {cpu: 100m, memory: 128Mi} |
| ee_resource_requirements | EE control plane container resource requirements | requests: {cpu: 100m, memory: 128Mi} |
Example of customization could be:
@@ -496,42 +557,63 @@ spec:
...
web_resource_requirements:
requests:
cpu: 1000m
cpu: 250m
memory: 2Gi
limits:
cpu: 2000m
cpu: 1000m
memory: 4Gi
task_resource_requirements:
requests:
cpu: 500m
cpu: 250m
memory: 1Gi
limits:
cpu: 1000m
cpu: 2000m
memory: 2Gi
ee_resource_requirements:
requests:
cpu: 500m
memory: 1Gi
cpu: 250m
memory: 100Mi
limits:
cpu: 1000m
cpu: 500m
memory: 2Gi
```
#### Priority Classes
The AWX and Postgres pods can be assigned a custom PriorityClass to rank their importance compared to other pods in your cluster, which determines which pods get evicted first if resources are running low.
First, [create your PriorityClass](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass) if needed.
Then set the name of your priority class to the control plane and postgres pods as shown below.
```yaml
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: awx-demo
spec:
...
control_plane_priority_class: awx-demo-high-priority
postgres_priority_class: awx-demo-medium-priority
```
#### 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`
| 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 | '' |
| tolerations | AWX pods' tolerations | '' |
| postgres_selector | Postgres pods' nodeSelector | '' |
| postgres_tolerations | Postgres pods' tolerations | '' |
| 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 | '' |
Example of customization could be:
@@ -543,6 +625,13 @@ spec:
disktype: ssd
kubernetes.io/arch: amd64
kubernetes.io/os: linux
topology_spread_constraints: |
- maxSkew: 100
topologyKey: "topology.kubernetes.io/zone"
whenUnsatisfiable: "ScheduleAnyway"
labelSelector:
matchLabels:
app.kubernetes.io/name: "<resourcename>"
tolerations: |
- key: "dedicated"
operator: "Equal"
@@ -569,8 +658,8 @@ Trusting a custom Certificate Authority allows the AWX to access network service
| Name | Description | Default |
| -------------------------------- | ---------------------------------------- | --------|
| ldap_cacert_secret | LDAP Certificate Authority secret name | '' |
| ldap_password_secret | LDAP BIND DN Password secret name | '' |
| bundle_cacert_secret | Certificate Authority secret name | '' |
Please note the `awx-operator` will look for the data field `ldap-ca.crt` in the specified secret when using the `ldap_cacert_secret`, whereas the data field `bundle-ca.crt` is required for `bundle_cacert_secret` parameter.
Example of customization could be:
@@ -580,10 +669,13 @@ Example of customization could be:
spec:
...
ldap_cacert_secret: <resourcename>-custom-certs
ldap_password_secret: <resourcename>-ldap-password
bundle_cacert_secret: <resourcename>-custom-certs
```
To create the secret, you can use the command below:
To create the secrets, you can use the commands below:
* Certificate Authority secret
```
# kubectl create secret generic <resourcename>-custom-certs \
@@ -591,17 +683,77 @@ To create the secret, you can use the command below:
--from-file=bundle-ca.crt=<PATH/TO/YOUR/CA/PEM/FILE>
```
* LDAP BIND DN Password secret
```
# kubectl create secret generic <resourcename>-ldap-password \
--from-literal=ldap-password=<your_ldap_dn_password>
```
#### Enabling LDAP Integration at AWX bootstrap
A sample of extra settings can be found as below:
```yaml
- setting: AUTH_LDAP_SERVER_URI
value: >-
"ldaps://ad01.abc.com:636 ldaps://ad02.abc.com:636"
- setting: AUTH_LDAP_BIND_DN
value: >-
"CN=LDAP User,OU=Service Accounts,DC=abc,DC=com"
- setting: AUTH_LDAP_USER_SEARCH
value: 'LDAPSearch("DC=abc,DC=com",ldap.SCOPE_SUBTREE,"(sAMAccountName=%(user)s)",)'
- setting: AUTH_LDAP_GROUP_SEARCH
value: 'LDAPSearch("OU=Groups,DC=abc,DC=com",ldap.SCOPE_SUBTREE,"(objectClass=group)",)'
- setting: AUTH_LDAP_USER_ATTR_MAP
value: '{"first_name": "givenName","last_name": "sn","email": "mail"}'
- setting: AUTH_LDAP_REQUIRE_GROUP
value: >-
"CN=operators,OU=Groups,DC=abc,DC=com"
- setting: AUTH_LDAP_USER_FLAGS_BY_GROUP
value: {
"is_superuser": [
"CN=admin,OU=Groups,DC=abc,DC=com"
]
}
- setting: AUTH_LDAP_ORGANIZATION_MAP
value: {
"abc": {
"admins": "CN=admin,OU=Groups,DC=abc,DC=com",
"remove_users": false,
"remove_admins": false,
"users": true
}
}
- setting: AUTH_LDAP_TEAM_MAP
value: {
"admin": {
"remove": true,
"users": "CN=admin,OU=Groups,DC=abc,DC=com",
"organization": "abc"
}
}
```
#### Persisting Projects Directory
In cases which you want to persist the `/var/lib/projects` directory, there are few variables that are customizable for the `awx-operator`.
| Name | Description | Default |
| -----------------------------------| ---------------------------------------------------------------------------------------------------- | ---------------|
| projects_persistence | Whether or not the /var/lib/projects directory will be persistent | false |
| projects_storage_class | Define the PersistentVolume storage class | '' |
| projects_storage_size | Define the PersistentVolume size | 8Gi |
| projects_storage_access_mode | Define the PersistentVolume access mode | ReadWriteMany |
| projects_existing_claim | Define an existing PersistentVolumeClaim to use (cannot be combined with `projects_storage_*`) | '' |
| Name | Description | Default |
| ---------------------------- | ---------------------------------------------------------------------------------------------- | ------------- |
| projects_persistence | Whether or not the /var/lib/projects directory will be persistent | false |
| projects_storage_class | Define the PersistentVolume storage class | '' |
| projects_storage_size | Define the PersistentVolume size | 8Gi |
| projects_storage_access_mode | Define the PersistentVolume access mode | ReadWriteMany |
| projects_existing_claim | Define an existing PersistentVolumeClaim to use (cannot be combined with `projects_storage_*`) | '' |
Example of customization when the `awx-operator` automatically handles the persistent volume could be:
@@ -618,14 +770,14 @@ spec:
In a scenario where custom volumes and volume mounts are required to either overwrite defaults or mount configuration files.
| Name | Description | Default |
| --------------------------------- | -------------------------------------------------------- | ------- |
| extra_volumes | Specify extra volumes to add to the application pod | '' |
| web_extra_volume_mounts | Specify volume mounts to be added to Web container | '' |
| task_extra_volume_mounts | Specify volume mounts to be added to Task container | '' |
| ee_extra_volume_mounts | Specify volume mounts to be added to Execution container | '' |
| init_container_extra_volume_mounts| Specify volume mounts to be added to Init container | '' |
| init_container_extra_commands | Specify additional commands for Init container | '' |
| Name | Description | Default |
| ---------------------------------- | -------------------------------------------------------- | ------- |
| extra_volumes | Specify extra volumes to add to the application pod | '' |
| web_extra_volume_mounts | Specify volume mounts to be added to Web container | '' |
| task_extra_volume_mounts | Specify volume mounts to be added to Task container | '' |
| ee_extra_volume_mounts | Specify volume mounts to be added to Execution container | '' |
| init_container_extra_volume_mounts | Specify volume mounts to be added to Init container | '' |
| init_container_extra_commands | Specify additional commands for Init container | '' |
> :warning: The `ee_extra_volume_mounts` and `extra_volumes` will only take effect to the globally available Execution Environments. For custom `ee`, please [customize the Pod spec](https://docs.ansible.com/ansible-tower/latest/html/administration/external_execution_envs.html#customize-the-pod-spec).
@@ -720,7 +872,7 @@ type: Opaque
```
##### Control plane ee from private registry
The images listed in "ee_images" will be added as globally available Execution Environments. The "control_plane_ee_image" will be used to run project updates. In order to use a private image for any of these you'll need to use `image_pull_secret` to provide a k8s pull secret to access it. Currently the same secret is used for any of these images supplied at install time.
The images listed in "ee_images" will be added as globally available Execution Environments. The "control_plane_ee_image" will be used to run project updates. In order to use a private image for any of these you'll need to use `image_pull_secrets` to provide a list of k8s pull secrets to access it. Currently the same secret is used for any of these images supplied at install time.
You can create `image_pull_secret`
```
@@ -746,11 +898,11 @@ type: kubernetes.io/dockerconfigjson
If you need to export custom environment variables to your containers.
| Name | Description | Default |
| ----------------------------- | -------------------------------------------------------- | ------- |
| task_extra_env | Environment variables to be added to Task container | '' |
| web_extra_env | Environment variables to be added to Web container | '' |
| ee_extra_env | Environment variables to be added to EE container | '' |
| Name | Description | Default |
| -------------- | --------------------------------------------------- | ------- |
| task_extra_env | Environment variables to be added to Task container | '' |
| web_extra_env | Environment variables to be added to Web container | '' |
| ee_extra_env | Environment variables to be added to EE container | '' |
> :warning: The `ee_extra_env` will only take effect to the globally available Execution Environments. For custom `ee`, please [customize the Pod spec](https://docs.ansible.com/ansible-tower/latest/html/administration/external_execution_envs.html#customize-the-pod-spec).
@@ -769,13 +921,43 @@ Example configuration of environment variables
value: foo
```
#### CSRF Cookie Secure Setting
With `csrf_cookie_secure`, you can pass the value for `CSRF_COOKIE_SECURE` to `/etc/tower/settings.py`
| Name | Description | Default |
| ------------------ | ------------------ | ------- |
| csrf_cookie_secure | CSRF Cookie Secure | '' |
Example configuration of the `csrf_cookie_secure` setting:
```yaml
spec:
csrf_cookie_secure: 'False'
```
#### Session Cookie Secure Setting
With `session_cookie_secure`, you can pass the value for `SESSION_COOKIE_SECURE` to `/etc/tower/settings.py`
| Name | Description | Default |
| --------------------- | --------------------- | ------- |
| session_cookie_secure | Session Cookie Secure | '' |
Example configuration of the `session_cookie_secure` setting:
```yaml
spec:
session_cookie_secure: 'False'
```
#### Extra Settings
With`extra_settings`, you can pass multiple custom settings via the `awx-operator`. The parameter `extra_settings` will be appended to the `/etc/tower/settings.py` and can be an alternative to the `extra_volumes` parameter.
| Name | Description | Default |
| ----------------------------- | -------------------------------------------------------- | ------- |
| extra_settings | Extra settings | '' |
| Name | Description | Default |
| -------------- | -------------- | ------- |
| extra_settings | Extra settings | '' |
Example configuration of `extra_settings` parameter
@@ -793,9 +975,9 @@ Example configuration of `extra_settings` parameter
If you need to modify some `ServiceAccount` proprieties
| Name | Description | Default |
| ----------------------------- | -------------------------------------------------------- | ------- |
| service_account_annotations | Annotations to the ServiceAccount | '' |
| Name | Description | Default |
| --------------------------- | --------------------------------- | ------- |
| service_account_annotations | Annotations to the ServiceAccount | '' |
Example configuration of environment variables
@@ -834,6 +1016,21 @@ delete your existing `awx-operator` service account, role and role binding.
Starting with awx-operator 0.14.0, the project is now based on operator-sdk 1.x. You may need to manually delete your old operator Deployment to avoid issues.
##### Steps to upgrade
Delete your old AWX Operator and existing `awx-operator` service account, role and role binding in `default` namespace first:
```
$ kubectl -n default delete deployment awx-operator
$ kubectl -n default delete serviceaccount awx-operator
$ kubectl -n default delete clusterrolebinding awx-operator
$ kubectl -n default delete clusterrole awx-operator
```
Then install the new AWX Operator by following the instructions in [Basic Install](#basic-install-on-existing-cluster). The `NAMESPACE` environment variable have to be the name of the namespace in which your old AWX instance resides.
Once the new AWX Operator is up and running, your AWX deployment will also be upgraded.
## Contributing
Please visit [our contributing guidelines](https://github.com/ansible/awx-operator/blob/devel/CONTRIBUTING.md).
@@ -841,46 +1038,11 @@ Please visit [our contributing guidelines](https://github.com/ansible/awx-operat
## Release Process
### Update version and files
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.
Update the awx-operator version:
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.
- `Makefile`
### Verify Functionality
Run the following command inside this directory:
```
$ IMAGE_TAG_BASE=quay.io/<user>/awx-operator make docker-build docker-push
```
After it is built, test it on a local cluster:
```
$ minikube start --memory 6g --cpus 4
$ minikube addons enable ingress
$ export NAMESPACE=example-awx
$ make deploy
$ ansible-playbook ansible/instantiate-awx-deployment.yml -e namespace=$NAMESPACE -e image=quay.io/<user>/awx -e service_type=nodeport
$ # Verify that the awx-task and awx-web containers are launched
$ # with the right version of the awx image
$ # Launch a job at `minikube service awx-demo-service --url -n $NAMESPACE`
$ minikube delete
```
### Update changelog
Generate a list of commits between the versions and add it to the [changelog](./CHANGELOG.md).
```
$ git log --no-merges --pretty="- %s (%an) - %h " <old_tag>..<new_tag>
```
### Commit / Create Release
If everything works, commit the updated version, then [publish a new release](https://github.com/ansible/awx-operator/releases/new) using the same version you used in `ansible/group_vars/all`.
After creating the release, [this GitHub Workflow](https://github.com/ansible/awx-operator/blob/devel/.github/workflows/release.yaml) will run and publish the new image to quay.io.
After the draft release is created, publish it and the [Promote AWX Operator image](https://github.com/ansible/awx-operator/blob/devel/.github/workflows/promote.yaml) will run, publishing the image to Quay.
## Author

View File

@@ -67,6 +67,9 @@ spec:
extra_volumes:
description: Specify extra volumes to add to the application pod
type: string
service_annotations:
description: Annotations to add to the service
type: string
service_type:
description: The service type to be used on the deployed instance
type: string
@@ -89,15 +92,15 @@ spec:
ingress_path:
description: The ingress path used to reach the deployed service
type: string
ingress_path_type:
description: The ingress path type for the deployed service
type: string
ingress_annotations:
description: Annotations to add to the Ingress Controller
type: string
ingress_tls_secret:
description: Secret where the Ingress TLS secret can be found
type: string
loadbalancer_annotations:
description: Annotations to add to the loadbalancer
type: string
loadbalancer_protocol:
description: Protocol to use for the loadbalancer
type: string
@@ -131,9 +134,15 @@ spec:
node_selector:
description: nodeSelector for the pods
type: string
topology_spread_constraints:
description: topology rule(s) for the pods
type: string
service_labels:
description: Additional labels to apply to the service
type: string
annotations:
description: annotations for the pods
type: string
tolerations:
description: node tolerations for the pods
type: string
@@ -156,6 +165,9 @@ spec:
control_plane_ee_image:
description: Registry path to the Execution Environment container image to use on control plane pods
type: string
control_plane_priority_class:
description: Assign a preexisting priority class to the control plane pods
type: string
ee_pull_credentials_secret:
description: Secret where pull credentials for registered ees can be found
type: string
@@ -170,8 +182,13 @@ spec:
- never
- IfNotPresent
- ifnotpresent
image_pull_secret:
description: The image pull secret
image_pull_secrets:
description: Image pull secrets for app and database containers
type: array
items:
type: string
image_pull_secret: # deprecated
description: (Deprecated) Image pull secret for app and database containers
type: string
task_resource_requirements:
description: Resource requirements for the task container
@@ -239,6 +256,28 @@ spec:
type: string
type: object
type: object
postgres_init_container_resource_requirements:
description: Resource requirements for the postgres init container
properties:
requests:
properties:
cpu:
type: string
memory:
type: string
storage:
type: string
type: object
limits:
properties:
cpu:
type: string
memory:
type: string
storage:
type: string
type: object
type: object
service_account_annotations:
description: ServiceAccount annotations
type: string
@@ -292,6 +331,11 @@ spec:
redis_image_version:
description: Redis container image version to use
type: string
redis_capabilities:
description: Redis container capabilities
type: array
items:
type: string
init_container_image:
description: Registry path to the init container to use
type: string
@@ -351,9 +395,16 @@ spec:
postgres_storage_class:
description: Storage class to use for the PostgreSQL PVC
type: string
postgres_priority_class:
description: Assign a preexisting priority class to the postgres pod
type: string
postgres_data_path:
description: Path where the PostgreSQL data are located
type: string
postgres_extra_args:
type: array
items:
type: string
ca_trust_bundle:
description: Path where the trusted CA bundle is available
type: string
@@ -363,6 +414,9 @@ spec:
ldap_cacert_secret:
description: Secret where can be found the LDAP trusted Certificate Authority Bundle
type: string
ldap_password_secret:
description: Secret where can be found the LDAP bind password
type: string
bundle_cacert_secret:
description: Secret where can be found the trusted Certificate Authority Bundle
type: string
@@ -390,6 +444,12 @@ spec:
description: AccessMode for the /var/lib/projects PersistentVolumeClaim
default: ReadWriteMany
type: string
csrf_cookie_secure:
description: Set csrf cookie secure mode for web
type: string
session_cookie_secure:
description: Set session cookie secure mode for web
type: string
extra_settings:
description: Extra settings to specify for the API
items:
@@ -400,6 +460,10 @@ spec:
x-kubernetes-preserve-unknown-fields: true
type: object
type: array
security_context_settings:
description: Key/values that will be set under the pod-level securityContext field
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
status:
properties:

View File

@@ -21,7 +21,7 @@ spec:
- containerPort: 8443
protocol: TCP
name: https
- name: manager
- name: awx-manager
args:
- "--health-probe-bind-address=:6789"
- "--metrics-bind-address=127.0.0.1:8080"

View File

@@ -8,14 +8,14 @@ spec:
template:
spec:
containers:
- name: manager
- name: awx-manager
args:
- "--config=controller_manager_config.yaml"
volumeMounts:
- name: manager-config
- name: awx-manager-config
mountPath: /controller_manager_config.yaml
subPath: controller_manager_config.yaml
volumes:
- name: manager-config
- name: awx-manager-config
configMap:
name: manager-config
name: awx-manager-config

View File

@@ -5,10 +5,10 @@ generatorOptions:
configMapGenerator:
- files:
- controller_manager_config.yaml
name: manager-config
name: awx-manager-config
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/ansible/awx-operator
newTag: 0.14.0
newTag: latest

View File

@@ -30,10 +30,12 @@ spec:
- --leader-elect
- --leader-election-id=awx-operator
image: controller:latest
name: manager
name: awx-manager
env:
- name: ANSIBLE_GATHERING
value: explicit
- name: ANSIBLE_DEBUG_LOGS
value: 'false'
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
@@ -53,4 +55,6 @@ spec:
initialDelaySeconds: 5
periodSeconds: 10
serviceAccountName: controller-manager
imagePullSecrets:
- name: ansible-deployment-pull-secret
terminationGracePeriodSeconds: 10

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: null
name: manager-role
name: awx-manager-role
rules:
- apiGroups:
- route.openshift.io

View File

@@ -2,11 +2,11 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: manager-rolebinding
name: awx-manager-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: manager-role
name: awx-manager-role
subjects:
- kind: ServiceAccount
name: controller-manager

View File

@@ -4,12 +4,6 @@ kind: AWX
metadata:
name: example-awx
spec:
service_account_annotations: |
foo: bar
deployment_type: awx
ingress_type: ingress
ingress_annotations: |
kubernetes.io/ingress.class: nginx
web_resource_requirements:
requests:
cpu: 250m

View File

@@ -8,7 +8,7 @@ spec:
template:
spec:
containers:
- name: manager
- name: awx-manager
env:
- name: ANSIBLE_DEBUG_LOGS
value: "TRUE"

View File

@@ -8,5 +8,5 @@ spec:
template:
spec:
containers:
- name: manager
- name: awx-manager
image: testing

View File

@@ -8,5 +8,5 @@ spec:
template:
spec:
containers:
- name: manager
- name: awx-manager
imagePullPolicy: Always

View File

@@ -8,5 +8,5 @@ spec:
template:
spec:
containers:
- name: manager
- name: awx-manager
imagePullPolicy: IfNotPresent

View File

@@ -8,5 +8,5 @@ spec:
template:
spec:
containers:
- name: manager
- name: awx-manager
imagePullPolicy: Never

51
docs/debugging.md Normal file
View File

@@ -0,0 +1,51 @@
# 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.
Install some dependencies:
```
$ ansible-galaxy collection install -r molecule/requirements.yml
$ pip install -r molecule/requirements.txt
```
To prevent the changes we're about to make from being overwritten, scale down any running instance of the operator:
```
$ kubectl scale deployment awx-operator-controller-manager --replicas=0
```
Create a playbook that invokes the installer role (the operator uses ansible-runner's role execution feature):
```yaml
# run.yml
---
- hosts: localhost
roles:
- installer
```
Create a vars file:
```yaml
# vars.yml
---
ansible_operator_meta:
name: awx
namespace: awx
service_type: nodeport
```
Run the installer:
```
$ ansible-playbook run.yml -e @vars.yml -v
```
Grab the URL and admin password:
```
$ minikube service awx-service --url -n awx
$ minikube kubectl get secret awx-admin-password -- -o jsonpath="{.data.password}" | base64 --decode
LU6lTfvnkjUvDwL240kXKy1sNhjakZmT
```

View File

@@ -21,6 +21,9 @@ provisioner:
namespace: ${TEST_OPERATOR_NAMESPACE:-osdk-test}
host_vars:
localhost:
awx_image: ${AWX_TEST_IMAGE:-""}
awx_version: ${AWX_TEST_VERSION:-""}
default_awx_version: "{{ lookup('url', 'https://api.github.com/repos/ansible/awx/releases/latest') | from_json | json_query('tag_name') }}"
ansible_python_interpreter: '{{ ansible_playbook_python }}'
config_dir: ${MOLECULE_PROJECT_DIRECTORY}/config
samples_dir: ${MOLECULE_PROJECT_DIRECTORY}/config/samples

View File

@@ -3,15 +3,13 @@
k8s:
state: present
namespace: '{{ namespace }}'
definition: "{{ lookup('template', '/'.join([samples_dir, cr_file])) | from_yaml }}"
definition: "{{ lookup('template', 'awx_cr_molecule.yml.j2') | from_yaml }}"
wait: yes
wait_timeout: 900
wait_condition:
type: Running
reason: Successful
status: "True"
vars:
cr_file: 'awx_v1beta1_awx.yaml'
- name: Obtain generated admin password
k8s_info:
@@ -20,11 +18,68 @@
name: example-awx-admin-password
register: admin_pw_secret
- name: Launch Demo Job Template
awx.awx.job_launch:
name: Demo Job Template
wait: yes
validate_certs: no
controller_host: localhost
controller_username: admin
controller_password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
- block:
- name: Get pod details
k8s_info:
namespace: '{{ namespace }}'
kind: Pod
label_selectors:
- app.kubernetes.io/name = example-awx
register: awx_pod
when: not awx_version
- name: Exract tags from images
set_fact:
image_tags: |
{{ awx_pod.resources[0].spec.containers |
map(attribute='image') |
map('regex_search', default_awx_version) }}
when: not awx_version
- fail:
msg: |
It looks like you may have broken the DEFAULT_AWX_VERSION functionality.
This is an environment variable that is set via build arg when releasing awx-operator.
when:
- not awx_version
- default_awx_version not in image_tags
- name: Launch Demo Job Template
awx.awx.job_launch:
name: Demo Job Template
wait: yes
validate_certs: no
controller_host: localhost
controller_username: admin
controller_password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
rescue:
- name: Get list of project updates and jobs
uri:
url: "http://localhost/api/v2/{{ resource }}/"
user: admin
password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
force_basic_auth: yes
register: job_lists
loop:
- project_updates
- jobs
loop_control:
loop_var: resource
- name: Get all job and project details
uri:
url: "http://localhost{{ endpoint }}"
user: admin
password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
force_basic_auth: yes
loop: |
{{ job_lists.results | map(attribute='json') | map(attribute='results') | flatten | map(attribute='url') }}
loop_control:
loop_var: endpoint
- name: Re-emit failure
vars:
failed_task:
result: '{{ ansible_failed_result }}'
fail:
msg: '{{ failed_task }}'

View File

@@ -0,0 +1,29 @@
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: example-awx
spec:
{% if awx_image %}
image: {{ awx_image }}
{% endif %}
{% if awx_version %}
image_version: {{ awx_version }}
{% endif %}
ingress_type: ingress
ingress_annotations: |
kubernetes.io/ingress.class: nginx
web_resource_requirements:
requests:
cpu: 100m
memory: 32M
task_resource_requirements:
requests:
cpu: 100m
memory: 32M
ee_resource_requirements:
requests:
cpu: 200m
memory: 32M
postgres_resource_requirements: {}
postgres_init_container_resource_requirements: {}

View File

@@ -36,7 +36,7 @@
k8s_log:
name: '{{ item.metadata.name }}'
namespace: '{{ namespace }}'
container: manager
container: awx-manager
loop: "{{ q('k8s', api_version='v1', kind='Pod', namespace=namespace, label_selector=ctrl_label) }}"
register: debug_logs

View File

@@ -10,15 +10,25 @@
build:
path: '{{ project_dir }}'
pull: no
args:
DEFAULT_AWX_VERSION: '{{ default_awx_version }}'
name: '{{ operator_image }}'
tag: latest
push: no
source: build
force_source: yes
- name: Load image into kind cluster
- name: Load operator image into kind cluster
command: kind load docker-image --name osdk-test '{{ operator_image }}'
register: result
changed_when: '"not yet present" in result.stdout'
- name: Load awx image into kind cluster
command: kind load docker-image --name osdk-test '{{ awx_image }}:{{ awx_version }}'
register: result
changed_when: '"not yet present" in result.stdout'
when:
- awx_image is defined
- awx_image != ''
- import_playbook: ../default/converge.yml

View File

@@ -23,7 +23,10 @@ provisioner:
namespace: ${TEST_OPERATOR_NAMESPACE:-osdk-test}
host_vars:
localhost:
awx_image: ${AWX_TEST_IMAGE:-""}
awx_version: ${AWX_TEST_VERSION:-""}
ansible_python_interpreter: '{{ ansible_playbook_python }}'
default_awx_version: "{{ lookup('url', 'https://api.github.com/repos/ansible/awx/releases/latest') | from_json | json_query('tag_name') }}"
config_dir: ${MOLECULE_PROJECT_DIRECTORY}/config
samples_dir: ${MOLECULE_PROJECT_DIRECTORY}/config/samples
project_dir: ${MOLECULE_PROJECT_DIRECTORY}

View File

@@ -2,6 +2,6 @@ molecule
molecule-docker
yamllint
ansible-lint
openshift
openshift!=0.13.0
jmespath
ansible-core

0
projects/.gitkeep Normal file → Executable file
View File

View File

@@ -63,6 +63,21 @@
when:
- backup_pvc == '' or backup_pvc is not defined
- name: Set default postgres image
set_fact:
_default_postgres_image: "{{ _postgres_image }}:{{_postgres_image_version }}"
- name: Set user provided postgres image
set_fact:
_custom_postgres_image: "{{ postgres_image }}:{{ postgres_image_version }}"
when:
- postgres_image | default([]) | length
- postgres_image_version is defined and postgres_image_version != ''
- name: Set Postgres image URL
set_fact:
_postgres_image: "{{ _custom_postgres_image | default(lookup('env', 'RELATED_IMAGE_AWX_POSTGRES')) | default(_default_postgres_image, true) }}"
- name: Create management pod from templated deployment config
k8s:
name: "{{ ansible_operator_meta.name }}-db-management"

View File

@@ -39,6 +39,7 @@
until:
- "postgres_pod['resources'] | length"
- "postgres_pod['resources'][0]['status']['phase'] == 'Running'"
- "postgres_pod['resources'][0]['status']['containerStatuses'][0]['ready'] == true"
delay: 5
retries: 60
@@ -99,7 +100,7 @@
command: |
bash -c """
set -e -o pipefail
PGPASSWORD={{ awx_postgres_pass }} {{ pgdump }} > {{ backup_dir }}/tower.db
PGPASSWORD='{{ awx_postgres_pass }}' {{ pgdump }} > {{ backup_dir }}/tower.db
echo 'Successful'
"""
register: data_migration

View File

@@ -21,9 +21,21 @@
- ingress_tls_secret
- ldap_cacert_secret
- bundle_cacert_secret
- image_pull_secret
- ee_pull_credentials_secret
# image_pull_secret is deprecated in favor of image_pull_secrets
- name: Dump image_pull_secret into file
include_tasks: dump_secret.yml
with_items:
- image_pull_secret
when: image_pull_secret is defined
- name: Dump image_pull_secrets into file
include_tasks: dump_secret.yml
with_items:
- image_pull_secrets
when: image_pull_secrets | default([]) | length
- name: Nest secrets under a single variable
set_fact:
secrets: {"secrets": '{{ secret_dict }}'}

View File

@@ -13,7 +13,7 @@ metadata:
spec:
containers:
- name: {{ ansible_operator_meta.name }}-db-management
image: "{{ postgres_image }}:{{ postgres_image_version }}"
image: "{{ _postgres_image }}"
imagePullPolicy: Always
command: ["sleep", "infinity"]
volumeMounts:

View File

@@ -1,6 +1,6 @@
---
deployment_type: "awx"
postgres_image: postgres
postgres_image_version: 12
_postgres_image: postgres
_postgres_image_version: 12
backup_complete: false
database_type: "unmanaged"

View File

@@ -10,6 +10,7 @@ task_privileged: false
service_type: ClusterIP
ingress_type: none
ingress_path: '/'
ingress_path_type: 'Prefix'
# 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>
@@ -35,7 +36,7 @@ ingress_tls_secret: ''
loadbalancer_protocol: 'http'
loadbalancer_port: '80'
loadbalancer_annotations: ''
service_annotations: ''
nodeport_port: '30080'
# The TLS termination mechanism to use to access
@@ -63,6 +64,17 @@ hostname: ''
# kubernetes.io/os: linux
node_selector: ''
# Add a topologySpreadConstraints for the AWX pods.
# Specify as literal block. E.g.:
# topology_spread_constraints: |
# - maxSkew: 100
# topologyKey: "topology.kubernetes.io/zone"
# whenUnsatisfiable: "ScheduleAnyway"
# labelSelector:
# matchLabels:
# app.kubernetes.io/name: "<resourcename>"
topology_spread_constraints: ''
# Add node tolerations for the AWX pods. Specify as literal block. E.g.:
# tolerations: |
# - key: "dedicated"
@@ -71,6 +83,12 @@ node_selector: ''
# effect: "NoSchedule"
tolerations: ''
# Add annotations to awx pods. Specify as literal block. E.g.:
# annotations: |
# my.annotation/1: value
# my.annotation/2: value2
annotations: ''
admin_user: admin
admin_email: test@example.com
@@ -106,16 +124,16 @@ extra_volumes: ''
# Use these image versions for Ansible AWX.
image: quay.io/ansible/awx
image_version: 19.4.0
redis_image: docker.io/redis
redis_image_version: latest
postgres_image: postgres
postgres_image_version: 12
init_container_image: quay.io/centos/centos
init_container_image_version: 8
_image: quay.io/ansible/awx
_image_version: "{{ lookup('env', 'DEFAULT_AWX_VERSION') or 'latest' }}"
_redis_image: docker.io/redis
_redis_image_version: latest
_postgres_image: postgres
_postgres_image_version: 12
_init_container_image: quay.io/centos/centos
_init_container_image_version: stream8
image_pull_policy: IfNotPresent
image_pull_secret: ''
image_pull_secrets: []
# Extra commands which will be appended to the initContainer
# Make sure that each command entered return an exit code 0
@@ -137,7 +155,7 @@ ee_images:
- name: AWX EE (latest)
image: quay.io/ansible/awx-ee:latest
control_plane_ee_image: quay.io/ansible/awx-ee:latest
_control_plane_ee_image: quay.io/ansible/awx-ee:latest
create_preload_data: true
@@ -151,19 +169,25 @@ web_command: []
task_resource_requirements:
requests:
cpu: 500m
memory: 1Gi
cpu: 100m
memory: 128Mi
web_resource_requirements:
requests:
cpu: 1000m
memory: 2Gi
cpu: 100m
memory: 128Mi
ee_resource_requirements:
requests:
cpu: 500m
memory: 1Gi
cpu: 100m
memory: 64Mi
# Customize CSRF options
csrf_cookie_secure: False
session_cookie_secure: False
# Assign a preexisting priority class to the control plane pods
control_plane_priority_class: ''
# Add extra environment variables to the AWX task/web containers. Specify as
# literal block. E.g.:
# task_extra_env: |
@@ -204,7 +228,16 @@ postgres_tolerations: ''
postgres_storage_requirements:
requests:
storage: 8Gi
postgres_resource_requirements: {}
postgres_resource_requirements:
requests:
cpu: 10m
memory: 64Mi
postgres_init_container_resource_requirements:
requests:
cpu: 10m
memory: 64Mi
# Assign a preexisting priority class to the postgres pod
postgres_priority_class: ''
postgres_data_path: '/var/lib/postgresql/data/pgdata'
# Persistence to the AWX project data folder
@@ -214,6 +247,9 @@ projects_persistence: false
# Define an existing PersistentVolumeClaim to use
projects_existing_claim: ''
#
# Define postgres configuration arguments to use
postgres_extra_args: ''
# Define the storage_class, size and access_mode
# when not using an existing claim
projects_storage_size: 8Gi
@@ -225,6 +261,9 @@ ca_trust_bundle: "/etc/pki/tls/certs/ca-bundle.crt"
#
ldap_cacert_secret: ''
# Secret to lookup that provides the LDAP bind password
ldap_password_secret: ''
# Secret to lookup that provides the custom CA trusted bundle
bundle_cacert_secret: ''
@@ -234,3 +273,5 @@ bundle_cacert_secret: ''
garbage_collect_secrets: false
development_mode: false
security_context_settings: {}

View File

@@ -47,11 +47,26 @@
- old_pg_config['resources'] | length
no_log: true
- name: Set default postgres image
set_fact:
_default_postgres_image: "{{ _postgres_image }}:{{_postgres_image_version }}"
- name: Set PostgreSQL configuration
set_fact:
_pg_config: '{{ _custom_pg_config_resources["resources"] | default([]) | length | ternary(_custom_pg_config_resources, _default_pg_config_resources) }}'
no_log: true
- name: Set user provided postgres image
set_fact:
_custom_postgres_image: "{{ postgres_image }}:{{ postgres_image_version }}"
when:
- postgres_image | default([]) | length
- postgres_image_version is defined and postgres_image_version != ''
- name: Set Postgres image URL
set_fact:
_postgres_image: "{{ _custom_postgres_image | default(lookup('env', 'RELATED_IMAGE_AWX_POSTGRES')) | default(_default_postgres_image, true) }}"
- block:
- name: Create Database configuration
k8s:
@@ -84,6 +99,10 @@
definition: "{{ lookup('template', 'postgres.yaml.j2') }}"
register: create_statefulset_result
- name: Scale down Deployment for migration
include_tasks: scale_down_deployment.yml
when: create_statefulset_result.changed
rescue:
- name: Scale down Deployment for migration
include_tasks: scale_down_deployment.yml
@@ -123,6 +142,26 @@
awx_postgres_sslmode: "{{ pg_config['resources'][0]['data']['sslmode'] | default('prefer'|b64encode) | b64decode }}"
no_log: true
- 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
field_selectors:
- status.phase=Running
register: postgres_pod
until:
- "postgres_pod['resources'] | length"
- "postgres_pod['resources'][0]['status']['phase'] == 'Running'"
- "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' }}"
- name: Look up details for this deployment
k8s_info:
api_version: "{{ api_version }}"

View File

@@ -13,18 +13,6 @@
register: users_result
changed_when: users_result.return_code > 0
- name: Update super user password via Django if it does exist (same password is a noop)
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: >-
bash -c "awx-manage update_password --username '{{ admin_user }}' --password '{{ admin_password }}'"
register: update_pw_result
changed_when: users_result.stdout == 'Password not updated'
no_log: true
when: users_result.return_code == 0
- name: Create super user via Django if it doesn't exist.
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
@@ -37,17 +25,6 @@
no_log: true
when: users_result.return_code > 0
- name: Create preload data if necessary. # noqa 305
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: >-
bash -c "awx-manage create_preload_data"
register: cdo
changed_when: "'added' in cdo.stdout"
when: create_preload_data | bool
- name: Check if legacy queue is present
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
@@ -118,3 +95,14 @@
changed_when: "'changed: True' in ree.stdout"
no_log: true
when: _execution_environments_pull_credentials['resources'] | default([]) | length
- name: Create preload data if necessary. # noqa 305
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: >-
bash -c "awx-manage create_preload_data"
register: cdo
changed_when: "'added' in cdo.stdout"
when: create_preload_data | bool

View File

@@ -0,0 +1,14 @@
---
- name: Retrieve LDAP bind password Secret
k8s_info:
kind: Secret
namespace: '{{ ansible_operator_meta.namespace }}'
name: '{{ ldap_password_secret }}'
register: ldap_password
no_log: true
- name: Load LDAP bind password Secret content
set_fact:
ldap_bind_password: '{{ ldap_password["resources"][0]["data"]["ldap-password"] | b64decode }}'
no_log: true
when: '"ldap-password" in ldap_password["resources"][0]["data"]'

View File

@@ -25,6 +25,11 @@
when:
- ldap_cacert_secret != ''
- name: Load ldap bind password
include_tasks: load_ldap_password_secret.yml
when:
- ldap_password_secret != ''
- name: Load bundle certificate authority certificate
include_tasks: load_bundle_cacert_secret.yml
when:
@@ -36,6 +41,9 @@
- name: Include broadcast websocket configuration tasks
include_tasks: broadcast_websocket_configuration.yml
- name: Include set_images tasks
include_tasks: set_images.yml
- name: Include database configuration tasks
include_tasks: database_configuration.yml

View File

@@ -29,6 +29,7 @@
until:
- "postgres_pod['resources'] | length"
- "postgres_pod['resources'][0]['status']['phase'] == 'Running'"
- "postgres_pod['resources'][0]['status']['containerStatuses'][0]['ready'] == true"
delay: 5
retries: 60
@@ -65,7 +66,7 @@
command: |
bash -c """
set -e -o pipefail
PGPASSWORD={{ awx_old_postgres_pass }} {{ pgdump }} | PGPASSWORD={{ awx_postgres_pass }} {{ pg_restore }}
PGPASSWORD='{{ awx_old_postgres_pass }}' {{ pgdump }} | PGPASSWORD='{{ awx_postgres_pass }}' {{ pg_restore }}
echo 'Successful'
"""
no_log: true

View File

@@ -17,6 +17,16 @@
set_fact:
tower_pod_name: "{{ tower_pods['resources'][0]['metadata']['name'] | default('') }}"
- name: Set user provided control plane ee image
set_fact:
_custom_control_plane_ee_image: "{{ control_plane_ee_image }}"
when:
- control_plane_ee_image | default([]) | length
- name: Set Control Plane EE image URL
set_fact:
_control_plane_ee_image: "{{ _custom_control_plane_ee_image | default(lookup('env', 'RELATED_IMAGE_CONTROL_PLANE_EE')) | default(_control_plane_ee_image, true) }}"
- name: Apply Resources
k8s:
apply: yes
@@ -32,6 +42,36 @@
- 'ingress'
no_log: true
- name: Set default awx app image
set_fact:
_default_image: "{{ _image }}:{{ _image_version }}"
- name: Set user provided awx app image
set_fact:
_custom_image: "{{ image }}:{{ image_version }}"
when:
- image | default([]) | length
- image_version is defined or image_version != ''
- name: Set AWX app image URL
set_fact:
_image: "{{ _custom_image | default(lookup('env', 'RELATED_IMAGE_AWX')) | default(_default_image, true) }}"
- name: Set default redis image
set_fact:
_default_redis_image: "{{ _redis_image }}:{{ _redis_image_version }}"
- name: Set user provided redis image
set_fact:
_custom_redis_image: "{{ redis_image }}:{{ redis_image_version }}"
when:
- redis_image | default([]) | length
- redis_image_version is defined or redis_image_version != ''
- name: Set Redis image URL
set_fact:
_redis_image: "{{ _custom_redis_image | default(lookup('env', 'RELATED_IMAGE_AWX_REDIS')) | default(_default_redis_image, true) }}"
- name: Apply deployment resources
k8s:
apply: yes

View File

@@ -0,0 +1,19 @@
# For disconnected environments, images must be set based on the values of `RELATED_IMAGE_` variables
---
- name: Set default awx init container image
set_fact:
_default_init_container_image: "{{ _init_container_image }}:{{ _init_container_image_version }}"
- name: Set user provided awx init image
set_fact:
_custom_init_container_image: "{{ init_container_image }}:{{ init_container_image_version }}"
when:
- init_container_image | default([]) | length
- init_container_image_version is defined or init_container_image_version != ''
- name: Set Init image URL
set_fact:
_init_container_image: >-
{{ _custom_init_container_image |
default(lookup('env', 'RELATED_IMAGE_AWX_INIT_CONTAINER')) |
default(_default_init_container_image, true) }}

View File

@@ -70,7 +70,7 @@
name: "{{ ansible_operator_meta.name }}"
namespace: "{{ ansible_operator_meta.namespace }}"
status:
image: "{{ image }}"
image: "{{ _custom_image | default(lookup('env', 'RELATED_IMAGE_AWX')) | default(_default_image, true) }}"
- block:
- name: Retrieve route URL

View File

@@ -18,6 +18,7 @@ data:
settings: |
import os
import socket
from django_auth_ldap.config import LDAPSearch
def get_secret():
if os.path.exists("/etc/tower/SECRET_KEY"):
@@ -25,11 +26,22 @@ data:
ADMINS = ()
STATIC_ROOT = '/var/lib/awx/public/static'
STATIC_URL = '{{ (ingress_path + '/static/').replace('//', '/') }}'
PROJECTS_ROOT = '/var/lib/awx/projects'
JOBOUTPUT_ROOT = '/var/lib/awx/job_status'
IS_K8S = True
# Set memory available based off of resource request/limit for the task pod
memory_limit = '{{ task_resource_requirements["limits"]["memory"] if "limits" in task_resource_requirements and "memory" in task_resource_requirements["limits"] }}'
if memory_limit:
SYSTEM_TASK_ABS_MEM = memory_limit
# Set cpu available based off of resource request/limit for the task pod
cpu_limit = '{{ task_resource_requirements["limits"]["cpu"] if "limits" in task_resource_requirements and "cpu" in task_resource_requirements["limits"] }}'
if cpu_limit:
SYSTEM_TASK_ABS_CPU = cpu_limit
SECRET_KEY = get_secret()
ALLOWED_HOSTS = ['*']
@@ -48,8 +60,8 @@ data:
CLUSTER_HOST_ID = socket.gethostname()
SYSTEM_UUID = os.environ.get('MY_POD_UID', '00000000-0000-0000-0000-000000000000')
CSRF_COOKIE_SECURE = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = {{ csrf_cookie_secure | bool }}
SESSION_COOKIE_SECURE = {{ session_cookie_secure | bool }}
SERVER_EMAIL = 'root@localhost'
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
@@ -172,15 +184,15 @@ data:
deny all;
}
location /static/ {
location {{ (ingress_path + '/static').replace('//', '/') }} {
alias /var/lib/awx/public/static/;
}
location /favicon.ico {
location {{ (ingress_path + '/favicon.ico').replace('//', '/') }} {
alias /var/lib/awx/public/static/media/favicon.ico;
}
location /websocket {
location {{ (ingress_path + '/websocket').replace('//', '/') }} {
# Pass request to the upstream alias
proxy_pass http://daphne;
# Require http version 1.1 to allow for upgrade requests
@@ -202,7 +214,7 @@ data:
proxy_set_header Connection $connection_upgrade;
}
location / {
location {{ ingress_path }} {
# Add trailing / if missing
rewrite ^(.*)$http_host(.*[^/])$ $1$http_host$2/ permanent;
uwsgi_read_timeout 120s;

View File

@@ -7,7 +7,7 @@ metadata:
namespace: '{{ ansible_operator_meta.namespace }}'
labels:
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/version: '{{ image_version }}'
app.kubernetes.io/version: '{{ _image.split(':')[-1] | truncate(63, True, '') }}'
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
app.kubernetes.io/component: '{{ deployment_type }}'
@@ -23,20 +23,32 @@ spec:
metadata:
labels:
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/version: '{{ image_version }}'
app.kubernetes.io/version: '{{ _image.split(':')[-1] | truncate(63, True, '') }}'
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
app.kubernetes.io/component: '{{ deployment_type }}'
{% if annotations %}
annotations:
{{ annotations | indent(width=8) }}
{% endif %}
spec:
serviceAccountName: '{{ ansible_operator_meta.name }}'
{% if image_pull_secret %}
{% if image_pull_secret is defined %}
imagePullSecrets:
- name: {{ image_pull_secret }}
{% elif image_pull_secrets | length > 0 %}
imagePullSecrets:
{% for secret in image_pull_secrets %}
- name: {{ secret }}
{% endfor %}
{% endif %}
{% if control_plane_priority_class is defined %}
priorityClassName: '{{ control_plane_priority_class }}'
{% endif %}
{% if bundle_ca_crt or projects_persistence|bool or init_container_extra_commands %}
initContainers:
{% if bundle_ca_crt or projects_persistence|bool or init_container_extra_commands %}
- name: init
image: '{{ init_container_image }}:{{ init_container_image_version }}'
image: '{{ _init_container_image }}'
imagePullPolicy: '{{ image_pull_policy }}'
command:
- /bin/sh
@@ -71,9 +83,14 @@ spec:
{% endif %}
{% endif %}
containers:
- image: '{{ redis_image }}:{{ redis_image_version }}'
- image: '{{ _redis_image }}'
imagePullPolicy: '{{ image_pull_policy }}'
name: redis
{% if redis_capabilities is defined and redis_capabilities %}
securityContext:
capabilities:
add: {{ redis_capabilities }}
{% endif %}
args: ["redis-server", "/etc/redis.conf"]
volumeMounts:
- name: {{ ansible_operator_meta.name }}-redis-config
@@ -84,7 +101,7 @@ spec:
mountPath: "/var/run/redis"
- name: "{{ ansible_operator_meta.name }}-redis-data"
mountPath: "/data"
- image: '{{ image }}:{{ image_version }}'
- image: '{{ _image }}'
name: '{{ ansible_operator_meta.name }}-web'
{% if web_command %}
command: {{ web_command }}
@@ -164,6 +181,8 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: UWSGI_MOUNT_PATH
value: "{{ ingress_path }}"
{% if development_mode | bool %}
- name: AWX_KUBE_DEVEL
value: "1"
@@ -172,7 +191,7 @@ spec:
{{ web_extra_env | indent(width=12, indentfirst=True) }}
{% endif %}
resources: {{ web_resource_requirements }}
- image: '{{ image }}:{{ image_version }}'
- image: '{{ _image }}'
name: '{{ ansible_operator_meta.name }}-task'
imagePullPolicy: '{{ image_pull_policy }}'
{% if task_privileged == true %}
@@ -262,7 +281,7 @@ spec:
{{ task_extra_env | indent(width=12, indentfirst=True) }}
{% endif %}
resources: {{ task_resource_requirements }}
- image: '{{ control_plane_ee_image }}'
- image: '{{ _control_plane_ee_image }}'
name: '{{ ansible_operator_meta.name }}-ee'
imagePullPolicy: '{{ image_pull_policy }}'
resources: {{ ee_resource_requirements }}
@@ -301,13 +320,22 @@ spec:
nodeSelector:
{{ node_selector | indent(width=8) }}
{% endif %}
{% if topology_spread_constraints %}
topologySpreadConstraints:
{{ topology_spread_constraints | indent(width=8) }}
{% endif %}
{% if tolerations %}
tolerations:
{{ tolerations | indent(width=8) }}
{% endif %}
{% if projects_persistence|bool %}
{% if projects_persistence|bool or (security_context_settings|length) %}
securityContext:
{% if projects_persistence|bool %}
fsGroup: 1000
{% endif %}
{% if security_context_settings|length %}
{{ security_context_settings | to_nice_yaml | indent(8) }}
{% endif %}
{% endif %}
volumes:
{% if bundle_ca_crt %}

View File

@@ -3,4 +3,4 @@ GLOBAL_JOB_EXECUTION_ENVIRONMENTS = [
{'name': '{{ item.name }}' , 'image': '{{ item.image }}'},
{% endfor %}
]
CONTROL_PLANE_EXECUTION_ENVIRONMENT = '{{ control_plane_ee_image }}'
CONTROL_PLANE_EXECUTION_ENVIRONMENT = "{{ _custom_control_plane_ee_image | default(lookup('env', 'RELATED_IMAGE_CONTROL_PLANE_EE')) | default(_control_plane_ee_image, true) }}"

View File

@@ -20,7 +20,7 @@ spec:
- http:
paths:
- path: '{{ ingress_path }}'
pathType: Prefix
pathType: '{{ ingress_path_type }}'
backend:
service:
name: '{{ ansible_operator_meta.name }}-service'

View File

@@ -33,14 +33,39 @@ spec:
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
spec:
{% if image_pull_secret %}
{% if image_pull_secret is defined %}
imagePullSecrets:
- name: {{ image_pull_secret }}
{% elif image_pull_secrets | length > 0 %}
imagePullSecrets:
{% for secret in image_pull_secrets %}
- name: {{ secret }}
{% endfor %}
{% endif %}
{% if postgres_priority_class is defined %}
priorityClassName: '{{ postgres_priority_class }}'
{% endif %}
initContainers:
- name: database-check
image: '{{ _init_container_image }}'
resources: {{ postgres_init_container_resource_requirements }}
imagePullPolicy: '{{ image_pull_policy }}'
command:
- /bin/sh
- -c
- |
[[ -d /check-db/pgsql/data ]] && rm -rf /check-db/data && mv /check-db/pgsql/data/ /check-db/data/ && rm -rf /check-db/pgsql || exit 0
volumeMounts:
- name: postgres
mountPath: /check-db
subPath: ''
containers:
- image: '{{ postgres_image }}:{{ postgres_image_version }}'
- image: '{{ _postgres_image }}'
imagePullPolicy: '{{ image_pull_policy }}'
name: postgres
{% if postgres_extra_args %}
args: {{ postgres_extra_args }}
{% endif %}
env:
# For postgres_image based on rhel8/postgresql-12
- name: POSTGRESQL_DATABASE

View File

@@ -11,13 +11,20 @@ metadata:
app.kubernetes.io/component: '{{ deployment_type }}'
app.kubernetes.io/operator-version: '{{ lookup("env", "OPERATOR_VERSION") }}'
{{ service_labels | indent(width=4) }}
{% if service_type | lower == 'loadbalancer' and loadbalancer_annotations %}
{% if service_annotations %}
annotations:
{{ loadbalancer_annotations | indent(width=4) }}
{{ service_annotations | indent(width=4) }}
{% endif %}
spec:
ports:
{% if service_type | lower != 'loadbalancer' and loadbalancer_protocol | lower != 'https' %}
{% if service_type | lower == "nodeport" %}
- port: 80
protocol: TCP
targetPort: 8052
name: http
nodePort: {{ nodeport_port }}
{% elif service_type | lower != 'loadbalancer' and loadbalancer_protocol | lower != 'https' %}
- port: 80
protocol: TCP
targetPort: 8052
@@ -44,10 +51,10 @@ spec:
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
app.kubernetes.io/component: '{{ deployment_type }}'
{% if service_type | lower == "loadbalancer" %}
type: LoadBalancer
{% elif service_type | lower == "nodeport" %}
{% if service_type | lower == "nodeport" %}
type: NodePort
{% elif service_type | lower == "loadbalancer" %}
type: LoadBalancer
{% else %}
type: ClusterIP
{% endif %}

View File

@@ -71,6 +71,21 @@
force: true
wait: true
- name: Set default postgres image
set_fact:
_default_postgres_image: "{{ _postgres_image }}:{{_postgres_image_version }}"
- name: Set user provided postgres image
set_fact:
_custom_postgres_image: "{{ postgres_image }}:{{ postgres_image_version }}"
when:
- postgres_image | default([]) | length
- postgres_image_version is defined and postgres_image_version != ''
- name: Set Postgres image URL
set_fact:
_postgres_image: "{{ _custom_postgres_image | default(lookup('env', 'RELATED_IMAGE_AWX_POSTGRES')) | default(_default_postgres_image, true) }}"
- name: Create management pod from templated deployment config
k8s:
name: "{{ ansible_operator_meta.name }}-db-management"

View File

@@ -37,6 +37,7 @@
until:
- "postgres_pod['resources'] | length"
- "postgres_pod['resources'][0]['status']['phase'] == 'Running'"
- "postgres_pod['resources'][0]['status']['containerStatuses'][0]['ready'] == true"
delay: 5
retries: 60
@@ -86,7 +87,7 @@
command: |
bash -c """
set -e -o pipefail
cat {{ backup_dir }}/tower.db | PGPASSWORD={{ awx_postgres_pass }} {{ pg_restore }}
cat {{ backup_dir }}/tower.db | PGPASSWORD='{{ awx_postgres_pass }}' {{ pg_restore }}
echo 'Successful'
"""
register: data_migration

View File

@@ -13,7 +13,7 @@ metadata:
spec:
containers:
- name: {{ ansible_operator_meta.name }}-db-management
image: "{{ postgres_image }}:{{ postgres_image_version }}"
image: "{{ _postgres_image }}"
imagePullPolicy: Always
command: ["sleep", "infinity"]
volumeMounts:

View File

@@ -1,8 +1,8 @@
---
deployment_type: "awx"
postgres_image: postgres
postgres_image_version: 12
_postgres_image: postgres
_postgres_image_version: 12
backup_api_version: '{{ deployment_type }}.ansible.com/v1beta1'
backup_kind: 'AWXBackup'

View File

@@ -4,14 +4,17 @@
group: awx.ansible.com
kind: AWX
role: installer
snakeCaseParameters: False
- version: v1beta1
group: awx.ansible.com
kind: AWXBackup
role: backup
snakeCaseParameters: False
- version: v1beta1
group: awx.ansible.com
kind: AWXRestore
role: restore
snakeCaseParameters: False
# +kubebuilder:scaffold:watch