Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPGRADE: Metric Monitoring Stack #711

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

UPGRADE: Metric Monitoring Stack #711

wants to merge 4 commits into from

Conversation

gsmith-sas
Copy link
Member

No description provided.

Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck -e SC1004' returned error 1 finding the following syntactical issues:

----------

In monitoring/bin/deploy_monitoring_cluster.sh line 6:
cd "$(dirname $BASH_SOURCE)/../.."
              ^----------^ SC2128 (warning): Expanding an array without an index only gives the first element.
              ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
cd "$(dirname "$BASH_SOURCE")/../.."


In monitoring/bin/deploy_monitoring_cluster.sh line 7:
source monitoring/bin/common.sh
       ^----------------------^ SC1091 (info): Not following: monitoring/bin/common.sh was not specified as input (see shellcheck -x).


In monitoring/bin/deploy_monitoring_cluster.sh line 8:
source bin/service-url-include.sh
       ^------------------------^ SC1091 (info): Not following: bin/service-url-include.sh was not specified as input (see shellcheck -x).


In monitoring/bin/deploy_monitoring_cluster.sh line 18:
source bin/tls-include.sh
       ^----------------^ SC1091 (info): Not following: bin/tls-include.sh was not specified as input (see shellcheck -x).


In monitoring/bin/deploy_monitoring_cluster.sh line 19:
if verify_cert_generator $MON_NS prometheus alertmanager grafana; then
                         ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if verify_cert_generator "$MON_NS" prometheus alertmanager grafana; then


In monitoring/bin/deploy_monitoring_cluster.sh line 20:
  log_debug "cert generator check OK [$cert_generator_ok]"
                                      ^----------------^ SC2154 (warning): cert_generator_ok is referenced but not assigned.


In monitoring/bin/deploy_monitoring_cluster.sh line 22:
  log_error "One or more required TLS certs do not exist and the expected certificate generator mechanism [$cert_generator] is not available to create the missing certs"
                                                                                                           ^-------------^ SC2154 (warning): cert_generator is referenced but not assigned.


In monitoring/bin/deploy_monitoring_cluster.sh line 26:
helm2ReleaseCheck v4m-$MON_NS
                      ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm2ReleaseCheck v4m-"$MON_NS"


In monitoring/bin/deploy_monitoring_cluster.sh line 27:
helm2ReleaseCheck prometheus-$MON_NS
                             ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm2ReleaseCheck prometheus-"$MON_NS"


In monitoring/bin/deploy_monitoring_cluster.sh line 43:
if [ -z "$(kubectl get ns $MON_NS -o name 2>/dev/null)" ]; then
                          ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if [ -z "$(kubectl get ns "$MON_NS" -o name 2>/dev/null)" ]; then


In monitoring/bin/deploy_monitoring_cluster.sh line 44:
  kubectl create ns $MON_NS
                    ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl create ns "$MON_NS"


In monitoring/bin/deploy_monitoring_cluster.sh line 47:
  disable_sa_token_automount $MON_NS default
                             ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  disable_sa_token_automount "$MON_NS" default


In monitoring/bin/deploy_monitoring_cluster.sh line 52:
generateImageKeysFile "$ALERTMANAGER_FULL_IMAGE"    "$imageKeysFile"  "ALERTMANAGER_"
                                                     ^------------^ SC2154 (warning): imageKeysFile is referenced but not assigned.


In monitoring/bin/deploy_monitoring_cluster.sh line 100:
    if kubectl get crd $crd.monitoring.coreos.com 1>/dev/null 2>&1; then
                       ^--^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
    if kubectl get crd "$crd".monitoring.coreos.com 1>/dev/null 2>&1; then


In monitoring/bin/deploy_monitoring_cluster.sh line 101:
      kubectl replace -f $crdURL
                         ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
      kubectl replace -f "$crdURL"


In monitoring/bin/deploy_monitoring_cluster.sh line 103:
      kubectl create -f $crdURL
                        ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
      kubectl create -f "$crdURL"


In monitoring/bin/deploy_monitoring_cluster.sh line 111:
kubectl delete daemonset -n $MON_NS -l app=prometheus-node-exporter --ignore-not-found
                            ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl delete daemonset -n "$MON_NS" -l app=prometheus-node-exporter --ignore-not-found


In monitoring/bin/deploy_monitoring_cluster.sh line 128:
  create_tls_certs $MON_NS monitoring ${apps[@]}
                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                      ^--------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

Did you mean: 
  create_tls_certs "$MON_NS" monitoring ${apps[@]}


In monitoring/bin/deploy_monitoring_cluster.sh line 140:
  kubectl delete cm -n $MON_NS --ignore-not-found grafana-datasource-prom-https
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl delete cm -n "$MON_NS" --ignore-not-found grafana-datasource-prom-https


In monitoring/bin/deploy_monitoring_cluster.sh line 141:
  kubectl create cm -n $MON_NS grafana-datasource-prom-https --from-file monitoring/tls/$grafanaDS
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl create cm -n "$MON_NS" grafana-datasource-prom-https --from-file monitoring/tls/$grafanaDS


In monitoring/bin/deploy_monitoring_cluster.sh line 142:
  kubectl label cm -n $MON_NS grafana-datasource-prom-https grafana_datasource=1 sas.com/monitoring-base=kube-viya-monitoring
                      ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl label cm -n "$MON_NS" grafana-datasource-prom-https grafana_datasource=1 sas.com/monitoring-base=kube-viya-monitoring


In monitoring/bin/deploy_monitoring_cluster.sh line 146:
  kubectl delete cm -n $MON_NS node-exporter-tls-web-config --ignore-not-found
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl delete cm -n "$MON_NS" node-exporter-tls-web-config --ignore-not-found


In monitoring/bin/deploy_monitoring_cluster.sh line 148:
  kubectl create cm -n $MON_NS node-exporter-tls-web-config --from-file monitoring/tls/node-exporter-web.yaml
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl create cm -n "$MON_NS" node-exporter-tls-web-config --from-file monitoring/tls/node-exporter-web.yaml


In monitoring/bin/deploy_monitoring_cluster.sh line 149:
  kubectl label cm -n $MON_NS node-exporter-tls-web-config sas.com/monitoring-base=kube-viya-monitoring
                      ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl label cm -n "$MON_NS" node-exporter-tls-web-config sas.com/monitoring-base=kube-viya-monitoring


In monitoring/bin/deploy_monitoring_cluster.sh line 159:
if helm3ReleaseExists prometheus-operator $MON_NS; then
                                          ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists prometheus-operator "$MON_NS"; then


In monitoring/bin/deploy_monitoring_cluster.sh line 168:
if helm3ReleaseExists $promRelease $MON_NS; then
                                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists $promRelease "$MON_NS"; then


In monitoring/bin/deploy_monitoring_cluster.sh line 182:
  kubectl delete -n $MON_NS --ignore-not-found \
                    ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl delete -n "$MON_NS" --ignore-not-found \


In monitoring/bin/deploy_monitoring_cluster.sh line 201:
chart2install="$(get_helmchart_reference $KUBE_PROM_STACK_CHART_REPO $KUBE_PROM_STACK_CHART_NAME $KUBE_PROM_STACK_CHART_VERSION)"
                                         ^-------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                     ^-------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                                 ^----------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
chart2install="$(get_helmchart_reference "$KUBE_PROM_STACK_CHART_REPO" "$KUBE_PROM_STACK_CHART_NAME" "$KUBE_PROM_STACK_CHART_VERSION")"


In monitoring/bin/deploy_monitoring_cluster.sh line 202:
versionstring="$(get_helm_versionstring  $KUBE_PROM_STACK_CHART_VERSION)"
                                         ^----------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
versionstring="$(get_helm_versionstring  "$KUBE_PROM_STACK_CHART_VERSION")"


In monitoring/bin/deploy_monitoring_cluster.sh line 205:
helm $helmDebug upgrade --install $promRelease \
     ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm "$helmDebug" upgrade --install $promRelease \


In monitoring/bin/deploy_monitoring_cluster.sh line 206:
  --namespace $MON_NS \
              ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --namespace "$MON_NS" \


In monitoring/bin/deploy_monitoring_cluster.sh line 207:
  -f $imageKeysFile \
     ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$imageKeysFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 209:
  -f $istioValuesFile \
     ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$istioValuesFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 210:
  -f $tlsValuesFile \
     ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$tlsValuesFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 211:
  -f $tlsPromAlertingEndpointFile \
     ^--------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$tlsPromAlertingEndpointFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 212:
  -f $nodePortValuesFile \
     ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$nodePortValuesFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 213:
  -f $wnpValuesFile \
     ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$wnpValuesFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 214:
  -f $PROM_OPER_USER_YAML \
     ^------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$PROM_OPER_USER_YAML" \


In monitoring/bin/deploy_monitoring_cluster.sh line 215:
  -f $tempoDSFile \
     ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$tempoDSFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 225:
  $versionstring \
  ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  "$versionstring" \


In monitoring/bin/deploy_monitoring_cluster.sh line 226:
  $chart2install
  ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  "$chart2install"


In monitoring/bin/deploy_monitoring_cluster.sh line 232:
  kubectl patch servicemonitor -n $MON_NS $promName-grafana --type=json \
                                  ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl patch servicemonitor -n "$MON_NS" $promName-grafana --type=json \


In monitoring/bin/deploy_monitoring_cluster.sh line 237:
disable_sa_token_automount $MON_NS v4m-grafana
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" v4m-grafana


In monitoring/bin/deploy_monitoring_cluster.sh line 238:
disable_sa_token_automount $MON_NS sas-ops-acct      #Used w/Prometheus
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" sas-ops-acct      #Used w/Prometheus


In monitoring/bin/deploy_monitoring_cluster.sh line 239:
disable_sa_token_automount $MON_NS v4m-node-exporter
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" v4m-node-exporter


In monitoring/bin/deploy_monitoring_cluster.sh line 240:
disable_sa_token_automount $MON_NS v4m-alertmanager
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" v4m-alertmanager


In monitoring/bin/deploy_monitoring_cluster.sh line 243:
disable_sa_token_automount $MON_NS v4m-kube-state-metrics
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" v4m-kube-state-metrics


In monitoring/bin/deploy_monitoring_cluster.sh line 244:
enable_pod_token_automount $MON_NS deployment v4m-kube-state-metrics
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
enable_pod_token_automount "$MON_NS" deployment v4m-kube-state-metrics


In monitoring/bin/deploy_monitoring_cluster.sh line 245:
disable_sa_token_automount $MON_NS v4m-operator
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" v4m-operator


In monitoring/bin/deploy_monitoring_cluster.sh line 246:
enable_pod_token_automount $MON_NS deployment v4m-operator
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
enable_pod_token_automount "$MON_NS" deployment v4m-operator


In monitoring/bin/deploy_monitoring_cluster.sh line 263:
  chart2install="$(get_helmchart_reference $TEMPO_CHART_REPO $TEMPO_CHART_NAME $TEMPO_CHART_VERSION)"
                                           ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                             ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                               ^------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  chart2install="$(get_helmchart_reference "$TEMPO_CHART_REPO" "$TEMPO_CHART_NAME" "$TEMPO_CHART_VERSION")"


In monitoring/bin/deploy_monitoring_cluster.sh line 264:
  versionstring="$(get_helm_versionstring  $TEMPO_CHART_VERSION)"
                                           ^------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  versionstring="$(get_helm_versionstring  "$TEMPO_CHART_VERSION")"


