Skip to content

Commit 96c1d5c

Browse files
committed
New OLM Parameter for Managing Deployment of Specific Versions
A new parameter, `cifmw_ci_gen_kustomize_values_deployment_version`, has been introduced for overriding OLM startingCSV values in kustomize. This also ensures the appropriate architecture directory is utilized and all necessary subscriptions are deployed based on the installed version. This eventually leverages the overlay `kustomize` feature, hence the new `olm_subscriptions_overlay.yml` that helps set the right overlay. When configured, this parameter will stop the update playbook from executing the `set_openstack_containers` role and the deployment playbook from executing the `update_container` role. The assumption is that OLM will be used to update any necessary operators. Depends-On: openstack-k8s-operators/architecture#537 Resolves-Part-Of: [OSPRH-15056](https://issues.redhat.com//browse/OSPRH-15056)
1 parent 0f9f620 commit 96c1d5c

File tree

7 files changed

+110
-5
lines changed

7 files changed

+110
-5
lines changed

playbooks/06-deploy-architecture.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,12 @@
226226
tags:
227227
- update_containers
228228
- edpm_bootstrap
229+
when: cifmw_ci_gen_kustomize_values_deployment_version is not defined
229230

230231
- name: Update containers in deployed OSP operators using set_openstack_containers role
231-
when: cifmw_set_openstack_containers | default(false) | bool
232+
when:
233+
- cifmw_set_openstack_containers | default(false) | bool
234+
- cifmw_ci_gen_kustomize_values_deployment_version is not defined
232235
ansible.builtin.include_role:
233236
name: set_openstack_containers
234237
tags:

playbooks/update.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
cifmw_set_openstack_containers_openstack_final_env: "operator_env_after_update.txt"
4040
ansible.builtin.include_role:
4141
name: set_openstack_containers
42+
when: cifmw_ci_gen_kustomize_values_deployment_version is not defined
4243

4344
- name: Sync repos for controller to compute
4445
hosts: computes

roles/ci_gen_kustomize_values/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ Optional parameters:
5454

5555
* `cifmw_ci_gen_kustomize_values_edpm_net_template_b64`: (String) The base64 content of `edpm_network_config_template`.
5656

57+
### Specific parameters for olm-values
58+
This ConfigMap specifies parameters to override those in `architecture/example/common/olm/values.yaml`.
59+
60+
* `cifmw_ci_gen_kustomize_values_ooi_image`: (String) The URI for the image providing the OpenStack operator index. Defaults to `quay.io/openstack-k8s-operators/openstack-operator-index:latest`.
61+
* `cifmw_ci_gen_kustomize_values_sub_channel`: (String) Specifies the channel to be used.
62+
63+
If the following parameter is set, it overrides the associated parameter in `architecture/example/common/olm-subscriptions/values.yaml`.
64+
65+
* `cifmw_ci_gen_kustomize_values_deployment_version`: (String) The version to be deployed by setting the `startingCSV` of the subscription for the OpenStack operator. Versions `v1.0.3` and `v1.0.6` are unique as they configure the subscription for all operators. The right kustomize overlay is selected by the `ci_gen_kustomize_values/tasks/olm_subscriptions_overlay.yml` file.
66+
67+
Access the remaining parameters in the `olm-subscription/values.yaml` file and override them with the `cifmw_architecture_user_kustomize_<some_string>` variable, which should set the `common.olm-values` hash. The earlier version parameter shouldn't be modified using this method, as it won't activate the additional code required for proper functionality.
68+
5769
## Adding a new template
5870

5971
The template must have a leading comment staging its source. For example, if your template is located in
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
# Description: This playbook generates the kustomize file that
18+
# retrieves the appropriate overlay based on
19+
# cifmw_ci_gen_kustomize_values_deployment_version. It allows for
20+
# specifying the deployment version when multiple versions are
21+
# available in the OLM catalog. This is particularly useful for
22+
# testing updates but can also be used to deploy any version from the
23+
# OLM catalog.
24+
25+
- name: Set the right overlay for the subscriptions
26+
ansible.builtin.set_fact:
27+
_cifmw_update_deployment_version_dir: >-
28+
{{
29+
cifmw_ci_gen_kustomize_values_deployment_version
30+
if cifmw_ci_gen_kustomize_values_deployment_version in ['v1.0.3', 'v1.0.6']
31+
else
32+
'default'
33+
}}
34+
35+
- name: Point to the right overlay for OLM when deploying old version
36+
vars:
37+
_kustomization:
38+
components:
39+
- "../../../lib/olm-deps"
40+
- "../../../lib/olm-openstack-subscriptions/overlays/{{ _cifmw_update_deployment_version_dir }}"
41+
resources:
42+
- "values.yaml"
43+
ansible.builtin.copy:
44+
content: |
45+
---
46+
{{ _kustomization | ansible.builtin.to_nice_yaml(indent=2) }}
47+
dest: "{{ cifmw_ci_gen_kustomize_values_architecture_repo }}/examples/common/olm-subscriptions/kustomization.yaml"
48+
mode: "0644"
49+
when: _cifmw_update_deployment_version_dir != 'default'
50+
51+
# Pass down the new value for `cifmw_kustomize_deploy_olm_source_files`
52+
- name: Change directory for the customization file when deploying old version
53+
ansible.builtin.set_fact:
54+
cifmw_kustomize_deploy_olm_source_files: >-
55+
{{
56+
cifmw_ci_gen_kustomize_values_architecture_repo
57+
}}/examples/common/olm-subscriptions

