Skip to content

Commit c90956d

Browse files
committed
rebase: Add logic to update kube-proxy images
1 parent 06f9841 commit c90956d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Diff for: scripts/auto-rebase/rebase.sh

+39
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ EOF
816816

817817
update_olm_images
818818
update_multus_images
819+
update_kubeproxy_images
819820

820821
popd >/dev/null
821822
}
@@ -1118,6 +1119,44 @@ EOF
11181119
done # for goarch
11191120
}
11201121

1122+
update_kubeproxy_images() {
1123+
title "Rebasing kube-proxy images"
1124+
1125+
for goarch in amd64 arm64; do
1126+
arch=${GOARCH_TO_UNAME_MAP["${goarch}"]:-noarch}
1127+
1128+
local release_file="${STAGING_DIR}/release_${goarch}.json"
1129+
local kustomization_arch_file="${REPOROOT}/assets/optional/kube-proxy/kustomization.${arch}.yaml"
1130+
local kubeproxy_release_json="${REPOROOT}/assets/optional/kube-proxy/release-kube-proxy-${arch}.json"
1131+
1132+
local base_release
1133+
base_release=$(jq -r ".metadata.version" "${release_file}")
1134+
jq -n "{\"release\": {\"base\": \"$base_release\"}, \"images\": {}}" > "${kubeproxy_release_json}"
1135+
1136+
# Create extra kustomization for each arch in separate file.
1137+
# Right file (depending on arch) should be appended during rpmbuild to kustomization.yaml.
1138+
cat <<EOF > "${kustomization_arch_file}"
1139+
1140+
images:
1141+
EOF
1142+
1143+
for container in kube-proxy; do
1144+
local new_image
1145+
new_image=$(jq -r ".references.spec.tags[] | select(.name == \"${container}\") | .from.name" "${release_file}")
1146+
local new_image_name="${new_image%@*}"
1147+
local new_image_digest="${new_image#*@}"
1148+
1149+
cat <<EOF >> "${kustomization_arch_file}"
1150+
- name: ${container}
1151+
newName: ${new_image_name}
1152+
digest: ${new_image_digest}
1153+
EOF
1154+
1155+
yq -i -o json ".images += {\"${container}\": \"${new_image}\"}" "${kubeproxy_release_json}"
1156+
done # for container
1157+
done # for goarch
1158+
}
1159+
11211160
check_for_manifests_changes() {
11221161
# Changes to ignore:
11231162
# - `release-$ARCH.json` files

0 commit comments

Comments
 (0)