From 42301208843d425b9dac1b4bb8e15377df7737ec Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Sat, 3 Apr 2021 17:15:56 -0400 Subject: [PATCH] More flexibility for customizing default EEs --- ansible/templates/crd.yml.j2 | 11 +++++++++-- deploy/awx-operator.yaml | 14 +++++++++++--- roles/installer/defaults/main.yml | 5 ++++- .../templates/execution_environments.py.j2 | 5 +++++ .../templates/tower_app_credentials.yaml.j2 | 5 +++-- roles/installer/templates/tower_deployment.yaml.j2 | 8 +++++--- 6 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 roles/installer/templates/execution_environments.py.j2 diff --git a/ansible/templates/crd.yml.j2 b/ansible/templates/crd.yml.j2 index 744164a6..77dc23c6 100644 --- a/ansible/templates/crd.yml.j2 +++ b/ansible/templates/crd.yml.j2 @@ -113,9 +113,16 @@ spec: tower_image: description: Registry path to the application container to use type: string - tower_ee_image: + tower_ee_images: description: Registry path to the Execution Environment container to use - type: string + type: array + items: + type: object + properties: + name: + type: string + image: + type: string tower_image_pull_policy: description: The image pull policy type: string diff --git a/deploy/awx-operator.yaml b/deploy/awx-operator.yaml index 0ddba7d9..92275636 100644 --- a/deploy/awx-operator.yaml +++ b/deploy/awx-operator.yaml @@ -122,7 +122,7 @@ spec: serviceAccountName: awx-operator containers: - name: awx-operator - image: "quay.io/ansible/awx-operator:0.7.0" + image: "quay.io/shanemcd/awx-operator:0.7.1" imagePullPolicy: "Always" volumeMounts: - mountPath: /tmp/ansible-operator/runner @@ -264,9 +264,17 @@ spec: tower_image: description: Registry path to the application container to use type: string - tower_ee_image: + tower_ee_images: description: Registry path to the Execution Environment container to use - type: string + type: array + items: + type: object + properties: + name: + type: string + image: + type: string + tower_image_pull_policy: description: The image pull policy type: string diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index f9318718..2ff7d3a1 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -84,7 +84,10 @@ tower_extra_volumes: '' tower_image: quay.io/ansible/awx:18.0.0 tower_image_pull_policy: IfNotPresent tower_image_pull_secret: '' -tower_ee_image: quay.io/ansible/awx-ee:0.1.1 + +tower_ee_images: + - name: AWX EE 0.1.1 + image: quay.io/ansible/awx-ee:0.1.1 tower_create_preload_data: true diff --git a/roles/installer/templates/execution_environments.py.j2 b/roles/installer/templates/execution_environments.py.j2 new file mode 100644 index 00000000..31b17e42 --- /dev/null +++ b/roles/installer/templates/execution_environments.py.j2 @@ -0,0 +1,5 @@ +DEFAULT_EXECUTION_ENVIRONMENTS = [ +{% for item in tower_ee_images %} + {'name': '{{ item.name }}' , 'image': '{{ item.image }}'} +{% endfor %} +] diff --git a/roles/installer/templates/tower_app_credentials.yaml.j2 b/roles/installer/templates/tower_app_credentials.yaml.j2 index 4ce00637..5993b355 100644 --- a/roles/installer/templates/tower_app_credentials.yaml.j2 +++ b/roles/installer/templates/tower_app_credentials.yaml.j2 @@ -11,5 +11,6 @@ metadata: app.kubernetes.io/managed-by: awx-operator app.kubernetes.io/component: awx data: - credentials_py: "{{ lookup('template', 'credentials.py.j2') | b64encode }}" - ldap_py: "{{ lookup('template', 'ldap.py.j2') | b64encode }}" + credentials.py: "{{ lookup('template', 'credentials.py.j2') | b64encode }}" + ldap.py: "{{ lookup('template', 'ldap.py.j2') | b64encode }}" + execution_environments.py: "{{ lookup('template', 'execution_environments.py.j2') | b64encode }}" diff --git a/roles/installer/templates/tower_deployment.yaml.j2 b/roles/installer/templates/tower_deployment.yaml.j2 index ff1aca36..580bd396 100644 --- a/roles/installer/templates/tower_deployment.yaml.j2 +++ b/roles/installer/templates/tower_deployment.yaml.j2 @@ -183,7 +183,7 @@ spec: {{ tower_task_extra_env | indent(width=12, indentfirst=True) }} {% endif %} resources: {{ tower_task_resource_requirements }} - - image: '{{ tower_ee_image }}' + - image: '{{ tower_ee_images[0].image }}' name: '{{ meta.name }}-ee' imagePullPolicy: '{{ tower_image_pull_policy }}' args: ['receptor', '--config', '/etc/receptor.conf'] @@ -234,10 +234,12 @@ spec: secret: secretName: "{{ meta.name }}-app-credentials" items: - - key: credentials_py + - key: credentials.py path: 'credentials.py' - - key: ldap_py + - key: ldap.py path: 'ldap.py' + - key: execution_environments.py + path: 'execution_environments.py' - name: "{{ secret_key_secret_name }}" secret: secretName: '{{ secret_key_secret_name }}'