Skip to content

Commit 5b61488

Browse files
committed
Prevent updating openstackclient pod during openstack update
Openstackclient pod is used during update to start/stop continues workload tests from it. Openstackclient should not be updated during update to not interfere with this tests. Update of the client should happend at the end of update on request.
1 parent 6c1ad63 commit 5b61488

File tree

2 files changed

+60
-4
lines changed

2 files changed

+60
-4
lines changed

roles/update/tasks/main.yml

+22-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@
3333
when:
3434
- cifmw_update_control_plane_check | bool
3535
- not cifmw_update_run_dryrun | bool
36-
ansible.builtin.shell: |
37-
{{ cifmw_update_artifacts_basedir }}/control_plane_test_start.sh
36+
37+
block:
38+
- name: Prevent updating openstackclient during openstack update
39+
ansible.builtin.include_tasks: prevent_openstack_client_update.yml
40+
41+
- name: Start the continuous control plane test
42+
ansible.builtin.shell: |
43+
{{ cifmw_update_artifacts_basedir }}/control_plane_test_start.sh
3844
3945
4046
- name: Set openstack_update_run Makefile environment variables
@@ -72,8 +78,20 @@
7278
when:
7379
- cifmw_update_control_plane_check | bool
7480
- not cifmw_update_run_dryrun | bool
75-
ansible.builtin.command: |
76-
{{ cifmw_update_artifacts_basedir }}/control_plane_test_stop.sh
81+
82+
block:
83+
- name: Stop the continuous control plane test
84+
ansible.builtin.command: |
85+
{{ cifmw_update_artifacts_basedir }}/control_plane_test_stop.sh
86+
87+
- name: Patch openstackversion to trigger update of openstackclient
88+
environment:
89+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
90+
PATH: "{{ cifmw_path }}"
91+
ansible.builtin.shell: >
92+
oc patch -n {{ cifmw_update_namespace }}
93+
openstackversion/controlplane --type=json
94+
--patch '[{ "op": "remove", "path": "/spec/customContainerImages/openstackClientImage" }]'
7795
7896
- name: Reboot the compute nodes
7997
ansible.builtin.include_tasks: reboot_computes.yml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
# Copyright Red Hat, Inc.
3+
# All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License. You may obtain
7+
# a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
17+
- name: Get current openstackversion image version
18+
environment:
19+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
20+
PATH: "{{ cifmw_path }}"
21+
ansible.builtin.shell: >
22+
oc get pod -n {{ cifmw_update_namespace }} openstackclient
23+
--output=jsonpath='{.spec.containers[0].image}'
24+
register: cifmw_openstack_client_image
25+
changed_when: false
26+
27+
- name: Patch openstackversion CR to keep old openstackclient pod running
28+
kubernetes.core.k8s:
29+
state: patched
30+
kind: OpenStackVersion
31+
api_version: core.openstack.org/v1beta1
32+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
33+
name: controlplane
34+
namespace: "{{ cifmw_update_namespace }}"
35+
definition:
36+
spec:
37+
customContainerImages:
38+
openstackClientImage: "{{ cifmw_openstack_client_image.stdout }}"

0 commit comments

Comments
 (0)