Skip to content

Commit 94e2d89

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

File tree

4 files changed

+186
-20
lines changed

4 files changed

+186
-20
lines changed

lib/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export CAPM3_BASE_URL="${CAPM3_BASE_URL:-metal3-io/cluster-api-provider-metal3}"
158158
export CAPM3REPO="${CAPM3REPO:-https://github.com/${CAPM3_BASE_URL}}"
159159
export CAPM3RELEASEBRANCH="${CAPM3RELEASEBRANCH:-main}"
160160

161-
export USE_IRSO="${USE_IRSO:-false}"
161+
export USE_IRSO="true"
162162
export IRSOPATH="${IRSOPATH:-${M3PATH}/ironic-standalone-operator}"
163163
export IRSO_BASE_URL="${IRSO_BASE_URL:-metal3-io/ironic-standalone-operator}"
164164
export IRSOREPO="${IRSOREPO:-https://github.com/${IRSO_BASE_URL}}"

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"

tests/roles/run_tests/vars/main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,21 @@ WORKER_MACHINE_COUNT: "{{ lookup('env', 'WORKER_MACHINE_COUNT') | default(1, tru
1616
NUM_NODES: "{{ lookup('env', 'NUM_NODES') | default(2, true) }}"
1717
NODE_DRAIN_TIMEOUT: "{{ lookup('env', 'NODE_DRAIN_TIMEOUT') | default('0s', true) }}"
1818
BMOPATH: "{{ lookup('env', 'BMOPATH') }}"
19+
IRSOPATH: "{{ lookup('env', 'IRSOPATH') }}"
20+
IRONIC_ROLLOUT_WAIT: "{{ lookup('env', 'IRONIC_ROLLOUT_WAIT') | default(10, true) }}"
21+
IPA_DOWNLOADER_IMAGE: "{{ lookup('env', 'IPA_DOWNLOADER_IMAGE') | default('registry.nordix.org/metal3/ironic-python-agent-downloader:latest', true) }}"
22+
IRSO_IMAGE: "{{ lookup('env', 'IRSO_IMAGE') | default('registry.nordix.org/metal3/ironic-standalone-operator:latest', true) }}"
23+
IRONIC_IMAGE: "{{ lookup('env', 'IRONIC_IMAGE') | default('registry.nordix.org/metal3/ironic:latest', true) }}"
24+
IRONIC_KEEPALIVED_IMAGE: "{{ lookup('env', 'IRONIC_KEEPALIVED_IMAGE') | default('registry.nordix.org/metal3/ironic-keepalived:latest', true) }}"
25+
IRSO_IRONIC_VERSION: "{{ lookup('env', 'IRSO_IRONIC_VERSION') | default('latest', true) }}"
26+
CLUSTER_DHCP_RANGE_START: "{{ lookup('env', 'CLUSTER_DHCP_RANGE_START') | default('172.22.0.10', true) }}"
27+
CLUSTER_DHCP_RANGE_END: "{{ lookup('env', 'CLUSTER_DHCP_RANGE_END') | default('172.22.0.100', true) }}"
28+
BARE_METAL_PROVISIONER_NETWORK: "{{ lookup('env', 'BARE_METAL_PROVISIONER_NETWORK') | default('172.22.0.0/24', true) }}"
29+
BARE_METAL_PROVISIONER_INTERFACE: "{{ lookup('env', 'BARE_METAL_PROVISIONER_INTERFACE') | default('ironicendpoint', true) }}"
30+
CLUSTER_BARE_METAL_PROVISIONER_IP: "{{ lookup('env', 'CLUSTER_BARE_METAL_PROVISIONER_IP') | default('172.22.0.2', true) }}"
31+
IPA_BRANCH: "{{ lookup('env', 'IPA_BRANCH') | default('main', true) }}"
1932
IRONIC_DATA_DIR: "{{ lookup('env', 'IRONIC_DATA_DIR') }}"
33+
NODES_PLATFORM: "{{ lookup('env', 'NODES_PLATFORM') | default('libvirt', true) }}"
2034
KUBECONFIG_PATH: "/home/ubuntu/.kube/config"
2135
KUBERNETES_VERSION: "{{ lookup('env', 'KUBERNETES_VERSION') | default('v1.34.1', true) }}"
2236
UPGRADED_K8S_VERSION: "{{ lookup('env', 'UPGRADED_K8S_VERSION') | default('v1.34.1', true) }}"

0 commit comments

Comments
 (0)