In monitoring/bin/deploy_monitoring_cluster.sh line 270:
    -f $imageKeysFile \
       ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
    -f "$imageKeysFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 273:
    $versionstring \
    ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
    "$versionstring" \


In monitoring/bin/deploy_monitoring_cluster.sh line 274:
    $chart2install
    ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
    "$chart2install"


In monitoring/bin/deploy_monitoring_cluster.sh line 279:
kubectl get ns $NGINX_NS 2>/dev/null
               ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl get ns "$NGINX_NS" 2>/dev/null


In monitoring/bin/deploy_monitoring_cluster.sh line 280:
if [ $? == 0 ]; then
     ^-- SC2181 (style): Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.


In monitoring/bin/deploy_monitoring_cluster.sh line 287:
  kubectl apply -n $NGINX_NS -f monitoring/monitors/kube/podMonitor-nginx.yaml 2>/dev/null
                   ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl apply -n "$NGINX_NS" -f monitoring/monitors/kube/podMonitor-nginx.yaml 2>/dev/null


In monitoring/bin/deploy_monitoring_cluster.sh line 291:
kubectl apply -n $MON_NS -f monitoring/monitors/kube/podMonitor-eventrouter.yaml 2>/dev/null
                 ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl apply -n "$MON_NS" -f monitoring/monitors/kube/podMonitor-eventrouter.yaml 2>/dev/null


In monitoring/bin/deploy_monitoring_cluster.sh line 295:
kubectl delete -n $MON_NS servicemonitor elasticsearch --ignore-not-found
                  ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl delete -n "$MON_NS" servicemonitor elasticsearch --ignore-not-found


In monitoring/bin/deploy_monitoring_cluster.sh line 296:
kubectl apply -n $MON_NS -f monitoring/monitors/logging/serviceMonitor-elasticsearch-v2.yaml
                 ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl apply -n "$MON_NS" -f monitoring/monitors/logging/serviceMonitor-elasticsearch-v2.yaml


In monitoring/bin/deploy_monitoring_cluster.sh line 299:
kubectl apply -n $MON_NS -f monitoring/monitors/logging/serviceMonitor-fluent-bit.yaml
                 ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl apply -n "$MON_NS" -f monitoring/monitors/logging/serviceMonitor-fluent-bit.yaml


In monitoring/bin/deploy_monitoring_cluster.sh line 300:
kubectl apply -n $MON_NS -f monitoring/monitors/logging/serviceMonitor-fluent-bit-v2.yaml
                 ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl apply -n "$MON_NS" -f monitoring/monitors/logging/serviceMonitor-fluent-bit-v2.yaml


In monitoring/bin/deploy_monitoring_cluster.sh line 305:
  kubectl apply -n $MON_NS -f $f
                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                              ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl apply -n "$MON_NS" -f "$f"


In monitoring/bin/deploy_monitoring_cluster.sh line 334:
gf_url=$(get_service_url $MON_NS v4m-grafana  "$TLS_ENABLE")
                         ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
gf_url=$(get_service_url "$MON_NS" v4m-grafana  "$TLS_ENABLE")


In monitoring/bin/deploy_monitoring_cluster.sh line 340:
if helm3ReleaseExists v4m $MON_NS; then
                          ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists v4m "$MON_NS"; then


In monitoring/bin/deploy_monitoring_cluster.sh line 352:
if [ ! -z "$gf_url" ]; then
     ^-- SC2236 (style): Use -n instead of ! -z.

For more information:
  https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
  https://www.shellcheck.net/wiki/SC2128 -- Expanding an array without an ind...
  https://www.shellcheck.net/wiki/SC2154 -- cert_generator is referenced but ...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors

'shfmt -s' returned error 1 finding the following formatting issues:

----------
diff monitoring/bin/deploy_monitoring_cluster.sh.orig monitoring/bin/deploy_monitoring_cluster.sh
--- monitoring/bin/deploy_monitoring_cluster.sh.orig
+++ monitoring/bin/deploy_monitoring_cluster.sh
@@ -8,19 +8,19 @@
 source bin/service-url-include.sh
 
 if [ "$OPENSHIFT_CLUSTER" == "true" ]; then
-  if [ "${CHECK_OPENSHIFT_CLUSTER:-true}" == "true" ]; then
-    log_error "This script should not be run on OpenShift clusters"
-    log_error "Run monitoring/bin/deploy_monitoring_openshift.sh instead"
-    exit 1
-  fi
+	if [ "${CHECK_OPENSHIFT_CLUSTER:-true}" == "true" ]; then
+		log_error "This script should not be run on OpenShift clusters"
+		log_error "Run monitoring/bin/deploy_monitoring_openshift.sh instead"
+		exit 1
+	fi
 fi
 
 source bin/tls-include.sh
 if verify_cert_generator $MON_NS prometheus alertmanager grafana; then
-  log_debug "cert generator check OK [$cert_generator_ok]"
-else
-  log_error "One or more required TLS certs do not exist and the expected certificate generator mechanism [$cert_generator] is not available to create the missing certs"
-  exit 1
+	log_debug "cert generator check OK [$cert_generator_ok]"
+else
+	log_error "One or more required TLS certs do not exist and the expected certificate generator mechanism [$cert_generator] is not available to create the missing certs"
+	exit 1
 fi
 
 helm2ReleaseCheck v4m-$MON_NS
@@ -32,32 +32,31 @@
 
 PROM_OPER_USER_YAML="${PROM_OPER_USER_YAML:-$USER_DIR/monitoring/user-values-prom-operator.yaml}"
 if [ ! -f "$PROM_OPER_USER_YAML" ]; then
-  log_debug "[$PROM_OPER_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
-  PROM_OPER_USER_YAML=$TMP_DIR/empty.yaml
+	log_debug "[$PROM_OPER_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
+	PROM_OPER_USER_YAML=$TMP_DIR/empty.yaml
 fi
 
 if [ "$HELM_DEBUG" == "true" ]; then
-  helmDebug="--debug"
+	helmDebug="--debug"
 fi
 
 if [ -z "$(kubectl get ns $MON_NS -o name 2>/dev/null)" ]; then
-  kubectl create ns $MON_NS
-
-  #Container Security: Disable serviceAccount Token Automounting
-  disable_sa_token_automount $MON_NS default
+	kubectl create ns $MON_NS
+
+	#Container Security: Disable serviceAccount Token Automounting
+	disable_sa_token_automount $MON_NS default
 fi
 
 #Generate yaml file with all container-related keys
-generateImageKeysFile "$PROMOP_FULL_IMAGE"          "monitoring/prom-operator_container_image.template"
-generateImageKeysFile "$ALERTMANAGER_FULL_IMAGE"    "$imageKeysFile"  "ALERTMANAGER_"
-generateImageKeysFile "$ADMWEBHOOK_FULL_IMAGE"      "$imageKeysFile"  "ADMWEBHOOK_"
-generateImageKeysFile "$KSM_FULL_IMAGE"             "$imageKeysFile"  "KSM_"
-generateImageKeysFile "$NODEXPORT_FULL_IMAGE"       "$imageKeysFile"  "NODEXPORT_"
-generateImageKeysFile "$PROMETHEUS_FULL_IMAGE"      "$imageKeysFile"  "PROMETHEUS_"
-generateImageKeysFile "$CONFIGRELOAD_FULL_IMAGE"    "$imageKeysFile"  "CONFIGRELOAD_"
-generateImageKeysFile "$GRAFANA_FULL_IMAGE"         "$imageKeysFile"  "GRAFANA_"
-generateImageKeysFile "$GRAFANA_SIDECAR_FULL_IMAGE" "$imageKeysFile"  "SIDECAR_"
-
+generateImageKeysFile "$PROMOP_FULL_IMAGE" "monitoring/prom-operator_container_image.template"
+generateImageKeysFile "$ALERTMANAGER_FULL_IMAGE" "$imageKeysFile" "ALERTMANAGER_"
+generateImageKeysFile "$ADMWEBHOOK_FULL_IMAGE" "$imageKeysFile" "ADMWEBHOOK_"
+generateImageKeysFile "$KSM_FULL_IMAGE" "$imageKeysFile" "KSM_"
+generateImageKeysFile "$NODEXPORT_FULL_IMAGE" "$imageKeysFile" "NODEXPORT_"
+generateImageKeysFile "$PROMETHEUS_FULL_IMAGE" "$imageKeysFile" "PROMETHEUS_"
+generateImageKeysFile "$CONFIGRELOAD_FULL_IMAGE" "$imageKeysFile" "CONFIGRELOAD_"
+generateImageKeysFile "$GRAFANA_FULL_IMAGE" "$imageKeysFile" "GRAFANA_"
+generateImageKeysFile "$GRAFANA_SIDECAR_FULL_IMAGE" "$imageKeysFile" "SIDECAR_"
 
 set -e
 log_notice "Deploying monitoring to the [$MON_NS] namespace..."
@@ -68,43 +67,43 @@
 istioValuesFile=$TMP_DIR/empty.yaml
 # Istio - Federate data from Istio's Prometheus instance
 if [ "$ISTIO_ENABLED" == "true" ]; then
-  log_verbose "Including Istio metric federation"
-  istioValuesFile=$TMP_DIR/values-prom-operator-tmp.yaml
-else
-  log_debug "ISTIO_ENABLED flag not set"
-  log_debug "Skipping deployment of federated scrape of Istio Prometheus instance"
+	log_verbose "Including Istio metric federation"
+	istioValuesFile=$TMP_DIR/values-prom-operator-tmp.yaml
+else
+	log_debug "ISTIO_ENABLED flag not set"
+	log_debug "Skipping deployment of federated scrape of Istio Prometheus instance"
 fi
 
 # Check if Prometheus Operator CRDs are already installed
 PROM_OPERATOR_CRD_UPDATE=${PROM_OPERATOR_CRD_UPDATE:-true}
 if [ "$PROM_OPERATOR_CRD_UPDATE" == "true" ]; then
