Skip to content

Commit bf64839

Browse files
Use IRSO in e2e tests
Signed-off-by: Muhammad Adil Ghaffar <[email protected]>
1 parent d942381 commit bf64839

File tree

11 files changed

+203
-14
lines changed

11 files changed

+203
-14
lines changed

scripts/ci-e2e.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ update_kustomize_image quay.io/metal3-io/ironic IRONIC_IMAGE "${REPO_ROOT}"/test
184184
# Apply envsubst to kustomization.yaml files in BMO and Ironic overlays
185185
kustomize_envsubst "${REPO_ROOT}"/test/e2e/data/bmo-deployment/overlays/pr-test
186186
kustomize_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-deployment/overlays/pr-test
187+
kustomize_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/operator
188+
kustomize_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/overlays/release-26.0
189+
kustomize_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/overlays/release-27.0
190+
kustomize_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/overlays/release-29.0
191+
kustomize_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/overlays/release-main
187192

188193
# Create usernames and passwords and other files related to ironi basic auth if they
189194
# are missing

test/e2e/common.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
bmov1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
2424
infrav1 "github.com/metal3-io/cluster-api-provider-metal3/api/v1beta1"
2525
ipamv1 "github.com/metal3-io/ip-address-manager/api/v1alpha1"
26+
irsov1alpha1 "github.com/metal3-io/ironic-standalone-operator/api/v1alpha1"
2627
. "github.com/onsi/ginkgo/v2"
2728
. "github.com/onsi/gomega"
2829
"github.com/pkg/errors"
@@ -1222,3 +1223,36 @@ func IsMetal3DataCountEqualToMachineCount(ctx context.Context, c client.Client,
12221223

12231224
return len(m3DataList.Items) == len(machineList.Items)
12241225
}
1226+
1227+
// WaitForIronicReady waits until the given Ironic resource has Ready condition = True.
1228+
func WaitForIronicReady(ctx context.Context, input WaitForIronicInput) {
1229+
Logf("Waiting for Ironic %q to be Ready", input.Name)
1230+
1231+
Eventually(func(g Gomega) {
1232+
ironic := &irsov1alpha1.Ironic{}
1233+
err := input.Client.Get(ctx, client.ObjectKey{
1234+
Namespace: input.Namespace,
1235+
Name: input.Name,
1236+
}, ironic)
1237+
g.Expect(err).To(Succeed())
1238+
1239+
ready := false
1240+
for _, cond := range ironic.Status.Conditions {
1241+
if cond.Type == string(irsov1alpha1.IronicStatusReady) && cond.Status == metav1.ConditionTrue {
1242+
ready = true
1243+
break
1244+
}
1245+
}
1246+
g.Expect(ready).To(BeTrue(), "Ironic %q is not Ready yet", input.Name)
1247+
}, input.Intervals...).Should(Succeed())
1248+
1249+
Logf("Ironic %q is Ready", input.Name)
1250+
}
1251+
1252+
// WaitForIronicInput bundles the parameters for WaitForIronicReady.
1253+
type WaitForIronicInput struct {
1254+
Client client.Client
1255+
Name string
1256+
Namespace string
1257+
Intervals []interface{} // e.g. []interface{}{time.Minute * 15, time.Second * 5}
1258+
}

