From b1ff2a8ac2ac7aa2474b359e55556834d3d29cf9 Mon Sep 17 00:00:00 2001 From: Jeffrey Tang Date: Tue, 16 Jul 2024 09:51:29 -0500 Subject: [PATCH 1/6] save Signed-off-by: Jeffrey Tang --- .github/workflows/support/ci_test.sh | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/.github/workflows/support/ci_test.sh b/.github/workflows/support/ci_test.sh index 608f9fb6e..e5b2d0696 100755 --- a/.github/workflows/support/ci_test.sh +++ b/.github/workflows/support/ci_test.sh @@ -88,8 +88,7 @@ kubectl wait --for=jsonpath='{.status.phase}'=Running pod -l fullstack.hedera.co echo "Running helm chart tests (takes ~5m, timeout 15m)... " echo "-----------------------------------------------------------------------------------------------------" -helm test "${RELEASE_NAME}" --filter name=network-test --timeout 15m -kubectl logs network-test + echo "-----------------------------------------------------------------------------------------------------" echo "Setup and start nodes" @@ -102,22 +101,3 @@ else source "${SCRIPTS_DIR}/${SCRIPT_NAME}" && start_node_all fi -echo "-----------------------------------------------------------------------------------------------------" -echo "Tear down cluster" - -kubectl delete pod network-test -n "${NAMESPACE}" || true - -echo "Uninstalling helm chart ${RELEASE_NAME} in namespace ${NAMESPACE}... " -echo "-----------------------------------------------------------------------------------------------------" -helm uninstall -n "${NAMESPACE}" "${RELEASE_NAME}" -sleep 10 -echo "Uninstalled helm chart ${RELEASE_NAME} in namespace ${NAMESPACE}" - -echo "Removing postgres pvc" -has_postgres_pvc=$(kubectl get pvc --no-headers -l app.kubernetes.io/component=postgresql,app.kubernetes.io/name=postgres,app.kubernetes.io/instance="${RELEASE_NAME}" | wc -l) -if [[ $has_postgres_pvc ]]; then -kubectl delete pvc -l app.kubernetes.io/component=postgresql,app.kubernetes.io/name=postgres,app.kubernetes.io/instance="${RELEASE_NAME}" -fi - -echo "Workflow finished successfully" -echo "-----------------------------------------------------------------------------------------------------" From 2ab75237643365dd85815e2f94024161fd54ef40 Mon Sep 17 00:00:00 2001 From: Jeffrey Tang Date: Tue, 16 Jul 2024 12:21:29 -0500 Subject: [PATCH 2/6] check proxy status Signed-off-by: Jeffrey Tang --- .../support/scripts/direct-install.sh | 2 ++ .github/workflows/support/scripts/env.sh | 31 +++---------------- .github/workflows/support/scripts/helper.sh | 13 ++++++++ .../workflows/support/scripts/template.env | 12 ------- 4 files changed, 19 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/support/scripts/template.env diff --git a/.github/workflows/support/scripts/direct-install.sh b/.github/workflows/support/scripts/direct-install.sh index c4841619d..90a928c73 100644 --- a/.github/workflows/support/scripts/direct-install.sh +++ b/.github/workflows/support/scripts/direct-install.sh @@ -92,6 +92,8 @@ function start_node_all() { verify_node_all || return "${EX_ERR}" + verify_haproxy || return "${EX_ERR}" + return "${EX_OK}" } diff --git a/.github/workflows/support/scripts/env.sh b/.github/workflows/support/scripts/env.sh index 9fd27b87c..1a045834b 100644 --- a/.github/workflows/support/scripts/env.sh +++ b/.github/workflows/support/scripts/env.sh @@ -46,34 +46,11 @@ function show_env_vars() { echo "NAMESPACE: ${NAMESPACE}" echo "SCRIPT_DIR: ${SCRIPT_DIR}" echo "TMP_DIR: ${TMP_DIR}" + echo "NODE_NAMES: ${NODE_NAMES[*]}" echo "-----------------------------------------------------------------------------------------------------" echo "" } -function setup_tmp_dir() { - if [ ! -f "${TMP_DIR}/.env" ]; then \ - echo "Creating .env file from template.env" - cp "${SCRIPT_DIR}/template.env" "${TMP_DIR}/.env" - echo "File list in ${TMP_DIR}" - ls -la "${TMP_DIR}" - fi -} - -function load_env_file() { - setup_tmp_dir - if [ -f "${TMP_DIR}/.env" ]; then \ - echo "Loading .env file: ${TMP_DIR}/.env" - set -a - # shellcheck source=./../temp/.env - source "${TMP_DIR}/.env" - set +a - fi -} - -function setup() { - load_env_file -} - function parse_minor_version() { local platform_version="$1" IFS=. read -a VERSION_PARTS <<< "$platform_version" @@ -109,14 +86,14 @@ USER="${USER:-changeme}" CLUSTER_NAME="${CLUSTER_NAME:-fst}" NAMESPACE="${NAMESPACE:-fst-${USER}}" RELEASE_NAME="${RELEASE_NAME:-fst}" -NMT_VERSION=v2.0.0-alpha.0 -PLATFORM_VERSION=v0.39.1 +NMT_VERSION=v1.2.4 +PLATFORM_VERSION=v0.49.0-alpha.2 POD_MONITOR_ROLE="${POD_MONITOR_ROLE:-pod-monitor-role}" GATEWAY_CLASS_NAME="${GATEWAY_CLASS_NAME:-fst-gateway-class}" #NODE_NAMES=(node0 node1 node2 node3) -NODE_NAMES=(node0) +NODE_NAMES=(node0 node1 node2) POD_MONITOR_ROLE="${POD_MONITOR_ROLE:-pod-monitor-role}" GATEWAY_CLASS_NAME="${GATEWAY_CLASS_NAME:-fst-gateway-class}" diff --git a/.github/workflows/support/scripts/helper.sh b/.github/workflows/support/scripts/helper.sh index 1f75834ff..d529da2db 100755 --- a/.github/workflows/support/scripts/helper.sh +++ b/.github/workflows/support/scripts/helper.sh @@ -678,6 +678,19 @@ function verify_network_state() { return "$EX_OK" } +function verify_haproxy() { + # iterate over each haprox pod check if READY is 1/1 + local pods=$("${KCTL}" get pods -l fullstack.hedera.com/type=haproxy -o jsonpath='{.items[*].metadata.name}') + for pod in ${pods}; do + local status=$("${KCTL}" get pod "${pod}" -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') + if [[ "${status}" != "True" ]]; then + echo "ERROR: <<< HAProxy pod ${pod} is not ready. >>>" + return "${EX_ERR}" + fi + done + return "${EX_OK}" +} + function verify_node_all() { if [[ "${#NODE_NAMES[*]}" -le 0 ]]; then echo "ERROR: Node list is empty. Set NODE_NAMES env variable with a list of nodes" diff --git a/.github/workflows/support/scripts/template.env b/.github/workflows/support/scripts/template.env deleted file mode 100644 index 9c4d8cf9e..000000000 --- a/.github/workflows/support/scripts/template.env +++ /dev/null @@ -1,12 +0,0 @@ -USER="${USER:-changeme}" -CLUSTER_NAME="${CLUSTER_NAME:-fst}" -NAMESPACE="${NAMESPACE:-fst-${USER}}" -RELEASE_NAME="${RELEASE_NAME:-fst}" -NMT_VERSION=v1.2.4 -PLATFORM_VERSION=v0.49.0-alpha.2 - -POD_MONITOR_ROLE="${POD_MONITOR_ROLE:-pod-monitor-role}" -GATEWAY_CLASS_NAME="${GATEWAY_CLASS_NAME:-fst-gateway-class}" - -#NODE_NAMES=(node0 node1 node2 node3) -NODE_NAMES=(node0) From 8412bdd192f230448a9e4b566885bd1ba4923cdd Mon Sep 17 00:00:00 2001 From: Jeffrey Tang Date: Tue, 16 Jul 2024 12:22:26 -0500 Subject: [PATCH 3/6] revert Signed-off-by: Jeffrey Tang --- .github/workflows/support/ci_test.sh | 41 +++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/.github/workflows/support/ci_test.sh b/.github/workflows/support/ci_test.sh index e5b2d0696..c29eb770e 100755 --- a/.github/workflows/support/ci_test.sh +++ b/.github/workflows/support/ci_test.sh @@ -88,7 +88,8 @@ kubectl wait --for=jsonpath='{.status.phase}'=Running pod -l fullstack.hedera.co echo "Running helm chart tests (takes ~5m, timeout 15m)... " echo "-----------------------------------------------------------------------------------------------------" - +helm test "${RELEASE_NAME}" --filter name=network-test --timeout 15m +kubectl logs network-test echo "-----------------------------------------------------------------------------------------------------" echo "Setup and start nodes" @@ -101,3 +102,41 @@ else source "${SCRIPTS_DIR}/${SCRIPT_NAME}" && start_node_all fi +echo "-----------------------------------------------------------------------------------------------------" +echo "Tear down cluster" + +kubectl delete pod network-test -n "${NAMESPACE}" || true + +echo "Uninstalling helm chart ${RELEASE_NAME} in namespace ${NAMESPACE}... " +echo "-----------------------------------------------------------------------------------------------------" +helm uninstall -n "${NAMESPACE}" "${RELEASE_NAME}" +sleep 10 +echo "Uninstalled helm chart ${RELEASE_NAME} in namespace ${NAMESPACE}" + +echo "Removing postgres pvc" +has_postgres_pvc=$(kubectl get pvc --no-headers -l app.kubernetes.io/component=postgresql,app.kubernetes.io/name=postgres,app.kubernetes.io/instance="${RELEASE_NAME}" | wc -l) +if [[ $has_postgres_pvc ]]; then +kubectl delete pvc -l app.kubernetes.io/component=postgresql,app.kubernetes.io/name=postgres,app.kubernetes.io/instance="${RELEASE_NAME}" +fi + +echo "Workflow finished successfully" +echo "-----------------------------------------------------------------------------------------------------" +echo "-----------------------------------------------------------------------------------------------------" +echo "Tear down cluster" + +kubectl delete pod network-test -n "${NAMESPACE}" || true + +echo "Uninstalling helm chart ${RELEASE_NAME} in namespace ${NAMESPACE}... " +echo "-----------------------------------------------------------------------------------------------------" +helm uninstall -n "${NAMESPACE}" "${RELEASE_NAME}" +sleep 10 +echo "Uninstalled helm chart ${RELEASE_NAME} in namespace ${NAMESPACE}" + +echo "Removing postgres pvc" +has_postgres_pvc=$(kubectl get pvc --no-headers -l app.kubernetes.io/component=postgresql,app.kubernetes.io/name=postgres,app.kubernetes.io/instance="${RELEASE_NAME}" | wc -l) +if [[ $has_postgres_pvc ]]; then +kubectl delete pvc -l app.kubernetes.io/component=postgresql,app.kubernetes.io/name=postgres,app.kubernetes.io/instance="${RELEASE_NAME}" +fi + +echo "Workflow finished successfully" +echo "-----------------------------------------------------------------------------------------------------" From 2c3d42c435bbd52a57775dccc827563522716ff6 Mon Sep 17 00:00:00 2001 From: Jeffrey Tang Date: Tue, 16 Jul 2024 12:27:27 -0500 Subject: [PATCH 4/6] save Signed-off-by: Jeffrey Tang --- .github/workflows/support/scripts/env.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/support/scripts/env.sh b/.github/workflows/support/scripts/env.sh index 1a045834b..12c202c4c 100644 --- a/.github/workflows/support/scripts/env.sh +++ b/.github/workflows/support/scripts/env.sh @@ -80,7 +80,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" readonly TMP_DIR="${SCRIPT_DIR}/../temp" readonly CLUSTER_SETUP_VALUES_FILE="${TMP_DIR}/cluster-values.yaml" mkdir -p "$TMP_DIR" -load_env_file USER="${USER:-changeme}" CLUSTER_NAME="${CLUSTER_NAME:-fst}" From 64fec94fd59108b1d3cac2e186190379c39e3791 Mon Sep 17 00:00:00 2001 From: Jeffrey Tang Date: Tue, 16 Jul 2024 12:40:15 -0500 Subject: [PATCH 5/6] save Signed-off-by: Jeffrey Tang --- .github/workflows/support/ci_test.sh | 19 ------------------- .../support/scripts/direct-install.sh | 2 ++ .github/workflows/support/scripts/helper.sh | 1 + 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/support/ci_test.sh b/.github/workflows/support/ci_test.sh index c29eb770e..608f9fb6e 100755 --- a/.github/workflows/support/ci_test.sh +++ b/.github/workflows/support/ci_test.sh @@ -121,22 +121,3 @@ fi echo "Workflow finished successfully" echo "-----------------------------------------------------------------------------------------------------" -echo "-----------------------------------------------------------------------------------------------------" -echo "Tear down cluster" - -kubectl delete pod network-test -n "${NAMESPACE}" || true - -echo "Uninstalling helm chart ${RELEASE_NAME} in namespace ${NAMESPACE}... " -echo "-----------------------------------------------------------------------------------------------------" -helm uninstall -n "${NAMESPACE}" "${RELEASE_NAME}" -sleep 10 -echo "Uninstalled helm chart ${RELEASE_NAME} in namespace ${NAMESPACE}" - -echo "Removing postgres pvc" -has_postgres_pvc=$(kubectl get pvc --no-headers -l app.kubernetes.io/component=postgresql,app.kubernetes.io/name=postgres,app.kubernetes.io/instance="${RELEASE_NAME}" | wc -l) -if [[ $has_postgres_pvc ]]; then -kubectl delete pvc -l app.kubernetes.io/component=postgresql,app.kubernetes.io/name=postgres,app.kubernetes.io/instance="${RELEASE_NAME}" -fi - -echo "Workflow finished successfully" -echo "-----------------------------------------------------------------------------------------------------" diff --git a/.github/workflows/support/scripts/direct-install.sh b/.github/workflows/support/scripts/direct-install.sh index 90a928c73..4836c1175 100644 --- a/.github/workflows/support/scripts/direct-install.sh +++ b/.github/workflows/support/scripts/direct-install.sh @@ -92,6 +92,8 @@ function start_node_all() { verify_node_all || return "${EX_ERR}" + sleep 2 + verify_haproxy || return "${EX_ERR}" return "${EX_OK}" diff --git a/.github/workflows/support/scripts/helper.sh b/.github/workflows/support/scripts/helper.sh index d529da2db..98fe63f84 100755 --- a/.github/workflows/support/scripts/helper.sh +++ b/.github/workflows/support/scripts/helper.sh @@ -687,6 +687,7 @@ function verify_haproxy() { echo "ERROR: <<< HAProxy pod ${pod} is not ready. >>>" return "${EX_ERR}" fi + echo "HAProxy pod ${pod} is ready" done return "${EX_OK}" } From 7fab555d6c32818015e8676bb8ad41e25a3c07a7 Mon Sep 17 00:00:00 2001 From: Jeffrey Tang Date: Tue, 16 Jul 2024 13:22:53 -0500 Subject: [PATCH 6/6] save Signed-off-by: Jeffrey Tang --- .github/workflows/support/scripts/nmt-install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/support/scripts/nmt-install.sh b/.github/workflows/support/scripts/nmt-install.sh index ff886fa83..fd236728b 100644 --- a/.github/workflows/support/scripts/nmt-install.sh +++ b/.github/workflows/support/scripts/nmt-install.sh @@ -62,6 +62,10 @@ function start_node_all() { verify_node_all || return "${EX_ERR}" + sleep 2 + + verify_haproxy || return "${EX_ERR}" + return "${EX_OK}" }