Skip to content

Commit a845453

Browse files
Use irso after pivot
Signed-off-by: Muhammad Adil Ghaffar <[email protected]>
1 parent 01530d0 commit a845453

File tree

2 files changed

+171
-19
lines changed

2 files changed

+171
-19
lines changed

tests/roles/run_tests/tasks/move.yml

Lines changed: 88 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
with_items: "{{ ironic_containers }}"
3838

3939
when: BOOTSTRAP_CLUSTER == "kind"
40-
become: yes
40+
become: true
4141
become_user: root
4242

4343
- name: Fetch container logs (minikube cluster)
@@ -53,18 +53,24 @@
5353
shell: "sudo {{ CONTAINER_RUNTIME }} logs {{ item }} > /tmp/{{ CONTAINER_RUNTIME }}/{{ item }}/stdout.log 2> /tmp/{{ CONTAINER_RUNTIME }}/{{ item }}/stderr.log"
5454
with_items: "{{ general_containers }}"
5555

56-
become: yes
56+
become: true
5757
become_user: root
5858
when: BOOTSTRAP_CLUSTER == "minikube"
5959

60-
- name: Remove Ironic from source cluster (minikube cluster)
60+
- name: Remove Ironic CR from source cluster (minikube cluster)
6161
kubernetes.core.k8s:
62-
name: "{{ NAMEPREFIX }}-ironic"
63-
kind: Deployment
62+
name: ironic
63+
kind: Ironic
64+
api_version: ironic.metal3.io/v1alpha1
6465
state: absent
6566
namespace: "{{ IRONIC_NAMESPACE }}"
6667
when: BOOTSTRAP_CLUSTER == "minikube"
6768

69+
- name: Remove IRSO from source cluster (minikube cluster)
70+
shell: "make -C {{ IRSOPATH }} uninstall undeploy"
71+
ignore_errors: true
72+
when: BOOTSTRAP_CLUSTER == "minikube"
73+
6874
- name: Label baremetalhost CRD to pivot.
6975
shell: "kubectl label --overwrite crds baremetalhosts.metal3.io {{ item }}"
7076
with_items:
@@ -136,15 +142,84 @@
136142
args:
137143
chdir: "{{ BMOPATH }}"
138144

139-
# Install Ironic
140-
- name: Install Ironic
141-
shell: "{{ BMOPATH }}/tools/deploy.sh -i {{ BMO_IRONIC_ARGS }}"
142-
environment:
143-
IRONIC_HOST: "{{ IRONIC_HOST }}"
144-
IRONIC_HOST_IP: "{{ IRONIC_HOST_IP }}"
145-
KUBECTL_ARGS: "{{ KUBECTL_ARGS }}"
145+
# Install IRSO and Ironic via IRSO
146+
- name: Set IPA_BASEURI in IRSO manager config
147+
lineinfile:
148+
path: "{{ IRSOPATH }}/config/manager/manager.env"
149+
line: 'IPA_BASEURI=https://artifactory.nordix.org/artifactory/openstack-remote-cache/ironic-python-agent/dib'
150+
create: yes
151+
152+
- name: Install and deploy IRSO
153+
shell: "make install deploy IMG={{ IRSO_IMAGE }}"
146154
args:
147-
chdir: "{{ BMOPATH }}"
155+
chdir: "{{ IRSOPATH }}"
156+
environment:
157+
KUBECONFIG: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"
158+
159+
- name: Wait for IRSO controller manager to be available
160+
kubernetes.core.k8s_info:
161+
kind: Deployment
162+
name: ironic-standalone-operator-controller-manager
163+
namespace: ironic-standalone-operator-system
164+
kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"
165+
wait: true
166+
wait_condition:
167+
type: Available
168+
status: "True"
169+
wait_timeout: 60
170+
171+
- name: Set Ironic spec
172+
set_fact:
173+
ironic_spec:
174+
apiVersion: ironic.metal3.io/v1alpha1
175+
kind: Ironic
176+
metadata:
177+
name: ironic
178+
namespace: "{{ IRONIC_NAMESPACE }}"
179+
spec:
180+
images:
181+
deployRamdiskBranch: "{{ IPA_BRANCH }}"
182+
deployRamdiskDownloader: "{{ IPA_DOWNLOADER_IMAGE }}"
183+
ironic: "{{ IRONIC_IMAGE }}"
184+
keepalived: "{{ IRONIC_KEEPALIVED_IMAGE }}"
185+
version: "{{ IRSO_IRONIC_VERSION }}"
186+
networking:
187+
dhcp:
188+
rangeBegin: "{{ CLUSTER_DHCP_RANGE_START }}"
189+
rangeEnd: "{{ CLUSTER_DHCP_RANGE_END }}"
190+
networkCIDR: "{{ BARE_METAL_PROVISIONER_NETWORK }}"
191+
interface: "{{ BARE_METAL_PROVISIONER_INTERFACE }}"
192+
ipAddress: "{{ CLUSTER_BARE_METAL_PROVISIONER_IP }}"
193+
ipAddressManager: keepalived
194+
deployRamdisk:
195+
sshKey: "{{ SSH_PUB_KEY_CONTENT }}"
196+
197+
- name: Add extraKernelParams for libvirt platform
198+
set_fact:
199+
ironic_spec: "{{ ironic_spec | combine({'spec': {'deployRamdisk': {'extraKernelParams': 'console=ttyS0'}}}, recursive=True) }}"
200+
when: NODES_PLATFORM == 'libvirt'
201+
202+
- name: Deploy Ironic using IRSO (retry if webhook not ready)
203+
kubernetes.core.k8s:
204+
state: present
205+
kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"
206+
definition: "{{ ironic_spec }}"
207+
register: ironic_create
208+
retries: 10
209+
delay: 3
210+
until: ironic_create is succeeded
211+
212+
- name: Wait for Ironic to be ready
213+
kubernetes.core.k8s_info:
214+
kind: Ironic
215+
name: ironic
216+
namespace: "{{ IRONIC_NAMESPACE }}"
217+
kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"
218+
wait: true
219+
wait_condition:
220+
type: Ready
221+
status: "True"
222+
wait_timeout: "{{ (IRONIC_ROLLOUT_WAIT | default(10) | int * 60) }}"
148223

