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

[FIX] Update samples/azure-deployment/README.md #613

Merged
merged 9 commits into from
Feb 22, 2024
Merged

Conversation

gsmith-sas
Copy link
Member

No description provided.

@gsmith-sas gsmith-sas requested a review from ceelias February 15, 2024 23:05
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 logging/bin/deploy_fluentbit_azmonitor.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 logging/bin/deploy_fluentbit_azmonitor.sh line 7:
source logging/bin/common.sh
       ^-------------------^ SC1091 (info): Not following: logging/bin/common.sh was not specified as input (see shellcheck -x).


In logging/bin/deploy_fluentbit_azmonitor.sh line 9:
this_script=`basename "$0"`
            ^-------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: 
this_script=$(basename "$0")


In logging/bin/deploy_fluentbit_azmonitor.sh line 29:
helm2ReleaseCheck fb-$LOG_NS
                     ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm2ReleaseCheck fb-"$LOG_NS"


In logging/bin/deploy_fluentbit_azmonitor.sh line 34:
if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 58:
log_info "Using FB ConfigMap:" $FB_CONFIGMAP
                               ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
log_info "Using FB ConfigMap:" "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 62:
if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if [ "$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 69:
      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
                 ^-----^ 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: 
      kubectl -n "$LOG_NS" create secret generic connection-info-azmonitor --from-literal=customer_id="$AZMONITOR_CUSTOMER_ID" --from-literal=shared_key="$AZMONITOR_SHARED_KEY"


In logging/bin/deploy_fluentbit_azmonitor.sh line 77:
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
          ^-------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                             ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 78:
   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
          ^------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                            ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_SHARED_KEY=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 82:
if helm3ReleaseExists fbaz $LOG_NS; then
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists fbaz "$LOG_NS"; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 84:
   helm  $helmDebug  delete -n $LOG_NS fbaz
         ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                               ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   helm  "$helmDebug"  delete -n "$LOG_NS" fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 86:
   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
        ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 88:
   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
          ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 97:
LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
^-------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 105:
kubectl -n $LOG_NS apply -f $FB_CONFIGMAP
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                            ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" apply -f "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 108:
kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-viya-parsers --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 109:
kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf


In logging/bin/deploy_fluentbit_azmonitor.sh line 127:
KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
^-----------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 130:
   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
                              ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                    ^-- SC1083 (warning): This { is literal. Check expression (missing ;/\n?) or quote it.
                                                                                             ^-- SC1083 (warning): This } is literal. Check expression (missing ;/\n?) or quote it.

Did you mean: 
   runtime=$(kubectl get node "$somenode" -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')


In logging/bin/deploy_fluentbit_azmonitor.sh line 149:
kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-env-vars --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 150:
kubectl -n $LOG_NS create configmap fbaz-env-vars \
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-env-vars \


In logging/bin/deploy_fluentbit_azmonitor.sh line 151:
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
                                                            ^------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT="$KUBERNETES_RUNTIME_LOGFMT" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 155:
kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" label configmap fbaz-env-vars   managed-by=v4m-es-script


In logging/bin/deploy_fluentbit_azmonitor.sh line 159:
 chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_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 "$FLUENTBIT_HELM_CHART_REPO" "$FLUENTBIT_HELM_CHART_NAME" "$FLUENTBIT_HELM_CHART_VERSION")"


In logging/bin/deploy_fluentbit_azmonitor.sh line 160:
 versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
                                          ^---------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 164:
helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
     ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                        ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm "$helmDebug" upgrade --install v4m-fbaz  --namespace "$LOG_NS"  \


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

Did you mean: 
  "$versionstring" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 166:
  --values $imageKeysFile \
           ^------------^ SC2154 (warning): imageKeysFile is referenced but not assigned.
           ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$imageKeysFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 168:
  --values $FB_AZMONITOR_USER_YAML \
           ^---------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$FB_AZMONITOR_USER_YAML" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 169:
  --values $tracingValuesFile \
           ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$tracingValuesFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 171:
  $chart2install
  ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  "$chart2install"


In logging/bin/deploy_fluentbit_azmonitor.sh line 175:
disable_sa_token_automount $LOG_NS v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$LOG_NS" v4m-fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 176:
enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
enable_pod_token_automount "$LOG_NS" daemonset v4m-fbaz

For more information:
  https://www.shellcheck.net/wiki/SC1083 -- This { is literal. Check expressi...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2128 -- Expanding an array without an ind...
----------

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:

----------
--- logging/bin/deploy_fluentbit_azmonitor.sh.orig
+++ logging/bin/deploy_fluentbit_azmonitor.sh
@@ -6,7 +6,7 @@
 cd "$(dirname $BASH_SOURCE)/../.."
 source logging/bin/common.sh
 
-this_script=`basename "$0"`
+this_script=$(basename "$0")
 
 log_debug "Script [$this_script] has started [$(date)]"
 
@@ -14,16 +14,15 @@
 FLUENT_BIT_ENABLED=${FLUENT_BIT_ENABLED:-true}
 
 if [ "$FLUENT_BIT_ENABLED" != "true" ]; then
-   log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
-   exit
+	log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
+	exit
 fi
 
-
 set -e
 
 HELM_DEBUG="${HELM_DEBUG:-false}"
 if [ "$HELM_DEBUG" == "true" ]; then
-  helmDebug="--debug"
+	helmDebug="--debug"
 fi
 
 helm2ReleaseCheck fb-$LOG_NS
@@ -32,73 +31,72 @@
 
 # Confirm namespace exists
 if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
-  log_error "The specified namespace [$LOG_NS] does not exist."
-  exit 1
+	log_error "The specified namespace [$LOG_NS] does not exist."
+	exit 1
 fi
 
 log_info "Deploying Fluent Bit (Azure Monitor)"
 
 #Generate yaml file with all container-related keys#Generate yaml file with all container-related keys
-generateImageKeysFile "$FB_FULL_IMAGE"          "logging/fb/fb_container_image.template"
+generateImageKeysFile "$FB_FULL_IMAGE" "logging/fb/fb_container_image.template"
 
 # Fluent Bit user customizations
 FB_AZMONITOR_USER_YAML="${FB_AZMONITOR_USER_YAML:-$USER_DIR/logging/user-values-fluent-bit-azmonitor.yaml}"
 if [ ! -f "$FB_AZMONITOR_USER_YAML" ]; then
-  log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
-  FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
+	log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
+	FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
 fi
 
 if [ -f "$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml" ]; then
-   # use copy in USER_DIR
-   FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in USER_DIR
+	FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
 else
-   # use copy in repo
-   FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in repo
+	FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
 fi
 log_info "Using FB ConfigMap:" $FB_CONFIGMAP
 
-
 # Check/Create Connection Info Secret
 if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
 
-   export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
-   export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
+	export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
+	export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
 
-   if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided"  ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
-      log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
-      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
-   else
-      log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
-      log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
-      exit 1
-   fi
+	if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided" ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
+		log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
+		kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
+	else
+		log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
+		log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
+		exit 1
+	fi
 else
-   log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
-   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
-   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
+	log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
+	export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" | base64 --decode)
+	export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" | base64 --decode)
 fi
 
 # Check for an existing Helm release of stable/fluent-bit
 if helm3ReleaseExists fbaz $LOG_NS; then
-   log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
-   helm  $helmDebug  delete -n $LOG_NS fbaz
+	log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
+	helm $helmDebug delete -n $LOG_NS fbaz
 
-   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
-      log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
-   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
-      log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
-      log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
-   fi
+	if [ $(kubectl get servicemonitors -A | grep fluent-bit-v2 -c) -ge 1 ]; then
+		log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
+	elif [ $(kubectl get servicemonitors -A | grep fluent-bit -c) -ge 1 ]; then
+		log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
+		log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
+	fi
 else
-   log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
+	log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
 fi
 
 # Multiline parser setup
 LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
 if [ "$LOG_MULTILINE_ENABLED" == "true" ]; then
-  LOG_MULTILINE_PARSER="docker, cri"
+	LOG_MULTILINE_PARSER="docker, cri"
 else
-  LOG_MULTILINE_PARSER=""
+	LOG_MULTILINE_PARSER=""
 fi
 
 # Create ConfigMap containing Fluent Bit configuration
@@ -106,41 +104,41 @@
 
 # Create ConfigMap containing Viya-customized parsers (delete it first)
 kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
-kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
+kubectl -n $LOG_NS create configmap fbaz-viya-parsers --from-file=logging/fb/viya-parsers.conf
 
 TRACING_ENABLE="${TRACING_ENABLE:-false}"
 if [ "$TRACING_ENABLE" == "true" ]; then
-  # Create ConfigMap containing tracing config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file=logging/fb/viya-tracing.conf
+	# Create ConfigMap containing tracing config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file=logging/fb/viya-tracing.conf
 
-  tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
-else 
-  # Create empty ConfigMap for tracing since it is expected to exist in main config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file="$TMP_DIR"/empty.yaml
+	tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
+else
+	# Create empty ConfigMap for tracing since it is expected to exist in main config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file="$TMP_DIR"/empty.yaml
 
-  tracingValuesFile=$TMP_DIR/empty.yaml
+	tracingValuesFile=$TMP_DIR/empty.yaml
 fi
 
 # Check for Kubernetes container runtime log format info
 KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
 if [ -z "$KUBERNETES_RUNTIME_LOGFMT" ]; then
-   somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
-   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
-   log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
-   case $runtime in
-    docker)
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-    containerd|cri-o)
-      KUBERNETES_RUNTIME_LOGFMT="criwithlog"
-      ;;
-    *)
-      log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-   esac
+	somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
+	runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
+	log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
+	case $runtime in
+	docker)
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	containerd | cri-o)
+		KUBERNETES_RUNTIME_LOGFMT="criwithlog"
+		;;
+	*)
+		log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	esac
 fi
 
 MON_NS="${MON_NS:-monitoring}"
