From eb813852d862b979dacf4c79c5020f1308460658 Mon Sep 17 00:00:00 2001 From: Huy Mai Date: Wed, 10 Apr 2024 11:54:12 +0000 Subject: [PATCH] Add e2e ironic upgrades Signed-off-by: Huy Mai --- hack/ci-e2e.sh | 31 ++++++------ .../e2e-release-24.0/ironic-patch.yaml | 10 ++++ .../e2e-release-24.0/ironic_bmo_configmap.env | 6 +++ .../e2e-release-24.0/kustomization.yaml | 49 +++++++++++++++++++ test/e2e/config/ironic.yaml | 6 +++ 5 files changed, 86 insertions(+), 16 deletions(-) create mode 100644 ironic-deployment/overlays/e2e-release-24.0/ironic-patch.yaml create mode 100644 ironic-deployment/overlays/e2e-release-24.0/ironic_bmo_configmap.env create mode 100644 ironic-deployment/overlays/e2e-release-24.0/kustomization.yaml diff --git a/hack/ci-e2e.sh b/hack/ci-e2e.sh index 06ba3317b6..b20599534f 100755 --- a/hack/ci-e2e.sh +++ b/hack/ci-e2e.sh @@ -153,7 +153,7 @@ popd # Generate credentials BMO_OVERLAYS=("${REPO_ROOT}/config/overlays/e2e" "${REPO_ROOT}/config/overlays/e2e-release-0.3" "${REPO_ROOT}/config/overlays/e2e-release-0.4" "${REPO_ROOT}/config/overlays/e2e-release-0.5") -IRONIC_OVERLAY="${REPO_ROOT}/ironic-deployment/overlays/e2e" +IRONIC_OVERLAYS=("${REPO_ROOT}/ironic-deployment/overlays/e2e" "${REPO_ROOT}/ironic-deployment/overlays/e2e-with-inspector" "${REPO_ROOT}/ironic-deployment/overlays/e2e-release-24.0") IRONIC_USERNAME="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 12 | head -n 1)" IRONIC_PASSWORD="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 12 | head -n 1)" @@ -175,21 +175,20 @@ for overlay in "${BMO_OVERLAYS[@]}"; do fi done -echo "IRONIC_HTPASSWD=$(htpasswd -n -b -B "${IRONIC_USERNAME}" "${IRONIC_PASSWORD}")" > \ - "${IRONIC_OVERLAY}/ironic-htpasswd" - -IRONIC_WITH_INSPECTOR_OVERLAY="${REPO_ROOT}/ironic-deployment/overlays/e2e-with-inspector" -envsubst < "${REPO_ROOT}/ironic-deployment/components/basic-auth/ironic-auth-config-tpl" > \ - "${IRONIC_WITH_INSPECTOR_OVERLAY}/ironic-auth-config" - -echo "IRONIC_HTPASSWD=$(htpasswd -n -b -B "${IRONIC_USERNAME}" "${IRONIC_PASSWORD}")" > \ - "${IRONIC_WITH_INSPECTOR_OVERLAY}/ironic-htpasswd" -IRONIC_INSPECTOR_AUTH_CONFIG_TPL="/tmp/ironic-inspector-auth-config-tpl" -curl -o "${IRONIC_INSPECTOR_AUTH_CONFIG_TPL}" https://raw.githubusercontent.com/metal3-io/baremetal-operator/release-0.5/ironic-deployment/components/basic-auth/ironic-inspector-auth-config-tpl -envsubst < "${IRONIC_INSPECTOR_AUTH_CONFIG_TPL}" > \ - "${IRONIC_WITH_INSPECTOR_OVERLAY}/ironic-inspector-auth-config" -echo "INSPECTOR_HTPASSWD=$(htpasswd -n -b -B "${IRONIC_INSPECTOR_USERNAME}" \ - "${IRONIC_INSPECTOR_PASSWORD}")" > "${IRONIC_WITH_INSPECTOR_OVERLAY}/ironic-inspector-htpasswd" +for overlay in "${IRONIC_OVERLAYS[@]}"; do + echo "IRONIC_HTPASSWD=$(htpasswd -n -b -B "${IRONIC_USERNAME}" "${IRONIC_PASSWORD}")" > \ + "${overlay}/ironic-htpasswd" + envsubst < "${REPO_ROOT}/ironic-deployment/components/basic-auth/ironic-auth-config-tpl" > \ + "${overlay}/ironic-auth-config" + if [[ "${overlay}" =~ -with-inspector ]]; then + IRONIC_INSPECTOR_AUTH_CONFIG_TPL="/tmp/ironic-inspector-auth-config-tpl" + curl -o "${IRONIC_INSPECTOR_AUTH_CONFIG_TPL}" https://raw.githubusercontent.com/metal3-io/baremetal-operator/release-0.5/ironic-deployment/components/basic-auth/ironic-inspector-auth-config-tpl + envsubst < "${IRONIC_INSPECTOR_AUTH_CONFIG_TPL}" > \ + "${overlay}/ironic-inspector-auth-config" + echo "INSPECTOR_HTPASSWD=$(htpasswd -n -b -B "${IRONIC_INSPECTOR_USERNAME}" \ + "${IRONIC_INSPECTOR_PASSWORD}")" > "${overlay}/ironic-inspector-htpasswd" + fi +done # We need to gather artifacts/logs before exiting also if there are errors set +e diff --git a/ironic-deployment/overlays/e2e-release-24.0/ironic-patch.yaml b/ironic-deployment/overlays/e2e-release-24.0/ironic-patch.yaml new file mode 100644 index 0000000000..098d21e109 --- /dev/null +++ b/ironic-deployment/overlays/e2e-release-24.0/ironic-patch.yaml @@ -0,0 +1,10 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ironic +spec: + template: + spec: + containers: + - name: ironic-dnsmasq + $patch: delete diff --git a/ironic-deployment/overlays/e2e-release-24.0/ironic_bmo_configmap.env b/ironic-deployment/overlays/e2e-release-24.0/ironic_bmo_configmap.env new file mode 100644 index 0000000000..cd099090c2 --- /dev/null +++ b/ironic-deployment/overlays/e2e-release-24.0/ironic_bmo_configmap.env @@ -0,0 +1,6 @@ +HTTP_PORT=6180 +PROVISIONING_IP=192.168.222.199 +CACHEURL=http://192.168.222.199/images +IRONIC_FAST_TRACK=true +IRONIC_KERNEL_PARAMS=console=ttyS0 +IRONIC_INSPECTOR_VLAN_INTERFACES=all diff --git a/ironic-deployment/overlays/e2e-release-24.0/kustomization.yaml b/ironic-deployment/overlays/e2e-release-24.0/kustomization.yaml new file mode 100644 index 0000000000..e28d4eaa20 --- /dev/null +++ b/ironic-deployment/overlays/e2e-release-24.0/kustomization.yaml @@ -0,0 +1,49 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: baremetal-operator-system +resources: +- https://github.com/metal3-io/baremetal-operator/config/namespace?ref=release-0.5 +- https://github.com/metal3-io/baremetal-operator/ironic-deployment/base?ref=release-0.5 + +components: +- https://github.com/metal3-io/baremetal-operator/ironic-deployment/components/basic-auth?ref=release-0.5 +- https://github.com/metal3-io/baremetal-operator/ironic-deployment/components/tls?ref=release-0.5 + +configMapGenerator: +- envs: + - ironic_bmo_configmap.env + name: ironic-bmo-configmap + behavior: create + +patches: +- path: ironic-patch.yaml + +images: +- name: quay.io/metal3-io/ironic + newTag: release-24.0 + +# NOTE: These credentials are generated automatically in hack/ci-e2e.sh +secretGenerator: +- name: ironic-htpasswd + behavior: create + envs: + - ironic-htpasswd +- name: ironic-auth-config + files: + - auth-config=ironic-auth-config + +replacements: +# Replace IRONIC_HOST_IP in certificates with the PROVISIONING_IP from the configmap +- source: + kind: ConfigMap + name: ironic-bmo-configmap + fieldPath: .data.PROVISIONING_IP + targets: + - select: + version: v1 + group: cert-manager.io + kind: Certificate + name: + fieldPaths: + - .spec.ipAddresses.0 + diff --git a/test/e2e/config/ironic.yaml b/test/e2e/config/ironic.yaml index 34cd6f335d..2669819134 100644 --- a/test/e2e/config/ironic.yaml +++ b/test/e2e/config/ironic.yaml @@ -72,3 +72,9 @@ bmoIronicUpgradeSpecs: initIronicKustomization: "../../ironic-deployment/overlays/e2e" upgradeEntityKustomization: "../../config/overlays/e2e" upgradeEntityName: "bmo" +- deployIronic: true + deployBMO: true + initBMOKustomization: "../../config/overlays/e2e" + initIronicKustomization: "../../ironic-deployment/overlays/e2e-release-24.0" + upgradeEntityKustomization: "../../ironic-deployment/overlays/e2e" + upgradeEntityName: "ironic"