Skip to content

Commit faedf25

Browse files
Merge pull request #4726 from praveenkumar/issue_5531
USHIFT-5531: Auto-rebase procedure with flannel and kube-proxy image update
2 parents 595c807 + df1f76d commit faedf25

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

scripts/auto-rebase/rebase.sh

+39
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@ EOF
802802

803803
update_olm_images
804804
update_multus_images
805+
update_kubeproxy_images
805806

806807
popd >/dev/null
807808
}
@@ -1104,6 +1105,44 @@ EOF
11041105
done # for goarch
11051106
}
11061107

1108+
update_kubeproxy_images() {
1109+
title "Rebasing kube-proxy images"
1110+
1111+
for goarch in amd64 arm64; do
1112+
arch=${GOARCH_TO_UNAME_MAP["${goarch}"]:-noarch}
1113+
1114+
local release_file="${STAGING_DIR}/release_${goarch}.json"
1115+
local kustomization_arch_file="${REPOROOT}/assets/optional/kube-proxy/kustomization.${arch}.yaml"
1116+
local kubeproxy_release_json="${REPOROOT}/assets/optional/kube-proxy/release-kube-proxy-${arch}.json"
1117+
1118+
local base_release
1119+
base_release=$(jq -r ".metadata.version" "${release_file}")
1120+
jq -n "{\"release\": {\"base\": \"$base_release\"}, \"images\": {}}" > "${kubeproxy_release_json}"
1121+
1122+
# Create extra kustomization for each arch in separate file.
1123+
# Right file (depending on arch) should be appended during rpmbuild to kustomization.yaml.
1124+
cat <<EOF > "${kustomization_arch_file}"
1125+
1126+
images:
1127+
EOF
1128+
1129+
for container in kube-proxy; do
1130+
local new_image
1131+
new_image=$(jq -r ".references.spec.tags[] | select(.name == \"${container}\") | .from.name" "${release_file}")
1132+
local new_image_name="${new_image%@*}"
1133+
local new_image_digest="${new_image#*@}"
1134+
1135+
cat <<EOF >> "${kustomization_arch_file}"
1136+
- name: ${container}
1137+
newName: ${new_image_name}
1138+
digest: ${new_image_digest}
1139+
EOF
1140+
1141+
yq -i -o json ".images += {\"${container}\": \"${new_image}\"}" "${kubeproxy_release_json}"
1142+
done # for container
1143+
done # for goarch
1144+
}
1145+
11071146
check_for_manifests_changes() {
11081147
# Changes to ignore:
11091148
# - `release-$ARCH.json` files

0 commit comments

Comments
 (0)