Skip to content

Commit aea963f

Browse files
Skip launching ironic in case of capm3 e2e tests
Signed-off-by: Muhammad Adil Ghaffar <[email protected]>
1 parent f22ad46 commit aea963f

File tree

3 files changed

+65
-41
lines changed

3 files changed

+65
-41
lines changed

03_launch_mgmt_cluster.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -829,24 +829,30 @@ fi
829829
patch_ipam
830830
launch_cluster_api_provider_metal3
831831
BMO_NAME_PREFIX="${NAMEPREFIX}"
832-
launch_baremetal_operator
832+
if [[ "${SKIP_APPLY_BMH:-false}" != "true" ]]; then
833+
launch_baremetal_operator
834+
fi
833835
if [[ "${USE_IRSO}" = true ]]; then
834-
launch_ironic_standalone_operator
835-
launch_ironic_via_irso
836+
if [[ "${SKIP_APPLY_BMH:-false}" = "false" ]]; then
837+
launch_ironic_standalone_operator
838+
launch_ironic_via_irso
839+
fi
836840
else
837841
launch_ironic
838842
fi
839843

840-
if [[ "${BMO_RUN_LOCAL}" != true ]]; then
841-
if ! kubectl rollout status deployment "${BMO_NAME_PREFIX}"-controller-manager -n "${IRONIC_NAMESPACE}" --timeout="${BMO_ROLLOUT_WAIT}"m; then
842-
echo "baremetal-operator-controller-manager deployment can not be rollout"
843-
exit 1
844+
if [[ "${SKIP_APPLY_BMH:-false}" != "true" ]]; then
845+
if [[ "${BMO_RUN_LOCAL}" != true ]]; then
846+
if ! kubectl rollout status deployment "${BMO_NAME_PREFIX}"-controller-manager -n "${IRONIC_NAMESPACE}" --timeout="${BMO_ROLLOUT_WAIT}"m; then
847+
echo "baremetal-operator-controller-manager deployment can not be rollout"
848+
exit 1
849+
fi
850+
else
851+
# There is no certificate to run validation webhook on local.
852+
# Thus we are deleting validatingwebhookconfiguration resource if exists
853+
# to let BMO is working properly on local runs.
854+
kubectl delete validatingwebhookconfiguration/"${BMO_NAME_PREFIX}"-validating-webhook-configuration --ignore-not-found=true
844855
fi
845-
else
846-
# There is no certificate to run validation webhook on local.
847-
# Thus we are deleting validatingwebhookconfiguration resource if exists
848-
# to let BMO is working properly on local runs.
849-
kubectl delete validatingwebhookconfiguration/"${BMO_NAME_PREFIX}"-validating-webhook-configuration --ignore-not-found=true
850856
fi
851857

852858
# Tests might want to apply bmh inside the test scipt

03_launch_mgmt_cluster_pre_1_10.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -744,24 +744,30 @@ kubectl create namespace metal3
744744
patch_clusterctl
745745
launch_cluster_api_provider_metal3
746746
BMO_NAME_PREFIX="${NAMEPREFIX}"
747-
launch_baremetal_operator
747+
if [[ "${SKIP_APPLY_BMH:-false}" != "true" ]]; then
748+
launch_baremetal_operator
749+
fi
748750
if [[ "${USE_IRSO}" = true ]]; then
749-
launch_ironic_standalone_operator
750-
launch_ironic_via_irso
751+
if [[ "${SKIP_APPLY_BMH:-false}" = "false" ]]; then
752+
launch_ironic_standalone_operator
753+
launch_ironic_via_irso
754+
fi
751755
else
752756
launch_ironic
753757
fi
754758

755-
if [[ "${BMO_RUN_LOCAL}" != true ]]; then
756-
if ! kubectl rollout status deployment "${BMO_NAME_PREFIX}"-controller-manager -n "${IRONIC_NAMESPACE}" --timeout="${BMO_ROLLOUT_WAIT}"m; then
757-
echo "baremetal-operator-controller-manager deployment can not be rollout"
758-
exit 1
759+
if [[ "${SKIP_APPLY_BMH:-false}" != "true" ]]; then
760+
if [[ "${BMO_RUN_LOCAL}" != true ]]; then
761+
if ! kubectl rollout status deployment "${BMO_NAME_PREFIX}"-controller-manager -n "${IRONIC_NAMESPACE}" --timeout="${BMO_ROLLOUT_WAIT}"m; then
762+
echo "baremetal-operator-controller-manager deployment can not be rollout"
763+
exit 1
764+
fi
765+
else
766+
# There is no certificate to run validation webhook on local.
767+
# Thus we are deleting validatingwebhookconfiguration resource if exists
768+
# to let BMO is working properly on local runs.
769+
kubectl delete validatingwebhookconfiguration/"${BMO_NAME_PREFIX}"-validating-webhook-configuration --ignore-not-found=true
759770
fi
760-
else
761-
# There is no certificate to run validation webhook on local.
762-
# Thus we are deleting validatingwebhookconfiguration resource if exists
763-
# to let BMO is working properly on local runs.
764-
kubectl delete validatingwebhookconfiguration/"${BMO_NAME_PREFIX}"-validating-webhook-configuration --ignore-not-found=true
765771
fi
766772

