Skip to content

Commit 2a003a9

Browse files
Copilotchefgs
andauthored
Use direct kubectl release download in devcontainer
Agent-Logs-Url: https://github.com/cloudengine-labs/devops_os/sessions/8929bee2-ec5e-454a-8614-f771484942ab Co-authored-by: chefgs <7605658+chefgs@users.noreply.github.com>
1 parent d2c1b3b commit 2a003a9

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,12 @@ RUN if [ "$INSTALL_TERRAFORM" = "true" ]; then \
123123

124124
# Install kubectl if requested
125125
RUN if [ "$INSTALL_KUBECTL" = "true" ]; then \
126-
KUBECTL_CHANNEL="$(curl -fsSL https://dl.k8s.io/release/stable.txt | sed -E 's/^v([0-9]+\.[0-9]+).*/v\1/')" \
127-
&& curl -fsSL "https://pkgs.k8s.io/core:/stable:/${KUBECTL_CHANNEL}/deb/Release.key" | gpg --dearmor -o /usr/share/keyrings/kubernetes-apt-keyring.gpg \
128-
&& echo "deb [signed-by=/usr/share/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/${KUBECTL_CHANNEL}/deb/ /" > /etc/apt/sources.list.d/kubernetes.list \
129-
&& apt-get update \
130-
&& apt-get install -y kubectl; \
126+
KUBECTL_VERSION="$(curl -fsSL https://dl.k8s.io/release/stable.txt)" \
127+
&& curl -fsSLo /tmp/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \
128+
&& curl -fsSLo /tmp/kubectl.sha256 "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256" \
129+
&& echo "$(cat /tmp/kubectl.sha256) /tmp/kubectl" | sha256sum --check \
130+
&& install -o root -g root -m 0755 /tmp/kubectl /usr/local/bin/kubectl \
131+
&& rm -f /tmp/kubectl /tmp/kubectl.sha256; \
131132
fi
132133

133134
# Install Helm if requested

0 commit comments

Comments
 (0)