File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55source ./hack/lib/kubectl-version.sh
66
7- wget -q https://dl.k8s.io/release/$KUBECTL_VERSION /bin/linux/amd64/kubectl
8- chmod +x ./kubectl
9-
10- mkdir -p ~ /bin
11- mv ./kubectl ~ /bin
7+ # Check if kubectl already exists in ~/bin
8+ if [ ! -f ~ /bin/kubectl ]; then
9+ echo " Downloading kubectl..."
10+
11+ # Detect OS and architecture
12+ OS=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
13+ ARCH=$( uname -m)
14+
15+ # Map architecture names
16+ if [ " $ARCH " = " x86_64" ]; then
17+ ARCH=" amd64"
18+ elif [ " $ARCH " = " aarch64" ] || [ " $ARCH " = " arm64" ]; then
19+ ARCH=" arm64"
20+ fi
21+
22+ wget -q https://dl.k8s.io/release/$KUBECTL_VERSION /bin/$OS /$ARCH /kubectl
23+ chmod +x ./kubectl
24+
25+ mkdir -p ~ /bin
26+ mv ./kubectl ~ /bin
27+ else
28+ echo " kubectl already exists in ~/bin, skipping download"
29+ fi
1230
1331export PATH=" $PATH :$HOME /bin"
1432
You can’t perform that action at this time.
0 commit comments