-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Huy Mai <[email protected]>
- Loading branch information
Showing
24 changed files
with
793 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
launch_fake_ipa() | ||
{ | ||
# Create a folder to host fakeIPA config and certs | ||
mkdir -p "${WORKING_DIR}/fake-ipa" | ||
if [[ "${EPHEMERAL_CLUSTER}" = "kind" ]] && [[ "${IRONIC_TLS_SETUP}" = "true" ]]; then | ||
cp "${IRONIC_CACERT_FILE}" "${WORKING_DIR}/fake-ipa/ironic-ca.crt" | ||
elif [[ "${IRONIC_TLS_SETUP}" = "true" ]]; then | ||
# wait for ironic to be running to ensure ironic-cert is created | ||
kubectl -n baremetal-operator-system wait --for=condition=available deployment/baremetal-operator-ironic --timeout=900s | ||
# Extract ironic-cert to be used inside fakeIPA for TLS | ||
kubectl get secret -n baremetal-operator-system ironic-cert -o json -o=jsonpath="{.data.ca\.crt}" | base64 -d > "${WORKING_DIR}/fake-ipa/ironic-ca.crt" | ||
fi | ||
|
||
# Create fake IPA custom config | ||
cat <<EOF > "${WORKING_DIR}/fake-ipa/config.py" | ||
FAKE_IPA_API_URL = "https://${CLUSTER_BARE_METAL_PROVISIONER_IP}:${IRONIC_API_PORT}" | ||
FAKE_IPA_INSPECTION_CALLBACK_URL = "${IRONIC_URL}/continue_inspection" | ||
FAKE_IPA_ADVERTISE_ADDRESS_IP = "${EXTERNAL_SUBNET_V4_HOST}" | ||
FAKE_IPA_INSECURE = ${FAKE_IPA_INSECURE:-False} | ||
FAKE_IPA_CAFILE = "${FAKE_IPA_CAFILE:-/root/cert/ironic-ca.crt}" | ||
FAKE_IPA_MIN_BOOT_TIME = ${FAKE_IPA_MIN_BOOT_TIME:-20} | ||
FAKE_IPA_MAX_BOOT_TIME = ${FAKE_IPA_MAX_BOOT_TIME:-30} | ||
EOF | ||
|
||
# shellcheck disable=SC2086 | ||
sudo "${CONTAINER_RUNTIME}" run -d --net host --name fake-ipa ${POD_NAME_INFRA} \ | ||
-v "/opt/metal3-dev-env/fake-ipa":/root/cert -v "/root/.ssh":/root/ssh \ | ||
-e CONFIG='/root/cert/config.py' \ | ||
"${FAKE_IPA_IMAGE}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<network> | ||
<name>baremetal-e2e</name> | ||
<forward mode='nat'> | ||
<nat> | ||
<port start='1024' end='65535'/> | ||
</nat> | ||
</forward> | ||
<bridge name='metal3'/> | ||
<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'/> | ||
</dhcp> | ||
</ip> | ||
</network> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2021 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -eux | ||
|
||
USR_LOCAL_BIN="/usr/local/bin" | ||
MINIMUM_KUBECTL_VERSION=v1.32.0 | ||
|
||
# Ensure the kubectl tool exists and is a viable version, or installs it | ||
verify_kubectl_version() | ||
{ | ||
# If kubectl is not available on the path, get it | ||
if ! [ -x "$(command -v kubectl)" ]; then | ||
if [[ "${OSTYPE}" == "linux-gnu" ]]; then | ||
echo "kubectl not found, installing" | ||
curl -LO "https://dl.k8s.io/release/${MINIMUM_KUBECTL_VERSION}/bin/linux/amd64/kubectl" | ||
sudo install kubectl "${USR_LOCAL_BIN}/kubectl" | ||
else | ||
echo "Missing required binary in path: kubectl" | ||
return 2 | ||
fi | ||
fi | ||
|
||
local kubectl_version | ||
IFS=" " read -ra kubectl_version <<< "$(kubectl version --client)" | ||
if [[ "${MINIMUM_KUBECTL_VERSION}" != $(echo -e "${MINIMUM_KUBECTL_VERSION}\n${kubectl_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) ]]; then | ||
cat << EOF | ||
Detected kubectl version: ${kubectl_version[2]}. | ||
Requires ${MINIMUM_KUBECTL_VERSION} or greater. | ||
Please install ${MINIMUM_KUBECTL_VERSION} or later. | ||
EOF | ||
return 2 | ||
fi | ||
} | ||
|
||
verify_kubectl_version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||
cd "${REPO_ROOT}" || exit 1 | ||
|
||
minikube delete | ||
docker rm -f vbmc | ||
docker rm -f image-server-e2e | ||
docker rm -f sushy-tools | ||
|
||
"${REPO_ROOT}/hack/e2e/data/clean_local_bmh_test_setup.sh" "^node-" | ||
|
||
rm -rf "${REPO_ROOT}/test/e2e/_artifacts" | ||
rm -rf "${REPO_ROOT}"/artifacts-* | ||
rm -rf "${REPO_ROOT}/test/e2e/images" | ||
|
||
# Clear network | ||
virsh -c qemu:///system net-destroy baremetal-e2e | ||
virsh -c qemu:///system net-undefine baremetal-e2e | ||
|
||
# Clean volume pool directory | ||
rm -rf /tmp/pool_oo/* | ||
|
||
# Clean volume pool | ||
virsh pool-destroy default || true | ||
virsh pool-delete default || true | ||
virsh pool-undefine default || true |
Oops, something went wrong.