Compare commits

..

40 Commits

Author SHA1 Message Date
Christian Adams
19c6c77c41 Add ability to configmap and include config files for nginx.conf (#1145) 2022-12-16 10:36:29 -05:00
Mathijsvw
4ee523ed69 Added pg_dump_suffix doc and crd property (#1006)
* Added pg_dump_suffix crd property

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

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

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

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

* Update awx.ansible.com_awxrestores.yaml

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

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

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

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
2022-10-04 14:10:07 -04:00
Dimitri Savineau
13b45cbb12 Merge pull request #1069 from rooftopcellist/no_log_more
More no_log default updates
2022-10-04 11:49:54 -04:00
Christian M. Adams
d3ca9c57c9 One more no_log default update 2022-10-04 11:36:56 -04:00
Christian Adams
9b1b5e676d Change no_log type to boolean (#1068) 2022-10-04 10:48:51 -04:00
33 changed files with 904 additions and 164 deletions

View File

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

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

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

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

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

View File

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

View File

@@ -1,4 +1,4 @@
FROM quay.io/operator-framework/ansible-operator:v1.23.0
FROM quay.io/operator-framework/ansible-operator:v1.25.3
USER 0

View File

@@ -140,7 +140,7 @@ ifeq (,$(shell which kustomize 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(KUSTOMIZE)) ;\
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.5/kustomize_v4.5.5_$(OS)_$(ARCHA).tar.gz | \
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.7/kustomize_v4.5.7_$(OS)_$(ARCHA).tar.gz | \
tar xzf - -C bin/ ;\
}
else
@@ -156,7 +156,7 @@ ifeq (,$(shell which ansible-operator 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(ANSIBLE_OPERATOR)) ;\
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.23.0/ansible-operator_$(OS)_$(ARCHA) ;\
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.25.3/ansible-operator_$(OS)_$(ARCHA) ;\
chmod +x $(ANSIBLE_OPERATOR) ;\
}
else
@@ -187,7 +187,7 @@ ifeq (,$(shell which opm 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(OPM)) ;\
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$(OS)-$(ARCHA)-opm ;\
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.25.3/$(OS)-$(ARCHA)-opm ;\
chmod +x $(OPM) ;\
}
else
@@ -296,8 +296,8 @@ helm-chart: helm-chart-generate
helm-chart-generate: kustomize helm kubectl-slice yq charts
@echo "== KUSTOMIZE: Set image and chart label =="
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
cd config/manager && $(KUSTOMIZE) edit set label helm.sh/chart:$(CHART_NAME)-$(VERSION)
cd config/default && $(KUSTOMIZE) edit set label helm.sh/chart:$(CHART_NAME)-$(VERSION)
cd config/manager && $(KUSTOMIZE) edit set label helm.sh/chart:$(CHART_NAME)
cd config/default && $(KUSTOMIZE) edit set label helm.sh/chart:$(CHART_NAME)
@echo "== Gather Helm Chart Metadata =="
# remove the existing chart if it exists
@@ -355,7 +355,7 @@ helm-package: cr helm-chart
$(CR) package ./charts/awx-operator
# List all tags oldest to newest.
TAGS := $(shell git tag -l --sort=creatordate)
TAGS := $(shell git ls-remote --tags --sort=version:refname --refs -q | cut -d/ -f3)
# The actual release happens in ansible/helm-release.yml
# until https://github.com/helm/chart-releaser/issues/122 happens

View File

@@ -203,6 +203,20 @@ spec:
> It may make sense to create and specify your own secret key for your deployment so that if the k8s secret gets deleted, it can be re-created if needed. If it is not provided, one will be auto-generated, but cannot be recovered if lost. Read more [here](#secret-key-configuration).
If you are on Openshift, you can take advantage of Routes by specifying the following your spec. This will automatically create a Route for you with a custom hostname. This can be found on the Route section of the Openshift Console.
```yaml
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: awx-demo
spec:
service_type: clusterip
ingress_type: Route
```
Make sure to add this new file to the list of "resources" in your `kustomization.yaml` file:
```yaml
@@ -243,13 +257,13 @@ awx-demo-service NodePort 10.109.40.38 <none> 80:31006/TCP 3m56
Once deployed, the AWX instance will be accessible by running:
```
$ minikube service awx-demo-service --url
$ minikube service -n awx awx-demo-service --url
```
By default, the admin user is `admin` and the password is available in the `<resourcename>-admin-password` secret. To retrieve the admin password, run:
```
$ kubectl get secret awx-demo-admin-password -o jsonpath="{.data.password}" | base64 --decode
$ kubectl get secret awx-demo-admin-password -o jsonpath="{.data.password}" | base64 --decode ; echo
yDL2Cx5Za94g9MvBP6B73nzVLlmfgPjR
```
@@ -303,7 +317,7 @@ There are three variables that are customizable for the admin user account creat
If `admin_password_secret` is not provided, the operator will look for a secret named `<resourcename>-admin-password` for the admin password. If it is not present, the operator will generate a password and create a Secret from it named `<resourcename>-admin-password`.
To retrieve the admin password, run `kubectl get secret <resourcename>-admin-password -o jsonpath="{.data.password}" | base64 --decode`
To retrieve the admin password, run `kubectl get secret <resourcename>-admin-password -o jsonpath="{.data.password}" | base64 --decode ; echo`
The secret that is expected to be passed should be formatted as follow:
@@ -481,6 +495,12 @@ spec:
### Database Configuration
#### Postgres Version
The default Postgres version for the version of AWX bundled with the latest version of the awx-operator is Postgres 13. You can find this default for a given version by at the default value for [_postgres_image_version](./roles/installer/defaults/main.yml#L138).
We only have coverage for the default version of Postgres. Newer versions of Postgres (14+) will likely work, but should only be configured as an external database. If your database is managed by the awx-operator (default if you don't specify a `postgres_configuration_secret`), then you should not override the default version as this may cause issues when awx-operator tries to upgrade your postgresql pod.
#### External PostgreSQL Service
To configure AWX to use an external database, the Custom Resource needs to know about the connection details. To do this, create a k8s secret with those connection details and specify the name of the secret as `postgres_configuration_secret` at the CR spec level.
@@ -698,18 +718,20 @@ You can constrain the AWX pods created by the operator to run on a certain subse
the AWX pods to run only on the nodes that match all the specified key/value pairs. `tolerations` and `postgres_tolerations` allow the AWX
pods to be scheduled onto nodes with matching taints.
The ability to specify topologySpreadConstraints is also allowed through `topology_spread_constraints`
If you want to use affinity rules for your AWX pod you can use the `affinity` option.
| Name | Description | Default |
| --------------------------- | ----------------------------------- | ------- |
| postgres_image | Path of the image to pull | postgres |
| postgres_image_version | Image version to pull | 13 |
| node_selector | AWX pods' nodeSelector | '' |
| topology_spread_constraints | AWX pods' topologySpreadConstraints | '' |
| tolerations | AWX pods' tolerations | '' |
| annotations | AWX pods' annotations | '' |
| postgres_selector | Postgres pods' nodeSelector | '' |
| postgres_tolerations | Postgres pods' tolerations | '' |
| Name | Description | Default |
| --------------------------- | ----------------------------------- | ------- |
| postgres_image | Path of the image to pull | postgres |
| postgres_image_version | Image version to pull | 13 |
| node_selector | AWX pods' nodeSelector | '' |
| topology_spread_constraints | AWX pods' topologySpreadConstraints | '' |
| affinity | AWX pods' affinity rules | '' |
| tolerations | AWX pods' tolerations | '' |
| annotations | AWX pods' annotations | '' |
| postgres_selector | Postgres pods' nodeSelector | '' |
| postgres_tolerations | Postgres pods' tolerations | '' |
Example of customization could be:
@@ -742,6 +764,28 @@ spec:
operator: "Equal"
value: "AWX"
effect: "NoSchedule"
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: another-node-label-key
operator: In
values:
- another-node-label-value
- another-node-label-value
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: security
operator: In
values:
- S2
topologyKey: topology.kubernetes.io/zone
```
#### Trusting a Custom Certificate Authority
@@ -951,6 +995,17 @@ Example spec file for volumes and volume mounts
> :warning: **Volume and VolumeMount names cannot contain underscores(_)**
##### Custom Nginx Configuration
Using the [extra_volumes feature](#custom-volume-and-volume-mount-options), it is possible to extend the nginx.conf.
1. Create a ConfigMap with the extra settings you want to include in the nginx.conf
2. Create an extra_volumes entry in the AWX spec for this ConfigMap
3. Create an web_extra_volume_mounts entry in the AWX spec to mount this volume
The AWX nginx config automatically includes /etc/nginx/conf.d/*.conf if present.
#### Default execution environments from private registries
In order to register default execution environments from private registries, the Custom Resource needs to know about the pull credentials. Those credentials should be stored as a secret and either specified as `ee_pull_credentials_secret` at the CR spec level, or simply be present on the namespace under the name `<resourcename>-ee-pull-credentials` . Instance initialization will register a `Container registry` type credential on the deployed instance and assign it to the registered default execution environments.
@@ -1070,8 +1125,14 @@ Example configuration of `extra_settings` parameter
- setting: AUTH_LDAP_BIND_DN
value: "cn=admin,dc=example,dc=com"
- setting: LOG_AGGREGATOR_LEVEL
value: "'DEBUG'"
```
Note for some settings, such as `LOG_AGGREGATOR_LEVEL`, the value may need double quotes.
#### No Log
Configure no_log for tasks with no_log
@@ -1083,7 +1144,7 @@ Example configuration of `no_log` parameter
```yaml
spec:
no_log: 'true'
no_log: true
```
#### Auto upgrade

View File

@@ -78,6 +78,9 @@ spec:
clean_backup_on_delete:
description: Flag to indicate if backup should be deleted on PVC if AWXBackup object is deleted
type: boolean
pg_dump_suffix:
description: Additional parameters for the pg_dump command
type: string
postgres_label_selector:
description: Label selector used to identify postgres pod for backing up data
type: string
@@ -89,7 +92,8 @@ spec:
type: string
no_log:
description: Configure no_log for no_log tasks
type: string
type: boolean
default: true
set_self_labels:
description: Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
type: boolean

View File

@@ -50,6 +50,9 @@ spec:
description: Name of the restored deployment. This should be different from the original deployment name
if the original deployment still exists.
type: string
cluster_name:
description: Cluster name
type: string
backup_name:
description: AWXBackup object name
type: string
@@ -91,7 +94,8 @@ spec:
type: string
no_log:
description: Configure no_log for no_log tasks
type: string
type: boolean
default: true
set_self_labels:
description: Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
type: boolean

View File

@@ -103,6 +103,9 @@ spec:
- ingress
- Route
- route
ingress_api_version:
description: The Ingress API version to use
type: string
ingress_path:
description: The ingress path used to reach the deployed service
type: string
@@ -141,6 +144,9 @@ spec:
- edge
- Passthrough
- passthrough
route_api_version:
description: The route API version to use
type: string
route_tls_secret:
description: Secret where the TLS related credentials are stored
type: string
@@ -154,6 +160,372 @@ spec:
topology_spread_constraints:
description: topology rule(s) for the pods
type: string
affinity:
description: If specified, the pod's scheduling constraints
properties:
nodeAffinity:
properties:
preferredDuringSchedulingIgnoredDuringExecution:
items:
properties:
preference:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchFields:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
type: object
x-kubernetes-map-type: atomic
weight:
format: int32
type: integer
required:
- preference
- weight
type: object
type: array
requiredDuringSchedulingIgnoredDuringExecution:
properties:
nodeSelectorTerms:
items:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchFields:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
type: object
x-kubernetes-map-type: atomic
type: array
required:
- nodeSelectorTerms
type: object
x-kubernetes-map-type: atomic
type: object
podAffinity:
properties:
preferredDuringSchedulingIgnoredDuringExecution:
items:
properties:
podAffinityTerm:
properties:
labelSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
namespaceSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
namespaces:
items:
type: string
type: array
topologyKey:
type: string
required:
- topologyKey
type: object
weight:
format: int32
type: integer
required:
- podAffinityTerm
- weight
type: object
type: array
requiredDuringSchedulingIgnoredDuringExecution:
items:
properties:
labelSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
namespaceSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
namespaces:
items:
type: string
type: array
topologyKey:
type: string
required:
- topologyKey
type: object
type: array
type: object
podAntiAffinity:
properties:
preferredDuringSchedulingIgnoredDuringExecution:
items:
properties:
podAffinityTerm:
properties:
labelSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
namespaceSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
namespaces:
items:
type: string
type: array
topologyKey:
type: string
required:
- topologyKey
type: object
weight:
format: int32
type: integer
required:
- podAffinityTerm
- weight
type: object
type: array
requiredDuringSchedulingIgnoredDuringExecution:
items:
properties:
labelSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
namespaceSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
namespaces:
items:
type: string
type: array
topologyKey:
type: string
required:
- topologyKey
type: object
type: array
type: object
type: object
service_labels:
description: Additional labels to apply to the service
type: string
@@ -504,7 +876,8 @@ spec:
type: array
no_log:
description: Configure no_log for no_log tasks
type: string
type: boolean
default: true
security_context_settings:
description: Key/values that will be set under the pod-level securityContext field
type: object
@@ -517,6 +890,10 @@ spec:
description: Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
type: boolean
default: true
ipv6_disabled:
description: Disable web container's nginx ipv6 listener
type: boolean
default: false
type: object
status:
properties:

View File

@@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
kubectl.kubernetes.io/default-container: awx-manager
labels:
control-plane: controller-manager
spec:

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,7 @@
entrypoint:
- scorecard-test
- basic-check-spec
image: quay.io/operator-framework/scorecard-test:v1.23.0
image: quay.io/operator-framework/scorecard-test:v1.25.3
labels:
suite: basic
test: basic-check-spec-test

View File

@@ -4,7 +4,7 @@
entrypoint:
- scorecard-test
- olm-bundle-validation
image: quay.io/operator-framework/scorecard-test:v1.23.0
image: quay.io/operator-framework/scorecard-test:v1.25.3
labels:
suite: olm
test: olm-bundle-validation-test
@@ -14,7 +14,7 @@
entrypoint:
- scorecard-test
- olm-crds-have-validation
image: quay.io/operator-framework/scorecard-test:v1.23.0
image: quay.io/operator-framework/scorecard-test:v1.25.3
labels:
suite: olm
test: olm-crds-have-validation-test
@@ -24,7 +24,7 @@
entrypoint:
- scorecard-test
- olm-crds-have-resources
image: quay.io/operator-framework/scorecard-test:v1.23.0
image: quay.io/operator-framework/scorecard-test:v1.25.3
labels:
suite: olm
test: olm-crds-have-resources-test
@@ -34,7 +34,7 @@
entrypoint:
- scorecard-test
- olm-spec-descriptors
image: quay.io/operator-framework/scorecard-test:v1.23.0
image: quay.io/operator-framework/scorecard-test:v1.25.3
labels:
suite: olm
test: olm-spec-descriptors-test
@@ -44,7 +44,7 @@
entrypoint:
- scorecard-test
- olm-status-descriptors
image: quay.io/operator-framework/scorecard-test:v1.23.0
image: quay.io/operator-framework/scorecard-test:v1.25.3
labels:
suite: olm
test: olm-status-descriptors-test

View File

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

View File

@@ -93,6 +93,12 @@ backup_resource_requirements:
memory: "32Mi"
```
To customize the pg_dump command that will be executed on a backup use the `pg_dump_suffix` variable. This variable will append your provided pg_dump parameters to the end of the 'standard' command. For example to exclude the data from 'main_jobevent' and 'main_job' to decrease the size of the backup use:
```
pg_dump_suffix: "--exclude-table-data 'main_jobevent*' --exclude-table-data 'main_job'"
```
Testing
----------------

View File

@@ -12,7 +12,7 @@ backup_pvc_namespace: "{{ ansible_operator_meta.namespace }}"
backup_storage_requirements: ''
# Set no_log settings on certain tasks
no_log: 'true'
no_log: true
# Variable to set when you want backups to be cleaned up when the CRD object is deleted
clean_backup_on_delete: false

View File

@@ -25,6 +25,7 @@
set_fact:
awx_spec:
spec: "{{ _awx }}"
previous_deployment_name: "{{ this_awx['resources'][0]['metadata']['name'] }}"
- name: Write awx object to pvc
k8s_exec:

View File

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

View File

@@ -75,7 +75,7 @@
namespace: "{{ backup_pvc_namespace }}"
pod: "{{ ansible_operator_meta.name }}-db-management"
command: >-
bash -c "chmod 0600 {{ backup_dir }}/tower.db && chown postgres:root {{ backup_dir }}/tower.db"
bash -c "chmod 660 {{ backup_dir }}/tower.db && chown :root {{ backup_dir }}/tower.db"
- name: Set full resolvable host name for postgres pod
set_fact:

View File

@@ -1,11 +1,5 @@
---
- name: Create Temporary secrets file
tempfile:
state: file
suffix: .json
register: tmp_secrets
- name: Dump (generated) secret names from statuses and data into file
include_tasks: dump_generated_secret.yml
with_items:
@@ -23,6 +17,12 @@
- bundle_cacert_secret
- ee_pull_credentials_secret
- name: Dump receptor secret names and data into file
include_tasks: dump_receptor_secrets.yml
loop:
- '{{ deployment_name }}-receptor-ca'
- '{{ deployment_name }}-receptor-work-signing'
# image_pull_secret is deprecated in favor of image_pull_secrets
- name: Dump image_pull_secret into file
include_tasks: dump_secret.yml

View File

@@ -12,6 +12,7 @@ ingress_type: none
ingress_class_name: ''
ingress_path: '/'
ingress_path_type: 'Prefix'
ingress_api_version: 'networking.k8s.io/v1'
# Add annotations to the service account. Specify as literal block. E.g.:
# service_account_annotations: |
# eks.amazonaws.com/role-arn: arn:aws:iam::<ACCOUNT_ID>:role/<IAM_ROLE_NAME>
@@ -50,6 +51,10 @@ route_tls_termination_mechanism: edge
#
route_tls_secret: ''
# Route API Version to support older version
# of the kubernetes services
route_api_version: 'route.openshift.io/v1'
# Host to create the root with.
# If not specific will default to <instance-name>-<namespace>-<routerCanonicalHostname>
#
@@ -76,6 +81,8 @@ node_selector: ''
# app.kubernetes.io/name: "<resourcename>"
topology_spread_constraints: ''
affinity: {}
# Add node tolerations for the AWX pods. Specify as literal block. E.g.:
# tolerations: |
# - key: "dedicated"
@@ -159,6 +166,8 @@ _control_plane_ee_image: quay.io/ansible/awx-ee:latest
_init_container_image: "{{ _control_plane_ee_image.split(':')[0] }}"
_init_container_image_version: "{{ _control_plane_ee_image.split(':')[1] }}"
_init_projects_container_image: quay.io/centos/centos:stream9
create_preload_data: true
replicas: "1"
@@ -288,7 +297,7 @@ development_mode: false
security_context_settings: {}
# Set no_log settings on certain tasks
no_log: 'true'
no_log: true
# Should AWX instances be automatically upgraded when operator gets upgraded
#
@@ -296,3 +305,6 @@ auto_upgrade: true
# Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
set_self_labels: true
# Disable web container's nginx ipv6 listener
ipv6_disabled: false

View File

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

View File

@@ -46,8 +46,8 @@ data:
{%- set cpu_limit = task_resource_requirements["limits"]["cpu"] if "limits" in task_resource_requirements and "cpu" in task_resource_requirements["limits"] -%}
{%- if cpu_limit is defined -%}
{%- set callback_receiver_cpu = cpu_limit | cpu_string_to_decimal -%}
{%- if callback_receiver_cpu |int > 4 -%}
# Set callback receiver workers based off cpu limit, default workers are 4, but if we have more than 4 cpu we can set higher value for workers
{%- if callback_receiver_cpu |int > 4 %}
# Set callback receiver workers based off cpu limit, default workers are 4, but if we have more than 4 cpu we can set higher value for workers
JOB_EVENT_WORKERS = {{ callback_receiver_cpu }}
{%- endif -%}
{%- endif %}
@@ -132,7 +132,9 @@ data:
{% if route_tls_termination_mechanism | lower == 'passthrough' %}
server {
listen 8052 default_server;
{% if not ipv6_disabled %}
listen [::]:8052 default_server;
{% endif %}
server_name _;
# Redirect all HTTP links to the matching HTTPS page
@@ -143,7 +145,9 @@ data:
server {
{% if route_tls_termination_mechanism | lower == 'passthrough' %}
listen 8053 ssl;
{% if not ipv6_disabled %}
listen [::]:8053 ssl;
{% endif %}
ssl_certificate /etc/nginx/pki/web.crt;
ssl_certificate_key /etc/nginx/pki/web.key;
@@ -154,7 +158,9 @@ data:
ssl_prefer_server_ciphers on;
{% else %}
listen 8052 default_server;
{% if not ipv6_disabled %}
listen [::]:8052 default_server;
{% endif %}
{% endif %}
# If you have a domain name, this is where to add it
@@ -212,9 +218,7 @@ data:
uwsgi_read_timeout 120s;
uwsgi_pass uwsgi;
include /etc/nginx/uwsgi_params;
{%- if extra_nginx_include is defined %}
include {{ extra_nginx_include }};
{%- endif %}
include /etc/nginx/conf.d/*.conf;
proxy_set_header X-Forwarded-Port 443;
uwsgi_param HTTP_X_FORWARDED_PORT 443;

View File

@@ -42,6 +42,7 @@ spec:
- name: init
image: '{{ _init_container_image }}'
imagePullPolicy: '{{ image_pull_policy }}'
resources: {{ task_resource_requirements }}
command:
- /bin/sh
- -c
@@ -53,10 +54,6 @@ spec:
mkdir -p /etc/pki/ca-trust/extracted/{java,pem,openssl,edk2}
update-ca-trust
{% endif %}
{% if projects_persistence|bool and is_k8s|bool %}
chmod 775 /var/lib/awx/projects
chgrp 1000 /var/lib/awx/projects
{% endif %}
{% if init_container_extra_commands %}
{{ init_container_extra_commands | indent(width=14) }}
{% endif %}
@@ -84,12 +81,27 @@ spec:
subPath: bundle-ca.crt
readOnly: true
{% endif %}
{% if projects_persistence|bool and is_k8s|bool %}
- name: "{{ ansible_operator_meta.name }}-projects"
mountPath: "/var/lib/awx/projects"
{% endif %}
{% if init_container_extra_volume_mounts -%}
{{ init_container_extra_volume_mounts | indent(width=12, first=True) }}
{% endif %}
{% if projects_persistence|bool and is_k8s|bool %}
- name: init-projects
image: '{{ _init_projects_container_image }}'
imagePullPolicy: '{{ image_pull_policy }}'
command:
- /bin/sh
- -c
- |
chmod 775 /var/lib/awx/projects
chgrp 1000 /var/lib/awx/projects
env:
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: "{{ ansible_operator_meta.name }}-projects"
mountPath: "/var/lib/awx/projects"
{% endif %}
containers:
- image: '{{ _redis_image }}'
@@ -367,6 +379,10 @@ spec:
topologySpreadConstraints:
{{ topology_spread_constraints | indent(width=8) }}
{% endif %}
{% if affinity | length %}
affinity:
{{ affinity | to_nice_yaml | indent(width=8) }}
{% endif %}
{% if tolerations %}
tolerations:
{{ tolerations | indent(width=8) }}

View File

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

View File

@@ -1,6 +1,8 @@
{% if ingress_type|lower == "ingress" %}
---
apiVersion: networking.k8s.io/v1
{% if ingress_api_version is defined %}
apiVersion: '{{ ingress_api_version }}'
{% endif %}
kind: Ingress
metadata:
name: '{{ ansible_operator_meta.name }}-ingress'
@@ -42,7 +44,9 @@ spec:
{% if ingress_type|lower == "route" %}
---
apiVersion: route.openshift.io/v1
{% if route_api_version is defined %}
apiVersion: '{{ route_api_version }}'
{% endif %}
kind: Route
metadata:
name: '{{ ansible_operator_meta.name }}'

View File

@@ -11,8 +11,11 @@ backup_pvc_namespace: '{{ ansible_operator_meta.namespace }}'
# Required: backup name, found on the awxbackup object
backup_dir: ''
# Default cluster name
cluster_name: 'cluster.local'
# Set no_log settings on certain tasks
no_log: 'true'
no_log: true
# Default resource requirements
restore_resource_requirements:

View File

@@ -1,27 +1,5 @@
---
- name: Get AWX object definition from pvc
k8s_exec:
namespace: "{{ backup_pvc_namespace }}"
pod: "{{ ansible_operator_meta.name }}-db-management"
command: >-
bash -c "cat '{{ backup_dir }}/awx_object'"
register: awx_object
- name: Create temp file for spec dict
tempfile:
state: file
register: tmp_spec
- name: Write spec vars to temp file
copy:
content: "{{ awx_object.stdout }}"
dest: "{{ tmp_spec.path }}"
mode: '0644'
- name: Include spec vars to save them as a dict
include_vars: "{{ tmp_spec.path }}"
- name: Deploy AWX
k8s:
state: "{{ state | default('present') }}"

View File

@@ -0,0 +1,25 @@
---
- name: Import awx_object variables
block:
- name: Get AWX object definition from pvc
k8s_exec:
namespace: "{{ backup_pvc_namespace }}"
pod: "{{ ansible_operator_meta.name }}-db-management"
command: >-
bash -c "cat '{{ backup_dir }}/awx_object'"
register: awx_object
- name: Create temp file for spec dict
tempfile:
state: file
register: tmp_spec
- name: Write spec vars to temp file
copy:
content: "{{ awx_object.stdout }}"
dest: "{{ tmp_spec.path }}"
mode: '0644'
- name: Include spec vars to save them as a dict
include_vars: "{{ tmp_spec.path }}"

View File

@@ -29,6 +29,8 @@
- block:
- include_tasks: init.yml
- include_tasks: import_vars.yml
- include_tasks: secrets.yml
- include_tasks: deploy_awx.yml

View File

@@ -66,7 +66,7 @@
- name: Set full resolvable host name for postgres pod
set_fact:
resolvable_db_host: "{{ awx_postgres_host }}.{{ ansible_operator_meta.namespace }}.svc.cluster.local"
resolvable_db_host: "{{ awx_postgres_host }}.{{ ansible_operator_meta.namespace }}.svc.{{ cluster_name }}"
no_log: "{{ no_log }}"
when: awx_postgres_type == 'managed'
@@ -76,7 +76,6 @@
pg_restore --clean --if-exists
-U {{ awx_postgres_user }}
-h {{ resolvable_db_host }}
-U {{ awx_postgres_user }}
-d {{ awx_postgres_database }}
-p {{ awx_postgres_port }}
no_log: "{{ no_log }}"

View File

@@ -54,6 +54,37 @@
no_log: "{{ no_log }}"
when: secrets['postgresConfigurationSecret']['data']['type'] | b64decode == 'managed'
- name: Set new receptor secret names
set_fact:
previous_receptor_ca_name: "{{ previous_deployment_name }}-receptor-ca"
previous_receptor_tls_name: "{{ previous_deployment_name }}-receptor-work-signing"
no_log: "{{ no_log }}"
- name: Set new name for receptor secrets using deployment_name
block:
- name: Set new receptor secret names
set_fact:
receptor_ca_name: "{{ deployment_name }}-receptor-ca"
receptor_work_signing_name: "{{ deployment_name }}-receptor-work-signing"
no_log: "{{ no_log }}"
- name: Set tmp dict for receptor secrets
set_fact:
_ca_secret: "{{ secrets[previous_receptor_ca_name] }}"
_work_signing_secret: "{{ secrets[previous_receptor_tls_name] }}"
no_log: "{{ no_log }}"
- name: Change receptor secret names in tmp dict
set_fact:
_ca_secret_name: "{{ _ca_secret | combine({ 'name': receptor_ca_name }) }}"
_work_signing_secret_name: "{{ _work_signing_secret | combine({ 'name': receptor_work_signing_name}) }}"
no_log: "{{ no_log }}"
- name: Create a new dict of receptor secrets with updated names
set_fact:
secrets: "{{ secrets | combine({previous_receptor_ca_name: _ca_secret_name, previous_receptor_tls_name: _work_signing_secret_name}) }}"
no_log: "{{ no_log }}"
- name: Apply secret
k8s:
state: present