Skip to content

Commit

Permalink
Merge pull request #2222 from Nordix/lentzi90/e2e-kind-release-0.9
Browse files Browse the repository at this point in the history
🌱 Switch e2e to kind
  • Loading branch information
metal3-io-bot authored Feb 5, 2025
2 parents 704230d + 6c381b4 commit 00f50eb
Show file tree
Hide file tree
Showing 39 changed files with 198 additions and 457 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/e2e-fixture-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:

- name: Install libvirt
run: |
sudo apt-get update
sudo apt-get install -y libvirt-dev
sudo apt-get update
sudo apt-get install -y libvirt-dev
- name: Build BMO e2e Docker Image
env:
Expand All @@ -40,7 +40,8 @@ jobs:
run: make test-e2e

- name: Upload artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: ${{ !cancelled() }}
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: artifacts-fixture.tar.gz
path: test/e2e/_artifacts
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ go.work.sum
*~
*.tmp
.DS_Store
.zed*

# Tilt files.
.tiltbuild
Expand Down
4 changes: 0 additions & 4 deletions config/overlays/e2e-release-0.4/ironic.env

This file was deleted.

38 changes: 0 additions & 38 deletions config/overlays/e2e-release-0.4/kustomization.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions config/overlays/e2e-release-0.5/ironic.env

This file was deleted.

36 changes: 0 additions & 36 deletions config/overlays/e2e-release-0.5/kustomization.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions config/overlays/e2e-release-0.6/ironic.env
Original file line number Diff line number Diff line change
@@ -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/
6 changes: 3 additions & 3 deletions config/overlays/e2e-release-0.8/ironic.env
Original file line number Diff line number Diff line change
@@ -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/
6 changes: 3 additions & 3 deletions config/overlays/e2e/ironic.env
Original file line number Diff line number Diff line change
@@ -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/
21 changes: 0 additions & 21 deletions config/overlays/fixture-release-0.4/kustomization.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions config/overlays/fixture-release-0.5/kustomization.yaml

This file was deleted.

47 changes: 3 additions & 44 deletions hack/ci-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,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"
Expand All @@ -58,35 +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

# 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
Expand All @@ -105,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
Expand Down Expand Up @@ -171,53 +150,33 @@ popd
# Generate credentials
BMO_OVERLAYS=(
"${REPO_ROOT}/config/overlays/e2e"
"${REPO_ROOT}/config/overlays/e2e-release-0.5"
"${REPO_ROOT}/config/overlays/e2e-release-0.6"
"${REPO_ROOT}/config/overlays/e2e-release-0.8"
)
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-with-inspector"
"${REPO_ROOT}/ironic-deployment/overlays/e2e-release-24.1"
"${REPO_ROOT}/ironic-deployment/overlays/e2e-release-25.0"
"${REPO_ROOT}/ironic-deployment/overlays/e2e-release-26.0"
)

IRONIC_USERNAME="$(uuidgen)"
IRONIC_PASSWORD="$(uuidgen)"
IRONIC_INSPECTOR_USERNAME="$(uuidgen)"
IRONIC_INSPECTOR_PASSWORD="$(uuidgen)"

# These must be exported so that envsubst can pick them up below
export IRONIC_USERNAME
export IRONIC_PASSWORD
export IRONIC_INSPECTOR_USERNAME
export IRONIC_INSPECTOR_PASSWORD

for overlay in "${BMO_OVERLAYS[@]}"; do
echo "${IRONIC_USERNAME}" > "${overlay}/ironic-username"
echo "${IRONIC_PASSWORD}" > "${overlay}/ironic-password"
if [[ "${overlay}" =~ release-0\.[1-5]$ ]]; then
echo "${IRONIC_INSPECTOR_USERNAME}" > "${overlay}/ironic-inspector-username"
echo "${IRONIC_INSPECTOR_PASSWORD}" > "${overlay}/ironic-inspector-password"
fi
done

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
Expand Down
2 changes: 1 addition & 1 deletion hack/clean-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 35 additions & 0 deletions hack/e2e/ensure_kind.sh
Original file line number Diff line number Diff line change
@@ -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-linux-amd64 "${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
33 changes: 0 additions & 33 deletions hack/e2e/ensure_minikube.sh

This file was deleted.

3 changes: 1 addition & 2 deletions hack/e2e/net.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
<ip address='192.168.222.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.222.2' end='192.168.222.199'/>
<host mac='52:54:00:6c:3c:01' name='minikube' ip='192.168.222.199'/>
<bootp file='http://192.168.222.199:6180/boot.ipxe'/>
<bootp file='http://192.168.222.1:6180/boot.ipxe'/>
</dhcp>
</ip>
</network>
2 changes: 0 additions & 2 deletions ironic-deployment/components/tls/certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ metadata:
spec:
commonName: ironic-ca
isCA: true
ipAddresses:
- IRONIC_HOST_IP
issuerRef:
kind: Issuer
name: selfsigned-issuer
Expand Down
Loading

0 comments on commit 00f50eb

Please sign in to comment.