@@ -148,29 +146,28 @@
 # Create ConfigMap containing Kubernetes container runtime log format
 kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
 kubectl -n $LOG_NS create configmap fbaz-env-vars \
-                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
-                   --from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
-                   --from-literal=MON_NS="${MON_NS}"
+	--from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
+	--from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
+	--from-literal=MON_NS="${MON_NS}"
 
-kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
+kubectl -n $LOG_NS label configmap fbaz-env-vars managed-by=v4m-es-script
 
- ## Get Helm Chart Name
- log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
- chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
- versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
- log_debug "Installing Helm chart from artifact [$chart2install]"
+## Get Helm Chart Name
+log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
+chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
+versionstring="$(get_helm_versionstring $FLUENTBIT_HELM_CHART_VERSION)"
+log_debug "Installing Helm chart from artifact [$chart2install]"
 
 # Deploy Fluent Bit via Helm chart
-helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
-  $versionstring \
-  --values $imageKeysFile \
-  --values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
-  --values $FB_AZMONITOR_USER_YAML \
-  --values $tracingValuesFile \
-  --set fullnameOverride=v4m-fbaz \
-  $chart2install
+helm $helmDebug upgrade --install v4m-fbaz --namespace $LOG_NS \
+	$versionstring \
+	--values $imageKeysFile \
+	--values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
+	--values $FB_AZMONITOR_USER_YAML \
+	--values $tracingValuesFile \
+	--set fullnameOverride=v4m-fbaz \
+	$chart2install
 
-
 #Container Security: Disable Token Automounting at ServiceAccount; enable for Pod
 disable_sa_token_automount $LOG_NS v4m-fbaz
 enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
----------

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

  shfmt -s -w filename


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 logging/bin/deploy_fluentbit_azmonitor.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 logging/bin/deploy_fluentbit_azmonitor.sh line 7:
source logging/bin/common.sh
       ^-------------------^ SC1091 (info): Not following: logging/bin/common.sh was not specified as input (see shellcheck -x).


In logging/bin/deploy_fluentbit_azmonitor.sh line 9:
this_script=`basename "$0"`
            ^-------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: 
this_script=$(basename "$0")


In logging/bin/deploy_fluentbit_azmonitor.sh line 29:
helm2ReleaseCheck fb-$LOG_NS
                     ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm2ReleaseCheck fb-"$LOG_NS"


In logging/bin/deploy_fluentbit_azmonitor.sh line 34:
if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 58:
log_info "Using FB ConfigMap:" $FB_CONFIGMAP
                               ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
log_info "Using FB ConfigMap:" "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 62:
if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if [ "$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 69:
      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
                 ^-----^ 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: 
      kubectl -n "$LOG_NS" create secret generic connection-info-azmonitor --from-literal=customer_id="$AZMONITOR_CUSTOMER_ID" --from-literal=shared_key="$AZMONITOR_SHARED_KEY"


In logging/bin/deploy_fluentbit_azmonitor.sh line 77:
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
          ^-------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                             ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 78:
   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
          ^------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                            ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_SHARED_KEY=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 82:
if helm3ReleaseExists fbaz $LOG_NS; then
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists fbaz "$LOG_NS"; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 84:
   helm  $helmDebug  delete -n $LOG_NS fbaz
         ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                               ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   helm  "$helmDebug"  delete -n "$LOG_NS" fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 86:
   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
        ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 88:
   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
          ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 97:
LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
^-------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 105:
kubectl -n $LOG_NS apply -f $FB_CONFIGMAP
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                            ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" apply -f "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 108:
kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-viya-parsers --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 109:
kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf


In logging/bin/deploy_fluentbit_azmonitor.sh line 127:
KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
^-----------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 130:
   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
                              ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                    ^-- SC1083 (warning): This { is literal. Check expression (missing ;/\n?) or quote it.
                                                                                             ^-- SC1083 (warning): This } is literal. Check expression (missing ;/\n?) or quote it.

Did you mean: 
   runtime=$(kubectl get node "$somenode" -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')


In logging/bin/deploy_fluentbit_azmonitor.sh line 149:
kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-env-vars --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 150:
kubectl -n $LOG_NS create configmap fbaz-env-vars \
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-env-vars \


In logging/bin/deploy_fluentbit_azmonitor.sh line 151:
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
                                                            ^------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT="$KUBERNETES_RUNTIME_LOGFMT" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 155:
kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" label configmap fbaz-env-vars   managed-by=v4m-es-script


In logging/bin/deploy_fluentbit_azmonitor.sh line 159:
 chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_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 "$FLUENTBIT_HELM_CHART_REPO" "$FLUENTBIT_HELM_CHART_NAME" "$FLUENTBIT_HELM_CHART_VERSION")"


In logging/bin/deploy_fluentbit_azmonitor.sh line 160:
 versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
                                          ^---------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 164:
helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
     ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                        ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm "$helmDebug" upgrade --install v4m-fbaz  --namespace "$LOG_NS"  \


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

Did you mean: 
  "$versionstring" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 166:
  --values $imageKeysFile \
           ^------------^ SC2154 (warning): imageKeysFile is referenced but not assigned.
           ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$imageKeysFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 168:
  --values $FB_AZMONITOR_USER_YAML \
           ^---------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$FB_AZMONITOR_USER_YAML" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 169:
  --values $tracingValuesFile \
           ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$tracingValuesFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 171:
  $chart2install
  ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  "$chart2install"


In logging/bin/deploy_fluentbit_azmonitor.sh line 175:
disable_sa_token_automount $LOG_NS v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$LOG_NS" v4m-fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 176:
enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
enable_pod_token_automount "$LOG_NS" daemonset v4m-fbaz

For more information:
  https://www.shellcheck.net/wiki/SC1083 -- This { is literal. Check expressi...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2128 -- Expanding an array without an ind...
----------

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:

----------
--- logging/bin/deploy_fluentbit_azmonitor.sh.orig
+++ logging/bin/deploy_fluentbit_azmonitor.sh
@@ -6,7 +6,7 @@
 cd "$(dirname $BASH_SOURCE)/../.."
 source logging/bin/common.sh
 
-this_script=`basename "$0"`
+this_script=$(basename "$0")
 
 log_debug "Script [$this_script] has started [$(date)]"
 
@@ -14,16 +14,15 @@
 FLUENT_BIT_ENABLED=${FLUENT_BIT_ENABLED:-true}
 
 if [ "$FLUENT_BIT_ENABLED" != "true" ]; then
-   log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
-   exit
+	log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
+	exit
 fi
 
-
 set -e
 
 HELM_DEBUG="${HELM_DEBUG:-false}"
 if [ "$HELM_DEBUG" == "true" ]; then
-  helmDebug="--debug"
+	helmDebug="--debug"
 fi
 
 helm2ReleaseCheck fb-$LOG_NS
@@ -32,73 +31,72 @@
 
 # Confirm namespace exists
 if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
-  log_error "The specified namespace [$LOG_NS] does not exist."
-  exit 1
+	log_error "The specified namespace [$LOG_NS] does not exist."
+	exit 1
 fi
 
 log_info "Deploying Fluent Bit (Azure Monitor)"
 
 #Generate yaml file with all container-related keys#Generate yaml file with all container-related keys
-generateImageKeysFile "$FB_FULL_IMAGE"          "logging/fb/fb_container_image.template"
+generateImageKeysFile "$FB_FULL_IMAGE" "logging/fb/fb_container_image.template"
 
 # Fluent Bit user customizations
 FB_AZMONITOR_USER_YAML="${FB_AZMONITOR_USER_YAML:-$USER_DIR/logging/user-values-fluent-bit-azmonitor.yaml}"
 if [ ! -f "$FB_AZMONITOR_USER_YAML" ]; then
-  log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
-  FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
+	log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
+	FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
 fi
 
 if [ -f "$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml" ]; then
-   # use copy in USER_DIR
-   FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in USER_DIR
+	FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
 else
-   # use copy in repo
-   FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in repo
+	FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
 fi
 log_info "Using FB ConfigMap:" $FB_CONFIGMAP
 
-
 # Check/Create Connection Info Secret
 if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
 
-   export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
-   export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
+	export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
+	export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
 
-   if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided"  ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
-      log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
-      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
-   else
-      log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
-      log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
-      exit 1
-   fi
+	if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided" ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
+		log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
+		kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
+	else
+		log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
+		log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
+		exit 1
+	fi
 else
-   log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
-   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
-   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
+	log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
+	export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" | base64 --decode)
+	export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" | base64 --decode)
 fi
 
 # Check for an existing Helm release of stable/fluent-bit
 if helm3ReleaseExists fbaz $LOG_NS; then
-   log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
-   helm  $helmDebug  delete -n $LOG_NS fbaz
+	log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
+	helm $helmDebug delete -n $LOG_NS fbaz
 
-   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
-      log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
-   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
-      log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
-      log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
-   fi
+	if [ $(kubectl get servicemonitors -A | grep fluent-bit-v2 -c) -ge 1 ]; then
+		log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
+	elif [ $(kubectl get servicemonitors -A | grep fluent-bit -c) -ge 1 ]; then
+		log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
+		log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
+	fi
 else
-   log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
+	log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
 fi
 
 # Multiline parser setup
 LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
 if [ "$LOG_MULTILINE_ENABLED" == "true" ]; then
-  LOG_MULTILINE_PARSER="docker, cri"
+	LOG_MULTILINE_PARSER="docker, cri"
 else
-  LOG_MULTILINE_PARSER=""
+	LOG_MULTILINE_PARSER=""
 fi
 
 # Create ConfigMap containing Fluent Bit configuration
@@ -106,41 +104,41 @@
 
 # Create ConfigMap containing Viya-customized parsers (delete it first)
 kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
-kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
+kubectl -n $LOG_NS create configmap fbaz-viya-parsers --from-file=logging/fb/viya-parsers.conf
 
 TRACING_ENABLE="${TRACING_ENABLE:-false}"
 if [ "$TRACING_ENABLE" == "true" ]; then
-  # Create ConfigMap containing tracing config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file=logging/fb/viya-tracing.conf
+	# Create ConfigMap containing tracing config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file=logging/fb/viya-tracing.conf
 
-  tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
-else 
-  # Create empty ConfigMap for tracing since it is expected to exist in main config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file="$TMP_DIR"/empty.yaml
+	tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
+else
+	# Create empty ConfigMap for tracing since it is expected to exist in main config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file="$TMP_DIR"/empty.yaml
 
-  tracingValuesFile=$TMP_DIR/empty.yaml
+	tracingValuesFile=$TMP_DIR/empty.yaml
 fi
 
 # Check for Kubernetes container runtime log format info
 KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
 if [ -z "$KUBERNETES_RUNTIME_LOGFMT" ]; then
-   somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
-   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
-   log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
-   case $runtime in
-    docker)
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-    containerd|cri-o)
-      KUBERNETES_RUNTIME_LOGFMT="criwithlog"
-      ;;
-    *)
-      log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-   esac
+	somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
+	runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
+	log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
+	case $runtime in
+	docker)
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	containerd | cri-o)
+		KUBERNETES_RUNTIME_LOGFMT="criwithlog"
+		;;
+	*)
+		log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	esac
 fi
 
 MON_NS="${MON_NS:-monitoring}"
@@ -148,29 +146,28 @@
 # Create ConfigMap containing Kubernetes container runtime log format
 kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
 kubectl -n $LOG_NS create configmap fbaz-env-vars \
-                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
-                   --from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
-                   --from-literal=MON_NS="${MON_NS}"
+	--from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
+	--from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
+	--from-literal=MON_NS="${MON_NS}"
 
-kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
+kubectl -n $LOG_NS label configmap fbaz-env-vars managed-by=v4m-es-script
 
- ## Get Helm Chart Name
- log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
- chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
- versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
- log_debug "Installing Helm chart from artifact [$chart2install]"
+## Get Helm Chart Name
+log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
+chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
+versionstring="$(get_helm_versionstring $FLUENTBIT_HELM_CHART_VERSION)"
+log_debug "Installing Helm chart from artifact [$chart2install]"
 
 # Deploy Fluent Bit via Helm chart
-helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
-  $versionstring \
-  --values $imageKeysFile \
-  --values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
-  --values $FB_AZMONITOR_USER_YAML \
-  --values $tracingValuesFile \
-  --set fullnameOverride=v4m-fbaz \
-  $chart2install
+helm $helmDebug upgrade --install v4m-fbaz --namespace $LOG_NS \
+	$versionstring \
+	--values $imageKeysFile \
+	--values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
+	--values $FB_AZMONITOR_USER_YAML \
+	--values $tracingValuesFile \
+	--set fullnameOverride=v4m-fbaz \
+	$chart2install
 
-
 #Container Security: Disable Token Automounting at ServiceAccount; enable for Pod
 disable_sa_token_automount $LOG_NS v4m-fbaz
 enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
----------

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

  shfmt -s -w filename


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 logging/bin/deploy_fluentbit_azmonitor.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 logging/bin/deploy_fluentbit_azmonitor.sh line 7:
source logging/bin/common.sh
       ^-------------------^ SC1091 (info): Not following: logging/bin/common.sh was not specified as input (see shellcheck -x).


In logging/bin/deploy_fluentbit_azmonitor.sh line 9:
this_script=`basename "$0"`
            ^-------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: 
this_script=$(basename "$0")


In logging/bin/deploy_fluentbit_azmonitor.sh line 29:
helm2ReleaseCheck fb-$LOG_NS
                     ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm2ReleaseCheck fb-"$LOG_NS"


In logging/bin/deploy_fluentbit_azmonitor.sh line 34:
if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 58:
log_info "Using FB ConfigMap:" $FB_CONFIGMAP
                               ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
