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>
This commit is contained in:
Christian M. Adams
2021-10-21 11:40:13 -04:00
parent 071b67a814
commit 8aee279634
11 changed files with 96 additions and 10 deletions

View File

@@ -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:

View File

@@ -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:

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

@@ -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"

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

@@ -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:

View File

@@ -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

View File

@@ -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 }}

View File

@@ -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:

View File

@@ -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"

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: