From 01e66fe4c251828e22b98496df0e206f466ec5dd Mon Sep 17 00:00:00 2001 From: Leo J <153937047+leiicamundi@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:40:35 +0100 Subject: [PATCH] fix: env variable not loaded by the scripts --- README.md | 29 +++++++++++++++++------------ checks/kube/aws-irsa.sh | 10 +++++----- checks/kube/connectivity.sh | 2 +- checks/kube/deployment.sh | 9 +++++---- checks/zeebe/connectivity.sh | 23 ++++++++++++----------- checks/zeebe/token.sh | 12 ++++++------ 6 files changed, 46 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index f0fa43c..f5a9284 100644 --- a/README.md +++ b/README.md @@ -40,13 +40,13 @@ It verifies the presence and readiness of required containers within the deploym ##### Usage: ```bash -Usage: ./checks/kube/deployment.sh [-h] [-n NAMESPACE] [-d HELM_DEPLOYMENT_NAME] [-l] [-c REQUIRED_CONTAINERS] +Usage: ./checks/kube/deployment.sh [-h] [-n NAMESPACE] [-d HELM_DEPLOYMENT_NAME] Options: -h Display this help message -n NAMESPACE Specify the namespace to use -d HELM_DEPLOYMENT_NAME Specify the name of the helm deployment (default: camunda) -l Skip checks of the helm deployment (default: 0) - -c REQUIRED_CONTAINERS Specify the list of containers to check (comma-separated, default: console connector web-modeler optimize zeebe zeebe-gateway) + -c Specify the list of containers to check (comma-separated, default: connector,optimize,zeebe,zeebe-gateway) ``` ##### Example: @@ -68,14 +68,17 @@ Please note that this check requires Helm to be deployed directly; using `helm t ##### Usage: ```bash -Usage: ./checks/kube/aws-irsa.sh [-h] [-n NAMESPACE] [-e EXCLUDE_COMPONENTS] [-p COMPONENTS_PG] [-l COMPONENTS_OS] [-s] +Usage: ./checks/kube/aws-irsa.sh [-h] [-n NAMESPACE] [-e EXCLUDE_COMPONENTS] [-p] [-l] [-s] Options: -h Display this help message - -n NAMESPACE Specify the namespace to use - -e EXCLUDE_COMPONENTS Comma-separated list of components to exclude from the check (reference of the component is the root key used in the chart) - -p COMPONENTS_PG Comma-separated list of components to check IRSA for PostgreSQL (overrides default list) - -l COMPONENTS_OS Comma-separated list of components to check IRSA for OpenSearch (overrides default list) - -s Disable pod spawn for IRSA and network flow verification + -n NAMESPACE Specify the namespace to use (required) + -e EXCLUDE_COMPONENTS Comma-separated list of Components to exclude from the check (reference of the component is the root key used in the chart) + -p Comma-separated list of Components to check IRSA for PostgreSQL (overrides default list: identityKeycloak,identity,webModeler) + -l Comma-separated list of Components to check IRSA for OpenSearch (overrides default list: zeebe,operate,tasklist,optimize) + -s Disable pod spawn for IRSA and connectivity verification. + By default, the script spawns jobs in the specified namespace to perform + IRSA checks and network connectivity tests. These jobs use the amazonlinux:latest + image and scan with nmap to verify connectivity. ``` ##### Example: @@ -106,7 +109,7 @@ It checks for the presence of services and ingresses that conform to the require ##### Usage: ```bash -Usage: ./checks/kube/connectivity.sh [-h] [-n NAMESPACE] [-i] +Usage: ./checks/kube/connectivity.sh [-h] [-n NAMESPACE] [-d HELM_DEPLOYMENT_NAME] Options: -h Display this help message -n NAMESPACE Specify the namespace to use @@ -133,10 +136,11 @@ This script retrieves an access token from an authorization server using client ##### Usage: ```bash -Usage: ./checks/zeebe/token.sh [-h] [-a ZEEBE_AUTHORIZATION_SERVER_URL] [-i ZEEBE_CLIENT_ID] [-s ZEEBE_CLIENT_SECRET] [-u ZEEBE_TOKEN_AUDIENCE] +Usage: ./checks/zeebe/token.sh [-h] [-a AUTH_SERVER_URL] [-i CLIENT_ID] [-s CLIENT_SECRET] [-u TOKEN_AUDIENCE] Options: -h Display this help message - -a ZEEBE_AUTHORIZATION_SERVER_URL Specify the authorization server URL (e.g.: https://local.distro.ultrawombat.com/auth/realms/camunda-platform/protocol/openid-connect/token) + -a ZEEBE_AUTHORIZATION_SERVER_URL Specify the authorization server URL (e.g.: https://local.distro.ultrawombat.com/auth/realms/camunda-platform/protocol/openid-connect/t +oken) -i ZEEBE_CLIENT_ID Specify the client ID -s ZEEBE_CLIENT_SECRET Specify the client secret -u ZEEBE_TOKEN_AUDIENCE Specify the token audience @@ -172,7 +176,8 @@ Options: -k Skip TLS verification (insecure mode) -r CACERT Specify the path to CA certificate file -j CLIENTCERT Specify the path to Client certificate file - -a ZEEBE_AUTHORIZATION_SERVER_URL Specify the authorization server URL (e.g.: https://local.distro.example.com/auth/realms/camunda-platform/protocol/openid-connect/token) + -a ZEEBE_AUTHORIZATION_SERVER_URL Specify the authorization server URL (e.g.: https://local.distro.example.com/auth/realms/camunda-platform/protocol/openid-connect/t +oken) -i ZEEBE_CLIENT_ID Specify the client ID -s ZEEBE_CLIENT_SECRET Specify the client secret -u ZEEBE_TOKEN_AUDIENCE Specify the token audience diff --git a/checks/kube/aws-irsa.sh b/checks/kube/aws-irsa.sh index 2d037a9..53cf2da 100755 --- a/checks/kube/aws-irsa.sh +++ b/checks/kube/aws-irsa.sh @@ -9,7 +9,7 @@ DIR_NAME=$(dirname "$0") LVL_1_SCRIPT_NAME="$DIR_NAME/$SCRIPT_NAME" # Default variables -NAMESPACE="" +NAMESPACE="${NAMESPACE:-""}" SCRIPT_STATUS_OUTPUT=0 CHART_NAME="camunda-platform" SPAWN_POD=true # By default, the pod will spawn for verification @@ -21,7 +21,7 @@ COMPONENTS_TO_CHECK_IRSA_OS="zeebe,operate,tasklist,optimize" # The second list is for components that need IRSA to authenticate to PostgreSQL COMPONENTS_TO_CHECK_IRSA_PG="identityKeycloak,identity,webModeler" -EXCLUDE_COMPONENTS="" +EXCLUDE_COMPONENTS="${EXCLUDE_COMPONENTS:-""}" # Associative array for case-insensitive component mapping @@ -41,13 +41,13 @@ REQUIRED_AWSCLI_VERSION_V1="1.27.160" # Usage message usage() { - echo "Usage: $0 [-h] [-n NAMESPACE] [-e EXCLUDE_COMPONENTS] [-p COMPONENTS_PG] [-l COMPONENTS_OS] [-s]" + echo "Usage: $0 [-h] [-n NAMESPACE] [-e EXCLUDE_COMPONENTS] [-p] [-l] [-s]" echo "Options:" echo " -h Display this help message" echo " -n NAMESPACE Specify the namespace to use (required)" echo " -e EXCLUDE_COMPONENTS Comma-separated list of Components to exclude from the check (reference of the component is the root key used in the chart)" - echo " -p COMPONENTS_PG Comma-separated list of Components to check IRSA for PostgreSQL (overrides default list: $COMPONENTS_TO_CHECK_IRSA_PG)" - echo " -l COMPONENTS_OS Comma-separated list of Components to check IRSA for OpenSearch (overrides default list: $COMPONENTS_TO_CHECK_IRSA_OS)" + echo " -p Comma-separated list of Components to check IRSA for PostgreSQL (overrides default list: $COMPONENTS_TO_CHECK_IRSA_PG)" + echo " -l Comma-separated list of Components to check IRSA for OpenSearch (overrides default list: $COMPONENTS_TO_CHECK_IRSA_OS)" echo " -s Disable pod spawn for IRSA and connectivity verification." echo " By default, the script spawns jobs in the specified namespace to perform" echo " IRSA checks and network connectivity tests. These jobs use the amazonlinux:latest" diff --git a/checks/kube/connectivity.sh b/checks/kube/connectivity.sh index 977de21..d916b34 100755 --- a/checks/kube/connectivity.sh +++ b/checks/kube/connectivity.sh @@ -8,7 +8,7 @@ DIR_NAME=$(dirname "$0") LVL_1_SCRIPT_NAME="$DIR_NAME/$SCRIPT_NAME" # Define default variables -NAMESPACE="" +NAMESPACE="${NAMESPACE:-""}" SKIP_CHECK_INGRESS_CLASS=0 usage() { diff --git a/checks/kube/deployment.sh b/checks/kube/deployment.sh index 6e90c51..18589e6 100755 --- a/checks/kube/deployment.sh +++ b/checks/kube/deployment.sh @@ -8,10 +8,11 @@ DIR_NAME=$(dirname "$0") LVL_1_SCRIPT_NAME="$DIR_NAME/$SCRIPT_NAME" # Define default variables -NAMESPACE="" -HELM_DEPLOYMENT_NAME="camunda" +NAMESPACE="${NAMESPACE:-""}" +HELM_DEPLOYMENT_NAME="${HELM_DEPLOYMENT_NAME:-"camunda"}" SKIP_CHECK_HELM_DEPLOYMENT=0 -REQUIRED_CONTAINERS=("connector" "optimize" "zeebe" "zeebe-gateway") +DEFAULT_REQUIRED_CONTAINERS="connector,optimize,zeebe,zeebe-gateway" +REQUIRED_CONTAINERS=() usage() { echo "Usage: $0 [-h] [-n NAMESPACE] [-d HELM_DEPLOYMENT_NAME]" @@ -20,7 +21,7 @@ usage() { echo " -n NAMESPACE Specify the namespace to use" echo " -d HELM_DEPLOYMENT_NAME Specify the name of the helm deployment (default: $HELM_DEPLOYMENT_NAME)" echo " -l Skip checks of the helm deployment (default: $SKIP_CHECK_HELM_DEPLOYMENT)" - echo " -c REQUIRED_CONTAINERS Specify the list of containers to check (comma-separated, default: ${REQUIRED_CONTAINERS[*]})" + echo " -c Specify the list of containers to check (comma-separated, default: ${DEFAULT_REQUIRED_CONTAINERS})" exit 1 } diff --git a/checks/zeebe/connectivity.sh b/checks/zeebe/connectivity.sh index 8478901..9bb5345 100755 --- a/checks/zeebe/connectivity.sh +++ b/checks/zeebe/connectivity.sh @@ -8,24 +8,25 @@ DIR_NAME=$(dirname "$0") LVL_1_SCRIPT_NAME="$DIR_NAME/$SCRIPT_NAME" # Define default variables -ZEEBE_HOST="" -PROTO_FILE="" +ZEEBE_HOST="${ZEEBE_HOST:-""}" +PROTO_FILE="${PROTO_FILE:-""}" SKIP_TLS_VERIFICATION="" EXTRA_FLAGS_CURL="" EXTRA_FLAGS_GRPCURL="" EXTRA_FLAGS_ZBCTL="" EXTRA_FLAGS_TOKEN="" -CACERT="" -CLIENTCERT="" -ZEEBE_AUTHORIZATION_SERVER_URL="" -ZEEBE_CLIENT_ID="" -ZEEBE_CLIENT_SECRET="" -ZEEBE_TOKEN_AUDIENCE="" -ZEEBE_TOKEN_SCOPE="camunda-identity" -API_PROTOCOL="grpc" +CACERT="${CACERT:-""}" +CLIENTCERT="${CLIENTCERT:-""}" +ZEEBE_AUTHORIZATION_SERVER_URL="${ZEEBE_AUTHORIZATION_SERVER_URL:-""}" +ZEEBE_CLIENT_ID="${ZEEBE_CLIENT_ID:-""}" +ZEEBE_CLIENT_SECRET="${ZEEBE_CLIENT_SECRET:-""}" +ZEEBE_TOKEN_AUDIENCE="${ZEEBE_TOKEN_AUDIENCE:-""}" +ZEEBE_TOKEN_SCOPE="${ZEEBE_TOKEN_SCOPE:-"camunda-identity"}" +API_PROTOCOL="${API_PROTOCOL:-"grpc"}" # renovate: datasource=github-releases depName=camunda/zeebe -ZEEBE_VERSION="8.6.5" +ZEEBE_DEFAULT_VERSION="8.6.5" +ZEEBE_VERSION="${ZEEBE_VERSION:-$ZEEBE_DEFAULT_VERSION}" # Function to display script usage usage() { diff --git a/checks/zeebe/token.sh b/checks/zeebe/token.sh index e4cdc82..f385694 100755 --- a/checks/zeebe/token.sh +++ b/checks/zeebe/token.sh @@ -8,13 +8,13 @@ DIR_NAME=$(dirname "$0") LVL_1_SCRIPT_NAME="$DIR_NAME/$SCRIPT_NAME" # Define default variables -ZEEBE_AUTHORIZATION_SERVER_URL="" -ZEEBE_CLIENT_ID="" -ZEEBE_CLIENT_SECRET="" -ZEEBE_TOKEN_AUDIENCE="" +ZEEBE_AUTHORIZATION_SERVER_URL="${ZEEBE_AUTHORIZATION_SERVER_URL:-""}" +ZEEBE_CLIENT_ID="${ZEEBE_CLIENT_ID:-""}" +ZEEBE_CLIENT_SECRET="${ZEEBE_CLIENT_SECRET:-""}" +ZEEBE_TOKEN_AUDIENCE="${ZEEBE_TOKEN_AUDIENCE:-""}" SKIP_TLS_VERIFICATION="" -CACERT="" -CLIENTCERT="" +CACERT="${CACERT:-""}" +CLIENTCERT="${CLIENTCERT:-""}" EXTRA_FLAGS_CURL="" # Function to display script usage