roles/ci_gen_kustomize_values/templates/common/olm-values/values.yaml.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ data:
44
{% if cifmw_ci_gen_kustomize_values_sub_channel is defined %}
55
openstack-operator-channel: {{ cifmw_ci_gen_kustomize_values_sub_channel }}
66
{% endif %}
7+
{% if cifmw_ci_gen_kustomize_values_deployment_version is defined %}
8+
{% if cifmw_ci_gen_kustomize_values_deployment_version not in ['v1.0.3', 'v1.0.6'] %}
9+
openstack-operator-version: openstack-operator.{{ cifmw_ci_gen_kustomize_values_deployment_version }}
10+
{% endif %}
11+
{% endif %}

roles/kustomize_deploy/tasks/install_operators.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,20 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17+
- name: Install subscriptions
18+
ansible.builtin.include_role:
19+
name: ci_gen_kustomize_values
20+
tasks_from: olm_subscriptions_overlay.yml
21+
when: cifmw_ci_gen_kustomize_values_deployment_version is defined
22+
1723
- name: Generate values.yaml for OLM resources
1824
vars:
19-
cifmw_architecture_scenario: 'common/olm'
25+
cifmw_architecture_scenario: >-
26+
{{
27+
'common/olm'
28+
if not cifmw_ci_gen_kustomize_values_deployment_version | default(false) | bool
29+
else 'common/olm-subscriptions'
30+
}}
2031
cifmw_ci_gen_kustomize_values_src_file: >-
2132
{{
2233
(

roles/update/tasks/main.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,38 @@
3636
ansible.builtin.shell: |
3737
{{ cifmw_update_artifacts_basedir }}/control_plane_test_start.sh
3838
39+
# Get the next available version available when using OLM
40+
- name: Capture the .status.availableVersion in cifmw_update_available_version fact
41+
ansible.builtin.set_fact:
42+
cifmw_update_next_available_version: >-
43+
openstackversion_info.resources[0].status.availableVersion
44+
when: cifmw_update_openstack_update_run_operators_updated is defined
3945

4046
- name: Set openstack_update_run Makefile environment variables
4147
tags:
4248
- always
4349
ansible.builtin.set_fact:
4450
_make_openstack_update_run_params: |
4551
TIMEOUT: {{ cifmw_update_openstack_update_run_timeout }}
46-
{% if not cifmw_update_openstack_update_run_operators_updated | bool -%}
52+
{% if _cifmw_update_use_fake_update -%}
4753
FAKE_UPDATE: true
4854
CONTAINERS_NAMESPACE: {{ cifmw_update_openstack_update_run_containers_namespace }}
4955
CONTAINERS_TARGET_TAG: {{ cifmw_update_openstack_update_run_containers_target_tag }}
5056
OPENSTACK_VERSION: {{ cifmw_update_openstack_update_run_target_version }}
5157
{% else -%}
52-
OPENSTACK_VERSION: {{ cifmw_update_openstack_update_run_target_version }}
58+
OPENSTACK_VERSION: {{ _cifmw_update_openstack_version }}
5359
{% endif -%}
54-
60+
vars:
61+
# When using OLM style of update, or if
62+
# cifmw_update_openstack_update_run_operators_updated is true do
63+
# not use fake update in openstack-update.sh.
64+
_cifmw_update_use_fake_update: >-
65+
not (
66+
cifmw_update_openstack_update_run_operators_updated | default(false) | bool
67+
) and not ( cifmw_update_openstack_update_run_operators_updated | bool )
68+
_cifmw_update_openstack_version: >-
69+
cifmw_update_next_available_version |
70+
default(cifmw_update_openstack_update_run_target_version)
5571
5672
- name: Run make openstack_update_run
5773
vars:

0 commit comments

Comments
 (0)