-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] 🌱 Stop using dev-env in E2E setup #2250
Open
mquhuy
wants to merge
1
commit into
metal3-io:main
Choose a base branch
from
Nordix:mquhuy/detach-dev-env-from-e2e
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
formatter: | ||
indentless_arrays: true |
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
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,21 @@ | ||
<network> | ||
<name>external</name> | ||
<forward mode='nat'> | ||
<nat> | ||
<port start='1024' end='65535'/> | ||
</nat> | ||
</forward> | ||
<bridge name='m3ex'/> | ||
<domain name='ostest.test.metalkube.org' localOnly='yes'/> | ||
<dns> | ||
<forwarder domain='apps.ostest.test.metalkube.org' addr='127.0.0.1'/> | ||
</dns> | ||
<ip address='192.168.100.1' netmask='255.255.255.0'> | ||
<dhcp> | ||
<range start='192.168.100.2' end='192.168.100.199'/> | ||
</dhcp> | ||
</ip> | ||
<dnsmasq:options> | ||
<dnsmasq:option value='cache-size=0'/> | ||
</dnsmasq:options> | ||
</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,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,11 @@ | ||
<network> | ||
<name>provisioning</name> | ||
<forward mode='nat'> | ||
<nat> | ||
<port start='1024' end='65535'/> | ||
</nat> | ||
</forward> | ||
<bridge name='provisioning'/> | ||
<ip address='192.168.111.1' netmask='255.255.255.0'> | ||
</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 |
---|---|---|
@@ -1,49 +1,35 @@ | ||
#!/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 | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
MINIMUM_GO_VERSION=go1.22.4 | ||
|
||
# Ensure the go tool exists and is a viable version. | ||
# Ensure the go tool exists and is a viable version, or installs it | ||
verify_go_version() | ||
{ | ||
if [[ -z "$(command -v go)" ]]; then | ||
cat << EOF | ||
Can't find 'go' in PATH, please fix and retry. | ||
See http://golang.org/doc/install for installation instructions. | ||
EOF | ||
return 2 | ||
# If go is not available on the path, get it | ||
if ! [ -x "$(command -v go)" ]; then | ||
if [[ "${OSTYPE}" == "linux-gnu" ]]; then | ||
echo 'go not found, installing' | ||
curl -sLo "/tmp/${MINIMUM_GO_VERSION}.linux-amd64.tar.gz" "https://go.dev/dl/${MINIMUM_GO_VERSION}.linux-amd64.tar.gz" | ||
sudo tar -C /usr/local -xzf "/tmp/${MINIMUM_GO_VERSION}.linux-amd64.tar.gz" | ||
export PATH=/usr/local/go/bin:$PATH | ||
else | ||
echo "Missing required binary in path: go" | ||
return 2 | ||
fi | ||
fi | ||
|
||
local go_version | ||
IFS=" " read -ra go_version <<< "$(go version)" | ||
local minimum_go_version | ||
minimum_go_version=go1.20 | ||
if [[ "${minimum_go_version}" != $(echo -e "${minimum_go_version}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) ]] && [[ "${go_version[2]}" != "devel" ]]; then | ||
if [[ "${MINIMUM_GO_VERSION}" != $(echo -e "${MINIMUM_GO_VERSION}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) ]] && [[ "${go_version[2]}" != "devel" ]]; then | ||
cat << EOF | ||
Detected go version: ${go_version[*]}. | ||
Kubernetes requires ${minimum_go_version} or greater. | ||
Please install ${minimum_go_version} or later. | ||
Detected go version: ${go_version[2]}. | ||
Requires ${MINIMUM_GO_VERSION} or greater. | ||
Please install ${MINIMUM_GO_VERSION} or later. | ||
EOF | ||
return 2 | ||
fi | ||
} | ||
|
||
verify_go_version | ||
|
||
# Explicitly opt into go modules, even though we're inside a GOPATH directory | ||
export GO111MODULE=on |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
|
||
USR_LOCAL_BIN="/usr/local/bin" | ||
YQ_VERSION="v4.40.5" | ||
|
||
# Check if yq tool is installed and install it if not | ||
verify_yq() | ||
{ | ||
if ! [[ -x "$(command -v yq)" ]]; then | ||
if [[ "${OSTYPE}" == "linux-gnu" ]]; then | ||
echo "yq not found, installing" | ||
curl -LO "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64.tar.gz" | ||
tar xvf yq_linux_amd64.tar.gz | ||
sudo install yq_linux_amd64 "${USR_LOCAL_BIN}/yq" | ||
else | ||
echo "Missing required binary in path: yq" | ||
return 2 | ||
fi | ||
fi | ||
} | ||
|
||
verify_yq |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.