-  log_verbose "Updating Prometheus Operator custom resource definitions"
-  crds=( alertmanagerconfigs alertmanagers prometheuses prometheusrules podmonitors servicemonitors thanosrulers probes )
-  for crd in "${crds[@]}"; do
-    
-    ## Determine CRD URL - if in an airgap environment, look for them in USER_DIR.
-    if [ "$AIRGAP_DEPLOYMENT" == "true" ]; then
-      crdURL=$USER_DIR/monitoring/prometheus-operator-crd/$PROM_OPERATOR_CRD_VERSION/monitoring.coreos.com_$crd.yaml
-
-      ## Fail if the CRDs could not be located.
-      if [ ! -f "$crdURL" ]; then
-        log_error "Unable to locate file: [monitoring.coreos.com_$crd.yaml] in"
-        log_error "[$USER_DIR/monitoring/prometheus-operator-crd/$PROM_OPERATOR_CRD_VERSION] directory"
-        log_error "Please make sure to provide all Prometheus Operator CRDs before running the deployment"
-        exit 1
-      fi
-    else
-      crdURL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$PROM_OPERATOR_CRD_VERSION/example/prometheus-operator-crd/monitoring.coreos.com_$crd.yaml"
-    fi 
-
-    if kubectl get crd $crd.monitoring.coreos.com 1>/dev/null 2>&1; then
-      kubectl replace -f $crdURL
-    else
-      kubectl create -f $crdURL
-    fi
-  done
-else
-  log_debug "Prometheus Operator CRD update disabled"
+	log_verbose "Updating Prometheus Operator custom resource definitions"
+	crds=(alertmanagerconfigs alertmanagers prometheuses prometheusrules podmonitors servicemonitors thanosrulers probes)
+	for crd in "${crds[@]}"; do
+
+		## Determine CRD URL - if in an airgap environment, look for them in USER_DIR.
+		if [ "$AIRGAP_DEPLOYMENT" == "true" ]; then
+			crdURL=$USER_DIR/monitoring/prometheus-operator-crd/$PROM_OPERATOR_CRD_VERSION/monitoring.coreos.com_$crd.yaml
+
+			## Fail if the CRDs could not be located.
+			if [ ! -f "$crdURL" ]; then
+				log_error "Unable to locate file: [monitoring.coreos.com_$crd.yaml] in"
+				log_error "[$USER_DIR/monitoring/prometheus-operator-crd/$PROM_OPERATOR_CRD_VERSION] directory"
+				log_error "Please make sure to provide all Prometheus Operator CRDs before running the deployment"
+				exit 1
+			fi
+		else
+			crdURL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$PROM_OPERATOR_CRD_VERSION/example/prometheus-operator-crd/monitoring.coreos.com_$crd.yaml"
+		fi
+
+		if kubectl get crd $crd.monitoring.coreos.com 1>/dev/null 2>&1; then
+			kubectl replace -f $crdURL
+		else
+			kubectl create -f $crdURL
+		fi
+	done
+else
+	log_debug "Prometheus Operator CRD update disabled"
 fi
 
 # Remove existing DaemonSets in case of an upgrade-in-place
@@ -113,11 +112,11 @@
 # Optional workload node placement support
 MON_NODE_PLACEMENT_ENABLE=${MON_NODE_PLACEMENT_ENABLE:-${NODE_PLACEMENT_ENABLE:-false}}
 if [ "$MON_NODE_PLACEMENT_ENABLE" == "true" ]; then
-  log_verbose "Enabling monitoring components for workload node placement"
-  wnpValuesFile="monitoring/node-placement/values-prom-operator-wnp.yaml"
-else
-  log_debug "Workload node placement support is disabled"
-  wnpValuesFile="$TMP_DIR/empty.yaml"
+	log_verbose "Enabling monitoring components for workload node placement"
+	wnpValuesFile="monitoring/node-placement/values-prom-operator-wnp.yaml"
+else
+	log_debug "Workload node placement support is disabled"
+	wnpValuesFile="$TMP_DIR/empty.yaml"
 fi
 
 # Optional TLS Support
@@ -124,118 +123,118 @@
 tlsValuesFile=$TMP_DIR/empty.yaml
 tlsPromAlertingEndpointFile=$TMP_DIR/empty.yaml
 if [ "$TLS_ENABLE" == "true" ]; then
-  apps=( prometheus alertmanager grafana )
-  create_tls_certs $MON_NS monitoring ${apps[@]}
-
-  tlsValuesFile=monitoring/tls/values-prom-operator-tls.yaml
-  tlsPromAlertingEndpointFile=monitoring/tls/prom-alertendpoint-host-https.yaml
-  log_debug "Including TLS response file $tlsValuesFile"
-
-  log_verbose "Provisioning TLS-enabled Prometheus datasource for Grafana"
-  grafanaDS=grafana-datasource-prom-https.yaml
-  if [ "$MON_TLS_PATH_INGRESS" == "true" ]; then
-    grafanaDS=grafana-datasource-prom-https-path.yaml
-    tlsPromAlertingEndpointFile=monitoring/tls/prom-alertendpoint-path-https.yaml
-  fi
-  kubectl delete cm -n $MON_NS --ignore-not-found grafana-datasource-prom-https
-  kubectl create cm -n $MON_NS grafana-datasource-prom-https --from-file monitoring/tls/$grafanaDS
-  kubectl label cm -n $MON_NS grafana-datasource-prom-https grafana_datasource=1 sas.com/monitoring-base=kube-viya-monitoring
-
-  # node-exporter TLS
-  log_verbose "Enabling Prometheus node-exporter for TLS"
-  kubectl delete cm -n $MON_NS node-exporter-tls-web-config --ignore-not-found
-  sleep 1
-  kubectl create cm -n $MON_NS node-exporter-tls-web-config --from-file monitoring/tls/node-exporter-web.yaml
-  kubectl label cm -n $MON_NS node-exporter-tls-web-config sas.com/monitoring-base=kube-viya-monitoring
+	apps=(prometheus alertmanager grafana)
+	create_tls_certs $MON_NS monitoring ${apps[@]}
+
+	tlsValuesFile=monitoring/tls/values-prom-operator-tls.yaml
+	tlsPromAlertingEndpointFile=monitoring/tls/prom-alertendpoint-host-https.yaml
+	log_debug "Including TLS response file $tlsValuesFile"
+
+	log_verbose "Provisioning TLS-enabled Prometheus datasource for Grafana"
+	grafanaDS=grafana-datasource-prom-https.yaml
+	if [ "$MON_TLS_PATH_INGRESS" == "true" ]; then
+		grafanaDS=grafana-datasource-prom-https-path.yaml
+		tlsPromAlertingEndpointFile=monitoring/tls/prom-alertendpoint-path-https.yaml
+	fi
+	kubectl delete cm -n $MON_NS --ignore-not-found grafana-datasource-prom-https
+	kubectl create cm -n $MON_NS grafana-datasource-prom-https --from-file monitoring/tls/$grafanaDS
+	kubectl label cm -n $MON_NS grafana-datasource-prom-https grafana_datasource=1 sas.com/monitoring-base=kube-viya-monitoring
+
+	# node-exporter TLS
+	log_verbose "Enabling Prometheus node-exporter for TLS"
+	kubectl delete cm -n $MON_NS node-exporter-tls-web-config --ignore-not-found
+	sleep 1
+	kubectl create cm -n $MON_NS node-exporter-tls-web-config --from-file monitoring/tls/node-exporter-web.yaml
+	kubectl label cm -n $MON_NS node-exporter-tls-web-config sas.com/monitoring-base=kube-viya-monitoring
 fi
 
 nodePortValuesFile=$TMP_DIR/empty.yaml
 PROM_NODEPORT_ENABLE=${PROM_NODEPORT_ENABLE:-false}
 if [ "$PROM_NODEPORT_ENABLE" == "true" ]; then
-  log_debug "Enabling NodePort access for Prometheus and Alertmanager"
-  nodePortValuesFile=monitoring/values-prom-nodeport.yaml
+	log_debug "Enabling NodePort access for Prometheus and Alertmanager"
+	nodePortValuesFile=monitoring/values-prom-nodeport.yaml
 fi
 
 if helm3ReleaseExists prometheus-operator $MON_NS; then
-  promRelease=prometheus-operator
-  promName=prometheus-operator
-else
-  promRelease=v4m-prometheus-operator
-  promName=v4m
+	promRelease=prometheus-operator
+	promName=prometheus-operator
+else
+	promRelease=v4m-prometheus-operator
+	promName=v4m
 fi
 log_verbose "User response file: [$PROM_OPER_USER_YAML]"
 log_info "Deploying the kube-prometheus stack. This may take a few minutes ..."
 if helm3ReleaseExists $promRelease $MON_NS; then
-  log_verbose "Upgrading via Helm ($(date) - timeout 20m)"
-else
-  grafanaPwd="$GRAFANA_ADMIN_PASSWORD"
-  if [ "$grafanaPwd" == "" ]; then
-    log_debug "Generating random Grafana admin password"
-    showPass="true"
-    grafanaPwd="$(randomPassword)"
-  fi
-  log_verbose "Installing via Helm ($(date) - timeout 20m)"
+	log_verbose "Upgrading via Helm ($(date) - timeout 20m)"
+else
+	grafanaPwd="$GRAFANA_ADMIN_PASSWORD"
+	if [ "$grafanaPwd" == "" ]; then
+		log_debug "Generating random Grafana admin password"
+		showPass="true"
+		grafanaPwd="$(randomPassword)"
+	fi
+	log_verbose "Installing via Helm ($(date) - timeout 20m)"
 fi
 
 # See https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#from-21x-to-22x
-if [ "$V4M_CURRENT_VERSION_MAJOR" == "1" ] && [[ "$V4M_CURRENT_VERSION_MINOR" =~ [0-5] ]]; then
-  kubectl delete -n $MON_NS --ignore-not-found \
-    deployments.apps \
-    -l app.kubernetes.io/instance=v4m-prometheus-operator,app.kubernetes.io/name=kube-state-metrics
+if [ "$V4M_CURRENT_VERSION_MAJOR" == "1" ] && [[ $V4M_CURRENT_VERSION_MINOR =~ [0-5] ]]; then
+	kubectl delete -n $MON_NS --ignore-not-found \
+		deployments.apps \
+		-l app.kubernetes.io/instance=v4m-prometheus-operator,app.kubernetes.io/name=kube-state-metrics
 fi
 
 TRACING_ENABLE="${TRACING_ENABLE:-false}"
 if [ "$TRACING_ENABLE" == "false" ]; then
-  tempoDSFile=$TMP_DIR/empty.yaml
-else
-  TEMPO_USER_YAML="${TEMPO_USER_YAML:-$USER_DIR/monitoring/user-values-tempo.yaml}"
-  if [ ! -f "$TEMPO_USER_YAML" ]; then
-    log_debug "[$TEMPO_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
-    TEMPO_USER_YAML=$TMP_DIR/empty.yaml
-  fi
-  tempoDSFile="monitoring/grafana-datasource-tempo.yaml"
-fi 
+	tempoDSFile=$TMP_DIR/empty.yaml
+else
+	TEMPO_USER_YAML="${TEMPO_USER_YAML:-$USER_DIR/monitoring/user-values-tempo.yaml}"
+	if [ ! -f "$TEMPO_USER_YAML" ]; then
+		log_debug "[$TEMPO_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
+		TEMPO_USER_YAML=$TMP_DIR/empty.yaml
+	fi
+	tempoDSFile="monitoring/grafana-datasource-tempo.yaml"
+fi
 
 # Get Helm Chart Name
 log_debug "Kube-Prometheus Stack Helm Chart: repo [$KUBE_PROM_STACK_CHART_REPO] name [$KUBE_PROM_STACK_CHART_NAME] version [$KUBE_PROM_STACK_CHART_VERSION]"
 chart2install="$(get_helmchart_reference $KUBE_PROM_STACK_CHART_REPO $KUBE_PROM_STACK_CHART_NAME $KUBE_PROM_STACK_CHART_VERSION)"
-versionstring="$(get_helm_versionstring  $KUBE_PROM_STACK_CHART_VERSION)"
+versionstring="$(get_helm_versionstring $KUBE_PROM_STACK_CHART_VERSION)"
 log_debug "Installing Helm chart from artifact [$chart2install]"
 
 helm $helmDebug upgrade --install $promRelease \