149224
- name: Label baremetalhost CRD in target cluster to pivot back.
150225
shell: "kubectl --kubeconfig /tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml label crds baremetalhosts.metal3.io {{ item }} --overwrite "

tests/roles/run_tests/tasks/move_back.yml

Lines changed: 83 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,91 @@
2424
CONTAINER_RUNTIME: "{{ CONTAINER_RUNTIME }}"
2525
when: BOOTSTRAP_CLUSTER == "kind"
2626

27-
- name: Install Ironic in Source cluster (Bootstrap Cluster is minikube)
28-
shell: "{{ BMOPATH }}/tools/deploy.sh -i {{ BMO_IRONIC_ARGS }}"
29-
environment:
30-
IRONIC_HOST: "{{ IRONIC_HOST }}"
31-
IRONIC_HOST_IP: "{{ IRONIC_HOST_IP }}"
27+
28+
# Install IRSO and Ironic via IRSO
29+
- name: Set IPA_BASEURI in IRSO manager config
30+
lineinfile:
31+
path: "{{ IRSOPATH }}/config/manager/manager.env"
32+
line: 'IPA_BASEURI=https://artifactory.nordix.org/artifactory/openstack-remote-cache/ironic-python-agent/dib'
33+
create: yes
3234
when: BOOTSTRAP_CLUSTER == "minikube"
35+
36+
- name: Install and deploy IRSO
37+
shell: "make install deploy IMG={{ IRSO_IMAGE }}"
3338
args:
34-
chdir: "{{ BMOPATH }}"
39+
chdir: "{{ IRSOPATH }}"
40+
environment:
41+
KUBECONFIG: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"
42+
when: BOOTSTRAP_CLUSTER == "minikube"
43+
44+
- name: Wait for IRSO controller manager to be available
45+
kubernetes.core.k8s_info:
46+
kind: Deployment
47+
name: ironic-standalone-operator-controller-manager
48+
namespace: ironic-standalone-operator-system
49+
kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"
50+
wait: true
51+
wait_condition:
52+
type: Available
53+
status: "True"
54+
wait_timeout: 60
55+
when: BOOTSTRAP_CLUSTER == "minikube"
56+
57+
- name: Set Ironic spec
58+
when: BOOTSTRAP_CLUSTER == "minikube"
59+
set_fact:
60+
ironic_spec:
61+
apiVersion: ironic.metal3.io/v1alpha1
62+
kind: Ironic
63+
metadata:
64+
name: ironic
65+
namespace: "{{ IRONIC_NAMESPACE }}"
66+
spec:
67+
images:
68+
deployRamdiskBranch: "{{ IPA_BRANCH }}"
69+
deployRamdiskDownloader: "{{ IPA_DOWNLOADER_IMAGE }}"
70+
ironic: "{{ IRONIC_IMAGE }}"
71+
keepalived: "{{ IRONIC_KEEPALIVED_IMAGE }}"
72+
version: "{{ IRSO_IRONIC_VERSION }}"
73+
networking:
74+
dhcp:
75+
rangeBegin: "{{ CLUSTER_DHCP_RANGE_START }}"
76+
rangeEnd: "{{ CLUSTER_DHCP_RANGE_END }}"
77+
networkCIDR: "{{ BARE_METAL_PROVISIONER_NETWORK }}"
78+
interface: "{{ BARE_METAL_PROVISIONER_INTERFACE }}"
79+
ipAddress: "{{ CLUSTER_BARE_METAL_PROVISIONER_IP }}"
80+
ipAddressManager: keepalived
81+
deployRamdisk:
82+
sshKey: "{{ SSH_PUB_KEY_CONTENT }}"
83+
84+
- name: Add extraKernelParams for libvirt platform
85+
set_fact:
86+
ironic_spec: "{{ ironic_spec | combine({'spec': {'deployRamdisk': {'extraKernelParams': 'console=ttyS0'}}}, recursive=True) }}"
87+
when: NODES_PLATFORM == 'libvirt' and BOOTSTRAP_CLUSTER == "minikube"
88+
89+
- name: Deploy Ironic using IRSO (retry if webhook not ready)
90+
kubernetes.core.k8s:
91+
state: present
92+
kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"
93+
definition: "{{ ironic_spec }}"
94+
register: ironic_create
95+
retries: 10
96+
delay: 3
97+
until: ironic_create is succeeded
98+
when: BOOTSTRAP_CLUSTER == "minikube"
99+
100+
- name: Wait for Ironic to be ready
101+
when: BOOTSTRAP_CLUSTER == "minikube"
102+
kubernetes.core.k8s_info:
103+
kind: Ironic
104+
name: ironic
105+
namespace: "{{ IRONIC_NAMESPACE }}"
106+
kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"
107+
wait: true
108+
wait_condition:
109+
type: Ready
110+
status: "True"
111+
wait_timeout: "{{ (IRONIC_ROLLOUT_WAIT | default(10) | int * 60) }}"
35112

36113
- name: Re-pivot everything back to source cluster
37114
shell: "clusterctl move --kubeconfig /tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml --to-kubeconfig /home/$USER/.kube/config -n {{ NAMESPACE }} -v 10"

0 commit comments

Comments
 (0)