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 <[email protected]>
  • Loading branch information
mquhuy committed Dec 18, 2024
1 parent cf1e95c commit 9210083
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
13 changes: 13 additions & 0 deletions 02_configure_host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,19 @@ mkdir -p "${M3PATH}"
detect_mismatch "${BMO_LOCAL_IMAGE:-}" "${BMOPATH}"
clone_repo "${BMOREPO}" "${BMOBRANCH}" "${BMOPATH}" "${BMOCOMMIT}"

# In release-0.8 and earlier, we use deploy.sh instead of deploy-cli.
if [[ "${BMOBRANCH}" =~ release-0.(8|6|5) ]]; then
# Make symlink from deploy.sh to /usr/bin/deploy-cli
sudo ln -s "${BMOPATH}/tools/deploy.sh" /usr/bin/deploy-cli
else
# 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-cli
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-cli
export BMOPATH
deploy-cli -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-cli
export BMOPATH
deploy-cli -i "${BMO_IRONIC_ARGS[@]}"
fi
popd
}
Expand Down
1 change: 0 additions & 1 deletion lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,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-cli -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-cli -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-cli -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-cli -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
2 changes: 1 addition & 1 deletion tests/roles/run_tests/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ 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
# Args to pass to the deploy-cli 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 9210083

Please sign in to comment.