--- # 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: Create the support files for test ansible.builtin.include_tasks: create_test_files.yml - name: Create local openstackclient when: - (cifmw_update_control_plane_check | bool) or (cifmw_update_ping_test | bool) - not cifmw_update_run_dryrun | bool ansible.builtin.include_tasks: create_local_openstackclient.yml - name: Trigger the ping test when: - cifmw_update_ping_test | bool - not cifmw_update_run_dryrun | bool block: - name: Create Test instance before update ansible.builtin.include_tasks: create_instance.yml - name: Start ping test ansible.builtin.include_tasks: l3_agent_connectivity_check_start.yml - name: Trigger the continuous control plane test 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 - name: Install plan ansible.builtin.include_role: name: kustomize_deploy tasks_from: install_plan.yml vars: # Disable version filtering during update: approve the next # available unapproved InstallPlan regardless of CSV version. # The initially deployed version's plan is already approved; # the update needs to approve the newer version's plan. cifmw_kustomize_deploy_installplan_target_version: '' when: - cifmw_ci_gen_kustomize_values_installplan_approval is defined - cifmw_ci_gen_kustomize_values_installplan_approval | lower == 'manual' - name: Validate subscription CSV version after installplan when: - cifmw_ci_gen_kustomize_values_installplan_approval is defined - cifmw_ci_gen_kustomize_values_installplan_approval | lower == 'manual' block: - name: Wait for subscription installedCSV to match currentCSV kubernetes.core.k8s_info: kubeconfig: "{{ cifmw_openshift_kubeconfig }}" api_key: "{{ cifmw_openshift_token | default(omit) }}" context: "{{ cifmw_openshift_context | default(omit) }}" api_version: operators.coreos.com/v1alpha1 kind: Subscription namespace: openstack-operators label_selectors: - operators.coreos.com/openstack-operator.openstack-operators register: _cifmw_update_subscription_info until: > _cifmw_update_subscription_info.resources | length > 0 and _cifmw_update_subscription_info.resources[0].status.installedCSV is defined and _cifmw_update_subscription_info.resources[0].status.currentCSV is defined and _cifmw_update_subscription_info.resources[0].status.installedCSV == _cifmw_update_subscription_info.resources[0].status.currentCSV retries: 30 delay: 10 - name: Handle OpenStack operator initialization when: - cifmw_ci_gen_kustomize_values_deployment_version is defined - cifmw_ci_gen_kustomize_values_deployment_version in ['v1.0.3', 'v1.0.6'] block: - name: Set update step to About to initialize the OpenStack operator ansible.builtin.command: cmd: > {{ cifmw_update_artifacts_basedir }}/update_event.sh About to initialize the OpenStack operator - name: Initialize the OpenStack operator if needed kubernetes.core.k8s: kubeconfig: "{{ cifmw_openshift_kubeconfig }}" api_key: "{{ cifmw_openshift_token | default(omit) }}" context: "{{ cifmw_openshift_context | default(omit) }}" definition: "{{ _openstack_init_resource }}" state: present vars: _openstack_init_resource: apiVersion: operator.openstack.org/v1beta1 kind: OpenStack metadata: name: openstack namespace: "{{ operator_namespace }}" - name: Set update step to Wait for successful deployment of the openstack operator ansible.builtin.command: cmd: > {{ cifmw_update_artifacts_basedir }}/update_event.sh Wait for successful deployment of the openstack operator - name: Ensure OpenStack deployment is successful and block until it is done kubernetes.core.k8s_info: kubeconfig: "{{ cifmw_openshift_kubeconfig }}" api_key: "{{ cifmw_openshift_token | default(omit) }}" context: "{{ cifmw_openshift_context | default(omit) }}" api_version: operator.openstack.org/v1beta1 kind: OpenStack namespace: "{{ operator_namespace }}" register: _cifmw_update_openstack_info until: > _cifmw_update_openstack_info.resources[0].status.conditions is defined and ( _cifmw_update_openstack_info.resources[0].status.conditions | selectattr('type', 'equalto', 'Ready') | map(attribute='status') | first | default('False') == 'True' ) and ( _cifmw_update_openstack_info.resources[0].status.conditions | selectattr('type', 'equalto', 'OpenStackOperatorReadyCondition') | map(attribute='status') | first | default('False') == 'True' ) retries: 20 delay: 15 when: not (cifmw_update_run_dryrun | bool) # Get the next available version available when using OLM - name: Handle the next version when using OLM when: - cifmw_ci_gen_kustomize_values_deployment_version is defined block: - name: Set update step to About to get a new version ansible.builtin.command: cmd: > {{ cifmw_update_artifacts_basedir }}/update_event.sh About to get a new version - name: Make sure we get a new version available, block until we do. kubernetes.core.k8s_info: kubeconfig: "{{ cifmw_openshift_kubeconfig }}" api_key: "{{ cifmw_openshift_token | default(omit) }}" context: "{{ cifmw_openshift_context | default(omit) }}" api_version: core.openstack.org/v1beta1 kind: OpenStackVersion namespace: "{{ cifmw_update_namespace }}" register: openstackversion_info until: openstackversion_info.resources[0].spec.targetVersion != openstackversion_info.resources[0].status.availableVersion retries: 20 delay: 15 - name: Capture the available version in openstackversion ansible.builtin.set_fact: cifmw_update_next_available_version: >- {{ openstackversion_info.resources[0].status.availableVersion }} - name: Set update step to Got new version ansible.builtin.command: cmd: > {{ cifmw_update_artifacts_basedir }}/update_event.sh Got new version {{ cifmw_update_next_available_version }} ({{ openstackversion_info.resources[0].status.deployedVersion }}) - name: Wait for OpenStackControlPlane to be ready after operator update when: - not (cifmw_update_run_dryrun | bool) - cifmw_ci_gen_kustomize_values_deployment_version is defined block: - name: Delay to allow OpenStackControlPlane ready condition to transition # If we install the new operators, the control plane is in 'ready' status, so # we need to wait a few seconds so it changes to a 'non-ready' status first. ansible.builtin.pause: seconds: "{{ cifmw_update_wait_controplane_status_change_sec }}" - name: Wait for OpenStackControlPlane ready condition environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" ansible.builtin.command: cmd: >- oc wait OpenStackControlPlane --all --namespace={{ cifmw_update_namespace }} --for=condition=ready --timeout={{ cifmw_update_openstack_update_run_timeout }} - name: Set openstack_update_run Makefile environment variables tags: - always ansible.builtin.set_fact: _make_update_params: | TIMEOUT: {{ cifmw_update_openstack_update_run_timeout }} KPATCH_UPDATE: {{ cifmw_update_openstack_update_kpatch }} {% if _cifmw_update_use_fake_update | bool -%} FAKE_UPDATE: true CONTAINERS_NAMESPACE: {{ cifmw_update_openstack_update_run_containers_namespace }} CONTAINERS_TARGET_TAG: {{ cifmw_update_openstack_update_run_containers_target_tag }} OPENSTACK_VERSION: {{ cifmw_update_openstack_update_run_target_version }} {% else -%} OPENSTACK_VERSION: {{ _cifmw_update_openstack_version }} {% endif -%} vars: # When using OLM style of update, or if # cifmw_update_openstack_update_run_operators_updated is true do # not use fake update in openstack-update.sh. _cifmw_update_use_fake_update: >- {{ not ( cifmw_ci_gen_kustomize_values_deployment_version is defined ) and not ( cifmw_update_openstack_update_run_operators_updated | bool ) }} _cifmw_update_openstack_version: >- {{ cifmw_update_next_available_version | default(cifmw_update_openstack_update_run_target_version) }} - name: Run the selected update variant ansible.builtin.include_tasks: "update_variant_{{ cifmw_update_variant }}.yml" - name: Stop the ping test ansible.builtin.include_tasks: l3_agent_connectivity_check_stop.yml when: - cifmw_update_ping_test | bool - not cifmw_update_run_dryrun | bool - name: Stop the continuous control plane test 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 - name: Set update step to About to start Reboot ansible.builtin.command: cmd: > {{ cifmw_update_artifacts_basedir }}/update_event.sh About to start Reboot when: - cifmw_update_reboot_test | bool - name: Reboot the compute nodes ansible.builtin.include_tasks: reboot_computes.yml when: - cifmw_update_reboot_test | bool - name: Set update step to Update complete ansible.builtin.command: cmd: > {{ cifmw_update_artifacts_basedir }}/update_event.sh Update complete