log_info "Using FB ConfigMap:" "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 62:
if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if [ "$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 69:
      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
                 ^-----^ 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: 
      kubectl -n "$LOG_NS" create secret generic connection-info-azmonitor --from-literal=customer_id="$AZMONITOR_CUSTOMER_ID" --from-literal=shared_key="$AZMONITOR_SHARED_KEY"


In logging/bin/deploy_fluentbit_azmonitor.sh line 77:
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
          ^-------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                             ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 78:
   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
          ^------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                            ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_SHARED_KEY=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 82:
if helm3ReleaseExists fbaz $LOG_NS; then
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists fbaz "$LOG_NS"; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 84:
   helm  $helmDebug  delete -n $LOG_NS fbaz
         ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                               ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   helm  "$helmDebug"  delete -n "$LOG_NS" fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 86:
   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
        ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 88:
   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
          ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 97:
LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
^-------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 105:
kubectl -n $LOG_NS apply -f $FB_CONFIGMAP
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                            ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" apply -f "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 108:
kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-viya-parsers --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 109:
kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf


In logging/bin/deploy_fluentbit_azmonitor.sh line 127:
KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
^-----------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 130:
   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
                              ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                    ^-- SC1083 (warning): This { is literal. Check expression (missing ;/\n?) or quote it.
                                                                                             ^-- SC1083 (warning): This } is literal. Check expression (missing ;/\n?) or quote it.

Did you mean: 
   runtime=$(kubectl get node "$somenode" -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')


In logging/bin/deploy_fluentbit_azmonitor.sh line 149:
kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-env-vars --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 150:
kubectl -n $LOG_NS create configmap fbaz-env-vars \
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-env-vars \


In logging/bin/deploy_fluentbit_azmonitor.sh line 151:
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
                                                            ^------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT="$KUBERNETES_RUNTIME_LOGFMT" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 155:
kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" label configmap fbaz-env-vars   managed-by=v4m-es-script


In logging/bin/deploy_fluentbit_azmonitor.sh line 159:
 chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_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 "$FLUENTBIT_HELM_CHART_REPO" "$FLUENTBIT_HELM_CHART_NAME" "$FLUENTBIT_HELM_CHART_VERSION")"


In logging/bin/deploy_fluentbit_azmonitor.sh line 160:
 versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
                                          ^---------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 164:
helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
     ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                        ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm "$helmDebug" upgrade --install v4m-fbaz  --namespace "$LOG_NS"  \


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

Did you mean: 
  "$versionstring" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 166:
  --values $imageKeysFile \
           ^------------^ SC2154 (warning): imageKeysFile is referenced but not assigned.
           ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$imageKeysFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 168:
  --values $FB_AZMONITOR_USER_YAML \
           ^---------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$FB_AZMONITOR_USER_YAML" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 169:
  --values $tracingValuesFile \
           ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$tracingValuesFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 171:
  $chart2install
  ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  "$chart2install"


In logging/bin/deploy_fluentbit_azmonitor.sh line 175:
disable_sa_token_automount $LOG_NS v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$LOG_NS" v4m-fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 176:
enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
enable_pod_token_automount "$LOG_NS" daemonset v4m-fbaz

For more information:
  https://www.shellcheck.net/wiki/SC1083 -- This { is literal. Check expressi...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2128 -- Expanding an array without an ind...
----------

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:

----------
--- logging/bin/deploy_fluentbit_azmonitor.sh.orig
+++ logging/bin/deploy_fluentbit_azmonitor.sh
@@ -6,7 +6,7 @@
 cd "$(dirname $BASH_SOURCE)/../.."
 source logging/bin/common.sh
 
-this_script=`basename "$0"`
+this_script=$(basename "$0")
 
 log_debug "Script [$this_script] has started [$(date)]"
 
@@ -14,16 +14,15 @@
 FLUENT_BIT_ENABLED=${FLUENT_BIT_ENABLED:-true}
 
 if [ "$FLUENT_BIT_ENABLED" != "true" ]; then
-   log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
-   exit
+	log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
+	exit
 fi
 
-
 set -e
 
 HELM_DEBUG="${HELM_DEBUG:-false}"
 if [ "$HELM_DEBUG" == "true" ]; then
-  helmDebug="--debug"
+	helmDebug="--debug"
 fi
 
 helm2ReleaseCheck fb-$LOG_NS
@@ -32,73 +31,72 @@
 
 # Confirm namespace exists
 if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
-  log_error "The specified namespace [$LOG_NS] does not exist."
-  exit 1
+	log_error "The specified namespace [$LOG_NS] does not exist."
+	exit 1
 fi
 
 log_info "Deploying Fluent Bit (Azure Monitor)"
 
 #Generate yaml file with all container-related keys#Generate yaml file with all container-related keys
-generateImageKeysFile "$FB_FULL_IMAGE"          "logging/fb/fb_container_image.template"
+generateImageKeysFile "$FB_FULL_IMAGE" "logging/fb/fb_container_image.template"
 
 # Fluent Bit user customizations
 FB_AZMONITOR_USER_YAML="${FB_AZMONITOR_USER_YAML:-$USER_DIR/logging/user-values-fluent-bit-azmonitor.yaml}"
 if [ ! -f "$FB_AZMONITOR_USER_YAML" ]; then
-  log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
-  FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
+	log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
+	FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
 fi
 
 if [ -f "$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml" ]; then
-   # use copy in USER_DIR
-   FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in USER_DIR
+	FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
 else
-   # use copy in repo
-   FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in repo
+	FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
 fi
 log_info "Using FB ConfigMap:" $FB_CONFIGMAP
 
-
 # Check/Create Connection Info Secret
 if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
 
-   export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
-   export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
+	export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
+	export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
 
-   if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided"  ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
-      log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
-      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
-   else
-      log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
-      log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
-      exit 1
-   fi
+	if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided" ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
+		log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
+		kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
+	else
+		log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
+		log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
+		exit 1
+	fi
 else
-   log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
-   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
-   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
+	log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
+	export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" | base64 --decode)
+	export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" | base64 --decode)
 fi
 
 # Check for an existing Helm release of stable/fluent-bit
 if helm3ReleaseExists fbaz $LOG_NS; then
-   log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
-   helm  $helmDebug  delete -n $LOG_NS fbaz
+	log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
+	helm $helmDebug delete -n $LOG_NS fbaz
 
-   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
-      log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
-   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
-      log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
-      log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
-   fi
+	if [ $(kubectl get servicemonitors -A | grep fluent-bit-v2 -c) -ge 1 ]; then
+		log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
+	elif [ $(kubectl get servicemonitors -A | grep fluent-bit -c) -ge 1 ]; then
+		log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
+		log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
+	fi
 else
-   log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
+	log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
 fi
 
 # Multiline parser setup
 LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
 if [ "$LOG_MULTILINE_ENABLED" == "true" ]; then
-  LOG_MULTILINE_PARSER="docker, cri"
+	LOG_MULTILINE_PARSER="docker, cri"
 else
-  LOG_MULTILINE_PARSER=""
+	LOG_MULTILINE_PARSER=""
 fi
 
 # Create ConfigMap containing Fluent Bit configuration
@@ -106,41 +104,41 @@
 
 # Create ConfigMap containing Viya-customized parsers (delete it first)
 kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
-kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
+kubectl -n $LOG_NS create configmap fbaz-viya-parsers --from-file=logging/fb/viya-parsers.conf
 
 TRACING_ENABLE="${TRACING_ENABLE:-false}"
 if [ "$TRACING_ENABLE" == "true" ]; then
-  # Create ConfigMap containing tracing config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file=logging/fb/viya-tracing.conf
+	# Create ConfigMap containing tracing config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file=logging/fb/viya-tracing.conf
 
-  tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
-else 
-  # Create empty ConfigMap for tracing since it is expected to exist in main config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file="$TMP_DIR"/empty.yaml
+	tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
+else
+	# Create empty ConfigMap for tracing since it is expected to exist in main config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file="$TMP_DIR"/empty.yaml
 
-  tracingValuesFile=$TMP_DIR/empty.yaml
+	tracingValuesFile=$TMP_DIR/empty.yaml
 fi
 
 # Check for Kubernetes container runtime log format info
 KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
 if [ -z "$KUBERNETES_RUNTIME_LOGFMT" ]; then
-   somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
-   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
-   log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
-   case $runtime in
-    docker)
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-    containerd|cri-o)
-      KUBERNETES_RUNTIME_LOGFMT="criwithlog"
-      ;;
-    *)
-      log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-   esac
+	somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
+	runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
+	log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
+	case $runtime in
+	docker)
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	containerd | cri-o)
+		KUBERNETES_RUNTIME_LOGFMT="criwithlog"
+		;;
+	*)
+		log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	esac
 fi
 
 MON_NS="${MON_NS:-monitoring}"
@@ -148,29 +146,28 @@
 # Create ConfigMap containing Kubernetes container runtime log format
 kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
 kubectl -n $LOG_NS create configmap fbaz-env-vars \
-                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
-                   --from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
-                   --from-literal=MON_NS="${MON_NS}"
+	--from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
+	--from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
+	--from-literal=MON_NS="${MON_NS}"
 
-kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
+kubectl -n $LOG_NS label configmap fbaz-env-vars managed-by=v4m-es-script
 
- ## Get Helm Chart Name
- log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
- chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
- versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
- log_debug "Installing Helm chart from artifact [$chart2install]"
+## Get Helm Chart Name
+log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
+chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
+versionstring="$(get_helm_versionstring $FLUENTBIT_HELM_CHART_VERSION)"
+log_debug "Installing Helm chart from artifact [$chart2install]"
 
 # Deploy Fluent Bit via Helm chart
-helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
-  $versionstring \
-  --values $imageKeysFile \
-  --values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
-  --values $FB_AZMONITOR_USER_YAML \
-  --values $tracingValuesFile \
-  --set fullnameOverride=v4m-fbaz \
-  $chart2install
+helm $helmDebug upgrade --install v4m-fbaz --namespace $LOG_NS \
+	$versionstring \
+	--values $imageKeysFile \
+	--values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
+	--values $FB_AZMONITOR_USER_YAML \
+	--values $tracingValuesFile \
+	--set fullnameOverride=v4m-fbaz \
+	$chart2install
 
-
 #Container Security: Disable Token Automounting at ServiceAccount; enable for Pod
 disable_sa_token_automount $LOG_NS v4m-fbaz
 enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
----------

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

  shfmt -s -w filename


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 logging/bin/deploy_fluentbit_azmonitor.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 logging/bin/deploy_fluentbit_azmonitor.sh line 7:
source logging/bin/common.sh
       ^-------------------^ SC1091 (info): Not following: logging/bin/common.sh was not specified as input (see shellcheck -x).


In logging/bin/deploy_fluentbit_azmonitor.sh line 9:
this_script=`basename "$0"`
            ^-------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: 
this_script=$(basename "$0")


In logging/bin/deploy_fluentbit_azmonitor.sh line 29:
helm2ReleaseCheck fb-$LOG_NS
                     ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm2ReleaseCheck fb-"$LOG_NS"


In logging/bin/deploy_fluentbit_azmonitor.sh line 34:
if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 58:
log_info "Using FB ConfigMap:" $FB_CONFIGMAP
                               ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
