Skip to content

Commit

Permalink
use TRIMMED_KUBERNETES_VERSION to download pkgs
Browse files Browse the repository at this point in the history
This commit used TRIMMED_KUBERNETES_VERSION as an env variable to
download packages. This way we can update with ease.

Signed-off-by: Anurag <[email protected]>
  • Loading branch information
kranurag7 committed Oct 24, 2023
1 parent b52cc9e commit ed74184
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 17 deletions.
5 changes: 3 additions & 2 deletions templates/cluster-templates/bases/hcloud-kcp-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ spec:
- export CRUN=1.9.2 # update: datasource=github-tags depName=containers/crun versioning=semver-coerced
- export CONTAINERD=1.7.7 # update: datasource=github-tags depName=containerd/containerd extractVersion=^v(?<version>.*)$ versioning=semver
- export KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/^v//')
- export TRIMMED_KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/^v//' | awk -F . '{print $1 "." $2}')
- ARCH=amd64
- if [ "$(uname -m)" = "aarch64" ]; then ARCH=arm64; fi
- localectl set-locale LANG=en_US.UTF-8
Expand All @@ -208,8 +209,8 @@ spec:
- rm -f /etc/cni/net.d/10-containerd-net.conflist
- chmod -R 644 /etc/cni && chown -R root:root /etc/cni
- systemctl daemon-reload && systemctl enable containerd && systemctl start containerd
- curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.27/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.27/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
- curl -fsSL https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
- apt-get update
- apt-get install -y kubelet=$KUBERNETES_VERSION-1.1 kubeadm=$KUBERNETES_VERSION-1.1 kubectl=$KUBERNETES_VERSION-1.1 bash-completion && apt-mark hold kubelet kubectl kubeadm && systemctl enable kubelet
- kubeadm config images pull --kubernetes-version $KUBERNETES_VERSION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ spec:
- export CRUN=1.9.2 # update: datasource=github-tags depName=containers/crun versioning=semver-coerced
- export CONTAINERD=1.7.7 # update: datasource=github-tags depName=containerd/containerd extractVersion=^v(?<version>.*)$ versioning=semver
- export KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/^v//')
- export TRIMMED_KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/^v//' | awk -F . '{print $1 "." $2}')
- localectl set-locale LANG=en_US.UTF-8
- localectl set-locale LANGUAGE=en_US.UTF-8
- apt-get update -y
Expand All @@ -225,8 +226,8 @@ spec:
- rm -f /etc/cni/net.d/10-containerd-net.conflist
- chmod -R 644 /etc/cni && chown -R root:root /etc/cni
- systemctl daemon-reload && systemctl enable containerd && systemctl start containerd
- curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.27/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.27/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
- curl -fsSL https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
- apt-get update
- apt-get install -y kubelet=$KUBERNETES_VERSION-1.1 kubeadm=$KUBERNETES_VERSION-1.1 kubectl=$KUBERNETES_VERSION-1.1 bash-completion && apt-mark hold kubelet kubectl kubeadm && systemctl enable kubelet
- kubeadm config images pull --kubernetes-version $KUBERNETES_VERSION
Expand Down
5 changes: 3 additions & 2 deletions templates/cluster-templates/bases/kct-md-0-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ spec:
- export CRUN=1.9.2 # update: datasource=github-tags depName=containers/crun versioning=semver-coerced
- export CONTAINERD=1.7.7 # update: datasource=github-tags depName=containerd/containerd extractVersion=^v(?<version>.*)$ versioning=semver
- export KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/^v//')
- export TRIMMED_KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/^v//' | awk -F . '{print $1 "." $2}')
- ARCH=amd64
- if [ "$(uname -m)" = "aarch64" ]; then ARCH=arm64; fi
- localectl set-locale LANG=en_US.UTF-8
Expand All @@ -95,8 +96,8 @@ spec:
- rm -f /etc/cni/net.d/10-containerd-net.conflist
- chmod -R 644 /etc/cni && chown -R root:root /etc/cni
- systemctl daemon-reload && systemctl enable containerd && systemctl start containerd
- curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.27/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.27/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
- curl -fsSL https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
- apt-get update
- apt-get install -y kubelet=$KUBERNETES_VERSION-1.1 kubeadm=$KUBERNETES_VERSION-1.1 kubectl=$KUBERNETES_VERSION-1.1 bash-completion && apt-mark hold kubelet kubectl kubeadm && systemctl enable kubelet
- kubeadm config images pull --kubernetes-version $KUBERNETES_VERSION
Expand Down
5 changes: 3 additions & 2 deletions templates/cluster-templates/cluster-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ spec:
- export CRUN=1.6
- export CONTAINERD=1.6.8
- export KUBERNETES_VERSION=1.25.3
- export TRIMMED_KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/^v//' | awk -F . '{print $1 "." $2}')
- localectl set-locale LANG=en_US.UTF-8
- localectl set-locale LANGUAGE=en_US.UTF-8
- apt-get update -y
Expand All @@ -577,8 +578,8 @@ spec:
- rm -f /etc/cni/net.d/10-containerd-net.conflist
- chmod -R 644 /etc/cni && chown -R root:root /etc/cni
- systemctl daemon-reload && systemctl enable containerd && systemctl start containerd
- curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.25/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.25/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
- curl -fsSL https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
- apt-get update
- apt-get install -y kubelet=$KUBERNETES_VERSION-1.1 kubeadm=$KUBERNETES_VERSION-1.1
kubectl=$KUBERNETES_VERSION-1.1 bash-completion && apt-mark hold kubelet kubectl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ set -o errexit
set -o nounset
set -o pipefail

curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.24/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.24/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
KUBERNETES_VERSION=1.24.1 # https://kubernetes.io/releases/#release-history
TRIMMED_KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/^v//' | awk -F . '{print $1 "." $2}')
curl -fsSL https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
apt-get update

# Check actual version: https://github.com/kubernetes/kubernetes/releases
KUBERNETES_VERSION=1.24.1 # https://kubernetes.io/releases/#release-history

apt-get install -y kubelet=$KUBERNETES_VERSION-1.1 kubeadm=$KUBERNETES_VERSION-1.1 kubectl=$KUBERNETES_VERSION-1.1 bash-completion
apt-mark hold kubelet kubectl kubeadm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ set -o errexit
set -o nounset
set -o pipefail

curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.25/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.25/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
KUBERNETES_VERSION=1.25.2 # https://kubernetes.io/releases/#release-history
TRIMMED_KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/^v//' | awk -F . '{print $1 "." $2}')
curl -fsSL https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
apt-get update

# Check actual version: https://github.com/kubernetes/kubernetes/releases
KUBERNETES_VERSION=1.25.2 # https://kubernetes.io/releases/#release-history

apt-get install -y kubelet=$KUBERNETES_VERSION-1.1 kubeadm=$KUBERNETES_VERSION-1.1 kubectl=$KUBERNETES_VERSION-1.1 bash-completion
apt-mark hold kubelet kubectl kubeadm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ set -o errexit
set -o nounset
set -o pipefail

curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.27/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.27/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
KUBERNETES_VERSION=1.27.3 # https://kubernetes.io/releases/#release-history
TRIMMED_KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | sed 's/^v//' | awk -F . '{print $1 "." $2}')
curl -fsSL https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$TRIMMED_KUBERNETES_VERSION/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
apt-get update

# Check actual version: https://github.com/kubernetes/kubernetes/releases
KUBERNETES_VERSION=1.27.3 # https://kubernetes.io/releases/#release-history

apt-get install -y kubelet=$KUBERNETES_VERSION-1.1 kubeadm=$KUBERNETES_VERSION-1.1 kubectl=$KUBERNETES_VERSION-1.1 bash-completion
apt-mark hold kubelet kubectl kubeadm
Expand Down

0 comments on commit ed74184

Please sign in to comment.