Skip to content

Commit

Permalink
WIP add support for ironic-standalone-operator
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Tantsur <dtantsur@protonmail.com>
  • Loading branch information
dtantsur committed Nov 18, 2024
1 parent dea22f2 commit 9720d0d
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 4 deletions.
84 changes: 83 additions & 1 deletion 03_launch_mgmt_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,84 @@ EOF
popd
}

launch_ironic_via_irso() {
local opdir="${WORKING_DIR}/ironic-standalone-operator"

# TODO(dtantsur): find a better place to do this
clone_repo "${IRSOREPO}" "${IRSOBRANCH}" "${opdir}" "${IRSOCOMMIT}"

local openv="${opdir}/config/manager/manager.env"
if [ -n "${IRONIC_LOCAL_IMAGE:-}" ]; then
echo "IRONIC_IMAGE=${IRONIC_LOCAL_IMAGE}" >> "${openv}"
else
echo "IRONIC_IMAGE=${IRONIC_IMAGE}" >> "${openv}"
fi
if [ -n "${MARIADB_LOCAL_IMAGE:-}" ]; then
echo "MARIADB_IMAGE=${MARIADB_LOCAL_IMAGE}" >> "${openv}"
else
echo "MARIADB_IMAGE=${MARIADB_IMAGE}" >> "${openv}"
fi
# TODO(dtantsur): keepalive support; IPA branch support
if [ -n "${IPA_DOWNLOADER_LOCAL_IMAGE:-}" ]; then
echo "RAMDISK_DOWNLOADER_IMAGE=${IPA_DOWNLOADER_LOCAL_IMAGE}" >> "${openv}"
else
echo "RAMDISK_DOWNLOADER_IMAGE=${IPA_DOWNLOADER_IMAGE}" >> "${openv}"
fi

cat "${openv}" # temporary

make -C "${opdir}" install deploy
kubectl wait --for=condition=Available --timeout=60s \
-n ironic-standalone-operator-system deployment/ironic-standalone-operator-controller-manager

local ironic="${IRONIC_DATA_DIR}/ironic.yaml"
cat > "${ironic}" <<EOF
---
apiVersion: metal3.io/v1alpha1
kind: Ironic
metadata:
name: ironic
namespace: "${IRONIC_NAMESPACE}"
spec:
networking:
dhcp:
rangeBegin: "${CLUSTER_DHCP_RANGE_START}"
rangeEnd: "${CLUSTER_DHCP_RANGE_END}"
networkCIDR: "${BARE_METAL_PROVISIONER_NETWORK}"
interface: "${BARE_METAL_PROVISIONER_INTERFACE}"
ipAddress: "${CLUSTER_BARE_METAL_PROVISIONER_IP}"
ramdiskSSHKey: "${IRONIC_RAMDISK_SSH_KEY}"
EOF

if [[ "${NODES_PLATFORM}" == "libvirt" ]]; then
cat >> "${ironic}" <<EOF
ramdiskExtraKernelParams: "console=ttyS0"
EOF
fi

if [[ "${IRONIC_USE_MARIADB}" == "true" ]]; then
cat >> "${ironic}" <<EOF
databaseRef:
name: ironic-db
---
apiVersion: metal3.io/v1alpha1
kind: IronicDatabase
metadata:
name: ironic-db
namespace: "${IRONIC_NAMESPACE}"
spec: {}
EOF
fi

kubectl create -f "${ironic}"
if ! kubectl wait --for=condition=Ready --timeout=180s -n "${IRONIC_NAMESPACE}" ironic/ironic; then
# FIXME(dtantsur): temporary, rely on CI artifacts in the final version
kubectl get -n "${IRONIC_NAMESPACE}" -o yaml ironic/ironic
kubectl get pod -n "${IRONIC_NAMESPACE}" -o yaml
exit 1
fi
}

#
# Launch and configure fakeIPA
#
Expand Down Expand Up @@ -562,7 +640,11 @@ if [ "${EPHEMERAL_CLUSTER}" != "tilt" ]; then
launch_cluster_api_provider_metal3
BMO_NAME_PREFIX="${NAMEPREFIX}"
launch_baremetal_operator
launch_ironic
if [[ "${USE_EXPERIMENTAL_IRSO}" == true ]]; then
launch_ironic_via_irso
else
launch_ironic
fi

if [[ "${BMO_RUN_LOCAL}" != true ]]; then
if ! kubectl rollout status deployment "${BMO_NAME_PREFIX}"-controller-manager -n "${IRONIC_NAMESPACE}" --timeout="${BMO_ROLLOUT_WAIT}"m; then
Expand Down
7 changes: 7 additions & 0 deletions lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ export CAPM3_BASE_URL="${CAPM3_BASE_URL:-metal3-io/cluster-api-provider-metal3}"
export CAPM3REPO="${CAPM3REPO:-https://github.com/${CAPM3_BASE_URL}}"
export CAPM3RELEASEBRANCH="${CAPM3RELEASEBRANCH:-main}"

# FIXME(dtantsur): flip to false until we're ready to do the switch
export USE_EXPERIMENTAL_IRSO="${USE_EXPERIMENTAL_IRSO:-true}"
export IRSO_BASE_URL="${IRSO_BASE_URL:-metal3-io/ironic-standalone-operator}"
export IRSOREPO="${IRSOREPO:-https://github.com/${IRSO_BASE_URL}}"
export IRSOBRANCH="${IRSOBRANCH:-main}"

if [[ "${CAPM3RELEASEBRANCH}" == "release-1.6" ]]; then
export CAPM3BRANCH="${CAPM3BRANCH:-release-1.6}"
export IPAMBRANCH="${IPAMBRANCH:-release-1.6}"
Expand All @@ -181,6 +187,7 @@ export BMOCOMMIT="${BMOCOMMIT:-HEAD}"
export CAPM3COMMIT="${CAPM3COMMIT:-HEAD}"
export IPAMCOMMIT="${IPAMCOMMIT:-HEAD}"
export CAPICOMMIT="${CAPICOMMIT:-HEAD}"
export IRSOCOMMIT="${IRSOCOMMIT:-HEAD}"

export IRONIC_IMAGE_PATH="${IRONIC_IMAGE_PATH:-/tmp/ironic-image}"
export IRONIC_IMAGE_REPO="${IRONIC_IMAGE_REPO:-https://github.com/metal3-io/ironic-image.git}"
Expand Down
6 changes: 3 additions & 3 deletions lib/network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ 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
network_address IPAM_PROVISIONING_POOL_RANGE_END "$BARE_METAL_PROVISIONER_NETWORK" 200

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
Expand Down
3 changes: 3 additions & 0 deletions vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ assured that they are persisted.
| IPA_BASEURI | IPA downloader will download IPA from this url | | https://tarballs.opendev.org/openstack/ironic-python-agent/dib |
| IPA_BRANCH | The last part of the name of the IPA archive | | master |
| IPA_FLAVOR | The middle part of the name of the IPA archive | | centos9 |
| IRSOREPO | Ironic Standalone Operator git repository URL | | https://github.com/metal3-io/ironic-standalone-operator.git |
| IRSOBRANCH | Ironic Standalone Operator git repository branch to checkout | | main |
| IRSOCOMMIT | Ironic Standalone Operator git commit to checkout on IRSOBRANCH | | HEAD |
<!-- markdownlint-enable MD013 MD034 -->

**NOTE** `(BMO/CAPI/CAPM3/IPAM)RELEASE` variables are also affecting the
Expand Down

0 comments on commit 9720d0d

Please sign in to comment.