log_info "Using FB ConfigMap:" "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 62:
if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if [ "$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 69:
      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
                 ^-----^ 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: 
      kubectl -n "$LOG_NS" create secret generic connection-info-azmonitor --from-literal=customer_id="$AZMONITOR_CUSTOMER_ID" --from-literal=shared_key="$AZMONITOR_SHARED_KEY"


In logging/bin/deploy_fluentbit_azmonitor.sh line 77:
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
          ^-------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                             ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 78:
   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
          ^------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                            ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_SHARED_KEY=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 82:
if helm3ReleaseExists fbaz $LOG_NS; then
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists fbaz "$LOG_NS"; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 84:
   helm  $helmDebug  delete -n $LOG_NS fbaz
         ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                               ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   helm  "$helmDebug"  delete -n "$LOG_NS" fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 86:
   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
        ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 88:
   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
          ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 97:
LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
^-------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 105:
kubectl -n $LOG_NS apply -f $FB_CONFIGMAP
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                            ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" apply -f "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 108:
kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-viya-parsers --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 109:
kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf


In logging/bin/deploy_fluentbit_azmonitor.sh line 127:
KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
^-----------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 130:
   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
                              ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                    ^-- SC1083 (warning): This { is literal. Check expression (missing ;/\n?) or quote it.
                                                                                             ^-- SC1083 (warning): This } is literal. Check expression (missing ;/\n?) or quote it.

Did you mean: 
   runtime=$(kubectl get node "$somenode" -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')


In logging/bin/deploy_fluentbit_azmonitor.sh line 149:
kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-env-vars --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 150:
kubectl -n $LOG_NS create configmap fbaz-env-vars \
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-env-vars \


In logging/bin/deploy_fluentbit_azmonitor.sh line 151:
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
                                                            ^------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT="$KUBERNETES_RUNTIME_LOGFMT" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 155:
kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" label configmap fbaz-env-vars   managed-by=v4m-es-script


In logging/bin/deploy_fluentbit_azmonitor.sh line 159:
 chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_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 "$FLUENTBIT_HELM_CHART_REPO" "$FLUENTBIT_HELM_CHART_NAME" "$FLUENTBIT_HELM_CHART_VERSION")"


In logging/bin/deploy_fluentbit_azmonitor.sh line 160:
 versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
                                          ^---------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 164:
helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
     ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                        ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm "$helmDebug" upgrade --install v4m-fbaz  --namespace "$LOG_NS"  \


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

Did you mean: 
  "$versionstring" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 166:
  --values $imageKeysFile \
           ^------------^ SC2154 (warning): imageKeysFile is referenced but not assigned.
           ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$imageKeysFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 168:
  --values $FB_AZMONITOR_USER_YAML \
           ^---------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$FB_AZMONITOR_USER_YAML" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 169:
  --values $tracingValuesFile \
           ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$tracingValuesFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 171:
  $chart2install
  ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  "$chart2install"


In logging/bin/deploy_fluentbit_azmonitor.sh line 175:
disable_sa_token_automount $LOG_NS v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$LOG_NS" v4m-fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 176:
enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
enable_pod_token_automount "$LOG_NS" daemonset v4m-fbaz

For more information:
  https://www.shellcheck.net/wiki/SC1083 -- This { is literal. Check expressi...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2128 -- Expanding an array without an ind...
----------

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:

----------
--- logging/bin/deploy_fluentbit_azmonitor.sh.orig
+++ logging/bin/deploy_fluentbit_azmonitor.sh
@@ -6,7 +6,7 @@
 cd "$(dirname $BASH_SOURCE)/../.."
 source logging/bin/common.sh
 
-this_script=`basename "$0"`
+this_script=$(basename "$0")
 
 log_debug "Script [$this_script] has started [$(date)]"
 
@@ -14,16 +14,15 @@
 FLUENT_BIT_ENABLED=${FLUENT_BIT_ENABLED:-true}
 
 if [ "$FLUENT_BIT_ENABLED" != "true" ]; then
-   log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
-   exit
+	log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
+	exit
 fi
 
-
 set -e
 
 HELM_DEBUG="${HELM_DEBUG:-false}"
 if [ "$HELM_DEBUG" == "true" ]; then
-  helmDebug="--debug"
+	helmDebug="--debug"
 fi
 
 helm2ReleaseCheck fb-$LOG_NS
@@ -32,73 +31,72 @@
 
 # Confirm namespace exists
 if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
-  log_error "The specified namespace [$LOG_NS] does not exist."
-  exit 1
+	log_error "The specified namespace [$LOG_NS] does not exist."
+	exit 1
 fi
 
 log_info "Deploying Fluent Bit (Azure Monitor)"
 
 #Generate yaml file with all container-related keys#Generate yaml file with all container-related keys
-generateImageKeysFile "$FB_FULL_IMAGE"          "logging/fb/fb_container_image.template"
+generateImageKeysFile "$FB_FULL_IMAGE" "logging/fb/fb_container_image.template"
 
 # Fluent Bit user customizations
 FB_AZMONITOR_USER_YAML="${FB_AZMONITOR_USER_YAML:-$USER_DIR/logging/user-values-fluent-bit-azmonitor.yaml}"
 if [ ! -f "$FB_AZMONITOR_USER_YAML" ]; then
-  log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
-  FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
+	log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
+	FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
 fi
 
 if [ -f "$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml" ]; then
-   # use copy in USER_DIR
-   FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in USER_DIR
+	FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
 else
-   # use copy in repo
-   FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in repo
+	FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
 fi
 log_info "Using FB ConfigMap:" $FB_CONFIGMAP
 
-
 # Check/Create Connection Info Secret
 if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
 
-   export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
-   export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
+	export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
+	export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
 
-   if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided"  ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
-      log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
-      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
-   else
-      log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
-      log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
-      exit 1
-   fi
+	if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided" ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
+		log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
+		kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
+	else
+		log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
+		log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
+		exit 1
+	fi
 else
-   log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
-   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
-   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
+	log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
+	export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" | base64 --decode)
+	export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" | base64 --decode)
 fi
 
 # Check for an existing Helm release of stable/fluent-bit
 if helm3ReleaseExists fbaz $LOG_NS; then
-   log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
-   helm  $helmDebug  delete -n $LOG_NS fbaz
+	log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
+	helm $helmDebug delete -n $LOG_NS fbaz
 
-   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
-      log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
-   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
-      log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
-      log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
-   fi
+	if [ $(kubectl get servicemonitors -A | grep fluent-bit-v2 -c) -ge 1 ]; then
+		log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
+	elif [ $(kubectl get servicemonitors -A | grep fluent-bit -c) -ge 1 ]; then
+		log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
+		log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
+	fi
 else
-   log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
+	log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
 fi
 
 # Multiline parser setup
 LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
 if [ "$LOG_MULTILINE_ENABLED" == "true" ]; then
-  LOG_MULTILINE_PARSER="docker, cri"
+	LOG_MULTILINE_PARSER="docker, cri"
 else
-  LOG_MULTILINE_PARSER=""
+	LOG_MULTILINE_PARSER=""
 fi
 
 # Create ConfigMap containing Fluent Bit configuration
@@ -106,41 +104,41 @@
 
 # Create ConfigMap containing Viya-customized parsers (delete it first)
 kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
-kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
+kubectl -n $LOG_NS create configmap fbaz-viya-parsers --from-file=logging/fb/viya-parsers.conf
 
 TRACING_ENABLE="${TRACING_ENABLE:-false}"
 if [ "$TRACING_ENABLE" == "true" ]; then
-  # Create ConfigMap containing tracing config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file=logging/fb/viya-tracing.conf
+	# Create ConfigMap containing tracing config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file=logging/fb/viya-tracing.conf
 
-  tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
-else 
-  # Create empty ConfigMap for tracing since it is expected to exist in main config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file="$TMP_DIR"/empty.yaml
+	tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
+else
+	# Create empty ConfigMap for tracing since it is expected to exist in main config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file="$TMP_DIR"/empty.yaml
 
-  tracingValuesFile=$TMP_DIR/empty.yaml
+	tracingValuesFile=$TMP_DIR/empty.yaml
 fi
 
 # Check for Kubernetes container runtime log format info
 KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
 if [ -z "$KUBERNETES_RUNTIME_LOGFMT" ]; then
-   somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
-   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
-   log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
-   case $runtime in
-    docker)
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-    containerd|cri-o)
-      KUBERNETES_RUNTIME_LOGFMT="criwithlog"
-      ;;
-    *)
-      log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-   esac
+	somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
+	runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
+	log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
+	case $runtime in
+	docker)
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	containerd | cri-o)
+		KUBERNETES_RUNTIME_LOGFMT="criwithlog"
+		;;
+	*)
+		log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	esac
 fi
 
 MON_NS="${MON_NS:-monitoring}"
@@ -148,29 +146,28 @@
 # Create ConfigMap containing Kubernetes container runtime log format
 kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
 kubectl -n $LOG_NS create configmap fbaz-env-vars \
-                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
-                   --from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
-                   --from-literal=MON_NS="${MON_NS}"
+	--from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
+	--from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
+	--from-literal=MON_NS="${MON_NS}"
 
-kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
+kubectl -n $LOG_NS label configmap fbaz-env-vars managed-by=v4m-es-script
 
- ## Get Helm Chart Name
- log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
- chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
- versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
- log_debug "Installing Helm chart from artifact [$chart2install]"
+## Get Helm Chart Name
+log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
+chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
+versionstring="$(get_helm_versionstring $FLUENTBIT_HELM_CHART_VERSION)"
+log_debug "Installing Helm chart from artifact [$chart2install]"
 
 # Deploy Fluent Bit via Helm chart
-helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
-  $versionstring \
-  --values $imageKeysFile \
-  --values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
-  --values $FB_AZMONITOR_USER_YAML \
-  --values $tracingValuesFile \
-  --set fullnameOverride=v4m-fbaz \
-  $chart2install
+helm $helmDebug upgrade --install v4m-fbaz --namespace $LOG_NS \
+	$versionstring \
+	--values $imageKeysFile \
+	--values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
+	--values $FB_AZMONITOR_USER_YAML \
+	--values $tracingValuesFile \
+	--set fullnameOverride=v4m-fbaz \
+	$chart2install
 
-
 #Container Security: Disable Token Automounting at ServiceAccount; enable for Pod
 disable_sa_token_automount $LOG_NS v4m-fbaz
 enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
----------

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

  shfmt -s -w filename


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 logging/bin/deploy_fluentbit_azmonitor.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 logging/bin/deploy_fluentbit_azmonitor.sh line 7:
source logging/bin/common.sh
       ^-------------------^ SC1091 (info): Not following: logging/bin/common.sh was not specified as input (see shellcheck -x).


In logging/bin/deploy_fluentbit_azmonitor.sh line 9:
this_script=`basename "$0"`
            ^-------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: 
this_script=$(basename "$0")


In logging/bin/deploy_fluentbit_azmonitor.sh line 29:
helm2ReleaseCheck fb-$LOG_NS
                     ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm2ReleaseCheck fb-"$LOG_NS"


In logging/bin/deploy_fluentbit_azmonitor.sh line 34:
if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 58:
log_info "Using FB ConfigMap:" $FB_CONFIGMAP
                               ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