-  --namespace $MON_NS \
-  -f $imageKeysFile \
-  -f monitoring/values-prom-operator.yaml \
-  -f $istioValuesFile \
-  -f $tlsValuesFile \
-  -f $tlsPromAlertingEndpointFile \
-  -f $nodePortValuesFile \
-  -f $wnpValuesFile \
-  -f $PROM_OPER_USER_YAML \
-  -f $tempoDSFile \
-  --atomic \
-  --timeout 20m \
-  --set nameOverride=$promName \
-  --set fullnameOverride=$promName \
-  --set prometheus-node-exporter.fullnameOverride=$promName-node-exporter \
-  --set kube-state-metrics.fullnameOverride=$promName-kube-state-metrics \
-  --set grafana.fullnameOverride=$promName-grafana \
-  --set grafana.adminPassword="$grafanaPwd" \
-  --set prometheus.prometheusSpec.alertingEndpoints[0].namespace="$MON_NS" \
-  $versionstring \
-  $chart2install
+	--namespace $MON_NS \
+	-f $imageKeysFile \
+	-f monitoring/values-prom-operator.yaml \
+	-f $istioValuesFile \
+	-f $tlsValuesFile \
+	-f $tlsPromAlertingEndpointFile \
+	-f $nodePortValuesFile \
+	-f $wnpValuesFile \
+	-f $PROM_OPER_USER_YAML \
+	-f $tempoDSFile \
+	--atomic \
+	--timeout 20m \
+	--set nameOverride=$promName \
+	--set fullnameOverride=$promName \
+	--set prometheus-node-exporter.fullnameOverride=$promName-node-exporter \
+	--set kube-state-metrics.fullnameOverride=$promName-kube-state-metrics \
+	--set grafana.fullnameOverride=$promName-grafana \
+	--set grafana.adminPassword="$grafanaPwd" \
+	--set prometheus.prometheusSpec.alertingEndpoints[0].namespace="$MON_NS" \
+	$versionstring \
+	$chart2install
 
 sleep 2
 
 if [ "$TLS_ENABLE" == "true" ]; then
-  log_verbose "Patching Grafana ServiceMonitor for TLS"
-  kubectl patch servicemonitor -n $MON_NS $promName-grafana --type=json \
-    -p='[{"op": "replace", "path": "/spec/endpoints/0/scheme", "value":"https"},{"op": "replace", "path": "/spec/endpoints/0/tlsConfig", "value":{}},{"op": "replace", "path": "/spec/endpoints/0/tlsConfig/insecureSkipVerify", "value":true}]'
+	log_verbose "Patching Grafana ServiceMonitor for TLS"
+	kubectl patch servicemonitor -n $MON_NS $promName-grafana --type=json \
+		-p='[{"op": "replace", "path": "/spec/endpoints/0/scheme", "value":"https"},{"op": "replace", "path": "/spec/endpoints/0/tlsConfig", "value":{}},{"op": "replace", "path": "/spec/endpoints/0/tlsConfig/insecureSkipVerify", "value":true}]'
 fi
 
 #Container Security: Disable serviceAccount Token Automounting
 disable_sa_token_automount $MON_NS v4m-grafana
-disable_sa_token_automount $MON_NS sas-ops-acct      #Used w/Prometheus
+disable_sa_token_automount $MON_NS sas-ops-acct #Used w/Prometheus
 disable_sa_token_automount $MON_NS v4m-node-exporter
 disable_sa_token_automount $MON_NS v4m-alertmanager
 
@@ -249,29 +248,29 @@
 log_verbose "Deploying cluster ServiceMonitors"
 
 if [ "$TRACING_ENABLE" == "true" ]; then
-  log_info "Tracing enabled..."
-
-  #Generate yaml file with all container-related keys
-  generateImageKeysFile "$TEMPO_FULL_IMAGE" "monitoring/tempo_container_image.template"
-
-  # Add the grafana helm chart repo
-  helmRepoAdd grafana https://grafana.github.io/helm-charts
-  helm repo update
-
-  # Get Helm Chart Name
-  log_debug "Tempo Helm Chart: repo [$TEMPO_CHART_REPO] name [$TEMPO_CHART_NAME] version [$TEMPO_CHART_VERSION]"
-  chart2install="$(get_helmchart_reference $TEMPO_CHART_REPO $TEMPO_CHART_NAME $TEMPO_CHART_VERSION)"
-  versionstring="$(get_helm_versionstring  $TEMPO_CHART_VERSION)"
-  log_debug "Installing Helm chart from artifact [$chart2install]"
-
-  log_info "Installing tempo"
-  helm upgrade --install v4m-tempo \
-    -n "$MON_NS" \
-    -f $imageKeysFile \
-    -f monitoring/values-tempo.yaml \
-    -f "$TEMPO_USER_YAML" \
-    $versionstring \
-    $chart2install
+	log_info "Tracing enabled..."
+
+	#Generate yaml file with all container-related keys
+	generateImageKeysFile "$TEMPO_FULL_IMAGE" "monitoring/tempo_container_image.template"
+
+	# Add the grafana helm chart repo
+	helmRepoAdd grafana https://grafana.github.io/helm-charts
+	helm repo update
+
+	# Get Helm Chart Name
+	log_debug "Tempo Helm Chart: repo [$TEMPO_CHART_REPO] name [$TEMPO_CHART_NAME] version [$TEMPO_CHART_VERSION]"
+	chart2install="$(get_helmchart_reference $TEMPO_CHART_REPO $TEMPO_CHART_NAME $TEMPO_CHART_VERSION)"
+	versionstring="$(get_helm_versionstring $TEMPO_CHART_VERSION)"
+	log_debug "Installing Helm chart from artifact [$chart2install]"
+
+	log_info "Installing tempo"
+	helm upgrade --install v4m-tempo \
+		-n "$MON_NS" \
+		-f $imageKeysFile \
+		-f monitoring/values-tempo.yaml \
+		-f "$TEMPO_USER_YAML" \
+		$versionstring \
+		$chart2install
 fi
 
 # NGINX
@@ -278,13 +277,13 @@
 set +e
 kubectl get ns $NGINX_NS 2>/dev/null
 if [ $? == 0 ]; then
-  nginxFound=true
+	nginxFound=true
 fi
 set -e
 
 if [ "$nginxFound" == "true" ]; then
-  log_verbose "NGINX found. Deploying podMonitor to [$NGINX_NS] namespace"
-  kubectl apply -n $NGINX_NS -f monitoring/monitors/kube/podMonitor-nginx.yaml 2>/dev/null
+	log_verbose "NGINX found. Deploying podMonitor to [$NGINX_NS] namespace"
+	kubectl apply -n $NGINX_NS -f monitoring/monitors/kube/podMonitor-nginx.yaml 2>/dev/null
 fi
 
 # Eventrouter ServiceMonitor
@@ -302,25 +301,25 @@
 # Rules
 log_verbose "Adding Prometheus recording rules"
 for f in monitoring/rules/viya/rules-*.yaml; do
-  kubectl apply -n $MON_NS -f $f
+	kubectl apply -n $MON_NS -f $f
 done
 
 # Elasticsearch Datasource for Grafana
 LOGGING_DATASOURCE="${LOGGING_DATASOURCE:-false}"
 if [ "$LOGGING_DATASOURCE" == "true" ]; then
-  set +e
-  log_debug "Creating the logging data source using the create_logging_datasource script"
-  monitoring/bin/create_logging_datasource.sh
-
-  if (( $? == 1 )); then
-    log_warn "Unable to configure the logging data source at this time."
-    log_warn "Please address the errors and re-run the follow command to create the data source at a later time:"
-    log_warn "monitoring/bin/create_logging_datasource.sh"
-  fi
-  set -e
-else
-  log_debug "LOGGING_DATASOURCE not set"
-  log_debug "Skipping creation of logging data source for Grafana"
+	set +e
+	log_debug "Creating the logging data source using the create_logging_datasource script"
+	monitoring/bin/create_logging_datasource.sh
+
+	if (($? == 1)); then
+		log_warn "Unable to configure the logging data source at this time."
+		log_warn "Please address the errors and re-run the follow command to create the data source at a later time:"
+		log_warn "monitoring/bin/create_logging_datasource.sh"
+	fi
+	set -e
+else
+	log_debug "LOGGING_DATASOURCE not set"
+	log_debug "Skipping creation of logging data source for Grafana"
 fi
 
 echo ""
@@ -331,7 +330,7 @@
 get_ingress_ports
 
 # get URLs for Grafana, Prometheus and AlertManager
-gf_url=$(get_service_url $MON_NS v4m-grafana  "$TLS_ENABLE")
+gf_url=$(get_service_url $MON_NS v4m-grafana "$TLS_ENABLE")
 # pr_url=$(get_url $MON_NS v4m-prometheus  "$TLS_ENABLE")
 # am_url=$(get_url $MON_NS v4m-alertmanager  "$TLS_ENABLE")
 set -e
@@ -338,12 +337,12 @@
 
 # If a deployment with the old name exists, remove it first
 if helm3ReleaseExists v4m $MON_NS; then
-  log_verbose "Removing outdated SAS Viya Monitoring Helm chart release from [$MON_NS] namespace"
-  helm uninstall -n "$MON_NS" "v4m"
+	log_verbose "Removing outdated SAS Viya Monitoring Helm chart release from [$MON_NS] namespace"
+	helm uninstall -n "$MON_NS" "v4m"
 fi
 
 if ! deployV4MInfo "$MON_NS" "v4m-metrics"; then
-  log_warn "Unable to update SAS Viya Monitoring Helm chart release"
+	log_warn "Unable to update SAS Viya Monitoring Helm chart release"
 fi
 
 # Print URL to access web apps
@@ -350,13 +349,13 @@
 log_notice ""
 log_notice "GRAFANA: "
 if [ ! -z "$gf_url" ]; then
-   log_notice "  $gf_url"
-else
-   log_notice " It was not possible to determine the URL needed to access Grafana. Note  "
-   log_notice " that this is not necessarily a sign of a problem; it may only reflect an "
-   log_notice " ingress or network access configuration that this script does not handle."
-fi
-   log_notice ""
+	log_notice "  $gf_url"
+else
+	log_notice " It was not possible to determine the URL needed to access Grafana. Note  "
+	log_notice " that this is not necessarily a sign of a problem; it may only reflect an "
+	log_notice " ingress or network access configuration that this script does not handle."
+fi
+log_notice ""
 
 #log_notice ""
 #log_notice "================================================================================"
@@ -379,14 +378,12 @@
 #log_notice ""
 
 if [ "$showPass" == "true" ]; then
-  # Find the grafana pod
- 
-  log_notice " Generated Grafana admin password is: $grafanaPwd"
-  log_notice " To change the password, run the following script (replace myNewPassword with an updated password):"
-  log_notice " monitoring/bin/change_grafana_admin_password.sh -p myNewPassword"
+	# Find the grafana pod
+
+	log_notice " Generated Grafana admin password is: $grafanaPwd"
+	log_notice " To change the password, run the following script (replace myNewPassword with an updated password):"
+	log_notice " monitoring/bin/change_grafana_admin_password.sh -p myNewPassword"
 fi
 
 log_message ""
 log_notice " Successfully deployed components to the [$MON_NS] namespace"
-
-
----------

You can reformat the above files to meet shfmt's requirements by typing:

  shfmt -s -w filename


