Skip to content

Commit

Permalink
Take Deploy-cli into use to replace deploy.sh
Browse files Browse the repository at this point in the history
Now that we have deploy-cli in BMO main, we can start using it to
replace deploy.sh in installing BMO and Ironic.

Signed-off-by: Huy Mai <huy.mai@est.tech>
  • Loading branch information
mquhuy committed Dec 17, 2024
1 parent cf1e95c commit 6f9b837
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
10 changes: 10 additions & 0 deletions 02_configure_host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,16 @@ mkdir -p "${M3PATH}"
detect_mismatch "${BMO_LOCAL_IMAGE:-}" "${BMOPATH}"
clone_repo "${BMOREPO}" "${BMOBRANCH}" "${BMOPATH}" "${BMOCOMMIT}"

export DEPLOY_TOOL="${BMOPATH}/tools/deploy.sh"
if [[ "${BMOBRANCH}" = "main" ]] || [[ "${BMOBRANCH}" = "release-0.9" ]]; then
# Install deploy-cli.
pushd "${BMOPATH}"
make deploy-cli
sudo install tools/bin/deploy-cli /usr/bin/
export DEPLOY_TOOL="deploy-cli"
popd
fi

detect_mismatch "${CAPM3_LOCAL_IMAGE:-}" "${CAPM3PATH}"
clone_repo "${CAPM3REPO}" "${CAPM3BRANCH}" "${CAPM3PATH}" "${CAPM3COMMIT}"

Expand Down
12 changes: 7 additions & 5 deletions 03_launch_mgmt_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ launch_baremetal_operator()
{
pushd "${BMOPATH}"

# Deploy BMO using deploy.sh script
# Deploy BMO using DEPLOY_TOOL
if [[ "${EPHEMERAL_CLUSTER}" != "tilt" ]]; then
# Update container images to use local ones
if [[ -n "${BARE_METAL_OPERATOR_LOCAL_IMAGE:-}" ]]; then
Expand All @@ -78,8 +78,9 @@ EOF
echo "DEPLOY_ISO_URL=${DEPLOY_ISO_URL}" | sudo tee -a "${BMOPATH}/config/default/ironic.env"
fi

# Deploy BMO using deploy.sh script
"${BMOPATH}/tools/deploy.sh" -b "${BMO_IRONIC_ARGS[@]}"
# Deploy BMO using DEPLOY_TOOL
export BMOPATH
"${DEPLOY_TOOL}" -b "${BMO_IRONIC_ARGS[@]}"

# If BMO should run locally, scale down the deployment and run BMO
if [[ "${BMO_RUN_LOCAL}" = "true" ]]; then
Expand Down Expand Up @@ -236,8 +237,9 @@ EOF
echo "Waiting for Ironic to become ready"
retry sudo "${CONTAINER_RUNTIME}" exec ironic /bin/ironic-readiness
else
# Deploy Ironic using deploy.sh script
"${BMOPATH}/tools/deploy.sh" -i "${BMO_IRONIC_ARGS[@]}"
# Deploy Ironic using DEPLOY_TOOL
export BMOPATH
"${DEPLOY_TOOL}" -i "${BMO_IRONIC_ARGS[@]}"
fi
popd
}
Expand Down
7 changes: 6 additions & 1 deletion lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ export SUSHY_TOOLS_IMAGE="${SUSHY_TOOLS_IMAGE:-${CONTAINER_REGISTRY}/metal3-io/s
export FAKE_IPA_IMAGE="${FAKE_IPA_IMAGE:-${CONTAINER_REGISTRY}/metal3-io/fake-ipa}"
export FKAS_IMAGE="${FKAS_IMAGE:-${CONTAINER_REGISTRY}/metal3-io/metal3-fkas}"

# Default Deploy tool is set to deploy-cli. We will still use the old deploy.sh script for release-1.8 and earlier.
export DEPLOY_TOOL="deploy-cli"
if [[ "${CAPM3RELEASEBRANCH}" =~ release-1.(8|6|5) ]]; then
export DEPLOY_TOOL="${BMOPATH}/tools/deploy.sh"
fi

# CAPM3 and IPAM controller images
if [[ "${CAPM3RELEASEBRANCH}" = "release-1.6" ]]; then
export CAPM3_IMAGE=${CAPM3_IMAGE:-"${CONTAINER_REGISTRY}/metal3-io/cluster-api-provider-metal3:release-1.6"}
Expand Down Expand Up @@ -336,7 +342,6 @@ export IPXE_SOURCE_DIR="${IRONIC_DATA_DIR}/ipxe-source"

