Skip to content

Commit

Permalink
[CHANGE] Eliminated use of --short option (deprecated in K8s 1.28) fr…
Browse files Browse the repository at this point in the history
…om kubectl version commands (#652)
  • Loading branch information
gsmith-sas authored Jun 13, 2024
1 parent 2cea48e commit f1c06e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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/)

Expand Down
4 changes: 2 additions & 2 deletions bin/kube-include.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f1c06e0

Please sign in to comment.