@gsmith-sas gsmith-sas requested a review from ceelias January 24, 2025 15:21
Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck -e SC1004' returned error 1 finding the following syntactical issues:

----------

In monitoring/bin/deploy_monitoring_cluster.sh line 6:
cd "$(dirname $BASH_SOURCE)/../.."
              ^----------^ SC2128 (warning): Expanding an array without an index only gives the first element.
              ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
cd "$(dirname "$BASH_SOURCE")/../.."


In monitoring/bin/deploy_monitoring_cluster.sh line 7:
source monitoring/bin/common.sh
       ^----------------------^ SC1091 (info): Not following: monitoring/bin/common.sh was not specified as input (see shellcheck -x).


In monitoring/bin/deploy_monitoring_cluster.sh line 8:
source bin/service-url-include.sh
       ^------------------------^ SC1091 (info): Not following: bin/service-url-include.sh was not specified as input (see shellcheck -x).


In monitoring/bin/deploy_monitoring_cluster.sh line 18:
source bin/tls-include.sh
       ^----------------^ SC1091 (info): Not following: bin/tls-include.sh was not specified as input (see shellcheck -x).


In monitoring/bin/deploy_monitoring_cluster.sh line 19:
if verify_cert_generator $MON_NS prometheus alertmanager grafana; then
                         ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if verify_cert_generator "$MON_NS" prometheus alertmanager grafana; then


In monitoring/bin/deploy_monitoring_cluster.sh line 20:
  log_debug "cert generator check OK [$cert_generator_ok]"
                                      ^----------------^ SC2154 (warning): cert_generator_ok is referenced but not assigned.


In monitoring/bin/deploy_monitoring_cluster.sh line 22:
  log_error "One or more required TLS certs do not exist and the expected certificate generator mechanism [$cert_generator] is not available to create the missing certs"
                                                                                                           ^-------------^ SC2154 (warning): cert_generator is referenced but not assigned.


In monitoring/bin/deploy_monitoring_cluster.sh line 26:
helm2ReleaseCheck v4m-$MON_NS
                      ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm2ReleaseCheck v4m-"$MON_NS"


In monitoring/bin/deploy_monitoring_cluster.sh line 27:
helm2ReleaseCheck prometheus-$MON_NS
                             ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm2ReleaseCheck prometheus-"$MON_NS"


In monitoring/bin/deploy_monitoring_cluster.sh line 43:
if [ -z "$(kubectl get ns $MON_NS -o name 2>/dev/null)" ]; then
                          ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if [ -z "$(kubectl get ns "$MON_NS" -o name 2>/dev/null)" ]; then


In monitoring/bin/deploy_monitoring_cluster.sh line 44:
  kubectl create ns $MON_NS
                    ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl create ns "$MON_NS"


In monitoring/bin/deploy_monitoring_cluster.sh line 47:
  disable_sa_token_automount $MON_NS default
                             ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  disable_sa_token_automount "$MON_NS" default


In monitoring/bin/deploy_monitoring_cluster.sh line 52:
generateImageKeysFile "$ALERTMANAGER_FULL_IMAGE"    "$imageKeysFile"  "ALERTMANAGER_"
                                                     ^------------^ SC2154 (warning): imageKeysFile is referenced but not assigned.


In monitoring/bin/deploy_monitoring_cluster.sh line 100:
    if kubectl get crd $crd.monitoring.coreos.com 1>/dev/null 2>&1; then
                       ^--^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
    if kubectl get crd "$crd".monitoring.coreos.com 1>/dev/null 2>&1; then


In monitoring/bin/deploy_monitoring_cluster.sh line 101:
      kubectl replace -f $crdURL
                         ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
      kubectl replace -f "$crdURL"


In monitoring/bin/deploy_monitoring_cluster.sh line 103:
      kubectl create -f $crdURL
                        ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
      kubectl create -f "$crdURL"


In monitoring/bin/deploy_monitoring_cluster.sh line 111:
kubectl delete daemonset -n $MON_NS -l app=prometheus-node-exporter --ignore-not-found
                            ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl delete daemonset -n "$MON_NS" -l app=prometheus-node-exporter --ignore-not-found


In monitoring/bin/deploy_monitoring_cluster.sh line 128:
  create_tls_certs $MON_NS monitoring ${apps[@]}
                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                      ^--------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

Did you mean: 
  create_tls_certs "$MON_NS" monitoring ${apps[@]}


In monitoring/bin/deploy_monitoring_cluster.sh line 140:
  kubectl delete cm -n $MON_NS --ignore-not-found grafana-datasource-prom-https
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl delete cm -n "$MON_NS" --ignore-not-found grafana-datasource-prom-https


In monitoring/bin/deploy_monitoring_cluster.sh line 141:
  kubectl create cm -n $MON_NS grafana-datasource-prom-https --from-file monitoring/tls/$grafanaDS
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl create cm -n "$MON_NS" grafana-datasource-prom-https --from-file monitoring/tls/$grafanaDS


In monitoring/bin/deploy_monitoring_cluster.sh line 142:
  kubectl label cm -n $MON_NS grafana-datasource-prom-https grafana_datasource=1 sas.com/monitoring-base=kube-viya-monitoring
                      ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl label cm -n "$MON_NS" grafana-datasource-prom-https grafana_datasource=1 sas.com/monitoring-base=kube-viya-monitoring


In monitoring/bin/deploy_monitoring_cluster.sh line 146:
  kubectl delete cm -n $MON_NS node-exporter-tls-web-config --ignore-not-found
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl delete cm -n "$MON_NS" node-exporter-tls-web-config --ignore-not-found


In monitoring/bin/deploy_monitoring_cluster.sh line 148:
  kubectl create cm -n $MON_NS node-exporter-tls-web-config --from-file monitoring/tls/node-exporter-web.yaml
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl create cm -n "$MON_NS" node-exporter-tls-web-config --from-file monitoring/tls/node-exporter-web.yaml


In monitoring/bin/deploy_monitoring_cluster.sh line 149:
  kubectl label cm -n $MON_NS node-exporter-tls-web-config sas.com/monitoring-base=kube-viya-monitoring
                      ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl label cm -n "$MON_NS" node-exporter-tls-web-config sas.com/monitoring-base=kube-viya-monitoring


In monitoring/bin/deploy_monitoring_cluster.sh line 159:
if helm3ReleaseExists prometheus-operator $MON_NS; then
                                          ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists prometheus-operator "$MON_NS"; then


In monitoring/bin/deploy_monitoring_cluster.sh line 168:
if helm3ReleaseExists $promRelease $MON_NS; then
                                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists $promRelease "$MON_NS"; then


In monitoring/bin/deploy_monitoring_cluster.sh line 182:
  kubectl delete -n $MON_NS --ignore-not-found \
                    ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl delete -n "$MON_NS" --ignore-not-found \


In monitoring/bin/deploy_monitoring_cluster.sh line 201:
chart2install="$(get_helmchart_reference $KUBE_PROM_STACK_CHART_REPO $KUBE_PROM_STACK_CHART_NAME $KUBE_PROM_STACK_CHART_VERSION)"
                                         ^-------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                     ^-------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                                 ^----------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
chart2install="$(get_helmchart_reference "$KUBE_PROM_STACK_CHART_REPO" "$KUBE_PROM_STACK_CHART_NAME" "$KUBE_PROM_STACK_CHART_VERSION")"


In monitoring/bin/deploy_monitoring_cluster.sh line 202:
versionstring="$(get_helm_versionstring  $KUBE_PROM_STACK_CHART_VERSION)"
                                         ^----------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
versionstring="$(get_helm_versionstring  "$KUBE_PROM_STACK_CHART_VERSION")"


In monitoring/bin/deploy_monitoring_cluster.sh line 205:
helm $helmDebug upgrade --install $promRelease \
     ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm "$helmDebug" upgrade --install $promRelease \


In monitoring/bin/deploy_monitoring_cluster.sh line 206:
  --namespace $MON_NS \
              ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --namespace "$MON_NS" \


In monitoring/bin/deploy_monitoring_cluster.sh line 207:
  -f $imageKeysFile \
     ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$imageKeysFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 209:
  -f $istioValuesFile \
     ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$istioValuesFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 210:
  -f $tlsValuesFile \
     ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$tlsValuesFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 211:
  -f $tlsPromAlertingEndpointFile \
     ^--------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$tlsPromAlertingEndpointFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 212:
  -f $nodePortValuesFile \
     ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$nodePortValuesFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 213:
  -f $wnpValuesFile \
     ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$wnpValuesFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 214:
  -f $PROM_OPER_USER_YAML \
     ^------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$PROM_OPER_USER_YAML" \


In monitoring/bin/deploy_monitoring_cluster.sh line 215:
  -f $tempoDSFile \
     ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  -f "$tempoDSFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 225:
  $versionstring \
  ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  "$versionstring" \


In monitoring/bin/deploy_monitoring_cluster.sh line 226:
  $chart2install
  ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  "$chart2install"


In monitoring/bin/deploy_monitoring_cluster.sh line 232:
  kubectl patch servicemonitor -n $MON_NS $promName-grafana --type=json \
                                  ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl patch servicemonitor -n "$MON_NS" $promName-grafana --type=json \


In monitoring/bin/deploy_monitoring_cluster.sh line 237:
disable_sa_token_automount $MON_NS v4m-grafana
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" v4m-grafana


In monitoring/bin/deploy_monitoring_cluster.sh line 238:
disable_sa_token_automount $MON_NS sas-ops-acct      #Used w/Prometheus
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" sas-ops-acct      #Used w/Prometheus


In monitoring/bin/deploy_monitoring_cluster.sh line 239:
disable_sa_token_automount $MON_NS v4m-node-exporter
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" v4m-node-exporter


In monitoring/bin/deploy_monitoring_cluster.sh line 240:
disable_sa_token_automount $MON_NS v4m-alertmanager
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" v4m-alertmanager


In monitoring/bin/deploy_monitoring_cluster.sh line 243:
disable_sa_token_automount $MON_NS v4m-kube-state-metrics
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" v4m-kube-state-metrics


In monitoring/bin/deploy_monitoring_cluster.sh line 244:
enable_pod_token_automount $MON_NS deployment v4m-kube-state-metrics
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
enable_pod_token_automount "$MON_NS" deployment v4m-kube-state-metrics


In monitoring/bin/deploy_monitoring_cluster.sh line 245:
disable_sa_token_automount $MON_NS v4m-operator
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$MON_NS" v4m-operator


In monitoring/bin/deploy_monitoring_cluster.sh line 246:
enable_pod_token_automount $MON_NS deployment v4m-operator
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
enable_pod_token_automount "$MON_NS" deployment v4m-operator


In monitoring/bin/deploy_monitoring_cluster.sh line 263:
  chart2install="$(get_helmchart_reference $TEMPO_CHART_REPO $TEMPO_CHART_NAME $TEMPO_CHART_VERSION)"
                                           ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                             ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                               ^------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  chart2install="$(get_helmchart_reference "$TEMPO_CHART_REPO" "$TEMPO_CHART_NAME" "$TEMPO_CHART_VERSION")"


In monitoring/bin/deploy_monitoring_cluster.sh line 264:
  versionstring="$(get_helm_versionstring  $TEMPO_CHART_VERSION)"
                                           ^------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  versionstring="$(get_helm_versionstring  "$TEMPO_CHART_VERSION")"