test/e2e/config/e2e_conf.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ variables:
235235
IRONIC_RELEASE_29.0: "data/ironic-deployment/overlays/release-29.0"
236236
IRONIC_RELEASE_PR_TEST: "data/ironic-deployment/overlays/pr-test"
237237
IRONIC_RELEASE_LATEST: "data/ironic-deployment/overlays/release-latest"
238+
IRSO_OPERATOR_LATEST: "data/ironic-standalone-operator/operator"
239+
IRSO_IRONIC_26.0: "data/ironic-standalone-operator/ironic/overlays/release-26.0"
240+
IRSO_IRONIC_27.0: "data/ironic-standalone-operator/ironic/overlays/release-27.0"
241+
IRSO_IRONIC_29.0: "data/ironic-standalone-operator/ironic/overlays/release-29.0"
242+
IRSO_IRONIC_MAIN: "data/ironic-standalone-operator/ironic/overlays/release-main"
238243
BMO_RELEASE_0.8: "data/bmo-deployment/overlays/release-0.8"
239244
BMO_RELEASE_0.9: "data/bmo-deployment/overlays/release-0.9"
240245
BMO_RELEASE_0.10: "data/bmo-deployment/overlays/release-0.10"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
apiVersion: ironic.metal3.io/v1alpha1
3+
kind: Ironic
4+
metadata:
5+
name: ironic
6+
namespace: "${IRONIC_NAMESPACE}"
7+
spec:
8+
apiCredentialsName: ironic-auth
9+
images:
10+
deployRamdiskBranch: "${IPA_BRANCH}"
11+
deployRamdiskDownloader: "${IPA_DOWNLOADER_IMAGE}"
12+
ironic: "${IRONIC_IMAGE}"
13+
keepalived: "${IRONIC_KEEPALIVED_IMAGE}"
14+
version: "${IRSO_IRONIC_VERSION}"
15+
networking:
16+
dhcp:
17+
rangeBegin: "${CLUSTER_DHCP_RANGE_START}"
18+
rangeEnd: "${CLUSTER_DHCP_RANGE_END}"
19+
networkCIDR: "${BARE_METAL_PROVISIONER_NETWORK}"
20+
interface: "${BARE_METAL_PROVISIONER_INTERFACE}"
21+
ipAddress: "${CLUSTER_BARE_METAL_PROVISIONER_IP}"
22+
ipAddressManager: keepalived
23+
deployRamdisk:
24+
sshKey: "${SSH_PUB_KEY_CONTENT}"
25+
extraKernelParams: "console=ttyS0"
26+
tls:
27+
certificateName: ironic-cert
28+
---
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
resources:
2+
- ironic.yaml
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
resources:
2+
- ../../base
3+
4+
patches:
5+
- target:
6+
kind: Ironic
7+
name: ironic
8+
patch: |-
9+
- op: replace
10+
path: /spec/images/ironic
11+
value: "quay.io/metal3-io/ironic:release-26.0"
12+
images:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
resources:
2+
- ../../base
3+
4+
patches:
5+
- target:
6+
kind: Ironic
7+
name: ironic
8+
patch: |-
9+
- op: replace
10+
path: /spec/images/ironic
11+
value: "quay.io/metal3-io/ironic:release-27.0"
12+
images:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
resources:
2+
- ../../base
3+
4+
patches:
5+
- target:
6+
kind: Ironic
7+
name: ironic
8+
patch: |-
9+
- op: replace
10+
path: /spec/images/ironic
11+
value: "quay.io/metal3-io/ironic:release-29.0"
12+
images:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
resources:
2+
- ../../base
3+
4+
patches:
5+
- target:
6+
kind: Ironic
7+
name: ironic
8+
patch: |-
9+
- op: replace
10+
path: /spec/images/ironic
11+
value: "quay.io/metal3-io/ironic:main"
12+
images:
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- https://raw.githubusercontent.com/metal3-io/ironic-standalone-operator/refs/heads/${IRSOBRANCH}/config/crd/bases/ironic.metal3.io_ironics.yaml
6+
- https://raw.githubusercontent.com/metal3-io/ironic-standalone-operator/refs/heads/${IRSOBRANCH}/config/manager/manager.yaml
7+
8+
generatorOptions:
9+
disableNameSuffixHash: true
10+
11+
configMapGenerator:
12+
- name: ironic-operator-config
13+
literals:
14+
- FEATURE_GATES=HighAvailability=true
15+
- IPA_BASEURI=https://artifactory.nordix.org/artifactory/openstack-remote-cache/ironic-python-agent/dib
16+
17+
patches:
18+
- target:
19+
kind: Deployment
20+
name: controller-manager
21+
patch: |-
22+
apiVersion: apps/v1
23+
kind: Deployment
24+
metadata:
25+
name: controller-manager
26+
spec:
27+
template:
28+
spec:
29+
containers:
30+
- name: manager
31+
envFrom:
32+
- configMapRef:
33+
name: ironic-operator-config

0 commit comments

Comments
 (0)