Skip to content

Prevent updating openstackclient pod during openstack update #2880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions roles/update/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@
when:
- cifmw_update_control_plane_check | bool
- not cifmw_update_run_dryrun | bool
ansible.builtin.shell: |
{{ cifmw_update_artifacts_basedir }}/control_plane_test_start.sh

block:
- name: Prevent updating openstackclient during openstack update
ansible.builtin.include_tasks: prevent_openstack_client_update.yml

- name: Start the continuous control plane test
ansible.builtin.shell: |
{{ cifmw_update_artifacts_basedir }}/control_plane_test_start.sh


- name: Set openstack_update_run Makefile environment variables
Expand Down Expand Up @@ -72,8 +78,20 @@
when:
- cifmw_update_control_plane_check | bool
- not cifmw_update_run_dryrun | bool
ansible.builtin.command: |
{{ cifmw_update_artifacts_basedir }}/control_plane_test_stop.sh

block:
- name: Stop the continuous control plane test
ansible.builtin.command: |
{{ cifmw_update_artifacts_basedir }}/control_plane_test_stop.sh

- name: Patch openstackversion to trigger update of openstackclient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe Patch openstackversion to ensure openstackclient version is right

environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
ansible.builtin.shell: >
oc patch -n {{ cifmw_update_namespace }}
openstackversion {{ cifmw_openstack_version_name.stdout }} --type=json
--patch '[{ "op": "remove", "path": "/spec/customContainerImages/openstackClientImage" }]'

- name: Reboot the compute nodes
ansible.builtin.include_tasks: reboot_computes.yml
Expand Down
48 changes: 48 additions & 0 deletions roles/update/tasks/prevent_openstack_client_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

- name: Get current openstackclient image
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
ansible.builtin.shell: >
oc get pod -n {{ cifmw_update_namespace }} openstackclient
--output=jsonpath='{.spec.containers[0].image}'
register: cifmw_openstack_client_image
changed_when: false

- name: Get OpenStackVersion name
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
ansible.builtin.shell: >
oc get openstackversion -n {{ cifmw_update_namespace }}
--output=jsonpath='{.items[0].metadata.name}'
register: cifmw_openstack_version_name
changed_when: false

- name: Patch openstackversion CR to keep old openstackclient pod running
kubernetes.core.k8s:
state: patched
kind: OpenStackVersion
api_version: core.openstack.org/v1beta1
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
name: "{{ cifmw_openstack_version_name.stdout }}"
namespace: "{{ cifmw_update_namespace }}"
definition:
spec:
customContainerImages:
openstackClientImage: "{{ cifmw_openstack_client_image.stdout }}"
Loading