In monitoring/bin/deploy_monitoring_cluster.sh line 270:
    -f $imageKeysFile \
       ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
    -f "$imageKeysFile" \


In monitoring/bin/deploy_monitoring_cluster.sh line 273:
    $versionstring \
    ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
    "$versionstring" \


In monitoring/bin/deploy_monitoring_cluster.sh line 274:
    $chart2install
    ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
    "$chart2install"


In monitoring/bin/deploy_monitoring_cluster.sh line 279:
kubectl get ns $NGINX_NS 2>/dev/null
               ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl get ns "$NGINX_NS" 2>/dev/null


In monitoring/bin/deploy_monitoring_cluster.sh line 280:
if [ $? == 0 ]; then
     ^-- SC2181 (style): Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.


In monitoring/bin/deploy_monitoring_cluster.sh line 287:
  kubectl apply -n $NGINX_NS -f monitoring/monitors/kube/podMonitor-nginx.yaml 2>/dev/null
                   ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl apply -n "$NGINX_NS" -f monitoring/monitors/kube/podMonitor-nginx.yaml 2>/dev/null


In monitoring/bin/deploy_monitoring_cluster.sh line 291:
kubectl apply -n $MON_NS -f monitoring/monitors/kube/podMonitor-eventrouter.yaml 2>/dev/null
                 ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl apply -n "$MON_NS" -f monitoring/monitors/kube/podMonitor-eventrouter.yaml 2>/dev/null


In monitoring/bin/deploy_monitoring_cluster.sh line 295:
kubectl delete -n $MON_NS servicemonitor elasticsearch --ignore-not-found
                  ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl delete -n "$MON_NS" servicemonitor elasticsearch --ignore-not-found


In monitoring/bin/deploy_monitoring_cluster.sh line 296:
kubectl apply -n $MON_NS -f monitoring/monitors/logging/serviceMonitor-elasticsearch-v2.yaml
                 ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl apply -n "$MON_NS" -f monitoring/monitors/logging/serviceMonitor-elasticsearch-v2.yaml


In monitoring/bin/deploy_monitoring_cluster.sh line 299:
kubectl apply -n $MON_NS -f monitoring/monitors/logging/serviceMonitor-fluent-bit.yaml
                 ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl apply -n "$MON_NS" -f monitoring/monitors/logging/serviceMonitor-fluent-bit.yaml


In monitoring/bin/deploy_monitoring_cluster.sh line 300:
kubectl apply -n $MON_NS -f monitoring/monitors/logging/serviceMonitor-fluent-bit-v2.yaml
                 ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl apply -n "$MON_NS" -f monitoring/monitors/logging/serviceMonitor-fluent-bit-v2.yaml


In monitoring/bin/deploy_monitoring_cluster.sh line 305:
  kubectl apply -n $MON_NS -f $f
                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                              ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  kubectl apply -n "$MON_NS" -f "$f"


In monitoring/bin/deploy_monitoring_cluster.sh line 334:
gf_url=$(get_service_url $MON_NS v4m-grafana  "$TLS_ENABLE")
                         ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
gf_url=$(get_service_url "$MON_NS" v4m-grafana  "$TLS_ENABLE")


In monitoring/bin/deploy_monitoring_cluster.sh line 340:
if helm3ReleaseExists v4m $MON_NS; then
                          ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists v4m "$MON_NS"; then


In monitoring/bin/deploy_monitoring_cluster.sh line 352:
if [ ! -z "$gf_url" ]; then
     ^-- SC2236 (style): Use -n instead of ! -z.

For more information:
  https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
  https://www.shellcheck.net/wiki/SC2128 -- Expanding an array without an ind...
  https://www.shellcheck.net/wiki/SC2154 -- cert_generator is referenced but ...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors

'shfmt -s' returned error 1 finding the following formatting issues:

----------
diff monitoring/bin/deploy_monitoring_cluster.sh.orig monitoring/bin/deploy_monitoring_cluster.sh
--- monitoring/bin/deploy_monitoring_cluster.sh.orig
+++ monitoring/bin/deploy_monitoring_cluster.sh
@@ -8,19 +8,19 @@
 source bin/service-url-include.sh
 
 if [ "$OPENSHIFT_CLUSTER" == "true" ]; then
-  if [ "${CHECK_OPENSHIFT_CLUSTER:-true}" == "true" ]; then
-    log_error "This script should not be run on OpenShift clusters"
-    log_error "Run monitoring/bin/deploy_monitoring_openshift.sh instead"
-    exit 1
-  fi
+	if [ "${CHECK_OPENSHIFT_CLUSTER:-true}" == "true" ]; then
+		log_error "This script should not be run on OpenShift clusters"
+		log_error "Run monitoring/bin/deploy_monitoring_openshift.sh instead"
+		exit 1
+	fi
 fi
 
 source bin/tls-include.sh
 if verify_cert_generator $MON_NS prometheus alertmanager grafana; then
-  log_debug "cert generator check OK [$cert_generator_ok]"
-else
-  log_error "One or more required TLS certs do not exist and the expected certificate generator mechanism [$cert_generator] is not available to create the missing certs"
-  exit 1
+	log_debug "cert generator check OK [$cert_generator_ok]"
+else
+	log_error "One or more required TLS certs do not exist and the expected certificate generator mechanism [$cert_generator] is not available to create the missing certs"
+	exit 1
 fi
 
 helm2ReleaseCheck v4m-$MON_NS
@@ -32,32 +32,31 @@
 
 PROM_OPER_USER_YAML="${PROM_OPER_USER_YAML:-$USER_DIR/monitoring/user-values-prom-operator.yaml}"
 if [ ! -f "$PROM_OPER_USER_YAML" ]; then
-  log_debug "[$PROM_OPER_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
-  PROM_OPER_USER_YAML=$TMP_DIR/empty.yaml
+	log_debug "[$PROM_OPER_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
+	PROM_OPER_USER_YAML=$TMP_DIR/empty.yaml
 fi
 
 if [ "$HELM_DEBUG" == "true" ]; then
-  helmDebug="--debug"
+	helmDebug="--debug"
 fi
 
 if [ -z "$(kubectl get ns $MON_NS -o name 2>/dev/null)" ]; then
-  kubectl create ns $MON_NS
-
-  #Container Security: Disable serviceAccount Token Automounting
-  disable_sa_token_automount $MON_NS default
+	kubectl create ns $MON_NS
+
+	#Container Security: Disable serviceAccount Token Automounting
+	disable_sa_token_automount $MON_NS default
 fi
 
 #Generate yaml file with all container-related keys
-generateImageKeysFile "$PROMOP_FULL_IMAGE"          "monitoring/prom-operator_container_image.template"
-generateImageKeysFile "$ALERTMANAGER_FULL_IMAGE"    "$imageKeysFile"  "ALERTMANAGER_"
-generateImageKeysFile "$ADMWEBHOOK_FULL_IMAGE"      "$imageKeysFile"  "ADMWEBHOOK_"
-generateImageKeysFile "$KSM_FULL_IMAGE"             "$imageKeysFile"  "KSM_"
-generateImageKeysFile "$NODEXPORT_FULL_IMAGE"       "$imageKeysFile"  "NODEXPORT_"
-generateImageKeysFile "$PROMETHEUS_FULL_IMAGE"      "$imageKeysFile"  "PROMETHEUS_"
-generateImageKeysFile "$CONFIGRELOAD_FULL_IMAGE"    "$imageKeysFile"  "CONFIGRELOAD_"
-generateImageKeysFile "$GRAFANA_FULL_IMAGE"         "$imageKeysFile"  "GRAFANA_"
-generateImageKeysFile "$GRAFANA_SIDECAR_FULL_IMAGE" "$imageKeysFile"  "SIDECAR_"
-
+generateImageKeysFile "$PROMOP_FULL_IMAGE" "monitoring/prom-operator_container_image.template"
+generateImageKeysFile "$ALERTMANAGER_FULL_IMAGE" "$imageKeysFile" "ALERTMANAGER_"
+generateImageKeysFile "$ADMWEBHOOK_FULL_IMAGE" "$imageKeysFile" "ADMWEBHOOK_"
+generateImageKeysFile "$KSM_FULL_IMAGE" "$imageKeysFile" "KSM_"
+generateImageKeysFile "$NODEXPORT_FULL_IMAGE" "$imageKeysFile" "NODEXPORT_"
+generateImageKeysFile "$PROMETHEUS_FULL_IMAGE" "$imageKeysFile" "PROMETHEUS_"
+generateImageKeysFile "$CONFIGRELOAD_FULL_IMAGE" "$imageKeysFile" "CONFIGRELOAD_"
+generateImageKeysFile "$GRAFANA_FULL_IMAGE" "$imageKeysFile" "GRAFANA_"
+generateImageKeysFile "$GRAFANA_SIDECAR_FULL_IMAGE" "$imageKeysFile" "SIDECAR_"
 
 set -e
 log_notice "Deploying monitoring to the [$MON_NS] namespace..."
@@ -68,43 +67,43 @@
 istioValuesFile=$TMP_DIR/empty.yaml
 # Istio - Federate data from Istio's Prometheus instance
 if [ "$ISTIO_ENABLED" == "true" ]; then
-  log_verbose "Including Istio metric federation"
-  istioValuesFile=$TMP_DIR/values-prom-operator-tmp.yaml
-else
-  log_debug "ISTIO_ENABLED flag not set"
-  log_debug "Skipping deployment of federated scrape of Istio Prometheus instance"
+	log_verbose "Including Istio metric federation"
+	istioValuesFile=$TMP_DIR/values-prom-operator-tmp.yaml
+else
+	log_debug "ISTIO_ENABLED flag not set"
+	log_debug "Skipping deployment of federated scrape of Istio Prometheus instance"
 fi
 
 # Check if Prometheus Operator CRDs are already installed
 PROM_OPERATOR_CRD_UPDATE=${PROM_OPERATOR_CRD_UPDATE:-true}
 if [ "$PROM_OPERATOR_CRD_UPDATE" == "true" ]; then
