Skip to content

Commit 5495ef3

Browse files
raukadahopenshift-merge-bot[bot]
authored andcommitted
Use update_containers role to update ansibleee image
openstack-k8s-operators/dataplane-operator#889 adds the support of updating ansibleee runner image via openstack version interface. This pr updates the update_containers role to update the same. It modifies ci/playbooks/build_runner_image.yml playbook to use update_containers role to achieve the same. Depends-On: openstack-k8s-operators/openstack-operator#803 Signed-off-by: Chandan Kumar <[email protected]>
1 parent 318e019 commit 5495ef3

File tree

4 files changed

+9
-43
lines changed

4 files changed

+9
-43
lines changed

ci/playbooks/build_runner_image.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
ansible.builtin.copy:
4343
mode: "0644"
4444
content: |
45-
cifmw_edpm_prepare_update_os_containers: true
46-
cifmw_set_openstack_containers_operator_name: openstack-ansibleee
47-
cifmw_set_openstack_containers_overrides:
48-
RELATED_IMAGE_ANSIBLEEE_IMAGE_URL_DEFAULT: "{{ ansibleee_runner_img }}"
45+
cifmw_update_containers_ansibleee_image_url: "{{ ansibleee_runner_img }}"
46+
cifmw_update_containers: true
4947
dest: "{{ ansible_user_dir }}/ci-framework-data/artifacts/edpm-ansible.yml"

roles/edpm_prepare/tasks/main.yml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -132,33 +132,13 @@
132132
cacheable: true
133133
when: cifmw_build_images_output is defined
134134

135-
- name: Patch baremetal CSV to override the uefi image
136-
when: cifmw_update_containers_edpm_image_url is defined
135+
- name: Update BM CSV or Ansibleee CSV to update proper image
136+
when: >-
137+
(cifmw_update_containers_edpm_image_url is defined) or
138+
(cifmw_update_containers_ansibleee_image_url is defined)
137139
ansible.builtin.include_role:
138140
name: update_containers
139141

140-
- name: Patch ansible runner image temporarily
141-
when:
142-
- not cifmw_edpm_prepare_update_os_containers | bool
143-
- not cifmw_edpm_prepare_skip_patch_ansible_runner | bool
144-
environment:
145-
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
146-
PATH: "{{ cifmw_path }}"
147-
block:
148-
- name: Get ansibleee-operator csv name
149-
ansible.builtin.shell: |
150-
set -o pipefail && \
151-
oc get csv -n openstack-operators -o name | grep ansibleee-operator
152-
register: _ansibleee_csv_name
153-
154-
- name: Patch ansible runner image
155-
ansible.builtin.command:
156-
cmd: >-
157-
oc patch -n openstack-operators "{{ _ansibleee_csv_name.stdout }}"
158-
--type='json' -p='[{
159-
"op":"replace", "path":"/spec/install/spec/deployments/0/spec/template/spec/containers/1/env/0",
160-
"value": {"name": "RELATED_IMAGE_ANSIBLEEE_IMAGE_URL_DEFAULT", "value": "quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest"}}]'
161-
162142
# Prepare and kustomize the OpenStackControlPlane CR
163143
- name: Prepare OpenStack control plane CR
164144
vars:

roles/update_containers/tasks/main.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,3 @@
3232
PATH: "{{ cifmw_path }}"
3333
ansible.builtin.command:
3434
cmd: "oc apply -f {{ cifmw_update_containers_dest_path }}"
35-
36-
# Note(chkumar): It will be removed once ansiblee runner
37-
# support is enabled in openstackversion interface.
38-
- name: Update Ansibleee Runner container
39-
when: cifmw_update_containers_ansibleee_image_url is defined
40-
environment:
41-
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
42-
PATH: "{{ cifmw_path }}"
43-
ansible.builtin.command:
44-
cmd: >-
45-
oc patch csv -n openstack-operators openstack-ansibleee-operator.v0.0.1
46-
--type='json' -p='[{
47-
"op":"replace", "path":"/spec/install/spec/deployments/0/spec/template/spec/containers/1/env/0",
48-
"value": {"name": "RELATED_IMAGE_ANSIBLEEE_IMAGE_URL_DEFAULT",
49-
"value": {{ cifmw_update_containers_ansibleee_image_url }}}}]'

roles/update_containers/templates/update_containers.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,6 @@ spec:
8585
{% if cifmw_update_containers_edpm_image_url is defined %}
8686
osContainerImage: {{ cifmw_update_containers_edpm_image_url }}
8787
{% endif %}
88+
{% if cifmw_update_containers_ansibleee_image_url is defined %}
89+
ansibleeeImage: {{ cifmw_update_containers_ansibleee_image_url }}
90+
{% endif %}

0 commit comments

Comments
 (0)