log_info "Using FB ConfigMap:" "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 62:
if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if [ "$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 69:
      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
                 ^-----^ 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: 
      kubectl -n "$LOG_NS" create secret generic connection-info-azmonitor --from-literal=customer_id="$AZMONITOR_CUSTOMER_ID" --from-literal=shared_key="$AZMONITOR_SHARED_KEY"


In logging/bin/deploy_fluentbit_azmonitor.sh line 77:
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
          ^-------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                             ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 78:
   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
          ^------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                            ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_SHARED_KEY=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 82:
if helm3ReleaseExists fbaz $LOG_NS; then
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists fbaz "$LOG_NS"; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 84:
   helm  $helmDebug  delete -n $LOG_NS fbaz
         ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                               ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   helm  "$helmDebug"  delete -n "$LOG_NS" fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 86:
   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
        ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 88:
   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
          ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 97:
LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
^-------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 105:
kubectl -n $LOG_NS apply -f $FB_CONFIGMAP
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                            ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" apply -f "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 108:
kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-viya-parsers --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 109:
kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf


In logging/bin/deploy_fluentbit_azmonitor.sh line 127:
KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
^-----------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 130:
   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
                              ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                    ^-- SC1083 (warning): This { is literal. Check expression (missing ;/\n?) or quote it.
                                                                                             ^-- SC1083 (warning): This } is literal. Check expression (missing ;/\n?) or quote it.

Did you mean: 
   runtime=$(kubectl get node "$somenode" -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')


In logging/bin/deploy_fluentbit_azmonitor.sh line 149:
kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-env-vars --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 150:
kubectl -n $LOG_NS create configmap fbaz-env-vars \
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-env-vars \


In logging/bin/deploy_fluentbit_azmonitor.sh line 151:
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
                                                            ^------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT="$KUBERNETES_RUNTIME_LOGFMT" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 155:
kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" label configmap fbaz-env-vars   managed-by=v4m-es-script


In logging/bin/deploy_fluentbit_azmonitor.sh line 159:
 chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_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 "$FLUENTBIT_HELM_CHART_REPO" "$FLUENTBIT_HELM_CHART_NAME" "$FLUENTBIT_HELM_CHART_VERSION")"


In logging/bin/deploy_fluentbit_azmonitor.sh line 160:
 versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
                                          ^---------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 164:
helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
     ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                        ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm "$helmDebug" upgrade --install v4m-fbaz  --namespace "$LOG_NS"  \


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

Did you mean: 
  "$versionstring" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 166:
  --values $imageKeysFile \
           ^------------^ SC2154 (warning): imageKeysFile is referenced but not assigned.
           ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$imageKeysFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 168:
  --values $FB_AZMONITOR_USER_YAML \
           ^---------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$FB_AZMONITOR_USER_YAML" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 169:
  --values $tracingValuesFile \
           ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$tracingValuesFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 171:
  $chart2install
  ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  "$chart2install"


In logging/bin/deploy_fluentbit_azmonitor.sh line 175:
disable_sa_token_automount $LOG_NS v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$LOG_NS" v4m-fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 176:
enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
enable_pod_token_automount "$LOG_NS" daemonset v4m-fbaz

For more information:
  https://www.shellcheck.net/wiki/SC1083 -- This { is literal. Check expressi...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2128 -- Expanding an array without an ind...
----------

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:

----------
--- logging/bin/deploy_fluentbit_azmonitor.sh.orig
+++ logging/bin/deploy_fluentbit_azmonitor.sh
@@ -6,7 +6,7 @@
 cd "$(dirname $BASH_SOURCE)/../.."
 source logging/bin/common.sh
 
-this_script=`basename "$0"`
+this_script=$(basename "$0")
 
 log_debug "Script [$this_script] has started [$(date)]"
 
@@ -14,16 +14,15 @@
 FLUENT_BIT_ENABLED=${FLUENT_BIT_ENABLED:-true}
 
 if [ "$FLUENT_BIT_ENABLED" != "true" ]; then
-   log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
-   exit
+	log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
+	exit
 fi
 
-
 set -e
 
 HELM_DEBUG="${HELM_DEBUG:-false}"
 if [ "$HELM_DEBUG" == "true" ]; then
-  helmDebug="--debug"
+	helmDebug="--debug"
 fi
 
 helm2ReleaseCheck fb-$LOG_NS
@@ -32,73 +31,72 @@
 
 # Confirm namespace exists
 if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
-  log_error "The specified namespace [$LOG_NS] does not exist."
-  exit 1
+	log_error "The specified namespace [$LOG_NS] does not exist."
+	exit 1
 fi
 
 log_info "Deploying Fluent Bit (Azure Monitor)"
 
 #Generate yaml file with all container-related keys#Generate yaml file with all container-related keys
-generateImageKeysFile "$FB_FULL_IMAGE"          "logging/fb/fb_container_image.template"
+generateImageKeysFile "$FB_FULL_IMAGE" "logging/fb/fb_container_image.template"
 
 # Fluent Bit user customizations
 FB_AZMONITOR_USER_YAML="${FB_AZMONITOR_USER_YAML:-$USER_DIR/logging/user-values-fluent-bit-azmonitor.yaml}"
 if [ ! -f "$FB_AZMONITOR_USER_YAML" ]; then
-  log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
-  FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
+	log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
+	FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
 fi
 
 if [ -f "$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml" ]; then
-   # use copy in USER_DIR
-   FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in USER_DIR
+	FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
 else
-   # use copy in repo
-   FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in repo
+	FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
 fi
 log_info "Using FB ConfigMap:" $FB_CONFIGMAP
 
-
 # Check/Create Connection Info Secret
 if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
 
-   export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
-   export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
+	export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
+	export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
 
-   if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided"  ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
-      log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
-      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
-   else
-      log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
-      log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
-      exit 1
-   fi
+	if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided" ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
+		log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
+		kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
+	else
+		log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
+		log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
+		exit 1
+	fi
 else
-   log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
-   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
-   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
+	log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
+	export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" | base64 --decode)
+	export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" | base64 --decode)
 fi
 
 # Check for an existing Helm release of stable/fluent-bit
 if helm3ReleaseExists fbaz $LOG_NS; then
-   log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
-   helm  $helmDebug  delete -n $LOG_NS fbaz
+	log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
+	helm $helmDebug delete -n $LOG_NS fbaz
 
-   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
-      log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
-   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
-      log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
-      log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
-   fi
+	if [ $(kubectl get servicemonitors -A | grep fluent-bit-v2 -c) -ge 1 ]; then
+		log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
+	elif [ $(kubectl get servicemonitors -A | grep fluent-bit -c) -ge 1 ]; then
+		log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
+		log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
+	fi
 else
-   log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
+	log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
 fi
 
 # Multiline parser setup
 LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
 if [ "$LOG_MULTILINE_ENABLED" == "true" ]; then
-  LOG_MULTILINE_PARSER="docker, cri"
+	LOG_MULTILINE_PARSER="docker, cri"
 else
-  LOG_MULTILINE_PARSER=""
+	LOG_MULTILINE_PARSER=""
 fi
 
 # Create ConfigMap containing Fluent Bit configuration
@@ -106,41 +104,41 @@
 
 # Create ConfigMap containing Viya-customized parsers (delete it first)
 kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
-kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
+kubectl -n $LOG_NS create configmap fbaz-viya-parsers --from-file=logging/fb/viya-parsers.conf
 
 TRACING_ENABLE="${TRACING_ENABLE:-false}"
 if [ "$TRACING_ENABLE" == "true" ]; then
-  # Create ConfigMap containing tracing config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file=logging/fb/viya-tracing.conf
+	# Create ConfigMap containing tracing config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file=logging/fb/viya-tracing.conf
 
-  tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
-else 
-  # Create empty ConfigMap for tracing since it is expected to exist in main config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file="$TMP_DIR"/empty.yaml
+	tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
+else
+	# Create empty ConfigMap for tracing since it is expected to exist in main config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file="$TMP_DIR"/empty.yaml
 
-  tracingValuesFile=$TMP_DIR/empty.yaml
+	tracingValuesFile=$TMP_DIR/empty.yaml
 fi
 
 # Check for Kubernetes container runtime log format info
 KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
 if [ -z "$KUBERNETES_RUNTIME_LOGFMT" ]; then
-   somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
-   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
-   log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
-   case $runtime in
-    docker)
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-    containerd|cri-o)
-      KUBERNETES_RUNTIME_LOGFMT="criwithlog"
-      ;;
-    *)
-      log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-   esac
+	somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
+	runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
+	log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
+	case $runtime in
+	docker)
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	containerd | cri-o)
+		KUBERNETES_RUNTIME_LOGFMT="criwithlog"
+		;;
+	*)
+		log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	esac
 fi
 
 MON_NS="${MON_NS:-monitoring}"
@@ -148,29 +146,28 @@
 # Create ConfigMap containing Kubernetes container runtime log format
 kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
 kubectl -n $LOG_NS create configmap fbaz-env-vars \
-                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
-                   --from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
-                   --from-literal=MON_NS="${MON_NS}"
+	--from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
+	--from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
+	--from-literal=MON_NS="${MON_NS}"
 
-kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
+kubectl -n $LOG_NS label configmap fbaz-env-vars managed-by=v4m-es-script
 
- ## Get Helm Chart Name
- log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
- chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
- versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
- log_debug "Installing Helm chart from artifact [$chart2install]"
+## Get Helm Chart Name
+log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
+chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
+versionstring="$(get_helm_versionstring $FLUENTBIT_HELM_CHART_VERSION)"
+log_debug "Installing Helm chart from artifact [$chart2install]"
 
 # Deploy Fluent Bit via Helm chart
-helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
-  $versionstring \
-  --values $imageKeysFile \
-  --values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
-  --values $FB_AZMONITOR_USER_YAML \
-  --values $tracingValuesFile \
-  --set fullnameOverride=v4m-fbaz \
-  $chart2install
+helm $helmDebug upgrade --install v4m-fbaz --namespace $LOG_NS \
+	$versionstring \
+	--values $imageKeysFile \
+	--values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
+	--values $FB_AZMONITOR_USER_YAML \
+	--values $tracingValuesFile \
+	--set fullnameOverride=v4m-fbaz \
+	$chart2install
 
-
 #Container Security: Disable Token Automounting at ServiceAccount; enable for Pod
 disable_sa_token_automount $LOG_NS v4m-fbaz
 enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
----------

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

  shfmt -s -w filename


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 logging/bin/deploy_fluentbit_azmonitor.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 logging/bin/deploy_fluentbit_azmonitor.sh line 7:
source logging/bin/common.sh
       ^-------------------^ SC1091 (info): Not following: logging/bin/common.sh was not specified as input (see shellcheck -x).


In logging/bin/deploy_fluentbit_azmonitor.sh line 9:
this_script=`basename "$0"`
            ^-------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: 
this_script=$(basename "$0")


In logging/bin/deploy_fluentbit_azmonitor.sh line 29:
helm2ReleaseCheck fb-$LOG_NS
                     ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm2ReleaseCheck fb-"$LOG_NS"


In logging/bin/deploy_fluentbit_azmonitor.sh line 34:
if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
                       ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 58:
log_info "Using FB ConfigMap:" $FB_CONFIGMAP
                               ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
log_info "Using FB ConfigMap:" "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 62:
if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if [ "$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 69:
      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
                 ^-----^ 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: 
      kubectl -n "$LOG_NS" create secret generic connection-info-azmonitor --from-literal=customer_id="$AZMONITOR_CUSTOMER_ID" --from-literal=shared_key="$AZMONITOR_SHARED_KEY"


In logging/bin/deploy_fluentbit_azmonitor.sh line 77:
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
          ^-------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                             ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_CUSTOMER_ID=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 78:
   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
          ^------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                            ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   export AZMONITOR_SHARED_KEY=$(kubectl -n "$LOG_NS" get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)


In logging/bin/deploy_fluentbit_azmonitor.sh line 82:
if helm3ReleaseExists fbaz $LOG_NS; then
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
if helm3ReleaseExists fbaz "$LOG_NS"; then


In logging/bin/deploy_fluentbit_azmonitor.sh line 84:
   helm  $helmDebug  delete -n $LOG_NS fbaz
         ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                               ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
   helm  "$helmDebug"  delete -n "$LOG_NS" fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 86:
   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
        ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 88:
   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
          ^-- SC2046 (warning): Quote this to prevent word splitting.


In logging/bin/deploy_fluentbit_azmonitor.sh line 97:
LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
^-------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 105:
kubectl -n $LOG_NS apply -f $FB_CONFIGMAP
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                            ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" apply -f "$FB_CONFIGMAP"


In logging/bin/deploy_fluentbit_azmonitor.sh line 108:
kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-viya-parsers --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 109:
kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf


In logging/bin/deploy_fluentbit_azmonitor.sh line 127:
KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
^-----------------------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.


In logging/bin/deploy_fluentbit_azmonitor.sh line 130:
   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
                              ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                    ^-- SC1083 (warning): This { is literal. Check expression (missing ;/\n?) or quote it.
                                                                                             ^-- SC1083 (warning): This } is literal. Check expression (missing ;/\n?) or quote it.

Did you mean: 
   runtime=$(kubectl get node "$somenode" -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')


In logging/bin/deploy_fluentbit_azmonitor.sh line 149:
kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" delete configmap fbaz-env-vars --ignore-not-found


In logging/bin/deploy_fluentbit_azmonitor.sh line 150:
kubectl -n $LOG_NS create configmap fbaz-env-vars \
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" create configmap fbaz-env-vars \


In logging/bin/deploy_fluentbit_azmonitor.sh line 151:
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
                                                            ^------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
                   --from-literal=KUBERNETES_RUNTIME_LOGFMT="$KUBERNETES_RUNTIME_LOGFMT" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 155:
kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl -n "$LOG_NS" label configmap fbaz-env-vars   managed-by=v4m-es-script


In logging/bin/deploy_fluentbit_azmonitor.sh line 159:
 chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_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 "$FLUENTBIT_HELM_CHART_REPO" "$FLUENTBIT_HELM_CHART_NAME" "$FLUENTBIT_HELM_CHART_VERSION")"


In logging/bin/deploy_fluentbit_azmonitor.sh line 160:
 versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
                                          ^---------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

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


In logging/bin/deploy_fluentbit_azmonitor.sh line 164:
helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
     ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                        ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
helm "$helmDebug" upgrade --install v4m-fbaz  --namespace "$LOG_NS"  \


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

Did you mean: 
  "$versionstring" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 166:
  --values $imageKeysFile \
           ^------------^ SC2154 (warning): imageKeysFile is referenced but not assigned.
           ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$imageKeysFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 168:
  --values $FB_AZMONITOR_USER_YAML \
           ^---------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$FB_AZMONITOR_USER_YAML" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 169:
  --values $tracingValuesFile \
           ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  --values "$tracingValuesFile" \


In logging/bin/deploy_fluentbit_azmonitor.sh line 171:
  $chart2install
  ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  "$chart2install"


In logging/bin/deploy_fluentbit_azmonitor.sh line 175:
disable_sa_token_automount $LOG_NS v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
disable_sa_token_automount "$LOG_NS" v4m-fbaz


In logging/bin/deploy_fluentbit_azmonitor.sh line 176:
enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
                           ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
enable_pod_token_automount "$LOG_NS" daemonset v4m-fbaz

For more information:
  https://www.shellcheck.net/wiki/SC1083 -- This { is literal. Check expressi...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2128 -- Expanding an array without an ind...
----------

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:

----------
--- logging/bin/deploy_fluentbit_azmonitor.sh.orig
+++ logging/bin/deploy_fluentbit_azmonitor.sh
@@ -6,7 +6,7 @@
 cd "$(dirname $BASH_SOURCE)/../.."
 source logging/bin/common.sh
 
-this_script=`basename "$0"`
+this_script=$(basename "$0")
 
 log_debug "Script [$this_script] has started [$(date)]"
 
@@ -14,16 +14,15 @@
 FLUENT_BIT_ENABLED=${FLUENT_BIT_ENABLED:-true}
 
 if [ "$FLUENT_BIT_ENABLED" != "true" ]; then
-   log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
-   exit
+	log_info "Environment variable [FLUENT_BIT_ENABLED] is not set to 'true'; existing WITHOUT deploying Fluent Bit"
+	exit
 fi
 
-
 set -e
 
 HELM_DEBUG="${HELM_DEBUG:-false}"
 if [ "$HELM_DEBUG" == "true" ]; then
-  helmDebug="--debug"
+	helmDebug="--debug"
 fi
 
 helm2ReleaseCheck fb-$LOG_NS
@@ -32,73 +31,72 @@
 
 # Confirm namespace exists
 if [ "$(kubectl get ns $LOG_NS -o name 2>/dev/null)" == "" ]; then
-  log_error "The specified namespace [$LOG_NS] does not exist."
-  exit 1
+	log_error "The specified namespace [$LOG_NS] does not exist."
+	exit 1
 fi
 
 log_info "Deploying Fluent Bit (Azure Monitor)"
 
 #Generate yaml file with all container-related keys#Generate yaml file with all container-related keys
-generateImageKeysFile "$FB_FULL_IMAGE"          "logging/fb/fb_container_image.template"
+generateImageKeysFile "$FB_FULL_IMAGE" "logging/fb/fb_container_image.template"
 
 # Fluent Bit user customizations
 FB_AZMONITOR_USER_YAML="${FB_AZMONITOR_USER_YAML:-$USER_DIR/logging/user-values-fluent-bit-azmonitor.yaml}"
 if [ ! -f "$FB_AZMONITOR_USER_YAML" ]; then
-  log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
-  FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
+	log_debug "[$FB_AZMONITOR_USER_YAML] not found. Using $TMP_DIR/empty.yaml"
+	FB_AZMONITOR_USER_YAML=$TMP_DIR/empty.yaml
 fi
 
 if [ -f "$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml" ]; then
-   # use copy in USER_DIR
-   FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in USER_DIR
+	FB_CONFIGMAP="$USER_DIR/logging/fluent-bit_config.configmap_azmonitor.yaml"
 else
-   # use copy in repo
-   FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
+	# use copy in repo
+	FB_CONFIGMAP="logging/fb/fluent-bit_config.configmap_azmonitor.yaml"
 fi
 log_info "Using FB ConfigMap:" $FB_CONFIGMAP
 
-
 # Check/Create Connection Info Secret
 if [ "$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o name 2>/dev/null)" == "" ]; then
 
-   export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
-   export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
+	export AZMONITOR_CUSTOMER_ID="${AZMONITOR_CUSTOMER_ID:-NotProvided}"
+	export AZMONITOR_SHARED_KEY="${AZMONITOR_SHARED_KEY:-NotProvided}"
 
-   if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided"  ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
-      log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
-      kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
-   else
-      log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
-      log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
-      exit 1
-   fi
+	if [ "$AZMONITOR_CUSTOMER_ID" != "NotProvided" ] && [ "$AZMONITOR_SHARED_KEY" != "NotProvided" ]; then
+		log_info "Creating secret [connection-info-azmonitor] in [$LOG_NS] namespace to hold Azure connection information."
+		kubectl -n $LOG_NS create secret generic connection-info-azmonitor --from-literal=customer_id=$AZMONITOR_CUSTOMER_ID --from-literal=shared_key=$AZMONITOR_SHARED_KEY
+	else
+		log_error "Unable to create secret [$LOG_NS/connection-info-azmonitor] because missing required information: [AZMONITOR_CUSTOMER_ID: $AZMONITOR_CUSTOMER_ID ; AZMONITOR_SHARED_KEY: $AZMONITOR_SHARED_KEY]."
+		log_error "You must provide this information via environment variables or create the secret [connection-info-azmonitor] before running this script."
+		exit 1
+	fi
 else
-   log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
-   export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" |base64 --decode)
-   export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" |base64 --decode)
+	log_info "Obtaining connection information from existing secret [$LOG_NS/connection-info-azmonitor]"
+	export AZMONITOR_CUSTOMER_ID=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.customer_id}" | base64 --decode)
+	export AZMONITOR_SHARED_KEY=$(kubectl -n $LOG_NS get secret connection-info-azmonitor -o=jsonpath="{.data.shared_key}" | base64 --decode)
 fi
 
 # Check for an existing Helm release of stable/fluent-bit
 if helm3ReleaseExists fbaz $LOG_NS; then
