Skip to content

Commit fc30400

Browse files
abaysopenshift-merge-bot[bot]
authored andcommitted
Support new OpenStack initialization resource for RHOSO install
1 parent e53622f commit fc30400

File tree

3 files changed

+110
-3
lines changed

3 files changed

+110
-3
lines changed

roles/edpm_prepare/tasks/main.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,34 @@
119119
--namespace={{ cifmw_install_yamls_defaults['OPERATOR_NAMESPACE'] }}
120120
--for=jsonpath='{.status.phase}'=Complete --timeout=20m
121121
122+
- name: Check if the OpenStack initialization CRD exists
123+
when:
124+
- not cifmw_edpm_prepare_dry_run
125+
kubernetes.core.k8s_info:
126+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
127+
api_key: "{{ cifmw_openshift_token | default(omit) }}"
128+
context: "{{ cifmw_openshift_context | default(omit) }}"
129+
kind: CustomResourceDefinition
130+
name: openstacks.operator.openstack.org
131+
register: _cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out
132+
tags:
133+
- control-plane
134+
135+
- name: OpenStack meta-operator initialization, if necessary
136+
when:
137+
- not cifmw_edpm_prepare_dry_run
138+
- _cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out is defined
139+
- _cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out.resources is defined
140+
- (_cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out.resources | length) > 0
141+
vars:
142+
make_openstack_init_env: "{{ cifmw_edpm_prepare_common_env }}"
143+
make_openstack_init_dryrun: "{{ cifmw_edpm_prepare_dry_run }}"
144+
ansible.builtin.include_role:
145+
name: 'install_yamls_makes'
146+
tasks_from: 'make_openstack_init'
147+
tags:
148+
- control-plane
149+
122150
# Note(chkumar): Keeping set_openstack_containers role
123151
# till we migrate this task to update_containers role
124152
- name: Update OpenStack Services containers Env

roles/kustomize_deploy/defaults/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,24 @@ cifmw_kustomize_deploy_nmstate_dest_file: >-
108108
] | path_join
109109
}}
110110
111+
# openstack init resource
112+
cifmw_kustomize_deploy_openstack_source_files: >-
113+
{{
114+
[
115+
cifmw_kustomize_deploy_architecture_repo_dest_dir,
116+
cifmw_kustomize_deploy_architecture_examples_common_path,
117+
'openstack'
118+
] | path_join
119+
}}
120+
121+
cifmw_kustomize_deploy_openstack_dest_file: >-
122+
{{
123+
[
124+
cifmw_kustomize_deploy_kustomizations_dest_dir,
125+
'openstack.yaml'
126+
] | path_join
127+
}}
128+
111129
# controlsplane resources
112130

113131
cifmw_kustomize_deploy_nncp_source_files: >-

roles/kustomize_deploy/tasks/install_operators.yml

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
- _cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | length == 1
108108
- (_cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | first)['status']['installPlanRef'] is defined
109109

110-
- name: Wait for the openstack operators InstallPlan to be finish
110+
- name: Wait for the openstack operators InstallPlan to be finished
111111
vars:
112112
_install_plan: >-
113113
{{
@@ -319,8 +319,69 @@
319319
status: "True"
320320
wait_timeout: 300
321321

322-
- name: Wait until OpenStack operators are deployed and ready
323-
when: not cifmw_kustomize_deploy_generate_crs_only
322+
- name: Check if the OpenStack initialization CRD exists
323+
kubernetes.core.k8s_info:
324+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
325+
api_key: "{{ cifmw_openshift_token | default(omit) }}"
326+
context: "{{ cifmw_openshift_context | default(omit) }}"
327+
kind: CustomResourceDefinition
328+
name: openstacks.operator.openstack.org
329+
register: _cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out
330+
331+
- name: Handle OpenStack initialization, if necessary
332+
when: (_cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out.resources | length) > 0
333+
block:
334+
- name: Generate OpenStack initialization kustomization file
335+
ansible.builtin.copy:
336+
content: >-
337+
{{
338+
lookup(
339+
'kubernetes.core.kustomize',
340+
dir=cifmw_kustomize_deploy_openstack_source_files
341+
)
342+
}}
343+
dest: "{{ cifmw_kustomize_deploy_openstack_dest_file }}"
344+
mode: "0644"
345+
346+
- name: Openstack initialization resources
347+
when: not cifmw_kustomize_deploy_generate_crs_only
348+
block:
349+
- name: Apply the kustomized OpenStack initialization CRs
350+
kubernetes.core.k8s:
351+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
352+
api_key: "{{ cifmw_openshift_token | default(omit) }}"
353+
context: "{{ cifmw_openshift_context | default(omit) }}"
354+
state: present
355+
wait: true
356+
src: "{{ cifmw_kustomize_deploy_openstack_dest_file }}"
357+
check_mode: >-
358+
{{
359+
cifmw_kustomize_deploy_check_mode |
360+
default(false, true)
361+
}}
362+
363+
- name: Wait until OpenStack operators are deployed and ready (new install paradigm)
364+
when: not cifmw_kustomize_deploy_generate_crs_only
365+
kubernetes.core.k8s_info:
366+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
367+
kind: Openstack
368+
namespace: openstack-operators
369+
name: openstack
370+
wait: true
371+
wait_condition:
372+
type: Ready
373+
status: "True"
374+
wait_timeout: 600
375+
check_mode: >-
376+
{{
377+
cifmw_kustomize_deploy_check_mode |
378+
default(false, true)
379+
}}
380+
381+
- name: Wait until OpenStack operators are deployed and ready (old install paradigm)
382+
when:
383+
- not cifmw_kustomize_deploy_generate_crs_only
384+
- (_cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out.resources | length) == 0
324385
kubernetes.core.k8s_info:
325386
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
326387
kind: Deployment

0 commit comments

Comments
 (0)