Skip to content

Commit

Permalink
Test IPAM and CAPM3 changes together because tests don't pass alone d…
Browse files Browse the repository at this point in the history
…ue to namespace name change

Signed-off-by: peppi-lotta <[email protected]>
  • Loading branch information
peppi-lotta committed Oct 2, 2024
1 parent bc435b3 commit 4742bea
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
49 changes: 34 additions & 15 deletions 03_launch_mgmt_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -258,23 +258,33 @@ function apply_bm_hosts() {
popd
}

# --------------------------
# CAPM3 deployment functions
# --------------------------
# -----------------------------
# Create loacal IPAM release for testing
# -----------------------------
function create_local_ipam_version(){

mkdir -p "${HOME}"/ipam-metal3/v1.0.0/
git init "${HOME}"/ipam-metal3

cat << EOF > "${HOME}"/ipam-metal3/v1.0.0/metadata.yaml
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
kind: Metadata
releaseSeries:
- major: 1
minor: 0
contract: v1beta1
EOF

#
# Update the imports for the CAPM3 deployment files
#
function update_capm3_imports(){
pushd "${CAPM3PATH}"
sed -i -e "s#quay.io/metal3-io/ip-address-manager:main#docker.io/estpeppilotta/ipam-provider-metal3-test:latest#" "${IPAMPATH}/config/default/manager_image_patch.yaml"

make kustomize
./hack/tools/bin/kustomize build "${IPAMPATH}/config/default" > config/ipam/metal3-ipam-components.yaml

sed -i -e "s#https://github.com/metal3-io/ip-address-manager/releases/download/v.*/ipam-components.yaml#metal3-ipam-components.yaml#" "config/ipam/kustomization.yaml"
./hack/tools/bin/kustomize build "${IPAMPATH}/config/default" > "${HOME}"/ipam-metal3/v1.0.0/ipam-components.yaml
popd
}

# --------------------------
# CAPM3 deployment functions
# --------------------------
#
# Update the CAPM3 and BMO manifests to use local images as defined in variables
#
Expand Down Expand Up @@ -302,10 +312,10 @@ function update_component_image(){
export MANIFEST_TAG="${TMP_IMAGE_TAG}"
make set-manifest-image
;;
"IPAM")
"IPAM")
export MANIFEST_IMG_IPAM="${REGISTRY}/localimages/$TMP_IMAGE_NAME"
export MANIFEST_TAG_IPAM="$TMP_IMAGE_TAG"
make set-manifest-image-ipam
##make set-manifest-image-ipam
;;
"Ironic")
export MANIFEST_IMG="${REGISTRY}/localimages/${TMP_IMAGE_NAME}"
Expand Down Expand Up @@ -339,6 +349,15 @@ function patch_clusterctl(){
mkdir -p "${CAPI_CONFIG_FOLDER}"
touch "${CAPI_CONFIG_FOLDER}"/clusterctl.yaml

cat << EOF >> "${CAPI_CONFIG_FOLDER}"/clusterctl.yaml
providers:
- name: metal3
url: file://${HOME}/ipam-metal3/v1.0.0/ipam-components.yaml
type: IPAMProvider
EOF



# At this point the images variables have been updated with update_images
# Reflect the change in components files
if [ -n "${CAPM3_LOCAL_IMAGE:-}" ]; then
Expand All @@ -353,7 +372,7 @@ function patch_clusterctl(){
update_component_image IPAM "${IPAM_IMAGE}"
fi

update_capm3_imports
create_local_ipam_version
make release-manifests

rm -rf "${CAPI_CONFIG_FOLDER}"/overrides/infrastructure-metal3/"${CAPM3RELEASE}"
Expand Down Expand Up @@ -387,7 +406,7 @@ function launch_cluster_api_provider_metal3() {

# shellcheck disable=SC2153
clusterctl init --core cluster-api:"${CAPIRELEASE}" --bootstrap kubeadm:"${CAPIRELEASE}" \
--control-plane kubeadm:"${CAPIRELEASE}" --infrastructure=metal3:"${CAPM3RELEASE}" -v5
--control-plane kubeadm:"${CAPIRELEASE}" --infrastructure=metal3:"${CAPM3RELEASE}" -v5 --ipam metal3

if [ "${CAPM3_RUN_LOCAL}" == true ]; then
touch capm3.out.log
Expand Down
6 changes: 6 additions & 0 deletions config_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,9 @@

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

export CAPM3REPO="https://github.com/Nordix/cluster-api-provider-metal3"
export CAPM3BRANCH="peppi-lotta/change-IPAM-namespace"

export IPAMREPO="https://github.com/Nordix/metal3-ipam/"
export IPAMBRANCH="peppi-lotta/make-ipam-a-provider-for-capi"
2 changes: 1 addition & 1 deletion tests/roles/run_tests/tasks/move.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"

- name: Initialize Provider component in target cluster
shell: "clusterctl init --kubeconfig /tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml --core cluster-api:{{ CAPIRELEASE }} --bootstrap kubeadm:{{ CAPIRELEASE }} --control-plane kubeadm:{{ CAPIRELEASE }} --infrastructure metal3:{{ CAPM3RELEASE }} -v 5"
shell: "clusterctl init --kubeconfig /tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml --core cluster-api:{{ CAPIRELEASE }} --bootstrap kubeadm:{{ CAPIRELEASE }} --control-plane kubeadm:{{ CAPIRELEASE }} --infrastructure metal3:{{ CAPM3RELEASE }} -v 5 --ipam metal3"

# Check for cert-manager pods on the target cluster
- name: Check if cert-manager pods in running state
Expand Down

0 comments on commit 4742bea

Please sign in to comment.