From 3fc98cbf643a8afbc39ff0e032c681db87855c46 Mon Sep 17 00:00:00 2001 From: Lenin Mehedy Date: Mon, 9 Oct 2023 09:46:43 +1100 Subject: [PATCH] fix: use RELEASE_NAME in node setup and start scripts Signed-off-by: Lenin Mehedy --- dev/scripts/direct-install.sh | 6 +++--- dev/scripts/helper.sh | 15 ++++++++------- dev/scripts/nmt-install.sh | 6 +++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/dev/scripts/direct-install.sh b/dev/scripts/direct-install.sh index c4841619d..71d2f0829 100644 --- a/dev/scripts/direct-install.sh +++ b/dev/scripts/direct-install.sh @@ -49,7 +49,7 @@ function setup_node_all() { local node_name for node_name in "${NODE_NAMES[@]}"; do - local pod="network-${node_name}-0" # pod name + local pod="${RELEASE_NAME}-network-${node_name}-0" # pod name create_hapi_directories "${pod}" || return "${EX_ERR}" copy_platform "${pod}" || return "${EX_ERR}" @@ -85,7 +85,7 @@ function start_node_all() { local node_name for node_name in "${NODE_NAMES[@]}"; do - local pod="network-${node_name}-0" # pod name + local pod="${RELEASE_NAME}-network-${node_name}-0" # pod name start_service "${pod}" || return "${EX_ERR}" log_time "start_node" done @@ -106,7 +106,7 @@ function stop_node_all() { local node_name for node_name in "${NODE_NAMES[@]}"; do - local pod="network-${node_name}-0" # pod name + local pod="${RELEASE_NAME}-network-${node_name}-0" # pod name stop_service "${pod}" || return "${EX_ERR}" log_time "stop_node" done diff --git a/dev/scripts/helper.sh b/dev/scripts/helper.sh index 14fde29f5..880b61f9a 100755 --- a/dev/scripts/helper.sh +++ b/dev/scripts/helper.sh @@ -20,6 +20,7 @@ readonly HGCAPP_DIR="/opt/hgcapp" readonly NMT_DIR="${HGCAPP_DIR}/node-mgmt-tools" readonly HAPI_PATH="${HGCAPP_DIR}/services-hedera/HapiApp2.0" readonly HEDERA_HOME_DIR="/home/hedera" +readonly RELEASE_NAME="${RELEASE_NAME:-fst}" readonly NMT_VERSION="${NMT_VERSION:-v2.0.0-alpha.0}" readonly NMT_RELEASE_URL="https://api.github.com/repos/swirlds/swirlds-docker/releases/tags/${NMT_VERSION}" @@ -304,13 +305,13 @@ function prep_address_book() { # prepare address book lines local addresses=() for node_name in "${NODE_NAMES[@]}"; do - local pod="network-${node_name}-0" # pod name + local pod="${RELEASE_NAME}-network-${node_name}-0" # pod name local max_attempts=$MAX_ATTEMPTS local attempts=0 local status=$(kubectl get pod "${pod}" -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') while [[ "${attempts}" -lt "${max_attempts}" && "${status}" != "True" ]]; do - kubectl get pod network-node0-0 -o 'jsonpath={..status.conditions[?(@.type=="Ready")]}' + kubectl get pod "${pod}" -o 'jsonpath={..status.conditions[?(@.type=="Ready")]}' echo "" echo "Waiting for the pod to be ready - ${pod}: Attempt# ${attempts}/${max_attempts} ..." @@ -327,8 +328,8 @@ function prep_address_book() { return "${EX_ERR}" fi - echo "${KCTL} get svc network-${node_name}-svc -o jsonpath='{.spec.clusterIP}' | xargs" - local SVC_IP=$("${KCTL}" get svc "network-${node_name}-svc" -o jsonpath='{.spec.clusterIP}' | xargs) + echo "${KCTL} get svc ${RELEASE_NAME}-network-${node_name}-svc -o jsonpath='{.spec.clusterIP}' | xargs" + local SVC_IP=$("${KCTL}" get svc "${RELEASE_NAME}-network-${node_name}-svc" -o jsonpath='{.spec.clusterIP}' | xargs) if [ -z "${SVC_IP}" ]; then echo "Could not detect service IP for ${pod}" return "${EX_ERR}" @@ -674,7 +675,7 @@ function verify_node_all() { local node_name for node_name in "${NODE_NAMES[@]}"; do - local pod="network-${node_name}-0" # pod name + local pod="${RELEASE_NAME}-network-${node_name}-0" # pod name verify_network_state "${pod}" "${MAX_ATTEMPTS}" || return "${EX_ERR}" log_time "verify_network_state" done @@ -694,7 +695,7 @@ function replace_keys_all() { local node_name for node_name in "${NODE_NAMES[@]}"; do - local pod="network-${node_name}-0" # pod name + local pod="${RELEASE_NAME}-network-${node_name}-0" # pod name copy_hedera_keys "${pod}" || return "${EX_ERR}" copy_node_keys "${node_name}" "${pod}" || return "${EX_ERR}" log_time "replace_keys" @@ -714,7 +715,7 @@ function reset_node_all() { local node_name for node_name in "${NODE_NAMES[@]}"; do - local pod="network-${node_name}-0" # pod name + local pod="${RELEASE_NAME}-network-${node_name}-0" # pod name reset_node "${pod}" || return "${EX_ERR}" log_time "reset_node" done diff --git a/dev/scripts/nmt-install.sh b/dev/scripts/nmt-install.sh index ff886fa83..75848466a 100644 --- a/dev/scripts/nmt-install.sh +++ b/dev/scripts/nmt-install.sh @@ -23,7 +23,7 @@ function setup_node_all() { local node_name for node_name in "${NODE_NAMES[@]}"; do - local pod="network-${node_name}-0" # pod name + local pod="${RELEASE_NAME}-network-${node_name}-0" # pod name reset_node "${pod}" copy_nmt "${pod}" || return "${EX_ERR}" copy_platform "${pod}" || return "${EX_ERR}" @@ -55,7 +55,7 @@ function start_node_all() { local node_name for node_name in "${NODE_NAMES[@]}"; do - local pod="network-${node_name}-0" # pod name + local pod="${RELEASE_NAME}-network-${node_name}-0" # pod name nmt_start "${pod}" || return "${EX_ERR}" log_time "start_node" done @@ -76,7 +76,7 @@ function stop_node_all() { local node_name for node_name in "${NODE_NAMES[@]}"; do - local pod="network-${node_name}-0" # pod name + local pod="${RELEASE_NAME}-network-${node_name}-0" # pod name nmt_stop "${pod}" || return "${EX_ERR}" log_time "stop_node" done