diff --git a/CHANGELOG.md b/CHANGELOG.md index 9937cc6e..bb58f721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # SAS Viya Monitoring for Kubernetes ## Unreleased +* **Overall** + * [CHANGE] Eliminated use of `--short` option (deprecated in Kubernetes 1.28) from `kubectl version` commands + * **Logging** * [SECURITY] Upgraded to Fluent Bit 3.0.6 to address critical security vulnerability [(CVE-2024-4323)](https://fluentbit.io/blog/2024/05/21/statement-on-cve-2024-4323-and-its-fix/) diff --git a/bin/kube-include.sh b/bin/kube-include.sh index 40a08268..28db0274 100644 --- a/bin/kube-include.sh +++ b/bin/kube-include.sh @@ -11,8 +11,8 @@ if [ ! "$(which kubectl)" ]; then exit 1 fi -KUBE_CLIENT_VER=$(kubectl version --short | grep 'Client Version' | awk '{print $3}' 2>/dev/null) -KUBE_SERVER_VER=$(kubectl version --short | grep 'Server Version' | awk '{print $3}' 2>/dev/null) +KUBE_CLIENT_VER=$(kubectl version --output=json | tr -d '\n' | tr -s " " | sed -E 's/^\{.*"clientVersion": \{([^\}]+)}.*/\1\n/' | sed -E 's/.*"gitVersion": "([^\"]*)".*$/\1/') +KUBE_SERVER_VER=$(kubectl version --output=json | tr -d '\n' | tr -s " " | sed -E 's/^\{.*"serverVersion": \{([^\}]+)}.*/\1\n/' | sed -E 's/.*"gitVersion": "([^\"]*)".*$/\1/') # Client version allowed to be one minor version earlier than minimum server version if [[ $KUBE_CLIENT_VER =~ v1.2[0-9] ]]; then