-  log_verbose "Updating Prometheus Operator custom resource definitions"
-  crds=( alertmanagerconfigs alertmanagers prometheuses prometheusrules podmonitors servicemonitors thanosrulers probes )
-  for crd in "${crds[@]}"; do
-    
-    ## Determine CRD URL - if in an airgap environment, look for them in USER_DIR.
-    if [ "$AIRGAP_DEPLOYMENT" == "true" ]; then
-      crdURL=$USER_DIR/monitoring/prometheus-operator-crd/$PROM_OPERATOR_CRD_VERSION/monitoring.coreos.com_$crd.yaml
-
-      ## Fail if the CRDs could not be located.
-      if [ ! -f "$crdURL" ]; then
-        log_error "Unable to locate file: [monitoring.coreos.com_$crd.yaml] in"
-        log_error "[$USER_DIR/monitoring/prometheus-operator-crd/$PROM_OPERATOR_CRD_VERSION] directory"
-        log_error "Please make sure to provide all Prometheus Operator CRDs before running the deployment"
-        exit 1
-      fi
-    else
-      crdURL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$PROM_OPERATOR_CRD_VERSION/example/prometheus-operator-crd/monitoring.coreos.com_$crd.yaml"
-    fi 
-
-    if kubectl get crd $crd.monitoring.coreos.com 1>/dev/null 2>&1; then
-      kubectl replace -f $crdURL
-    else
-      kubectl create -f $crdURL
-    fi
-  done
-else
-  log_debug "Prometheus Operator CRD update disabled"
+	log_verbose "Updating Prometheus Operator custom resource definitions"
+	crds=(alertmanagerconfigs alertmanagers prometheuses prometheusrules podmonitors servicemonitors thanosrulers probes)
+	for crd in "${crds[@]}"; do
+
+		## Determine CRD URL - if in an airgap environment, look for them in USER_DIR.
+		if [ "$AIRGAP_DEPLOYMENT" == "true" ]; then
+			crdURL=$USER_DIR/monitoring/prometheus-operator-crd/$PROM_OPERATOR_CRD_VERSION/monitoring.coreos.com_$crd.yaml
+
+			## Fail if the CRDs could not be located.
+			if [ ! -f "$crdURL" ]; then
+				log_error "Unable to locate file: [monitoring.coreos.com_$crd.yaml] in"
+				log_error "[$USER_DIR/monitoring/prometheus-operator-crd/$PROM_OPERATOR_CRD_VERSION] directory"
+				log_error "Please make sure to provide all Prometheus Operator CRDs before running the deployment"
+				exit 1
+			fi
+		else
+			crdURL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$PROM_OPERATOR_CRD_VERSION/example/prometheus-operator-crd/monitoring.coreos.com_$crd.yaml"
+		fi
+
+		if kubectl get crd $crd.monitoring.coreos.com 1>/dev/null 2>&1; then
+			kubectl replace -f $crdURL
+		else
+			kubectl create -f $crdURL
+		fi
+	done
+else
+	log_debug "Prometheus Operator CRD update disabled"
 fi
 
 # Remove existing DaemonSets in case of an upgrade-in-place
@@ -113,11 +112,11 @@
 # Optional workload node placement support
 MON_NODE_PLACEMENT_ENABLE=${MON_NODE_PLACEMENT_ENABLE:-${NODE_PLACEMENT_ENABLE:-false}}
 if [ "$MON_NODE_PLACEMENT_ENABLE" == "true" ]; then
-  log_verbose "Enabling monitoring components for workload node placement"
-  wnpValuesFile="monitoring/node-placement/values-prom-operator-wnp.yaml"
-else
-  log_debug "Workload node placement support is disabled"
-  wnpValuesFile="$TMP_DIR/empty.yaml"
+	log_verbose "Enabling monitoring components for workload node placement"
+	wnpValuesFile="monitoring/node-placement/values-prom-operator-wnp.yaml"
+else
+	log_debug "Workload node placement support is disabled"
+	wnpValuesFile="$TMP_DIR/empty.yaml"
 fi
 
 # Optional TLS Support
@@ -124,118 +123,118 @@
 tlsValuesFile=$TMP_DIR/empty.yaml
 tlsPromAlertingEndpointFile=$TMP_DIR/empty.yaml
 if [ "$TLS_ENABLE" == "true" ]; then
-  apps=( prometheus alertmanager grafana )
-  create_tls_certs $MON_NS monitoring ${apps[@]}
-
-  tlsValuesFile=monitoring/tls/values-prom-operator-tls.yaml
-  tlsPromAlertingEndpointFile=monitoring/tls/prom-alertendpoint-host-https.yaml
-  log_debug "Including TLS response file $tlsValuesFile"
-
-  log_verbose "Provisioning TLS-enabled Prometheus datasource for Grafana"
-  grafanaDS=grafana-datasource-prom-https.yaml
-  if [ "$MON_TLS_PATH_INGRESS" == "true" ]; then
-    grafanaDS=grafana-datasource-prom-https-path.yaml
-    tlsPromAlertingEndpointFile=monitoring/tls/prom-alertendpoint-path-https.yaml
-  fi
-  kubectl delete cm -n $MON_NS --ignore-not-found grafana-datasource-prom-https
-  kubectl create cm -n $MON_NS grafana-datasource-prom-https --from-file monitoring/tls/$grafanaDS
-  kubectl label cm -n $MON_NS grafana-datasource-prom-https grafana_datasource=1 sas.com/monitoring-base=kube-viya-monitoring
-
-  # node-exporter TLS
-  log_verbose "Enabling Prometheus node-exporter for TLS"
-  kubectl delete cm -n $MON_NS node-exporter-tls-web-config --ignore-not-found
-  sleep 1
-  kubectl create cm -n $MON_NS node-exporter-tls-web-config --from-file monitoring/tls/node-exporter-web.yaml
-  kubectl label cm -n $MON_NS node-exporter-tls-web-config sas.com/monitoring-base=kube-viya-monitoring
+	apps=(prometheus alertmanager grafana)
+	create_tls_certs $MON_NS monitoring ${apps[@]}
+
+	tlsValuesFile=monitoring/tls/values-prom-operator-tls.yaml
+	tlsPromAlertingEndpointFile=monitoring/tls/prom-alertendpoint-host-https.yaml
+	log_debug "Including TLS response file $tlsValuesFile"
+
+	log_verbose "Provisioning TLS-enabled Prometheus datasource for Grafana"
+	grafanaDS=grafana-datasource-prom-https.yaml
+	if [ "$MON_TLS_PATH_INGRESS" == "true" ]; then
+		grafanaDS=grafana-datasource-prom-https-path.yaml
+		tlsPromAlertingEndpointFile=monitoring/tls/prom-alertendpoint-path-https.yaml
+	fi
+	kubectl delete cm -n $MON_NS --ignore-not-found grafana-datasource-prom-https
+	kubectl create cm -n $MON_NS grafana-datasource-prom-https --from-file monitoring/tls/$grafanaDS
+	kubectl label cm -n $MON_NS grafana-datasource-prom-https grafana_datasource=1 sas.com/monitoring-base=kube-viya-monitoring
+
+	# node-exporter TLS
+	log_verbose "Enabling Prometheus node-exporter for TLS"
+	kubectl delete cm -n $MON_NS node-exporter-tls-web-config --ignore-not-found
+	sleep 1
+	kubectl create cm -n $MON_NS node-exporter-tls-web-config --from-file monitoring/tls/node-exporter-web.yaml
+	kubectl label cm -n $MON_NS node-exporter-tls-web-config sas.com/monitoring-base=kube-viya-monitoring
 fi
 
 nodePortValuesFile=$TMP_DIR/empty.yaml
 PROM_NODEPORT_ENABLE=${PROM_NODEPORT_ENABLE:-false}
 if [ "$PROM_NODEPORT_ENABLE" == "true" ]; then
-  log_debug "Enabling NodePort access for Prometheus and Alertmanager"
-  nodePortValuesFile=monitoring/values-prom-nodeport.yaml
+	log_debug "Enabling NodePort access for Prometheus and Alertmanager"
+	nodePortValuesFile=monitoring/values-prom-nodeport.yaml
 fi
 
 if helm3ReleaseExists prometheus-operator $MON_NS; then
-  promRelease=prometheus-operator
-  promName=prometheus-operator
-else
-  promRelease=v4m-prometheus-operator
-  promName=v4m
+	promRelease=prometheus-operator
+	promName=prometheus-operator
+else
+	promRelease=v4m-prometheus-operator
+	promName=v4m
 fi
 log_verbose "User response file: [$PROM_OPER_USER_YAML]"
 log_info "Deploying the kube-prometheus stack. This may take a few minutes ..."
 if helm3ReleaseExists $promRelease $MON_NS; then
-  log_verbose "Upgrading via Helm ($(date) - timeout 20m)"
-else
-  grafanaPwd="$GRAFANA_ADMIN_PASSWORD"
-  if [ "$grafanaPwd" == "" ]; then
-    log_debug "Generating random Grafana admin password"
-    showPass="true"
-    grafanaPwd="$(randomPassword)"
-  fi
-  log_verbose "Installing via Helm ($(date) - timeout 20m)"
+	log_verbose "Upgrading via Helm ($(date) - timeout 20m)"
+else
+	grafanaPwd="$GRAFANA_ADMIN_PASSWORD"
+	if [ "$grafanaPwd" == "" ]; then
+		log_debug "Generating random Grafana admin password"
+		showPass="true"
+		grafanaPwd="$(randomPassword)"
+	fi
+	log_verbose "Installing via Helm ($(date) - timeout 20m)"
 fi
 
 # See https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#from-21x-to-22x
-if [ "$V4M_CURRENT_VERSION_MAJOR" == "1" ] && [[ "$V4M_CURRENT_VERSION_MINOR" =~ [0-5] ]]; then
-  kubectl delete -n $MON_NS --ignore-not-found \
-    deployments.apps \
-    -l app.kubernetes.io/instance=v4m-prometheus-operator,app.kubernetes.io/name=kube-state-metrics
+if [ "$V4M_CURRENT_VERSION_MAJOR" == "1" ] && [[ $V4M_CURRENT_VERSION_MINOR =~ [0-5] ]]; then
+	kubectl delete -n $MON_NS --ignore-not-found \
+		deployments.apps \
+		-l app.kubernetes.io/instance=v4m-prometheus-operator,app.kubernetes.io/name=kube-state-metrics
 fi
 
 TRACING_ENABLE="${TRACING_ENABLE:-false}"
 if [ "$TRACING_ENABLE" == "false" ]; then
-  tempoDSFile=$TMP_DIR/empty.yaml
-else
-  TEMPO_USER_YAML="${TEMPO_USER_YAML:-$USER_DIR/monitoring/user-values-tempo.yaml}"
-  if [ ! -f "$TEMPO_USER_YAML" ]; then
-    log_debug "[$TEMPO_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
-    TEMPO_USER_YAML=$TMP_DIR/empty.yaml
-  fi
-  tempoDSFile="monitoring/grafana-datasource-tempo.yaml"
-fi 
+	tempoDSFile=$TMP_DIR/empty.yaml
+else
+	TEMPO_USER_YAML="${TEMPO_USER_YAML:-$USER_DIR/monitoring/user-values-tempo.yaml}"
+	if [ ! -f "$TEMPO_USER_YAML" ]; then
+		log_debug "[$TEMPO_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
+		TEMPO_USER_YAML=$TMP_DIR/empty.yaml
+	fi
+	tempoDSFile="monitoring/grafana-datasource-tempo.yaml"
+fi
 
 # Get Helm Chart Name
 log_debug "Kube-Prometheus Stack Helm Chart: repo [$KUBE_PROM_STACK_CHART_REPO] name [$KUBE_PROM_STACK_CHART_NAME] version [$KUBE_PROM_STACK_CHART_VERSION]"
 chart2install="$(get_helmchart_reference $KUBE_PROM_STACK_CHART_REPO $KUBE_PROM_STACK_CHART_NAME $KUBE_PROM_STACK_CHART_VERSION)"
-versionstring="$(get_helm_versionstring  $KUBE_PROM_STACK_CHART_VERSION)"
+versionstring="$(get_helm_versionstring $KUBE_PROM_STACK_CHART_VERSION)"
 log_debug "Installing Helm chart from artifact [$chart2install]"
 
 helm $helmDebug upgrade --install $promRelease \
