Skip to content

Commit

Permalink
Cache deployer - Using the same kubectl version as the server
Browse files Browse the repository at this point in the history
Fixes #4505
  • Loading branch information
Ark-kun committed Sep 21, 2020
1 parent 9a00eb3 commit ed2fe83
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions backend/src/cache/deployer/deploy-cache-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ NAMESPACE=${NAMESPACE_TO_WATCH:-kubeflow}
MUTATING_WEBHOOK_CONFIGURATION_NAME="cache-webhook-${NAMESPACE}"
WEBHOOK_SECRET_NAME=webhook-server-tls

# Getting correct kubectl. Kubernetes only supports kubectl versions within +/-1 minor version.
# kubectl has some resource version information hardcoded, so using too old kubectl can lead to errors
mkdir -p "$HOME/bin"
export PATH="$PATH:$HOME/bin"
{
server_version_major_minor=$(kubectl version --output json | jq '(.serverVersion.major + "." + .serverVersion.minor)' | tr -d '+')
stable_build_version=$(curl -s "https://storage.googleapis.com/kubernetes-release/release/stable-${server_version_major_minor}.txt")
kubectl_url="https://storage.googleapis.com/kubernetes-release/release/${stable_build_version}/bin/linux/amd64/kubectl"
curl -L -O "$HOME/bin/kubectl" "$kubectl_url"
chmod +x "$HOME/bin/kubectl"
} || true

# This should fail if there are connectivity problems
# Gotcha: Listing all objects requires list permission,
# but when listing a single oblect kubectl will fail if it's not found
Expand Down

0 comments on commit ed2fe83

Please sign in to comment.