-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address #321: Finegrained repo location patching.
So we copy the capi knowledge of whether kube-proxy is at the old location (k8s.gcr.io) or at the new one (registry.k8s.io). As the logic became somewhat involed, split it out into a separate script that can be tested more easily. Signed-off-by: Kurt Garloff <[email protected]>
- Loading branch information
Showing
2 changed files
with
21 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
# fixup_k8s_version.sh | ||
# Patch $2 (cluster-template.yaml) with fixed up k8s imageRepo if needed | ||
# This is to find old kube-proxy images on k8s.gcr.io and new ones on registry.k8s.io | ||
# See https://github.com/kubernetes-sigs/cluster-api/blob/main/internal/util/kubeadm/kubeadm.go#L40 | ||
# (c) Kurt Garloff, Roman Hros, 02/2023 | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if test -z "$2"; then echo "ERROR: Need clusterctl.yaml cluster-template args" 1>&2; exit 1; fi | ||
K8SVER=$(grep '^KUBERNETES_VERSION:' "$1" | sed 's/^KUBERNETES_VERSION: v\([0-9.]*\)/\1/') | ||
K8SMINOR=${K8SVER#*.} | ||
K8SVER=${K8SVER%%.*}${K8SMINOR%%.*}$(printf %02i 0${K8SVER##*.}) | ||
echo $K8SVER | ||
if grep 'k8s\.gcr\.io' "$2" >/dev/null 2>&1; then | ||
if test "$K8SVER" -ge 12409 \ | ||
|| test "$K8SVER" -lt 12400 -a "$K8SVER" -ge 12315 \ | ||
|| test "$K8SVER" -lt 12300 -a "$K8SVER" -ge 12217; then | ||
sed -i 's/k8s\.gcr\.io/registry.k8s.io/g' "$2" | ||
fi | ||
fi |