From 856ede6f76a90a63bed8f9ac8e82c5c38f097013 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Sun, 24 Nov 2024 13:17:32 +0100 Subject: [PATCH 1/3] Extract get_component_image from update_component_image Signed-off-by: Dmitry Tantsur --- 03_launch_mgmt_cluster.sh | 47 ++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/03_launch_mgmt_cluster.sh b/03_launch_mgmt_cluster.sh index 238d4f958..b55e8eb49 100755 --- a/03_launch_mgmt_cluster.sh +++ b/03_launch_mgmt_cluster.sh @@ -311,56 +311,57 @@ function update_capm3_imports(){ popd } -# -# Update the CAPM3 and BMO manifests to use local images as defined in variables -# -function update_component_image(){ - IMPORT=$1 - ORIG_IMAGE=$2 +function get_component_image(){ + local ORIG_IMAGE=$1 # Split the image IMAGE_NAME AND IMAGE_TAG, if any tag exist - TMP_IMAGE="${ORIG_IMAGE##*/}" - TMP_IMAGE_NAME="${TMP_IMAGE%%:*}" - TMP_IMAGE_TAG="${TMP_IMAGE##*:}" + local TMP_IMAGE="${ORIG_IMAGE##*/}" + local TMP_IMAGE_NAME="${TMP_IMAGE%%:*}" + local TMP_IMAGE_TAG="${TMP_IMAGE##*:}" # Assign the image tag to latest if there is no tag in the image if [ "${TMP_IMAGE_NAME}" == "${TMP_IMAGE_TAG}" ]; then TMP_IMAGE_TAG="latest" fi + echo "${REGISTRY}/localimages/${TMP_IMAGE_NAME}:${TMP_IMAGE_TAG}" +} + +# +# Update the CAPM3 and BMO manifests to use local images as defined in variables +# +function update_component_image(){ + local IMPORT=$1 + local ORIG_IMAGE=$2 + local TMP_IMAGE + TMP_IMAGE="$(get_component_image "$ORIG_IMAGE")" + if [[ "${IMPORT}" == "IPAM" ]]; then + export MANIFEST_IMG_IPAM="${TMP_IMAGE%:*}" + export MANIFEST_TAG_IPAM="${TMP_IMAGE##*:}" + else + export MANIFEST_IMG="${TMP_IMAGE%:*}" + export MANIFEST_TAG="${TMP_IMAGE##*:}" + fi + # NOTE: It is assumed that we are already in the correct directory to run make case "${IMPORT}" in "BMO") - export MANIFEST_IMG="${REGISTRY}/localimages/${TMP_IMAGE_NAME}" - export MANIFEST_TAG="${TMP_IMAGE_TAG}" make set-manifest-image-bmo ;; "CAPM3") - export MANIFEST_IMG="${REGISTRY}/localimages/${TMP_IMAGE_NAME}" - export MANIFEST_TAG="${TMP_IMAGE_TAG}" make set-manifest-image ;; "IPAM") - export MANIFEST_IMG_IPAM="${REGISTRY}/localimages/$TMP_IMAGE_NAME" - export MANIFEST_TAG_IPAM="$TMP_IMAGE_TAG" make set-manifest-image-ipam ;; "Ironic") - export MANIFEST_IMG="${REGISTRY}/localimages/${TMP_IMAGE_NAME}" - export MANIFEST_TAG="${TMP_IMAGE_TAG}" make set-manifest-image-ironic ;; "Mariadb") - export MANIFEST_IMG="${REGISTRY}/localimages/${TMP_IMAGE_NAME}" - export MANIFEST_TAG="${TMP_IMAGE_TAG}" make set-manifest-image-mariadb ;; "Keepalived") - export MANIFEST_IMG="${REGISTRY}/localimages/${TMP_IMAGE_NAME}" - export MANIFEST_TAG="${TMP_IMAGE_TAG}" make set-manifest-image-keepalived ;; "IPA-downloader") - export MANIFEST_IMG="${REGISTRY}/localimages/${TMP_IMAGE_NAME}" - export MANIFEST_TAG="${TMP_IMAGE_TAG}" make set-manifest-image-ipa-downloader ;; esac From 0ec3dd6bbb4b03e689653887cfe4c231c9ed679b Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Sun, 24 Nov 2024 13:23:06 +0100 Subject: [PATCH 2/3] Clone and start ironic-standalone-operator Signed-off-by: Dmitry Tantsur --- 02_configure_host.sh | 3 +++ 03_launch_mgmt_cluster.sh | 15 +++++++++++++++ lib/common.sh | 11 +++++++++++ vars.md | 3 +++ 4 files changed, 32 insertions(+) diff --git a/02_configure_host.sh b/02_configure_host.sh index 11775455f..4c37b3504 100755 --- a/02_configure_host.sh +++ b/02_configure_host.sh @@ -321,6 +321,9 @@ clone_repo "${IPAMREPO}" "${IPAMBRANCH}" "${IPAMPATH}" "${IPAMCOMMIT}" detect_mismatch "${CAPI_LOCAL_IMAGE:-}" "${CAPIPATH}" clone_repo "${CAPIREPO}" "${CAPIBRANCH}" "${CAPIPATH}" "${CAPICOMMIT}" +detect_mismatch "${IRSO_LOCAL_IMAGE:-}" "${IRSOPATH}" +clone_repo "${IRSOREPO}" "${IRSOBRANCH}" "${IRSOPATH}" "${IRSOCOMMIT}" + # MariaDB and Ironic source is not needed unless the images are built locally # If the repo path does not match with the IMAGE location that means the image # is built from a repo that is not under dev-env's control thus there is no diff --git a/03_launch_mgmt_cluster.sh b/03_launch_mgmt_cluster.sh index b55e8eb49..6d18d0cac 100755 --- a/03_launch_mgmt_cluster.sh +++ b/03_launch_mgmt_cluster.sh @@ -224,6 +224,20 @@ EOF popd } +launch_ironic_standalone_operator() { + # TODO(dtantsur): IPA branch support + cat > "${IRSOPATH}/config/manager/manager.env" < **NOTE** `(BMO/CAPI/CAPM3/IPAM)RELEASE` variables are also affecting the From bb69cf99540bdfea1b262bd7401a75e9440ab29e Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Tue, 29 Oct 2024 13:00:51 +0100 Subject: [PATCH 3/3] Allow using ironic-standalone-operator to provision Ironic It works, but does not pass the re-pivoting test in the CAPM3 suite. Signed-off-by: Dmitry Tantsur --- 03_launch_mgmt_cluster.sh | 85 ++++++++++++++++++++++++++++++++++++++- config_example.sh | 3 ++ lib/common.sh | 3 ++ lib/ironic_basic_auth.sh | 4 +- lib/network.sh | 6 +-- 5 files changed, 95 insertions(+), 6 deletions(-) diff --git a/03_launch_mgmt_cluster.sh b/03_launch_mgmt_cluster.sh index 6d18d0cac..3243eb2c9 100755 --- a/03_launch_mgmt_cluster.sh +++ b/03_launch_mgmt_cluster.sh @@ -238,6 +238,85 @@ EOF -n ironic-standalone-operator-system deployment/ironic-standalone-operator-controller-manager } +launch_ironic_via_irso() { + if [ "${IRONIC_BASIC_AUTH}" != "true" ]; then + echo "Not possible to use ironic-standalone-operator without authentication" + exit 1 + fi + kubectl create secret generic ironic-auth -n "${IRONIC_NAMESPACE}" \ + --from-file=username="${IRONIC_AUTH_DIR}ironic-username" \ + --from-file=password="${IRONIC_AUTH_DIR}ironic-password" + + local ironic="${IRONIC_DATA_DIR}/ironic.yaml" + cat > "${ironic}" <> "${ironic}" <> "${ironic}" <> "${ironic}" < "${IRONIC_AUTH_DIR}ironic-username" + echo -n "$IRONIC_USERNAME" > "${IRONIC_AUTH_DIR}ironic-username" else IRONIC_USERNAME="$(cat "${IRONIC_AUTH_DIR}ironic-username")" fi @@ -17,7 +17,7 @@ if [ "${IRONIC_BASIC_AUTH}" == "true" ]; then if [ -z "${IRONIC_PASSWORD:-}" ]; then if [ ! -f "${IRONIC_AUTH_DIR}ironic-password" ]; then IRONIC_PASSWORD="$(uuidgen)" - echo "$IRONIC_PASSWORD" > "${IRONIC_AUTH_DIR}ironic-password" + echo -n "$IRONIC_PASSWORD" > "${IRONIC_AUTH_DIR}ironic-password" else IRONIC_PASSWORD="$(cat "${IRONIC_AUTH_DIR}ironic-password")" fi diff --git a/lib/network.sh b/lib/network.sh index b3eed2d06..775794b4e 100644 --- a/lib/network.sh +++ b/lib/network.sh @@ -82,8 +82,8 @@ else fi # Calculate DHCP range -network_address ironic_dhcp_range_start "$BARE_METAL_PROVISIONER_NETWORK" 10 -network_address ironic_dhcp_range_end "$BARE_METAL_PROVISIONER_NETWORK" 100 +network_address CLUSTER_DHCP_RANGE_START "$BARE_METAL_PROVISIONER_NETWORK" 10 +network_address CLUSTER_DHCP_RANGE_END "$BARE_METAL_PROVISIONER_NETWORK" 100 # The nex range is for IPAM to know what is the pool that porovisioned noodes # can get IP's from network_address IPAM_PROVISIONING_POOL_RANGE_START "$BARE_METAL_PROVISIONER_NETWORK" 100 @@ -91,7 +91,7 @@ network_address IPAM_PROVISIONING_POOL_RANGE_END "$BARE_METAL_PROVISIONER_NETWOR export IPAM_PROVISIONING_POOL_RANGE_START export IPAM_PROVISIONING_POOL_RANGE_END -export CLUSTER_DHCP_RANGE=${CLUSTER_DHCP_RANGE:-"$ironic_dhcp_range_start,$ironic_dhcp_range_end"} +export CLUSTER_DHCP_RANGE=${CLUSTER_DHCP_RANGE:-"$CLUSTER_DHCP_RANGE_START,$CLUSTER_DHCP_RANGE_END"} EXTERNAL_SUBNET=${EXTERNAL_SUBNET:-""} if [[ -n "${EXTERNAL_SUBNET}" ]]; then