export IRONIC_KEEPALIVED_IMAGE="${IRONIC_KEEPALIVED_IMAGE:-${CONTAINER_REGISTRY}/metal3-io/keepalived:${KEEPALIVED_TAG}}"
export MARIADB_IMAGE="${MARIADB_IMAGE:-${CONTAINER_REGISTRY}/metal3-io/mariadb:${MARIADB_TAG}}"

# Enable ironic restart feature when the TLS certificate is updated
export RESTART_CONTAINER_CERTIFICATE_UPDATED="${RESTART_CONTAINER_CERTIFICATE_UPDATED:-${IRONIC_TLS_SETUP}}"

Expand Down
6 changes: 4 additions & 2 deletions tests/roles/run_tests/tasks/move.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,23 @@

# Install BMO
- name: Install Baremetal Operator
shell: "{{ BMOPATH }}/tools/deploy.sh -b {{ BMO_IRONIC_ARGS }}"
shell: "{{ DEPLOY_TOOL }} -b {{ BMO_IRONIC_ARGS }}"
environment:
IRONIC_HOST: "{{ IRONIC_HOST }}"
IRONIC_HOST_IP: "{{ IRONIC_HOST_IP }}"
KUBECTL_ARGS: "{{ KUBECTL_ARGS }}"
BMOPATH: "{{ BMOPATH }}"
args:
chdir: "{{ BMOPATH }}"

# Install Ironic
- name: Install Ironic
shell: "{{ BMOPATH }}/tools/deploy.sh -i {{ BMO_IRONIC_ARGS }}"
shell: "{{ DEPLOY_TOOL }} -i {{ BMO_IRONIC_ARGS }}"
environment:
IRONIC_HOST: "{{ IRONIC_HOST }}"
IRONIC_HOST_IP: "{{ IRONIC_HOST_IP }}"
KUBECTL_ARGS: "{{ KUBECTL_ARGS }}"
BMOPATH: "{{ BMOPATH }}"
args:
chdir: "{{ BMOPATH }}"

Expand Down
6 changes: 4 additions & 2 deletions tests/roles/run_tests/tasks/move_back.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@

# Install BMO in Source cluster
- name: Install Baremetal Operator in Source cluster
shell: "{{ BMOPATH }}/tools/deploy.sh -b {{ BMO_IRONIC_ARGS }}"
shell: "{{ DEPLOY_TOOL }} -b {{ BMO_IRONIC_ARGS }}"
environment:
IRONIC_HOST: "{{ IRONIC_HOST }}"
IRONIC_HOST_IP: "{{ IRONIC_HOST_IP }}"
BMOPATH: "{{ BMOPATH }}"
args:
chdir: "{{ BMOPATH }}"

Expand All @@ -25,10 +26,11 @@
when: EPHEMERAL_CLUSTER == "kind"

- name: Install Ironic in Source cluster (Ephemeral Cluster is minikube)
shell: "{{ BMOPATH }}/tools/deploy.sh -i {{ BMO_IRONIC_ARGS }}"
shell: "{{ DEPLOY_TOOL }} -i {{ BMO_IRONIC_ARGS }}"
environment:
IRONIC_HOST: "{{ IRONIC_HOST }}"
IRONIC_HOST_IP: "{{ IRONIC_HOST_IP }}"
BMOPATH: "{{ BMOPATH }}"
when: EPHEMERAL_CLUSTER == "minikube"
args:
chdir: "{{ BMOPATH }}"
Expand Down
5 changes: 4 additions & 1 deletion tests/roles/run_tests/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ CAPM3_INSECURE_DIAGNOSTICS: "true"
IPAM_DIAGNOSTICS_ADDRESS: "localhost:8080"
IPAM_INSECURE_DIAGNOSTICS: "true"

# Args to pass to the deploy.sh script when deploying Ironic and BMO
# DEPLOY_TOOL for deploying Ironic and BMO
DEPLOY_TOOL: "{{ lookup('env', 'DEPLOY_TOOL') }}"

# Args to pass to the DEPLOY_TOOL when deploying Ironic and BMO
# [k]eepalived [t]ls [n]o basic auth or [m]ariadb
BMO_IRONIC_ARGS: "-k {{ (IRONIC_TLS_SETUP == 'true') | ternary('-t', '') }} {{ (IRONIC_BASIC_AUTH == 'true') | ternary('', '-n') }} {{ (IRONIC_USE_MARIADB == 'true') | ternary('-m', '') }}"

Expand Down

0 comments on commit 6f9b837

Please sign in to comment.