Skip to content

Commit

Permalink
Start of sprint housekeeping (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmith-sas authored Aug 27, 2024
1 parent c48c351 commit ade004d
Showing 1 changed file with 31 additions and 12 deletions.
43 changes: 31 additions & 12 deletions bin/kube-include.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,48 @@ fi
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
:
else
log_warn "Unsupported kubectl version: [$KUBE_CLIENT_VER]."
log_warn "This script might not work as expected. Support might not be available until kubectl is upgraded to a supported version."
fi
if [[ "$KUBE_CLIENT_VER" =~ v([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
KUBE_CLIENT_MAJOR=${BASH_REMATCH[1]}
KUBE_CLIENT_MINOR=${BASH_REMATCH[2]}
KUBE_CLIENT_PATCH=${BASH_REMATCH[3]}
log_debug "Kubernetes CLIENT - Major: [$KUBE_CLIENT_MAJOR] Minor: [$KUBE_CLIENT_MINOR] Patch: [$KUBE_CLIENT_PATCH]"
else
log_error "Kubernetes Client Version does not match expected pattern.";
fi;

if [[ "$KUBE_SERVER_VER" =~ v([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
KUBE_SERVER_MAJOR=${BASH_REMATCH[1]}
KUBE_SERVER_MINOR=${BASH_REMATCH[2]}
KUBE_SERVER_PATCH=${BASH_REMATCH[3]}
log_debug "Kubernetes SERVER - Major: [$KUBE_SERVER_MAJOR] Minor: [$KUBE_SERVER_MINOR] Patch: [$KUBE_SERVER_PATCH]"
else
log_error "Kubernetes SERVER Version does not match expected pattern.";
fi;

# SAS Viya 4 versions
# supported by SAS Tech Support
# Updated: 29JUL24
# 2022.09 LTS 1.21 1.24
# Updated: 26AUG24
# 2022.09 LTS 1.21 1.24 (EOL: 1.21, 1.22)
# 2023.03 LTS 1.23 1.25
# 2023.10 LTS 1.25 1.27
# 2024.03 LTS 1.26 1.28
# 2024.04 1.26 1.28
# 2024.05 1.27 1.29
# 2024.06 1.27 1.29
# 2024.07 1.27 1.29
# 2024.08 1.27 1.29


# Client version allowed to be one minor version earlier than minimum server version
if [ "$KUBE_CLIENT_MAJOR" -eq "1" ] && [ "$KUBE_CLIENT_MINOR" -gt "21" ]; then
:
else
log_warn "Unsupported kubectl version: [$KUBE_CLIENT_VER]."
log_warn "This script might not work as expected. Support might not be available until kubectl is upgraded to a supported version."
fi

if [[ $KUBE_SERVER_VER =~ v1.2[1-9] ]]; then
if [ "$KUBE_SERVER_MAJOR" -eq "1" ] && [ "$KUBE_SERVER_MINOR" -gt "22" ]; then
:
else
else
log_warn "The detected version of Kubernetes [$KUBE_SERVER_VER] is not supported by any of the currently supported releases of SAS Viya."
log_warn "This script might not work as expected. Support might not be available until Kubernetes is upgraded to a supported version."
fi
Expand Down

0 comments on commit ade004d

Please sign in to comment.