-  --namespace $MON_NS \
-  -f $imageKeysFile \
-  -f monitoring/values-prom-operator.yaml \
-  -f $istioValuesFile \
-  -f $tlsValuesFile \
-  -f $tlsPromAlertingEndpointFile \
-  -f $nodePortValuesFile \
-  -f $wnpValuesFile \
-  -f $PROM_OPER_USER_YAML \
-  -f $tempoDSFile \
-  --atomic \
-  --timeout 20m \
-  --set nameOverride=$promName \
-  --set fullnameOverride=$promName \
-  --set prometheus-node-exporter.fullnameOverride=$promName-node-exporter \
-  --set kube-state-metrics.fullnameOverride=$promName-kube-state-metrics \
-  --set grafana.fullnameOverride=$promName-grafana \
-  --set grafana.adminPassword="$grafanaPwd" \
-  --set prometheus.prometheusSpec.alertingEndpoints[0].namespace="$MON_NS" \
-  $versionstring \
-  $chart2install
+	--namespace $MON_NS \
+	-f $imageKeysFile \
+	-f monitoring/values-prom-operator.yaml \
+	-f $istioValuesFile \
+	-f $tlsValuesFile \
+	-f $tlsPromAlertingEndpointFile \
+	-f $nodePortValuesFile \
+	-f $wnpValuesFile \
+	-f $PROM_OPER_USER_YAML \
+	-f $tempoDSFile \
+	--atomic \
+	--timeout 20m \
+	--set nameOverride=$promName \
+	--set fullnameOverride=$promName \
+	--set prometheus-node-exporter.fullnameOverride=$promName-node-exporter \
+	--set kube-state-metrics.fullnameOverride=$promName-kube-state-metrics \
+	--set grafana.fullnameOverride=$promName-grafana \
+	--set grafana.adminPassword="$grafanaPwd" \
+	--set prometheus.prometheusSpec.alertingEndpoints[0].namespace="$MON_NS" \
+	$versionstring \
+	$chart2install
 
 sleep 2
 
 if [ "$TLS_ENABLE" == "true" ]; then
-  log_verbose "Patching Grafana ServiceMonitor for TLS"
-  kubectl patch servicemonitor -n $MON_NS $promName-grafana --type=json \
-    -p='[{"op": "replace", "path": "/spec/endpoints/0/scheme", "value":"https"},{"op": "replace", "path": "/spec/endpoints/0/tlsConfig", "value":{}},{"op": "replace", "path": "/spec/endpoints/0/tlsConfig/insecureSkipVerify", "value":true}]'
+	log_verbose "Patching Grafana ServiceMonitor for TLS"
+	kubectl patch servicemonitor -n $MON_NS $promName-grafana --type=json \
+		-p='[{"op": "replace", "path": "/spec/endpoints/0/scheme", "value":"https"},{"op": "replace", "path": "/spec/endpoints/0/tlsConfig", "value":{}},{"op": "replace", "path": "/spec/endpoints/0/tlsConfig/insecureSkipVerify", "value":true}]'
 fi
 
 #Container Security: Disable serviceAccount Token Automounting
 disable_sa_token_automount $MON_NS v4m-grafana
-disable_sa_token_automount $MON_NS sas-ops-acct      #Used w/Prometheus
+disable_sa_token_automount $MON_NS sas-ops-acct #Used w/Prometheus
 disable_sa_token_automount $MON_NS v4m-node-exporter
 disable_sa_token_automount $MON_NS v4m-alertmanager
 
@@ -249,29 +248,29 @@
 log_verbose "Deploying cluster ServiceMonitors"
 
 if [ "$TRACING_ENABLE" == "true" ]; then
-  log_info "Tracing enabled..."
-
-  #Generate yaml file with all container-related keys
-  generateImageKeysFile "$TEMPO_FULL_IMAGE" "monitoring/tempo_container_image.template"
-
-  # Add the grafana helm chart repo
-  helmRepoAdd grafana https://grafana.github.io/helm-charts
-  helm repo update
-
-  # Get Helm Chart Name
-  log_debug "Tempo Helm Chart: repo [$TEMPO_CHART_REPO] name [$TEMPO_CHART_NAME] version [$TEMPO_CHART_VERSION]"
-  chart2install="$(get_helmchart_reference $TEMPO_CHART_REPO $TEMPO_CHART_NAME $TEMPO_CHART_VERSION)"
-  versionstring="$(get_helm_versionstring  $TEMPO_CHART_VERSION)"
-  log_debug "Installing Helm chart from artifact [$chart2install]"
-
-  log_info "Installing tempo"
-  helm upgrade --install v4m-tempo \
-    -n "$MON_NS" \
-    -f $imageKeysFile \
-    -f monitoring/values-tempo.yaml \
-    -f "$TEMPO_USER_YAML" \
-    $versionstring \
-    $chart2install
+	log_info "Tracing enabled..."
+
+	#Generate yaml file with all container-related keys
+	generateImageKeysFile "$TEMPO_FULL_IMAGE" "monitoring/tempo_container_image.template"
+
+	# Add the grafana helm chart repo
+	helmRepoAdd grafana https://grafana.github.io/helm-charts
+	helm repo update
+
+	# Get Helm Chart Name
+	log_debug "Tempo Helm Chart: repo [$TEMPO_CHART_REPO] name [$TEMPO_CHART_NAME] version [$TEMPO_CHART_VERSION]"
+	chart2install="$(get_helmchart_reference $TEMPO_CHART_REPO $TEMPO_CHART_NAME $TEMPO_CHART_VERSION)"
+	versionstring="$(get_helm_versionstring $TEMPO_CHART_VERSION)"
+	log_debug "Installing Helm chart from artifact [$chart2install]"
+
+	log_info "Installing tempo"
+	helm upgrade --install v4m-tempo \
+		-n "$MON_NS" \
+		-f $imageKeysFile \
+		-f monitoring/values-tempo.yaml \
+		-f "$TEMPO_USER_YAML" \
+		$versionstring \
+		$chart2install
 fi
 
 # NGINX
@@ -278,13 +277,13 @@
 set +e
 kubectl get ns $NGINX_NS 2>/dev/null
 if [ $? == 0 ]; then
-  nginxFound=true
+	nginxFound=true
 fi
 set -e
 
 if [ "$nginxFound" == "true" ]; then
-  log_verbose "NGINX found. Deploying podMonitor to [$NGINX_NS] namespace"
-  kubectl apply -n $NGINX_NS -f monitoring/monitors/kube/podMonitor-nginx.yaml 2>/dev/null
+	log_verbose "NGINX found. Deploying podMonitor to [$NGINX_NS] namespace"
+	kubectl apply -n $NGINX_NS -f monitoring/monitors/kube/podMonitor-nginx.yaml 2>/dev/null
 fi
 
 # Eventrouter ServiceMonitor
@@ -302,25 +301,25 @@
 # Rules
 log_verbose "Adding Prometheus recording rules"
 for f in monitoring/rules/viya/rules-*.yaml; do
-  kubectl apply -n $MON_NS -f $f
+	kubectl apply -n $MON_NS -f $f
 done
 
 # Elasticsearch Datasource for Grafana
 LOGGING_DATASOURCE="${LOGGING_DATASOURCE:-false}"
 if [ "$LOGGING_DATASOURCE" == "true" ]; then
-  set +e
-  log_debug "Creating the logging data source using the create_logging_datasource script"
-  monitoring/bin/create_logging_datasource.sh
-
-  if (( $? == 1 )); then
-    log_warn "Unable to configure the logging data source at this time."
-    log_warn "Please address the errors and re-run the follow command to create the data source at a later time:"
-    log_warn "monitoring/bin/create_logging_datasource.sh"
-  fi
-  set -e
-else
-  log_debug "LOGGING_DATASOURCE not set"
-  log_debug "Skipping creation of logging data source for Grafana"
+	set +e
+	log_debug "Creating the logging data source using the create_logging_datasource script"
+	monitoring/bin/create_logging_datasource.sh
+
+	if (($? == 1)); then
+		log_warn "Unable to configure the logging data source at this time."
+		log_warn "Please address the errors and re-run the follow command to create the data source at a later time:"
+		log_warn "monitoring/bin/create_logging_datasource.sh"
+	fi
+	set -e
+else
+	log_debug "LOGGING_DATASOURCE not set"
+	log_debug "Skipping creation of logging data source for Grafana"
 fi
 
 echo ""
@@ -331,7 +330,7 @@
 get_ingress_ports
 
 # get URLs for Grafana, Prometheus and AlertManager
-gf_url=$(get_service_url $MON_NS v4m-grafana  "$TLS_ENABLE")
+gf_url=$(get_service_url $MON_NS v4m-grafana "$TLS_ENABLE")
 # pr_url=$(get_url $MON_NS v4m-prometheus  "$TLS_ENABLE")
 # am_url=$(get_url $MON_NS v4m-alertmanager  "$TLS_ENABLE")
 set -e
@@ -338,12 +337,12 @@
 
 # If a deployment with the old name exists, remove it first
 if helm3ReleaseExists v4m $MON_NS; then
-  log_verbose "Removing outdated SAS Viya Monitoring Helm chart release from [$MON_NS] namespace"
-  helm uninstall -n "$MON_NS" "v4m"
+	log_verbose "Removing outdated SAS Viya Monitoring Helm chart release from [$MON_NS] namespace"
+	helm uninstall -n "$MON_NS" "v4m"
 fi
 
 if ! deployV4MInfo "$MON_NS" "v4m-metrics"; then
-  log_warn "Unable to update SAS Viya Monitoring Helm chart release"
+	log_warn "Unable to update SAS Viya Monitoring Helm chart release"
 fi
 
 # Print URL to access web apps
@@ -350,13 +349,13 @@
 log_notice ""
 log_notice "GRAFANA: "
 if [ ! -z "$gf_url" ]; then
-   log_notice "  $gf_url"
-else
-   log_notice " It was not possible to determine the URL needed to access Grafana. Note  "
-   log_notice " that this is not necessarily a sign of a problem; it may only reflect an "
-   log_notice " ingress or network access configuration that this script does not handle."
-fi
-   log_notice ""
+	log_notice "  $gf_url"
+else
+	log_notice " It was not possible to determine the URL needed to access Grafana. Note  "
+	log_notice " that this is not necessarily a sign of a problem; it may only reflect an "
+	log_notice " ingress or network access configuration that this script does not handle."
+fi
+log_notice ""
 
 #log_notice ""
 #log_notice "================================================================================"
@@ -379,14 +378,12 @@
 #log_notice ""
 
 if [ "$showPass" == "true" ]; then
-  # Find the grafana pod
- 
-  log_notice " Generated Grafana admin password is: $grafanaPwd"
-  log_notice " To change the password, run the following script (replace myNewPassword with an updated password):"
-  log_notice " monitoring/bin/change_grafana_admin_password.sh -p myNewPassword"
+	# Find the grafana pod
+
+	log_notice " Generated Grafana admin password is: $grafanaPwd"
+	log_notice " To change the password, run the following script (replace myNewPassword with an updated password):"
+	log_notice " monitoring/bin/change_grafana_admin_password.sh -p myNewPassword"
 fi
 
 log_message ""
 log_notice " Successfully deployed components to the [$MON_NS] namespace"
-
-
----------

You can reformat the above files to meet shfmt's requirements by typing:

  shfmt -s -w filename


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant