Compare commits

..

23 Commits
2.0.0 ... 2.0.1

Author SHA1 Message Date
Lila Yasin
e1e97a1bbf Merge pull request #1351 from djyasin/1331_Add_support_to_specify_different_annotation_for_task_and_web_deployments
Add support to specify different annotation for the task and web deployments in AWX operator
2023-04-17 16:22:36 -04:00
Lila
e54215863c Add ability to override annotations independently
- add web_annotations to override annotations for web pods
- add task_annotations to override annotations for task pods
2023-04-17 16:07:12 -04:00
Seth Foster
0c2f45569c Merge pull request #1358 from fosterseth/fix_development_mode
fix development mode
2023-04-13 11:10:37 -04:00
Seth Foster
cde24806cf fix development mode 2023-04-12 19:31:15 -04:00
Christian Adams
5a3b2179bc Set securityContext.capabilities for kube-rbac-proxy container (#1354) 2023-04-12 14:55:57 -04:00
Lukas Magauer
faf51c8b24 Add websocket configuration for contour ingress (#1320)
Co-authored-by: lumarel <lumarel@users.noreply.github.com>
2023-04-12 18:29:21 +00:00
Hao Liu
9bdbf4bacb Fix lint error (#1352)
Check warning on line 44 in roles/installer/defaults/main.yml
44:2 [comments] missing starting space in comment
2023-04-12 14:25:41 -04:00
Hao Liu
d4015546db Fix helm release problem (attempt 3) (#1350)
fix helm release result in helm index containing incorrect download link

Co-authored-by: Christian Adams <rooftopcellist@gmail.com>
Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com>
2023-04-11 20:37:51 +00:00
Hao Liu
10df62ff7b Merge pull request #1349 from thedoubl3j/fix_task_tolerations
fix task deployment tolerations
2023-04-11 15:13:59 -04:00
thedoubl3j
a2a35d0a40 remove to_nice_yaml from tolerations in the task deployment which caused in malformed yaml to be rendered for the task deployment 2023-04-11 14:26:51 -04:00
Hao Liu
4589e2849d Merge pull request #1333 from TheRealHaoLiu/fix-rsyslog-ca-cert
Add CA cert volume mount to rsyslog sidecar
2023-04-07 13:07:29 -04:00
Hao Liu
1456d24ff5 Merge pull request #1328 from thedoubl3j/fix_manual_projects
Add back project persistence so Manual projects SCM type have path
2023-04-07 13:06:56 -04:00
Hao Liu
b5e630d0b5 Merge pull request #1342 from TheRealHaoLiu/fix-molecue-failure
Update CI test and fix awx-operator CI failure in awx repo
2023-04-07 12:59:02 -04:00
Hao Liu
4104e7d912 Update awx_test.yml
- rename awx_pod to awx_web_pod to better reflect intention
- update `awx_version` block to also validate awx_task_pod
- add get awx_task_pod in additional label check block (fix CI in awx repo which does not run the validate awx_version block)
- add assertion for awx_task_pod extra label
2023-04-07 12:42:22 -04:00
thedoubl3j
2f7297f5f5 revert project persistance so that manual projects have a default path
move chmod chgrp for projects_persistence to different init

default init container is the awx-ee because and unable to run command chgrp

moving it into a different init container

note this is not needed for openshift so this is conditional on is_k8s
2023-04-07 12:02:13 -04:00
Lila Yasin
073e6cff0a Merge pull request #1327 from djyasin/1315_Update-tests-to-validate-web-task
Updating awx_test.yml to respect both web and task deployments.
2023-04-07 10:51:02 -04:00
Lila
910f1eeb36 Updating awx_test.yml to respect both web and task deployments.
- Extracts label information from both web and task pods
- Asserts web and task pod labels are correct respectively
2023-04-07 10:24:02 -04:00
Hao Liu
bba532e2e5 Merge pull request #1229 from manfuin/conditional-sslrootcert
Specify sslrootcert in database options conditionally (fixes #1215)
2023-04-05 14:18:05 -04:00
Hao Liu
fee2289753 Add CA cert volume mount to rsyslog sidecar
fixes https://github.com/ansible/awx-operator/issues/1332
2023-04-05 13:40:38 -04:00
Hao Liu
c5520d4c61 Merge pull request #1324 from TheRealHaoLiu/fix-supervisor-conf-file-inconsistancy
Fix supervisor conf file inconsistancy
2023-04-04 11:15:33 -04:00
Hao Liu
25e7f5a8f2 Fix supervisor conf file inconsistancy 2023-04-04 10:00:02 -04:00
Andrii Salnikov
ef10b06be5 Update roles/installer/templates/settings/credentials.py.j2
Co-authored-by: Dimitri Savineau <savineau.dimitri@gmail.com>
2023-03-23 22:31:39 +01:00
Andrii Salnikov
ce48812921 add sslrootcert to database options conditionally (fixes #1215) 2023-02-09 00:57:19 +01:00
12 changed files with 213 additions and 35 deletions

View File

@@ -354,7 +354,7 @@ helm-package: helm-chart
@echo "== Package Current Chart Version =="
mkdir -p .cr-release-packages
# package the chart and put it in .cr-release-packages dir
$(HELM) package ./charts/awx-operator -d .cr-release-packages
$(HELM) package ./charts/awx-operator -d .cr-release-packages/$(VERSION)
# List all tags oldest to newest.
TAGS := $(shell git ls-remote --tags --sort=version:refname --refs -q | cut -d/ -f3)

View File

@@ -477,6 +477,23 @@ spec:
environment: testing
```
##### Specialized Ingress Controller configuration
Some Ingress Controllers need a special configuration to fully support AWX, add the following value with the `ingress_controller` variable, if you are using one of these:
| Ingress Controller name | value |
| ------------------------------------- | ------- |
| [Contour](https://projectcontour.io/) | contour |
```yaml
---
spec:
...
ingress_type: ingress
hostname: awx-demo.example.com
ingress_controller: contour
```
* Route
The following variables are customizable when `ingress_type=route`

View File

@@ -121,6 +121,9 @@ spec:
ingress_class_name:
description: The name of ingress class to use instead of the cluster default.
type: string
ingress_controller:
description: Special configuration for specific Ingress Controllers
type: string
loadbalancer_protocol:
description: Protocol to use for the loadbalancer
type: string
@@ -183,7 +186,13 @@ spec:
description: Additional labels to apply to the service
type: string
annotations:
description: annotations for the pods
description: Common annotations for both Web and Task deployments.
type: string
task_annotations:
description: Task deployment annotations. This will override the general annotations parameter for the Task deployment.
type: string
web_annotations:
description: Web deployment annotations. This will override the general annotations parameter for the Web deployment.
type: string
tolerations:
description: node tolerations for the pods

View File

@@ -12,10 +12,9 @@ spec:
- name: kube-rbac-proxy
securityContext:
allowPrivilegeEscalation: false
# TODO(user): uncomment for common cases that do not require escalating privileges
# capabilities:
# drop:
# - "ALL"
capabilities:
drop:
- "ALL"
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0
args:
- "--secure-listen-address=0.0.0.0:8443"

View File

@@ -51,7 +51,6 @@ spec:
fieldPath: metadata.namespace
securityContext:
allowPrivilegeEscalation: false
# TODO(user): uncomment for common cases that do not require escalating privileges
capabilities:
drop:
- "ALL"

View File

@@ -251,6 +251,12 @@ spec:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:io.kubernetes:Secret
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:ingress_type:Ingress
- displayName: Ingress Controller
path: ingress_controller
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:text
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:ingress_type:Ingress
- displayName: LoadBalancer Annotations
path: service_annotations
x-descriptors:
@@ -684,6 +690,16 @@ spec:
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Task Annotations
path: task_annotations
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Web Annotations
path: web_annotations
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Tolerations
path: tolerations
x-descriptors:

View File

@@ -19,19 +19,36 @@
register: admin_pw_secret
- block:
- name: Get pod details
- name: Get web pod details
k8s_info:
namespace: '{{ namespace }}'
kind: Pod
label_selectors:
- app.kubernetes.io/name = example-awx-web
register: awx_pod
register: awx_web_pod
when: not awx_version
- name: Extract tags from images
- name: Get task pod details
k8s_info:
namespace: '{{ namespace }}'
kind: Pod
label_selectors:
- app.kubernetes.io/name = example-awx-task
register: awx_task_pod
when: not awx_version
- name: Extract tags from images from web pod
set_fact:
image_tags: |
{{ awx_pod.resources[0].spec.containers |
web_image_tags: |
{{ awx_web_pod.resources[0].spec.containers |
map(attribute='image') |
map('regex_search', default_awx_version) }}
when: not awx_version
- name: Extract tags from images from task pod
set_fact:
task_image_tags: |
{{ awx_task_pod.resources[0].spec.containers |
map(attribute='image') |
map('regex_search', default_awx_version) }}
when: not awx_version
@@ -42,7 +59,8 @@
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
- default_awx_version not in web_image_tags
- default_awx_version not in task_image_tags
- name: Launch Demo Job Template
awx.awx.job_launch:
@@ -93,13 +111,21 @@
name: example-awx
register: this_awx
- name: Get pod details
- name: Get web pod details
k8s_info:
namespace: '{{ namespace }}'
kind: Pod
label_selectors:
- app.kubernetes.io/name = example-awx-web
register: awx_pod
register: awx_web_pod
- name: Get task pod details
k8s_info:
namespace: '{{ namespace }}'
kind: Pod
label_selectors:
- app.kubernetes.io/name = example-awx-task
register: awx_task_pod
- name: Extract additional_labels from AWX spec
set_fact:
@@ -109,31 +135,58 @@
| list
}}
- name: Extract additional_labels from AWX Pod
- name: Extract additional_labels from AWX web Pod
set_fact:
pod_additional_labels: >-
{{ awx_pod.resources[0].metadata.labels
awx_web_pod_additional_labels: >-
{{ awx_web_pod.resources[0].metadata.labels
| dict2items | selectattr('key', 'in', this_awx.resources[0].spec.additional_labels)
| list
}}
- name: AWX Pod contains additional_labels
- name: Extract additional_labels from AWX task Pod
set_fact:
awx_task_pod_additional_labels: >-
{{ awx_task_pod.resources[0].metadata.labels
| dict2items | selectattr('key', 'in', this_awx.resources[0].spec.additional_labels)
| list
}}
- name: Assert AWX web Pod contains additional_labels
ansible.builtin.assert:
that:
- pod_additional_labels == awx_additional_labels
- awx_web_pod_additional_labels == awx_additional_labels
- name: Extract Pod labels which shouldn't have been propagated to it from AWX
- name: Assert AWX task Pod contains additional_labels
ansible.builtin.assert:
that:
- awx_task_pod_additional_labels == awx_additional_labels
- name: Extract web Pod labels which shouldn't have been propagated to it from AWX
set_fact:
pod_extra_labels: >-
{{ awx_pod.resources[0].metadata.labels
awx_web_pod_extra_labels: >-
{{ awx_web_pod.resources[0].metadata.labels
| dict2items | selectattr('key', 'in', ["my/do-not-inherit"])
| list
}}
- name: AWX Pod doesn't contain AWX labels not in additional_labels
- name: AWX web Pod doesn't contain AWX labels not in additional_labels
ansible.builtin.assert:
that:
- pod_extra_labels == []
- awx_web_pod_extra_labels == []
- name: Extract task Pod labels which shouldn't have been propagated to it from AWX
set_fact:
awx_task_pod_extra_labels: >-
{{ awx_task_pod.resources[0].metadata.labels
| dict2items | selectattr('key', 'in', ["my/do-not-inherit"])
| list
}}
- name: AWX task Pod doesn't contain AWX labels not in additional_labels
ansible.builtin.assert:
that:
- awx_task_pod_extra_labels == []
rescue:
- name: Re-emit failure
vars:

View File

@@ -36,12 +36,16 @@ ingress_annotations: ''
# certificate and key.
ingress_tls_secret: ''
# Special configuration for specific Ingress Controllers. E.g.:
# ingress_controller: contour
ingress_controller: ''
loadbalancer_protocol: 'http'
loadbalancer_port: '80'
service_annotations: ''
# Port to be used for NodePort configuration, default is to auto-assign a port between 30000-32768
#nodeport_port: '30080'
# nodeport_port: '30080'
# The TLS termination mechanism to use to access
# the services. Supported mechanism are: edge, passthrough
@@ -184,6 +188,18 @@ web_affinity: {}
# my.annotation/2: value2
annotations: ''
# Override annotations to awx task pods. Specify as literal block. E.g.:
# task_annotations: |
# my.task-annotation/1: value
# my.task-annotation/2: value2
task_annotations: ''
# Override annotations to awx web pods. Specify as literal block. E.g.:
# web_annotations: |
# my.web-annotation/1: value
# my.web-annotation/2: value2
web_annotations: ''
admin_user: admin
admin_email: test@example.com

View File

@@ -43,7 +43,9 @@ spec:
] %}
checksum-secret-{{ secret }}: "{{ lookup('ansible.builtin.vars', secret, default='')["resources"][0]["data"] | default('') | sha1 }}"
{% endfor %}
{% if annotations %}
{% if task_annotations %}
{{ task_annotations | indent(width=8) }}
{% elif annotations %}
{{ annotations | indent(width=8) }}
{% endif %}
spec:
@@ -356,13 +358,21 @@ spec:
mountPath: "/var/run/redis"
- name: rsyslog-socket
mountPath: "/var/run/awx-rsyslog"
{% if bundle_ca_crt %}
- name: "ca-trust-extracted"
mountPath: "/etc/pki/ca-trust/extracted"
- name: "{{ ansible_operator_meta.name }}-bundle-cacert"
mountPath: /etc/pki/ca-trust/source/anchors/bundle-ca.crt
subPath: bundle-ca.crt
readOnly: true
{% endif %}
{% if development_mode | bool %}
- name: awx-devel
mountPath: "/awx_devel"
{% endif %}
env:
- name: SUPERVISOR_CONFIG_PATH
value: "/etc/supervisor_rsyslog.conf"
value: "/etc/supervisord_rsyslog.conf"
{% if development_mode | bool %}
- name: AWX_KUBE_DEVEL
value: "1"
@@ -383,10 +393,10 @@ spec:
{% endif %}
{% if task_tolerations %}
tolerations:
{{ task_tolerations | to_nice_yaml | indent(width=8) }}
{{ task_tolerations | indent(width=8) }}
{% elif tolerations %}
tolerations:
{{ tolerations | to_nice_yaml | indent(width=8) }}
{{ tolerations | indent(width=8) }}
{% endif %}
{% if task_affinity %}
affinity:

View File

@@ -44,7 +44,9 @@ spec:
] %}
checksum-secret-{{ secret }}: "{{ lookup('ansible.builtin.vars', secret, default='')["resources"][0]["data"] | default('') | md5 }}"
{% endfor %}
{% if annotations %}
{% if web_annotations %}
{{ web_annotations | indent(width=8) }}
{% elif annotations %}
{{ annotations | indent(width=8) }}
{% endif %}
spec:
@@ -62,7 +64,7 @@ spec:
priorityClassName: '{{ control_plane_priority_class }}'
{% endif %}
initContainers:
{% if bundle_ca_crt or init_container_extra_commands %}
{% if bundle_ca_crt or projects_persistence|bool or init_container_extra_commands %}
- name: init
image: '{{ _init_container_image }}'
imagePullPolicy: '{{ image_pull_policy }}'
@@ -89,6 +91,25 @@ spec:
{% if init_container_extra_volume_mounts -%}
{{ init_container_extra_volume_mounts | indent(width=12, first=True) }}
{% endif %}
{% 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 }}'
@@ -172,6 +193,10 @@ spec:
mountPath: "/var/run/redis"
- name: rsyslog-socket
mountPath: "/var/run/awx-rsyslog"
{% if projects_persistence|bool %}
- name: "{{ ansible_operator_meta.name }}-projects"
mountPath: "/var/lib/awx/projects"
{% endif %}
- name: "{{ ansible_operator_meta.name }}-receptor-ca"
mountPath: "/etc/receptor/tls/ca/receptor-ca.crt"
subPath: "tls.crt"
@@ -195,7 +220,7 @@ spec:
- name: AWX_COMPONENT
value: "web"
- name: SUPERVISOR_CONFIG_PATH
value: "/etc/supervisor_web.conf"
value: "/etc/supervisord_web.conf"
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
@@ -240,13 +265,21 @@ spec:
mountPath: "/var/run/redis"
- name: rsyslog-socket
mountPath: "/var/run/awx-rsyslog"
{% if bundle_ca_crt %}
- name: "ca-trust-extracted"
mountPath: "/etc/pki/ca-trust/extracted"
- name: "{{ ansible_operator_meta.name }}-bundle-cacert"
mountPath: /etc/pki/ca-trust/source/anchors/bundle-ca.crt
subPath: bundle-ca.crt
readOnly: true
{% endif %}
{% if development_mode | bool %}
- name: awx-devel
mountPath: "/awx_devel"
{% endif %}
env:
- name: SUPERVISOR_CONFIG_PATH
value: "/etc/supervisor_rsyslog.conf"
value: "/etc/supervisord_rsyslog.conf"
{% if development_mode | bool %}
- name: AWX_KUBE_DEVEL
value: "1"
@@ -362,6 +395,15 @@ spec:
items:
- key: receptor_conf
path: receptor.conf
{% if projects_persistence|bool %}
- name: "{{ ansible_operator_meta.name }}-projects"
persistentVolumeClaim:
{% if projects_existing_claim %}
claimName: {{ projects_existing_claim }}
{% else %}
claimName: '{{ ansible_operator_meta.name }}-projects-claim'
{% endif %}
{% endif %}
{% if development_mode | bool %}
- name: awx-devel
hostPath:

View File

@@ -9,10 +9,16 @@ metadata:
namespace: '{{ ansible_operator_meta.namespace }}'
labels:
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
{% if ingress_annotations %}
{% if ingress_annotations or ingress_controller|lower == "contour" %}
annotations:
{% if ingress_annotations %}
{{ ingress_annotations | indent(width=4) }}
{% endif %}
{% if ingress_controller|lower == "contour" %}
projectcontour.io/websocket-routes: "/websocket"
kubernetes.io/ingress.class: contour
{% endif %}
{% endif %}
spec:
{% if ingress_class_name %}
ingressClassName: '{{ ingress_class_name }}'
@@ -27,6 +33,15 @@ spec:
name: '{{ ansible_operator_meta.name }}-service'
port:
number: 80
{% if ingress_controller|lower == "contour" %}
- path: '{{ ingress_path }}/websocket'
pathType: '{{ ingress_path_type }}'
backend:
service:
name: '{{ ansible_operator_meta.name }}-service'
port:
number: 80
{% endif %}
{% if hostname %}
host: {{ hostname }}
{% endif %}

View File

@@ -8,7 +8,9 @@ DATABASES = {
'HOST': '{{ awx_postgres_host }}',
'PORT': "{{ awx_postgres_port }}",
'OPTIONS': { 'sslmode': '{{ awx_postgres_sslmode }}',
{% if awx_postgres_sslmode in ['verify-ca', 'verify-full'] %}
'sslrootcert': '{{ ca_trust_bundle }}',
{% endif %}
},
}
}