767773
# Tests might want to apply bmh inside the test scipt

04_verify.sh

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,27 @@ EXPTD_V1ALPHAX_V1BETAX_CRDS="clusters.cluster.x-k8s.io \
192192
EXPTD_DEPLOYMENTS="capm3-system:capm3-controller-manager \
193193
capi-system:capi-controller-manager \
194194
capi-kubeadm-bootstrap-system:capi-kubeadm-bootstrap-controller-manager \
195-
capi-kubeadm-control-plane-system:capi-kubeadm-control-plane-controller-manager \
195+
capi-kubeadm-control-plane-system:capi-kubeadm-control-plane-controller-manager"
196+
197+
# Only expect BMO related deployments in dev-env tests and not in CAPM3 e2e tests.
198+
# CAPM3 will apply BMO and IRSO.
199+
if [[ "${SKIP_APPLY_BMH:-false}" != "true" ]]; then
200+
EXPTD_DEPLOYMENTS+=" \
196201
baremetal-operator-system:baremetal-operator-controller-manager"
202+
fi
197203

198204
if [[ "${BOOTSTRAP_CLUSTER}" == "minikube" ]]; then
199-
if [[ "${USE_IRSO}" == "true" ]]; then
200-
EXPTD_DEPLOYMENTS+=" \
201-
baremetal-operator-system:ironic-service \
202-
ironic-standalone-operator-system:ironic-standalone-operator-controller-manager"
203-
else
204-
EXPTD_DEPLOYMENTS+=" \
205-
baremetal-operator-system:baremetal-operator-ironic"
205+
# Only expect IRSO related deployments in dev-env tests and not in CAPM3 e2e tests.
206+
# CAPM3 will apply BMO and IRSO.
207+
if [[ "${SKIP_APPLY_BMH:-false}" != "true" ]]; then
208+
if [[ "${USE_IRSO}" == "true" ]]; then
209+
EXPTD_DEPLOYMENTS+=" \
210+
baremetal-operator-system:ironic-service \
211+
ironic-standalone-operator-system:ironic-standalone-operator-controller-manager"
212+
else
213+
EXPTD_DEPLOYMENTS+=" \
214+
baremetal-operator-system:baremetal-operator-ironic"
215+
fi
206216
fi
207217
fi
208218

@@ -309,15 +319,17 @@ for container in ${EXPTD_CONTAINERS}; do
309319
done
310320

311321
IRONIC_NODES_ENDPOINT="${IRONIC_URL}nodes"
312-
status="$(curl -sk -o /dev/null -I -w "%{http_code}" "${IRONIC_NODES_ENDPOINT}")"
313-
if [[ $status == 200 ]]; then
314-
echo "⚠️ ⚠️ ⚠️ WARNING: Ironic endpoint is exposed for unauthenticated users"
315-
exit 1
316-
elif [[ $status == 401 ]]; then
317-
echo "OK - Ironic endpoint is secured"
318-
else
319-
echo "FAIL- got $status from ${IRONIC_NODES_ENDPOINT}, expected 401"
320-
exit 1
322+
if [[ "${SKIP_APPLY_BMH:-false}" != "true" ]]; then
323+
status="$(curl -sk -o /dev/null -I -w "%{http_code}" "${IRONIC_NODES_ENDPOINT}")"
324+
if [[ $status == 200 ]]; then
325+
echo "⚠️ ⚠️ ⚠️ WARNING: Ironic endpoint is exposed for unauthenticated users"
326+
exit 1
327+
elif [[ $status == 401 ]]; then
328+
echo "OK - Ironic endpoint is secured"
329+
else
330+
echo "FAIL- got $status from ${IRONIC_NODES_ENDPOINT}, expected 401"
331+
exit 1
332+
fi
321333
fi
322334
echo ""
323335

0 commit comments

Comments
 (0)