From 8df77be5093e9ae66027784b26f7ce09312ac17b Mon Sep 17 00:00:00 2001 From: Lennart Jern Date: Tue, 21 Jan 2025 15:54:09 +0200 Subject: [PATCH] E2E: Use kind instead of minikube Minikube is having troubles starting sometimes. It was nice to work with since the VM could easily be attached to the same network as the BMH VMs, but it is possible to work around that also with kind. Signed-off-by: Lennart Jern --- .gitignore | 1 + config/overlays/e2e-release-0.6/ironic.env | 6 ++-- config/overlays/e2e-release-0.8/ironic.env | 6 ++-- config/overlays/e2e-release-0.9/ironic.env | 6 ++-- config/overlays/e2e/ironic.env | 6 ++-- hack/ci-e2e.sh | 36 ++----------------- hack/clean-e2e.sh | 2 +- hack/e2e/ensure_kind.sh | 35 ++++++++++++++++++ hack/e2e/ensure_minikube.sh | 33 ----------------- hack/e2e/net.xml | 3 +- .../components/tls/certificate.yaml | 2 -- .../ironic_bmo_configmap.env | 5 +-- .../kustomization.yaml | 27 ++++++-------- .../e2e-release-24.1/ironic_bmo_configmap.env | 5 +-- .../e2e-release-24.1/kustomization.yaml | 27 ++++++-------- .../e2e-release-25.0/ironic_bmo_configmap.env | 5 +-- .../e2e-release-25.0/kustomization.yaml | 25 ++++++------- .../e2e-release-26.0/ironic_bmo_configmap.env | 5 +-- .../e2e-release-26.0/kustomization.yaml | 25 ++++++------- .../ironic_bmo_configmap.env | 5 +-- .../e2e-with-inspector/kustomization.yaml | 25 ++++++------- .../overlays/e2e/ironic_bmo_configmap.env | 5 +-- .../overlays/e2e/kustomization.yaml | 25 ++++++------- test/e2e/config/ironic.yaml | 2 ++ test/e2e/e2e_suite_test.go | 22 ++++++++++++ test/go.mod | 2 +- tools/bmh_test/vm2vbmc.sh | 3 +- 27 files changed, 160 insertions(+), 189 deletions(-) create mode 100755 hack/e2e/ensure_kind.sh delete mode 100755 hack/e2e/ensure_minikube.sh diff --git a/.gitignore b/.gitignore index e4b21587a0..92aea3d84b 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ go.work.sum *~ *.tmp .DS_Store +.zed* # Tilt files. .tiltbuild diff --git a/config/overlays/e2e-release-0.6/ironic.env b/config/overlays/e2e-release-0.6/ironic.env index 0187ae15e4..44147ae0f3 100644 --- a/config/overlays/e2e-release-0.6/ironic.env +++ b/config/overlays/e2e-release-0.6/ironic.env @@ -1,3 +1,3 @@ -DEPLOY_KERNEL_URL=http://192.168.222.199:6180/images/ironic-python-agent.kernel -DEPLOY_RAMDISK_URL=http://192.168.222.199:6180/images/ironic-python-agent.initramfs -IRONIC_ENDPOINT=https://192.168.222.199:6385/v1/ +DEPLOY_KERNEL_URL=http://192.168.222.1:6180/images/ironic-python-agent.kernel +DEPLOY_RAMDISK_URL=http://192.168.222.1:6180/images/ironic-python-agent.initramfs +IRONIC_ENDPOINT=https://192.168.222.1:6385/v1/ diff --git a/config/overlays/e2e-release-0.8/ironic.env b/config/overlays/e2e-release-0.8/ironic.env index 0187ae15e4..44147ae0f3 100644 --- a/config/overlays/e2e-release-0.8/ironic.env +++ b/config/overlays/e2e-release-0.8/ironic.env @@ -1,3 +1,3 @@ -DEPLOY_KERNEL_URL=http://192.168.222.199:6180/images/ironic-python-agent.kernel -DEPLOY_RAMDISK_URL=http://192.168.222.199:6180/images/ironic-python-agent.initramfs -IRONIC_ENDPOINT=https://192.168.222.199:6385/v1/ +DEPLOY_KERNEL_URL=http://192.168.222.1:6180/images/ironic-python-agent.kernel +DEPLOY_RAMDISK_URL=http://192.168.222.1:6180/images/ironic-python-agent.initramfs +IRONIC_ENDPOINT=https://192.168.222.1:6385/v1/ diff --git a/config/overlays/e2e-release-0.9/ironic.env b/config/overlays/e2e-release-0.9/ironic.env index 0187ae15e4..44147ae0f3 100644 --- a/config/overlays/e2e-release-0.9/ironic.env +++ b/config/overlays/e2e-release-0.9/ironic.env @@ -1,3 +1,3 @@ -DEPLOY_KERNEL_URL=http://192.168.222.199:6180/images/ironic-python-agent.kernel -DEPLOY_RAMDISK_URL=http://192.168.222.199:6180/images/ironic-python-agent.initramfs -IRONIC_ENDPOINT=https://192.168.222.199:6385/v1/ +DEPLOY_KERNEL_URL=http://192.168.222.1:6180/images/ironic-python-agent.kernel +DEPLOY_RAMDISK_URL=http://192.168.222.1:6180/images/ironic-python-agent.initramfs +IRONIC_ENDPOINT=https://192.168.222.1:6385/v1/ diff --git a/config/overlays/e2e/ironic.env b/config/overlays/e2e/ironic.env index 0187ae15e4..44147ae0f3 100644 --- a/config/overlays/e2e/ironic.env +++ b/config/overlays/e2e/ironic.env @@ -1,3 +1,3 @@ -DEPLOY_KERNEL_URL=http://192.168.222.199:6180/images/ironic-python-agent.kernel -DEPLOY_RAMDISK_URL=http://192.168.222.199:6180/images/ironic-python-agent.initramfs -IRONIC_ENDPOINT=https://192.168.222.199:6385/v1/ +DEPLOY_KERNEL_URL=http://192.168.222.1:6180/images/ironic-python-agent.kernel +DEPLOY_RAMDISK_URL=http://192.168.222.1:6180/images/ironic-python-agent.initramfs +IRONIC_ENDPOINT=https://192.168.222.1:6385/v1/ diff --git a/hack/ci-e2e.sh b/hack/ci-e2e.sh index 5643778146..9fb74849a9 100755 --- a/hack/ci-e2e.sh +++ b/hack/ci-e2e.sh @@ -33,8 +33,6 @@ echo "BMO_E2E_EMULATOR=${BMO_E2E_EMULATOR}" export E2E_CONF_FILE="${REPO_ROOT}/test/e2e/config/ironic.yaml" export E2E_BMCS_CONF_FILE="${REPO_ROOT}/test/e2e/config/bmcs-${BMC_PROTOCOL}.yaml" -LOAD_LOCAL_IRONIC="${LOAD_LOCAL_IRONIC:-false}" - case "${GINKGO_FOCUS:-}" in *upgrade*) export DEPLOY_IRONIC="false" @@ -46,12 +44,11 @@ case "${GINKGO_FOCUS:-}" in export GINKGO_SKIP="${GINKGO_SKIP:-upgrade}" ;; esac -export USE_EXISTING_CLUSTER="true" # Ensure requirements are installed "${REPO_ROOT}/hack/e2e/ensure_go.sh" export PATH="/usr/local/go/bin:${PATH}" -"${REPO_ROOT}/hack/e2e/ensure_minikube.sh" +"${REPO_ROOT}/hack/e2e/ensure_kind.sh" "${REPO_ROOT}/hack/e2e/ensure_htpasswd.sh" # CAPI test framework uses kubectl in the background "${REPO_ROOT}/hack/e2e/ensure_kubectl.sh" @@ -60,42 +57,15 @@ export PATH="/usr/local/go/bin:${PATH}" # Build the container image with e2e tag (used in tests) IMG=quay.io/metal3-io/baremetal-operator:e2e make docker -# Set up minikube -minikube start --driver=kvm2 - virsh -c qemu:///system net-define "${REPO_ROOT}/hack/e2e/net.xml" virsh -c qemu:///system net-start baremetal-e2e -# Attach baremetal-e2e interface to minikube with specific mac. -# This will give minikube a known reserved IP address that we can use for Ironic -virsh -c qemu:///system attach-interface --domain minikube --mac="52:54:00:6c:3c:01" \ - --model virtio --source baremetal-e2e --type network --config - -# Restart minikube to apply the changes -minikube stop -## Following loop is to avoid minikube restart issue -## https://github.com/kubernetes/minikube/issues/14456 -while ! minikube start; do sleep 30; done - -# Load the BMO e2e image into it -# minikube image load quay.io/metal3-io/baremetal-operator:e2e -# Temporary workaround for https://github.com/kubernetes/minikube/issues/18021 -docker image save -o /tmp/bmo-e2e.tar quay.io/metal3-io/baremetal-operator:e2e -minikube image load /tmp/bmo-e2e.tar -rm /tmp/bmo-e2e.tar -if [[ "${LOAD_LOCAL_IRONIC}" == "true" ]]; then - echo "Saving local ironic image!" - docker image save -o \ - "/tmp/ironic-e2e.tar" "quay.io/metal3-io/ironic:local" - minikube image load /tmp/ironic-e2e.tar - rm /tmp/ironic-e2e.tar -fi # This IP is defined by the network we created above. IP_ADDRESS="192.168.222.1" # This IP is also defined by the network above, and is used consistently in all of # our e2e overlays -export IRONIC_PROVISIONING_IP="192.168.222.199" +export IRONIC_PROVISIONING_IP="${IP_ADDRESS}" # Build vbmctl make build-vbmctl @@ -114,7 +84,7 @@ if [[ "${BMO_E2E_EMULATOR}" == "vbmc" ]]; then address=$(echo "${bmc}" | jq -r '.address') hostName=$(echo "${bmc}" | jq -r '.hostName') vbmc_port="${address##*:}" - "${REPO_ROOT}/tools/bmh_test/vm2vbmc.sh" "${hostName}" "${vbmc_port}" + "${REPO_ROOT}/tools/bmh_test/vm2vbmc.sh" "${hostName}" "${vbmc_port}" "${IP_ADDRESS}" done elif [[ "${BMO_E2E_EMULATOR}" == "sushy-tools" ]]; then diff --git a/hack/clean-e2e.sh b/hack/clean-e2e.sh index 17c8f7f010..40ab5d10fb 100755 --- a/hack/clean-e2e.sh +++ b/hack/clean-e2e.sh @@ -3,7 +3,7 @@ REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. cd "${REPO_ROOT}" || exit 1 -minikube delete +kind delete cluster docker rm -f vbmc docker rm -f image-server-e2e docker rm -f sushy-tools diff --git a/hack/e2e/ensure_kind.sh b/hack/e2e/ensure_kind.sh new file mode 100755 index 0000000000..ed6af17b27 --- /dev/null +++ b/hack/e2e/ensure_kind.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -eux + +USR_LOCAL_BIN="/usr/local/bin" +MINIMUM_KIND_VERSION=v0.26.0 + +# Ensure the kind tool exists and is a viable version, or installs it +verify_kind_version() +{ + # If kind is not available on the path, get it + if ! [ -x "$(command -v kind)" ]; then + if [[ "${OSTYPE}" == "linux-gnu" ]]; then + echo "kind not found, installing" + curl -LO "https://kind.sigs.k8s.io/dl/${MINIMUM_KIND_VERSION}/kind-linux-amd64" + sudo install kind "${USR_LOCAL_BIN}/kind" + else + echo "Missing required binary in path: kind" + return 2 + fi + fi + + local kind_version + IFS=" " read -ra kind_version <<< "$(kind version)" + if [[ "${MINIMUM_KIND_VERSION}" != $(echo -e "${MINIMUM_KIND_VERSION}\n${kind_version[1]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) ]]; then + cat << EOF +Detected kind version: ${kind_version[2]}. +Requires ${MINIMUM_KIND_VERSION} or greater. +Please install ${MINIMUM_KIND_VERSION} or later. +EOF + return 2 + fi +} + +verify_kind_version diff --git a/hack/e2e/ensure_minikube.sh b/hack/e2e/ensure_minikube.sh deleted file mode 100755 index c4c48f9938..0000000000 --- a/hack/e2e/ensure_minikube.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -eux - -USR_LOCAL_BIN="/usr/local/bin" -OS=$(go env GOOS) -ARCH=$(go env GOARCH) -MINIMUM_MINIKUBE_VERSION=v1.33.0 - -verify_minikube_version() { - if ! [ -x "$(command -v minikube)" ]; then - if [[ "${OSTYPE}" == "linux-gnu" ]]; then - echo "minikube not found, installing" - curl -LO "https://storage.googleapis.com/minikube/releases/${MINIMUM_MINIKUBE_VERSION}/minikube-${OS}-${ARCH}" - sudo install minikube-linux-amd64 "${USR_LOCAL_BIN}/minikube" - else - echo "Missing required binary in path: minikube" - return 2 - fi - fi - local minikube_version - minikube_version="$(minikube version --short)" - if [[ "${MINIMUM_MINIKUBE_VERSION}" != $(echo -e "${MINIMUM_MINIKUBE_VERSION}\n${minikube_version}" | sort -V | head -n1) ]]; then - cat << EOF -Detected minikube version: ${minikube_version}. -Requires ${MINIMUM_MINIKUBE_VERSION} or greater. -Please install ${MINIMUM_MINIKUBE_VERSION} or later. -EOF - return 2 - fi -} - -verify_minikube_version diff --git a/hack/e2e/net.xml b/hack/e2e/net.xml index 71fdad47e8..6039360a57 100644 --- a/hack/e2e/net.xml +++ b/hack/e2e/net.xml @@ -9,8 +9,7 @@ - - + diff --git a/ironic-deployment/components/tls/certificate.yaml b/ironic-deployment/components/tls/certificate.yaml index d8a83c7aa7..2e576873db 100644 --- a/ironic-deployment/components/tls/certificate.yaml +++ b/ironic-deployment/components/tls/certificate.yaml @@ -12,8 +12,6 @@ metadata: spec: commonName: ironic-ca isCA: true - ipAddresses: - - IRONIC_HOST_IP issuerRef: kind: Issuer name: selfsigned-issuer diff --git a/ironic-deployment/overlays/e2e-release-24.0-with-inspector/ironic_bmo_configmap.env b/ironic-deployment/overlays/e2e-release-24.0-with-inspector/ironic_bmo_configmap.env index cd099090c2..c1e1d237fa 100644 --- a/ironic-deployment/overlays/e2e-release-24.0-with-inspector/ironic_bmo_configmap.env +++ b/ironic-deployment/overlays/e2e-release-24.0-with-inspector/ironic_bmo_configmap.env @@ -1,6 +1,7 @@ HTTP_PORT=6180 -PROVISIONING_IP=192.168.222.199 -CACHEURL=http://192.168.222.199/images +PROVISIONING_INTERFACE=eth0 +CACHEURL=http://192.168.222.1/images +IRONIC_EXTERNAL_CALLBACK_URL=https://192.168.222.1:6385 IRONIC_FAST_TRACK=true IRONIC_KERNEL_PARAMS=console=ttyS0 IRONIC_INSPECTOR_VLAN_INTERFACES=all diff --git a/ironic-deployment/overlays/e2e-release-24.0-with-inspector/kustomization.yaml b/ironic-deployment/overlays/e2e-release-24.0-with-inspector/kustomization.yaml index 104be2fe63..77f87441ac 100644 --- a/ironic-deployment/overlays/e2e-release-24.0-with-inspector/kustomization.yaml +++ b/ironic-deployment/overlays/e2e-release-24.0-with-inspector/kustomization.yaml @@ -16,7 +16,17 @@ configMapGenerator: behavior: create patches: - - path: ironic-patch.yaml +- path: ironic-patch.yaml +# The TLS component adds certificates but it cannot know the exact IPs of our environment. +# Here we patch the certificates to have the correct IPs. +# - 192.168.222.1: management computer IP, forwarded to ironic inside kind +- patch: |- + - op: replace + path: /spec/ipAddresses/0 + value: 192.168.222.1 + target: + kind: Certificate + name: ironic-cert images: - name: quay.io/metal3-io/ironic @@ -38,18 +48,3 @@ secretGenerator: - name: ironic-inspector-auth-config files: - auth-config=ironic-inspector-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/ironic-deployment/overlays/e2e-release-24.1/ironic_bmo_configmap.env b/ironic-deployment/overlays/e2e-release-24.1/ironic_bmo_configmap.env index a0840f4859..9dc4c4bf68 100644 --- a/ironic-deployment/overlays/e2e-release-24.1/ironic_bmo_configmap.env +++ b/ironic-deployment/overlays/e2e-release-24.1/ironic_bmo_configmap.env @@ -1,6 +1,7 @@ HTTP_PORT=6180 -PROVISIONING_IP=192.168.222.199 -CACHEURL=http://192.168.222.199/images +PROVISIONING_INTERFACE=eth0 +CACHEURL=http://192.168.222.1/images +IRONIC_EXTERNAL_CALLBACK_URL=https://192.168.222.1:6385 IRONIC_KERNEL_PARAMS=console=ttyS0 IRONIC_INSPECTOR_VLAN_INTERFACES=all USE_IRONIC_INSPECTOR=false diff --git a/ironic-deployment/overlays/e2e-release-24.1/kustomization.yaml b/ironic-deployment/overlays/e2e-release-24.1/kustomization.yaml index 1936f375f6..0bb5c3edd4 100644 --- a/ironic-deployment/overlays/e2e-release-24.1/kustomization.yaml +++ b/ironic-deployment/overlays/e2e-release-24.1/kustomization.yaml @@ -16,7 +16,17 @@ configMapGenerator: behavior: create patches: - - path: ironic-patch.yaml +- path: ironic-patch.yaml +# The TLS component adds certificates but it cannot know the exact IPs of our environment. +# Here we patch the certificates to have the correct IPs. +# - 192.168.222.1: management computer IP, forwarded to ironic inside kind +- patch: |- + - op: replace + path: /spec/ipAddresses/0 + value: 192.168.222.1 + target: + kind: Certificate + name: ironic-cert images: - name: quay.io/metal3-io/ironic @@ -28,18 +38,3 @@ secretGenerator: behavior: create envs: - ironic-htpasswd - -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/ironic-deployment/overlays/e2e-release-25.0/ironic_bmo_configmap.env b/ironic-deployment/overlays/e2e-release-25.0/ironic_bmo_configmap.env index a0840f4859..9dc4c4bf68 100644 --- a/ironic-deployment/overlays/e2e-release-25.0/ironic_bmo_configmap.env +++ b/ironic-deployment/overlays/e2e-release-25.0/ironic_bmo_configmap.env @@ -1,6 +1,7 @@ HTTP_PORT=6180 -PROVISIONING_IP=192.168.222.199 -CACHEURL=http://192.168.222.199/images +PROVISIONING_INTERFACE=eth0 +CACHEURL=http://192.168.222.1/images +IRONIC_EXTERNAL_CALLBACK_URL=https://192.168.222.1:6385 IRONIC_KERNEL_PARAMS=console=ttyS0 IRONIC_INSPECTOR_VLAN_INTERFACES=all USE_IRONIC_INSPECTOR=false diff --git a/ironic-deployment/overlays/e2e-release-25.0/kustomization.yaml b/ironic-deployment/overlays/e2e-release-25.0/kustomization.yaml index 8a84c06107..c539703339 100644 --- a/ironic-deployment/overlays/e2e-release-25.0/kustomization.yaml +++ b/ironic-deployment/overlays/e2e-release-25.0/kustomization.yaml @@ -17,6 +17,16 @@ configMapGenerator: patches: - path: ironic-patch.yaml +# The TLS component adds certificates but it cannot know the exact IPs of our environment. +# Here we patch the certificates to have the correct IPs. +# - 192.168.222.1: management computer IP, forwarded to ironic inside kind +- patch: |- + - op: replace + path: /spec/ipAddresses/0 + value: 192.168.222.1 + target: + kind: Certificate + name: ironic-cert images: - name: quay.io/metal3-io/ironic @@ -28,18 +38,3 @@ secretGenerator: behavior: create envs: - ironic-htpasswd - -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/ironic-deployment/overlays/e2e-release-26.0/ironic_bmo_configmap.env b/ironic-deployment/overlays/e2e-release-26.0/ironic_bmo_configmap.env index a0840f4859..9dc4c4bf68 100644 --- a/ironic-deployment/overlays/e2e-release-26.0/ironic_bmo_configmap.env +++ b/ironic-deployment/overlays/e2e-release-26.0/ironic_bmo_configmap.env @@ -1,6 +1,7 @@ HTTP_PORT=6180 -PROVISIONING_IP=192.168.222.199 -CACHEURL=http://192.168.222.199/images +PROVISIONING_INTERFACE=eth0 +CACHEURL=http://192.168.222.1/images +IRONIC_EXTERNAL_CALLBACK_URL=https://192.168.222.1:6385 IRONIC_KERNEL_PARAMS=console=ttyS0 IRONIC_INSPECTOR_VLAN_INTERFACES=all USE_IRONIC_INSPECTOR=false diff --git a/ironic-deployment/overlays/e2e-release-26.0/kustomization.yaml b/ironic-deployment/overlays/e2e-release-26.0/kustomization.yaml index d6d52e8d4a..8177566263 100644 --- a/ironic-deployment/overlays/e2e-release-26.0/kustomization.yaml +++ b/ironic-deployment/overlays/e2e-release-26.0/kustomization.yaml @@ -17,6 +17,16 @@ configMapGenerator: patches: - path: ironic-patch.yaml +# The TLS component adds certificates but it cannot know the exact IPs of our environment. +# Here we patch the certificates to have the correct IPs. +# - 192.168.222.1: management computer IP, forwarded to ironic inside kind +- patch: |- + - op: replace + path: /spec/ipAddresses/0 + value: 192.168.222.1 + target: + kind: Certificate + name: ironic-cert images: - name: quay.io/metal3-io/ironic @@ -28,18 +38,3 @@ secretGenerator: behavior: create envs: - ironic-htpasswd - -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/ironic-deployment/overlays/e2e-with-inspector/ironic_bmo_configmap.env b/ironic-deployment/overlays/e2e-with-inspector/ironic_bmo_configmap.env index 65624598de..0adcb437ce 100644 --- a/ironic-deployment/overlays/e2e-with-inspector/ironic_bmo_configmap.env +++ b/ironic-deployment/overlays/e2e-with-inspector/ironic_bmo_configmap.env @@ -1,6 +1,7 @@ HTTP_PORT=6180 -PROVISIONING_IP=192.168.222.199 -CACHEURL=http://192.168.222.199/images +PROVISIONING_INTERFACE=eth0 +CACHEURL=http://192.168.222.1/images +IRONIC_EXTERNAL_CALLBACK_URL=https://192.168.222.1:6385 IRONIC_FAST_TRACK=true IRONIC_KERNEL_PARAMS=console=ttyS0 IRONIC_INSPECTOR_VLAN_INTERFACES=all diff --git a/ironic-deployment/overlays/e2e-with-inspector/kustomization.yaml b/ironic-deployment/overlays/e2e-with-inspector/kustomization.yaml index d1009417ca..bdae9fbbc4 100644 --- a/ironic-deployment/overlays/e2e-with-inspector/kustomization.yaml +++ b/ironic-deployment/overlays/e2e-with-inspector/kustomization.yaml @@ -17,6 +17,16 @@ configMapGenerator: patches: - path: ironic-patch.yaml +# The TLS component adds certificates but it cannot know the exact IPs of our environment. +# Here we patch the certificates to have the correct IPs. +# - 192.168.222.1: management computer IP, forwarded to ironic inside kind +- patch: |- + - op: replace + path: /spec/ipAddresses/0 + value: 192.168.222.1 + target: + kind: Certificate + name: ironic-cert # NOTE: These credentials are generated automatically in hack/ci-e2e.sh secretGenerator: @@ -34,18 +44,3 @@ secretGenerator: - name: ironic-inspector-auth-config files: - auth-config=ironic-inspector-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/ironic-deployment/overlays/e2e/ironic_bmo_configmap.env b/ironic-deployment/overlays/e2e/ironic_bmo_configmap.env index d4aba53758..9be192df9c 100644 --- a/ironic-deployment/overlays/e2e/ironic_bmo_configmap.env +++ b/ironic-deployment/overlays/e2e/ironic_bmo_configmap.env @@ -1,6 +1,7 @@ HTTP_PORT=6180 -PROVISIONING_IP=192.168.222.199 -CACHEURL=http://192.168.222.199/images +PROVISIONING_INTERFACE=eth0 +CACHEURL=http://192.168.222.1/images +IRONIC_EXTERNAL_CALLBACK_URL=https://192.168.222.1:6385 IRONIC_KERNEL_PARAMS=console=ttyS0 IRONIC_INSPECTOR_VLAN_INTERFACES=all USE_IRONIC_INSPECTOR=false diff --git a/ironic-deployment/overlays/e2e/kustomization.yaml b/ironic-deployment/overlays/e2e/kustomization.yaml index 56f575d74b..2fc2a18570 100644 --- a/ironic-deployment/overlays/e2e/kustomization.yaml +++ b/ironic-deployment/overlays/e2e/kustomization.yaml @@ -17,6 +17,16 @@ configMapGenerator: patches: - path: ironic-patch.yaml +# The TLS component adds certificates but it cannot know the exact IPs of our environment. +# Here we patch the certificates to have the correct IPs. +# - 192.168.222.1: management computer IP, forwarded to ironic inside kind +- patch: |- + - op: replace + path: /spec/ipAddresses/0 + value: 192.168.222.1 + target: + kind: Certificate + name: ironic-cert # TODO(lentzi90): Remove once issue resolved: # https://github.com/metal3-io/baremetal-operator/issues/2110 @@ -31,18 +41,3 @@ secretGenerator: files: - htpasswd=ironic-htpasswd type: Opaque - -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 e0a7f336ee..8182849ef8 100644 --- a/test/e2e/config/ironic.yaml +++ b/test/e2e/config/ironic.yaml @@ -2,6 +2,8 @@ images: # Use locally built e2e images - name: quay.io/metal3-io/baremetal-operator:e2e loadBehavior: tryLoad +# - name: quay.io/metal3-io/ironic:local +# loadBehavior: tryLoad # Save some time and network by using cached images if available - name: quay.io/metal3-io/baremetal-operator:release-0.6 loadBehavior: tryLoad diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index b6e2b61494..11c5f845bc 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -23,6 +23,7 @@ import ( "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/bootstrap" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/kind/pkg/apis/config/v1alpha4" ) var ( @@ -155,6 +156,27 @@ var _ = SynchronizedBeforeSuite(func() []byte { clusterProvider = bootstrap.CreateKindBootstrapClusterAndLoadImages(ctx, bootstrap.CreateKindBootstrapClusterAndLoadImagesInput{ Name: "bmo-e2e", Images: e2eConfig.Images, + ExtraPortMappings: []v1alpha4.PortMapping{ + // TODO: Take from e2e config! + { + ContainerPort: 6180, + HostPort: 6180, + ListenAddress: "0.0.0.0", + Protocol: v1alpha4.PortMappingProtocolTCP, + }, + { + ContainerPort: 6385, + HostPort: 6385, + ListenAddress: "0.0.0.0", + Protocol: v1alpha4.PortMappingProtocolTCP, + }, + { + ContainerPort: 5050, + HostPort: 5050, + ListenAddress: "0.0.0.0", + Protocol: v1alpha4.PortMappingProtocolTCP, + }, + }, }) Expect(clusterProvider).ToNot(BeNil(), "Failed to create a cluster") kubeconfigPath = clusterProvider.GetKubeconfigPath() diff --git a/test/go.mod b/test/go.mod index 1443e6bdbc..3dd366cad6 100644 --- a/test/go.mod +++ b/test/go.mod @@ -21,6 +21,7 @@ require ( sigs.k8s.io/cluster-api v1.9.3 sigs.k8s.io/cluster-api/test v1.9.3 sigs.k8s.io/controller-runtime v0.19.4 + sigs.k8s.io/kind v0.25.0 sigs.k8s.io/kustomize/api v0.19.0 sigs.k8s.io/kustomize/kyaml v0.19.0 ) @@ -153,7 +154,6 @@ require ( sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect sigs.k8s.io/gateway-api v1.1.0 // indirect sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect - sigs.k8s.io/kind v0.25.0 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/tools/bmh_test/vm2vbmc.sh b/tools/bmh_test/vm2vbmc.sh index bfbfbc5c26..c2be2ecf7a 100755 --- a/tools/bmh_test/vm2vbmc.sh +++ b/tools/bmh_test/vm2vbmc.sh @@ -4,8 +4,9 @@ set -eux NAME="${1:?}" VBMC_PORT="${2:?}" +VBMC_ADDRESS="${3:-"::"}" # Add the BareMetalHost VM to VBMC -docker exec vbmc vbmc add "${NAME}" --port "${VBMC_PORT}" --libvirt-uri "qemu:///system" +docker exec vbmc vbmc add "${NAME}" --port "${VBMC_PORT}" --address "${VBMC_ADDRESS}" --libvirt-uri "qemu:///system" docker exec vbmc vbmc start "${NAME}" docker exec vbmc vbmc list