Skip to content

Commit 85efbfa

Browse files
committed
Test IPAM and CAPM3 changes together because tests don't pass alone due to namespace name change
Signed-off-by: peppi-lotta <[email protected]>
1 parent bc435b3 commit 85efbfa

File tree

3 files changed

+40
-19
lines changed

3 files changed

+40
-19
lines changed

03_launch_mgmt_cluster.sh

+33-18
Original file line numberDiff line numberDiff line change
@@ -258,23 +258,33 @@ function apply_bm_hosts() {
258258
popd
259259
}
260260

261-
# --------------------------
262-
# CAPM3 deployment functions
263-
# --------------------------
261+
# -----------------------------
262+
# Create loacal IPAM release for testing
263+
# -----------------------------
264+
function create_local_ipam_version(){
265+
266+
mkdir -p "${HOME}"/ipam-metal3/v1.0.0/
267+
git init "${HOME}"/ipam-metal3
268+
269+
cat << EOF > "${HOME}"/ipam-metal3/v1.0.0/metadata.yaml
270+
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
271+
kind: Metadata
272+
releaseSeries:
273+
- major: 1
274+
minor: 0
275+
contract: v1beta1
276+
EOF
264277

265-
#
266-
# Update the imports for the CAPM3 deployment files
267-
#
268-
function update_capm3_imports(){
269-
pushd "${CAPM3PATH}"
278+
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"
270279

271280
make kustomize
272-
./hack/tools/bin/kustomize build "${IPAMPATH}/config/default" > config/ipam/metal3-ipam-components.yaml
273-
274-
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"
281+
./hack/tools/bin/kustomize build "${IPAMPATH}/config/default" > "${HOME}"/ipam-metal3/v1.0.0/ipam-components.yaml
275282
popd
276283
}
277284

285+
# --------------------------
286+
# CAPM3 deployment functions
287+
# --------------------------
278288
#
279289
# Update the CAPM3 and BMO manifests to use local images as defined in variables
280290
#
@@ -302,11 +312,6 @@ function update_component_image(){
302312
export MANIFEST_TAG="${TMP_IMAGE_TAG}"
303313
make set-manifest-image
304314
;;
305-
"IPAM")
306-
export MANIFEST_IMG_IPAM="${REGISTRY}/localimages/$TMP_IMAGE_NAME"
307-
export MANIFEST_TAG_IPAM="$TMP_IMAGE_TAG"
308-
make set-manifest-image-ipam
309-
;;
310315
"Ironic")
311316
export MANIFEST_IMG="${REGISTRY}/localimages/${TMP_IMAGE_NAME}"
312317
export MANIFEST_TAG="${TMP_IMAGE_TAG}"
@@ -339,6 +344,15 @@ function patch_clusterctl(){
339344
mkdir -p "${CAPI_CONFIG_FOLDER}"
340345
touch "${CAPI_CONFIG_FOLDER}"/clusterctl.yaml
341346

347+
cat << EOF >> "${CAPI_CONFIG_FOLDER}"/clusterctl.yaml
348+
providers:
349+
- name: metal3
350+
url: file://${HOME}/ipam-metal3/v1.0.0/ipam-components.yaml
351+
type: IPAMProvider
352+
EOF
353+
354+
355+
342356
# At this point the images variables have been updated with update_images
343357
# Reflect the change in components files
344358
if [ -n "${CAPM3_LOCAL_IMAGE:-}" ]; then
@@ -353,7 +367,8 @@ function patch_clusterctl(){
353367
update_component_image IPAM "${IPAM_IMAGE}"
354368
fi
355369

356-
update_capm3_imports
370+
pushd "${CAPM3PATH}"
371+
create_local_ipam_version
357372
make release-manifests
358373

359374
rm -rf "${CAPI_CONFIG_FOLDER}"/overrides/infrastructure-metal3/"${CAPM3RELEASE}"
@@ -387,7 +402,7 @@ function launch_cluster_api_provider_metal3() {
387402

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

392407
if [ "${CAPM3_RUN_LOCAL}" == true ]; then
393408
touch capm3.out.log

config_example.sh

+6
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,9 @@
206206

207207
# Uncomment the line below to build ironic-image from source
208208
# export IRONIC_FROM_SOURCE="true"
209+
210+
export CAPM3REPO="https://github.com/Nordix/cluster-api-provider-metal3"
211+
export CAPM3BRANCH="peppi-lotta/change-IPAM-namespace"
212+
213+
export IPAMREPO="https://github.com/Nordix/metal3-ipam/"
214+
export IPAMBRANCH="peppi-lotta/make-ipam-a-provider-for-capi"

tests/roles/run_tests/tasks/move.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"
9797

9898
- name: Initialize Provider component in target cluster
99-
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"
99+
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"
100100

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

0 commit comments

Comments
 (0)