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: client version in kubernetes_kubeconfig_sa.sh #39

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions kubeconfig-exporter/kubernetes_export_sa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,13 @@ set_kube_config_values() {
}


CLIENT_VERSION=$(kubectl version --client | awk '/Client Version: /{print $3}'| cut -d '.' -f 2)
#CLIENT_VERSION=$(kubectl version --client | awk '/Client Version: /{print $3}'| cut -d '.' -f 2)
CLIENT_VERSION=$( kubectl version -o json | awk -F '"' '/"clientVersion"/ {getline; getline; print $4}' | cut -d '.' -f 2)
echo "$CLIENT_VERSION"
if [[ $CLIENT_VERSION -gt 27 ]]
then
VERSION=$(kubectl version | awk '/Server Version: /{print $3}' | cut -d '.' -f 2 )
VERSION=$(kubectl version -o json | awk -F '"' '/"serverVersion"/ {getline; getline; print $4}' | cut -d '.' -f 2 )
#VERSION=$(kubectl version | awk '/Server Version: /{print $3}' | cut -d '.' -f 2 )
VERSION=$(expr $VERSION)
else
VERSION=$(kubectl version --short | awk '/Server Version: /{print $3}' | cut -d '.' -f 2 )
Expand Down