-   log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
-   helm  $helmDebug  delete -n $LOG_NS fbaz
+	log_info "Removing an existing release of deprecated stable/fluent-bit Helm chart from from the [$LOG_NS] namespace [$(date)]"
+	helm $helmDebug delete -n $LOG_NS fbaz
 
-   if [ $(kubectl get servicemonitors -A |grep fluent-bit-v2 -c) -ge 1 ]; then
-      log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
-   elif [ $(kubectl get servicemonitors -A |grep fluent-bit -c) -ge 1 ]; then
-      log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
-      log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
-   fi
+	if [ $(kubectl get servicemonitors -A | grep fluent-bit-v2 -c) -ge 1 ]; then
+		log_debug "Updated serviceMonitor [fluent-bit-v2] appears to be deployed."
+	elif [ $(kubectl get servicemonitors -A | grep fluent-bit -c) -ge 1 ]; then
+		log_warn "You appear to have an obsolete service monitor in place for monitoring Fluent Bit."
+		log_warn "Run monitoring/bin/deploy_monitoring_cluster.sh to deploy the current set of service monitors."
+	fi
 else
-   log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
+	log_debug "No existing release of the deprecated stable/fluent-bit Helm chart was found"
 fi
 
 # Multiline parser setup
 LOG_MULTILINE_ENABLED="${LOG_MULTILINE_ENABLED}"
 if [ "$LOG_MULTILINE_ENABLED" == "true" ]; then
-  LOG_MULTILINE_PARSER="docker, cri"
+	LOG_MULTILINE_PARSER="docker, cri"
 else
-  LOG_MULTILINE_PARSER=""
+	LOG_MULTILINE_PARSER=""
 fi
 
 # Create ConfigMap containing Fluent Bit configuration
@@ -106,41 +104,41 @@
 
 # Create ConfigMap containing Viya-customized parsers (delete it first)
 kubectl -n $LOG_NS delete configmap fbaz-viya-parsers --ignore-not-found
-kubectl -n $LOG_NS create configmap fbaz-viya-parsers  --from-file=logging/fb/viya-parsers.conf
+kubectl -n $LOG_NS create configmap fbaz-viya-parsers --from-file=logging/fb/viya-parsers.conf
 
 TRACING_ENABLE="${TRACING_ENABLE:-false}"
 if [ "$TRACING_ENABLE" == "true" ]; then
-  # Create ConfigMap containing tracing config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file=logging/fb/viya-tracing.conf
+	# Create ConfigMap containing tracing config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file=logging/fb/viya-tracing.conf
 
-  tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
-else 
-  # Create empty ConfigMap for tracing since it is expected to exist in main config
-  kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
-  kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing  --from-file="$TMP_DIR"/empty.yaml
+	tracingValuesFile="logging/fb/fluent-bit_helm_values_tracing.yaml"
+else
+	# Create empty ConfigMap for tracing since it is expected to exist in main config
+	kubectl -n "$LOG_NS" delete configmap fbaz-viya-tracing --ignore-not-found
+	kubectl -n "$LOG_NS" create configmap fbaz-viya-tracing --from-file="$TMP_DIR"/empty.yaml
 
-  tracingValuesFile=$TMP_DIR/empty.yaml
+	tracingValuesFile=$TMP_DIR/empty.yaml
 fi
 
 # Check for Kubernetes container runtime log format info
 KUBERNETES_RUNTIME_LOGFMT="${KUBERNETES_RUNTIME_LOGFMT}"
 if [ -z "$KUBERNETES_RUNTIME_LOGFMT" ]; then
-   somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
-   runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
-   log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
-   case $runtime in
-    docker)
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-    containerd|cri-o)
-      KUBERNETES_RUNTIME_LOGFMT="criwithlog"
-      ;;
-    *)
-      log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
-      KUBERNETES_RUNTIME_LOGFMT="docker"
-      ;;
-   esac
+	somenode=$(kubectl get nodes | awk 'NR==2 { print $1 }')
+	runtime=$(kubectl get node $somenode -o jsonpath={.status.nodeInfo.containerRuntimeVersion} | awk -F: '{print $1}')
+	log_debug "Kubernetes container runtime [$runtime] found on node [$somenode]"
+	case $runtime in
+	docker)
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	containerd | cri-o)
+		KUBERNETES_RUNTIME_LOGFMT="criwithlog"
+		;;
+	*)
+		log_warn "Unrecognized Kubernetes container runtime [$runtime]; using default parser"
+		KUBERNETES_RUNTIME_LOGFMT="docker"
+		;;
+	esac
 fi
 
 MON_NS="${MON_NS:-monitoring}"
@@ -148,29 +146,28 @@
 # Create ConfigMap containing Kubernetes container runtime log format
 kubectl -n $LOG_NS delete configmap fbaz-env-vars --ignore-not-found
 kubectl -n $LOG_NS create configmap fbaz-env-vars \
-                   --from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
-                   --from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
-                   --from-literal=MON_NS="${MON_NS}"
+	--from-literal=KUBERNETES_RUNTIME_LOGFMT=$KUBERNETES_RUNTIME_LOGFMT \
+	--from-literal=LOG_MULTILINE_PARSER="${LOG_MULTILINE_PARSER}" \
+	--from-literal=MON_NS="${MON_NS}"
 
-kubectl -n $LOG_NS label configmap fbaz-env-vars   managed-by=v4m-es-script
+kubectl -n $LOG_NS label configmap fbaz-env-vars managed-by=v4m-es-script
 
- ## Get Helm Chart Name
- log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
- chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
- versionstring="$(get_helm_versionstring  $FLUENTBIT_HELM_CHART_VERSION)"
- log_debug "Installing Helm chart from artifact [$chart2install]"
+## Get Helm Chart Name
+log_debug "Fluent Bit Helm Chart: repo [$FLUENTBIT_HELM_CHART_REPO] name [$FLUENTBIT_HELM_CHART_NAME] version [$FLUENTBIT_HELM_CHART_VERSION]"
+chart2install="$(get_helmchart_reference $FLUENTBIT_HELM_CHART_REPO $FLUENTBIT_HELM_CHART_NAME $FLUENTBIT_HELM_CHART_VERSION)"
+versionstring="$(get_helm_versionstring $FLUENTBIT_HELM_CHART_VERSION)"
+log_debug "Installing Helm chart from artifact [$chart2install]"
 
 # Deploy Fluent Bit via Helm chart
-helm $helmDebug upgrade --install v4m-fbaz  --namespace $LOG_NS  \
-  $versionstring \
-  --values $imageKeysFile \
-  --values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
-  --values $FB_AZMONITOR_USER_YAML \
-  --values $tracingValuesFile \
-  --set fullnameOverride=v4m-fbaz \
-  $chart2install
+helm $helmDebug upgrade --install v4m-fbaz --namespace $LOG_NS \
+	$versionstring \
+	--values $imageKeysFile \
+	--values logging/fb/fluent-bit_helm_values_azmonitor.yaml \
+	--values $FB_AZMONITOR_USER_YAML \
+	--values $tracingValuesFile \
+	--set fullnameOverride=v4m-fbaz \
+	$chart2install
 
-
 #Container Security: Disable Token Automounting at ServiceAccount; enable for Pod
 disable_sa_token_automount $LOG_NS v4m-fbaz
 enable_pod_token_automount $LOG_NS daemonset v4m-fbaz
----------

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

  shfmt -s -w filename


@gsmith-sas gsmith-sas merged commit f220694 into main Feb 22, 2024
1 check failed
@gsmith-sas gsmith-sas deleted the fixsamples branch February 22, 2024 16:39
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.

2 participants