diff --git a/README.md b/README.md index a5532336..4b95133d 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ awx.awx.ansible.com/awx-demo created 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: diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 72d5180b..3e061d9b 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -38,6 +38,16 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: RELATED_IMAGE_APP + value: quay.io/ansible/awx:latest + - name: RELATED_IMAGE_INIT_CONTAINER + value: quay.io/centos/centos:8 + - name: RELATED_IMAGE_REDIS + value: docker.io/redis:latest + - name: RELATED_IMAGE_CONTROL_PLANE_EE + value: quay.io/ansible/awx-ee:latest + - name: RELATED_IMAGE_POSTGRES + value: postgres:12 securityContext: allowPrivilegeEscalation: false livenessProbe: diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index 15f3674d..f4bfc93e 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -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 diff --git a/roles/backup/tasks/init.yml b/roles/backup/tasks/init.yml index 65e6e92f..1657edd4 100644 --- a/roles/backup/tasks/init.yml +++ b/roles/backup/tasks/init.yml @@ -63,6 +63,17 @@ when: - backup_pvc == '' or backup_pvc is not defined +- 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_POSTGRES')) }}" + - name: Create management pod from templated deployment config k8s: name: "{{ ansible_operator_meta.name }}-db-management" diff --git a/roles/backup/templates/management-pod.yml.j2 b/roles/backup/templates/management-pod.yml.j2 index b79fe8f4..6269a3f1 100644 --- a/roles/backup/templates/management-pod.yml.j2 +++ b/roles/backup/templates/management-pod.yml.j2 @@ -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: diff --git a/roles/installer/tasks/database_configuration.yml b/roles/installer/tasks/database_configuration.yml index 0e4abac9..33502476 100644 --- a/roles/installer/tasks/database_configuration.yml +++ b/roles/installer/tasks/database_configuration.yml @@ -52,6 +52,17 @@ _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_POSTGRES')) }}" + - block: - name: Create Database configuration k8s: diff --git a/roles/installer/tasks/resources_configuration.yml b/roles/installer/tasks/resources_configuration.yml index 43ef5e7a..de5f7b2c 100644 --- a/roles/installer/tasks/resources_configuration.yml +++ b/roles/installer/tasks/resources_configuration.yml @@ -32,6 +32,49 @@ - 'ingress' no_log: true +- 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_APP')) }}" + +- name: Set user provided controller 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_INIT_CONTAINER')) }}" + +- 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_REDIS')) }}" + +- 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')) }}" + - name: Apply deployment resources k8s: apply: yes diff --git a/roles/installer/templates/deployment.yaml.j2 b/roles/installer/templates/deployment.yaml.j2 index 82cec20c..2af6eeec 100644 --- a/roles/installer/templates/deployment.yaml.j2 +++ b/roles/installer/templates/deployment.yaml.j2 @@ -36,7 +36,7 @@ spec: {% if bundle_ca_crt or projects_persistence|bool or init_container_extra_commands %} initContainers: - name: init - image: '{{ init_container_image }}:{{ init_container_image_version }}' + image: '{{ _init_container_image }}' imagePullPolicy: '{{ image_pull_policy }}' command: - /bin/sh @@ -71,7 +71,7 @@ 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 %} @@ -89,7 +89,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 }} @@ -177,7 +177,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 %} @@ -267,7 +267,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 }} diff --git a/roles/installer/templates/postgres.yaml.j2 b/roles/installer/templates/postgres.yaml.j2 index f9d67fba..185c0373 100644 --- a/roles/installer/templates/postgres.yaml.j2 +++ b/roles/installer/templates/postgres.yaml.j2 @@ -38,7 +38,7 @@ spec: - name: {{ image_pull_secret }} {% endif %} containers: - - image: '{{ postgres_image }}:{{ postgres_image_version }}' + - image: '{{ _postgres_image }}' imagePullPolicy: '{{ image_pull_policy }}' name: postgres env: diff --git a/roles/restore/tasks/init.yml b/roles/restore/tasks/init.yml index 146b2ea8..1f4a58ae 100644 --- a/roles/restore/tasks/init.yml +++ b/roles/restore/tasks/init.yml @@ -71,6 +71,17 @@ force: true wait: 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_POSTGRES')) }}" + - name: Create management pod from templated deployment config k8s: name: "{{ ansible_operator_meta.name }}-db-management" diff --git a/roles/restore/templates/management-pod.yml.j2 b/roles/restore/templates/management-pod.yml.j2 index 5ed3fb6c..d88351c3 100644 --- a/roles/restore/templates/management-pod.yml.j2 +++ b/roles/restore/templates/management-pod.yml.j2 @@ -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: