|
1 | 1 | --- |
2 | 2 |
|
3 | | -- name: Deploy OpenStack Lightspeed operators |
4 | | - hosts: localhost |
| 3 | +- name: Deploy OpenStack Lightspeed operator |
| 4 | + hosts: "{{ cifmw_target_hook_host | default('localhost') }}" |
5 | 5 | connection: local |
6 | 6 | vars: |
7 | | - # OpenShift Lightspeed (foundation) |
8 | | - openshift_lightspeed_namespace: "{{ cifmw_openshift_lightspeed_namespace | default('openshift-lightspeed') }}" |
9 | | - openshift_lightspeed_operator_group: "{{ cifmw_openshift_lightspeed_operator_group | default('lightspeed-operator-group') }}" |
10 | | - |
11 | | - # OpenStack Lightspeed (main goal) |
12 | | - openstack_lightspeed_namespace: "{{ cifmw_openstack_lightspeed_namespace | default('openstack-lightspeed') }}" |
| 7 | + # OpenStack Lightspeed configuration |
| 8 | + # Note: Installing in openshift-lightspeed namespace to ensure compatibility |
| 9 | + openstack_lightspeed_namespace: "{{ cifmw_openstack_lightspeed_namespace | default('openshift-lightspeed') }}" |
13 | 10 | openstack_lightspeed_operator_group: "{{ cifmw_openstack_lightspeed_operator_group | default('openstack-lightspeed-operator-group') }}" |
14 | 11 | openstack_lightspeed_catalog_image: "{{ cifmw_openstack_lightspeed_catalog_image | default('quay.io/openstack-lightspeed/operator-catalog:latest') }}" |
15 | 12 | openstack_lightspeed_catalog_name: "{{ cifmw_openstack_lightspeed_catalog_name | default('openstack-lightspeed-catalog') }}" |
|
20 | 17 | KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
21 | 18 |
|
22 | 19 | tasks: |
23 | | - # STEP 1: Deploy OpenShift Lightspeed (foundation ) |
24 | | - |
25 | | - - name: Create namespace for OpenShift Lightspeed |
26 | | - kubernetes.core.k8s: |
27 | | - state: present |
28 | | - definition: |
29 | | - apiVersion: v1 |
30 | | - kind: Namespace |
31 | | - metadata: |
32 | | - name: "{{ openshift_lightspeed_namespace }}" |
33 | | - |
34 | | - - name: Get service-ca bundle |
35 | | - kubernetes.core.k8s_info: |
36 | | - api_version: v1 |
37 | | - kind: ConfigMap |
38 | | - name: service-ca |
39 | | - namespace: openshift-config-managed |
40 | | - register: service_ca_cm |
41 | | - |
42 | | - - name: Create metrics-client-ca ConfigMap for OpenShift Lightspeed |
43 | | - kubernetes.core.k8s: |
44 | | - state: present |
45 | | - definition: |
46 | | - apiVersion: v1 |
47 | | - kind: ConfigMap |
48 | | - metadata: |
49 | | - name: metrics-client-ca |
50 | | - namespace: openshift-monitoring |
51 | | - data: |
52 | | - client-ca.crt: "{{ service_ca_cm.resources[0].data['ca-bundle.crt'] }}" |
53 | | - when: service_ca_cm.resources | length > 0 |
54 | | - |
55 | | - - name: Create OperatorGroup for OpenShift Lightspeed |
56 | | - kubernetes.core.k8s: |
57 | | - state: present |
58 | | - definition: |
59 | | - apiVersion: operators.coreos.com/v1 |
60 | | - kind: OperatorGroup |
61 | | - metadata: |
62 | | - name: "{{ openshift_lightspeed_operator_group }}" |
63 | | - namespace: "{{ openshift_lightspeed_namespace }}" |
64 | | - spec: |
65 | | - targetNamespaces: |
66 | | - - "{{ openshift_lightspeed_namespace }}" |
67 | | - |
68 | | - - name: Subscribe to OpenShift Lightspeed operator |
69 | | - kubernetes.core.k8s: |
70 | | - state: present |
71 | | - definition: |
72 | | - apiVersion: operators.coreos.com/v1alpha1 |
73 | | - kind: Subscription |
74 | | - metadata: |
75 | | - name: "lightspeed-operator" |
76 | | - namespace: "{{ openshift_lightspeed_namespace }}" |
77 | | - spec: |
78 | | - channel: "stable" |
79 | | - name: "lightspeed-operator" |
80 | | - source: "redhat-operators" |
81 | | - sourceNamespace: "openshift-marketplace" |
82 | | - installPlanApproval: "Automatic" |
83 | | - |
84 | | - - name: Wait for OpenShift Lightspeed operator to be ready |
85 | | - kubernetes.core.k8s_info: |
86 | | - api_version: apps/v1 |
87 | | - kind: Deployment |
88 | | - namespace: "{{ openshift_lightspeed_namespace }}" |
89 | | - label_selectors: |
90 | | - - "control-plane=controller-manager" |
91 | | - register: ols_deployment |
92 | | - failed_when: false |
93 | | - until: |
94 | | - - ols_deployment.resources is defined |
95 | | - - ols_deployment.resources | length > 0 |
96 | | - - ols_deployment.resources[0].status.readyReplicas is defined |
97 | | - - ols_deployment.resources[0].status.readyReplicas > 0 |
98 | | - retries: 30 |
99 | | - delay: 10 |
100 | | - |
101 | | - # STEP 2: Deploy OpenStack Lightspeed catalog |
| 20 | + # STEP 1: Deploy OpenStack Lightspeed catalog |
102 | 21 |
|
103 | 22 | - name: Create CatalogSource for OpenStack Lightspeed |
104 | 23 | kubernetes.core.k8s: |
|
131 | 50 | retries: 30 |
132 | 51 | delay: 10 |
133 | 52 |
|
134 | | - # STEP 3: Deploy OpenStack Lightspeed operator |
| 53 | + # STEP 2: Deploy OpenStack Lightspeed operator |
| 54 | + # Note: OpenStack Lightspeed operator will automatically install |
| 55 | + # and manage the OpenShift Lightspeed operator as a dependency |
135 | 56 |
|
136 | 57 | - name: Create namespace for OpenStack Lightspeed |
137 | 58 | kubernetes.core.k8s: |
|
171 | 92 | sourceNamespace: "openshift-marketplace" |
172 | 93 | installPlanApproval: "Automatic" |
173 | 94 |
|
174 | | - - name: Wait for OpenStack Lightspeed operator to be ready |
| 95 | + - name: Wait for OpenStack Lightspeed CSV to be ready |
175 | 96 | kubernetes.core.k8s_info: |
176 | | - api_version: apps/v1 |
177 | | - kind: Deployment |
| 97 | + api_version: operators.coreos.com/v1alpha1 |
| 98 | + kind: ClusterServiceVersion |
178 | 99 | namespace: "{{ openstack_lightspeed_namespace }}" |
179 | 100 | label_selectors: |
180 | | - - "control-plane=controller-manager" |
181 | | - register: osls_deployment |
| 101 | + - "operators.coreos.com/openstack-lightspeed-operator.{{ openstack_lightspeed_namespace }}" |
| 102 | + register: osls_csv |
182 | 103 | failed_when: false |
183 | 104 | until: |
184 | | - - osls_deployment.resources is defined |
185 | | - - osls_deployment.resources | length > 0 |
186 | | - - osls_deployment.resources[0].status.readyReplicas is defined |
187 | | - - osls_deployment.resources[0].status.readyReplicas > 0 |
| 105 | + - osls_csv.resources is defined |
| 106 | + - osls_csv.resources | length > 0 |
| 107 | + - osls_csv.resources[0].status.phase is defined |
| 108 | + - osls_csv.resources[0].status.phase == "Succeeded" |
188 | 109 | retries: 30 |
189 | 110 | delay: 10 |
190 | 111 |
|
191 | 112 | - name: Display deployment summary |
192 | 113 | ansible.builtin.debug: |
193 | 114 | msg: |
194 | | - - "✓ OpenShift Lightspeed operator deployed in namespace: {{ openshift_lightspeed_namespace }}" |
195 | 115 | - "✓ OpenStack Lightspeed operator deployed in namespace: {{ openstack_lightspeed_namespace }}" |
| 116 | + - "✓ OpenShift Lightspeed operator will be automatically managed by OpenStack Lightspeed" |
0 commit comments