Skip to content
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

Add option to skip apply BMHs #1463

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion 03_launch_mgmt_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,15 @@ if [ "${EPHEMERAL_CLUSTER}" != "tilt" ]; then
# Thus we are deleting validatingwebhookconfiguration resource if exists to let BMO is working properly on local runs.
kubectl delete validatingwebhookconfiguration/"${BMO_NAME_PREFIX}"-validating-webhook-configuration --ignore-not-found=true
fi
apply_bm_hosts "$NAMESPACE"
# Tests might want to apply bmh inside the test scipt
# then dev-env will create the bmh files but do not apply tehm
if [[ "${SKIP_APPLY_BMH:-false}" == "true" ]]; then
pushd "${BMOPATH}"
list_nodes | make_bm_hosts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move make_bm_hosts also to capm3. Perhaps in next step.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to create an issue

popd
else
apply_bm_hosts "$NAMESPACE"
fi
elif [ "${EPHEMERAL_CLUSTER}" == "tilt" ]; then

source tilt-setup/deploy_tilt_env.sh
Expand Down
73 changes: 40 additions & 33 deletions 04_verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,43 +32,47 @@ check_bm_hosts() {
-n metal3 -o json)"
BARE_METAL_VMS="$(sudo virsh list --all)"
BARE_METAL_VMNAME="${NAME//-/_}"
# Verify BM host exists
RESULT_STR="${NAME} Baremetalhost exist"
echo "${BARE_METAL_HOSTS}" | grep -w "${NAME}" > /dev/null
process_status $?

BARE_METAL_HOST="$(echo "${BARE_METAL_HOSTS}" | \
jq ' .items[] | select(.metadata.name=="'"${NAME}"'" )')"
# Skip BMH verification if not applied
if [[ "${SKIP_APPLY_BMH:-false}" != "true" ]]; then
# Verify BM host exists
RESULT_STR="${NAME} Baremetalhost exist"
echo "${BARE_METAL_HOSTS}" | grep -w "${NAME}" > /dev/null
process_status $?

# Verify addresses of the host
RESULT_STR="${NAME} Baremetalhost address correct"
equals "$(echo "${BARE_METAL_HOST}" | jq -r '.spec.bmc.address')" "${ADDRESS}"
BARE_METAL_HOST="$(echo "${BARE_METAL_HOSTS}" | \
jq ' .items[] | select(.metadata.name=="'"${NAME}"'" )')"

RESULT_STR="${NAME} Baremetalhost mac address correct"
equals "$(echo "${BARE_METAL_HOST}" | jq -r '.spec.bootMACAddress')" \
"${MAC}"
# Verify addresses of the host
RESULT_STR="${NAME} Baremetalhost address correct"
equals "$(echo "${BARE_METAL_HOST}" | jq -r '.spec.bmc.address')" "${ADDRESS}"

# Verify BM host status
RESULT_STR="${NAME} Baremetalhost status OK"
equals "$(echo "${BARE_METAL_HOST}" | jq -r '.status.operationalStatus')" \
"OK"
RESULT_STR="${NAME} Baremetalhost mac address correct"
equals "$(echo "${BARE_METAL_HOST}" | jq -r '.spec.bootMACAddress')" \
"${MAC}"

# Verify credentials exist
RESULT_STR="${NAME} Baremetalhost credentials secret exist"
CRED_NAME="$(echo "${BARE_METAL_HOST}" | jq -r '.spec.bmc.credentialsName')"
CRED_SECRET="$(kubectl get secret "${CRED_NAME}" -n metal3 -o json | \
jq '.data')"
process_status $?
# Verify BM host status
RESULT_STR="${NAME} Baremetalhost status OK"
equals "$(echo "${BARE_METAL_HOST}" | jq -r '.status.operationalStatus')" \
"OK"

# Verify credentials correct
RESULT_STR="${NAME} Baremetalhost password correct"
equals "$(echo "${CRED_SECRET}" | jq -r '.password' | \
base64 --decode)" "${PASSWORD}"
# Verify credentials exist
RESULT_STR="${NAME} Baremetalhost credentials secret exist"
CRED_NAME="$(echo "${BARE_METAL_HOST}" | jq -r '.spec.bmc.credentialsName')"
CRED_SECRET="$(kubectl get secret "${CRED_NAME}" -n metal3 -o json | \
jq '.data')"
process_status $?

RESULT_STR="${NAME} Baremetalhost user correct"
equals "$(echo "${CRED_SECRET}" | jq -r '.username' | \
base64 --decode)" "${USER}"
# Verify credentials correct
RESULT_STR="${NAME} Baremetalhost password correct"
equals "$(echo "${CRED_SECRET}" | jq -r '.password' | \
base64 --decode)" "${PASSWORD}"

RESULT_STR="${NAME} Baremetalhost user correct"
equals "$(echo "${CRED_SECRET}" | jq -r '.username' | \
base64 --decode)" "${USER}"
fi

# Verify the VM was created
RESULT_STR="${NAME} Baremetalhost VM exist"
echo "${BARE_METAL_VMS} "| grep -w "${BARE_METAL_VMNAME}" > /dev/null
Expand All @@ -82,10 +86,13 @@ check_bm_hosts() {
process_status $?
done

#Verify the introspection completed successfully
RESULT_STR="${NAME} Baremetalhost introspecting completed"
is_in "$(echo "${BARE_METAL_HOST}" | jq -r '.status.provisioning.state')" \
"ready available"
# Skip introspection verification in no BMH applied
if [[ "${SKIP_APPLY_BMH:-false}" != "true" ]]; then
#Verify the introspection completed successfully
RESULT_STR="${NAME} Baremetalhost introspecting completed"
is_in "$(echo "${BARE_METAL_HOST}" | jq -r '.status.provisioning.state')" \
"ready available"
fi

echo ""

Expand Down
3 changes: 3 additions & 0 deletions config_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,6 @@

# Uncomment the line below to build ironic-image from source
# export IRONIC_FROM_SOURCE="true"

# Skip applying BMHs
# export SKIP_APPLY_BMH="true"
1 change: 1 addition & 0 deletions vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ assured that they are persisted.
| BMO_RUN_LOCAL | Run a local baremetal operator instead of deploying in Kubernetes | "true", "false" | "false" |
| CAPM3_RUN_LOCAL | Run a local CAPM3 operator instead of deploying in Kubernetes | "true", "false" | "false" |
| SKIP_RETRIES | Do not retry on failure during verifications or tests of the environment. This should be false. It could only be set to false for verifications of a dev env deployment that fully completed. Otherwise failures will appear as resources are not ready. | "true", "false" | "false" |
| SKIP_APPLY_BMH | Do not apply the BMHs. used usually when the BMHs will be applied later in the tests. | "true", "false" | "false" |
| TEST_TIME_INTERVAL | Interval between retries after verification or test failure (seconds) | | 10 |
| TEST_MAX_TIME | Number of maximum verification or test retries | | 120 |
| BMO_ROLLOUT_WAIT | Number of minutes(Until max 10m that is the default value of deployment.spec.progressDeadlineSeconds) to wait for BMO rollout | | 5 |
Expand Down