Skip to content

Commit bb274a3

Browse files
weizhoubluesayboras
authored andcommitted
chart: define the image variable in the makefile
[ upstream commit fa3cf34 ] Signed-off-by: [email protected] <[email protected]> Signed-off-by: Tam Mach <[email protected]>
1 parent 718d17d commit bb274a3

File tree

4 files changed

+29
-20
lines changed

4 files changed

+29
-20
lines changed

images/scripts/check-cilium-envoy-image.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ root_dir="$(git rev-parse --show-toplevel)"
1212

1313
cd "${root_dir}"
1414

15-
image="quay.io/cilium/cilium-envoy"
16-
image_tag="$(yq '.envoy.image.tag' ./install/kubernetes/cilium/values.yaml.tmpl)"
17-
image_sha256="$(yq '.envoy.image.digest' ./install/kubernetes/cilium/values.yaml.tmpl)"
15+
image="$(yq '.envoy.image.repository' ./install/kubernetes/cilium/values.yaml)"
16+
image_tag="$(yq '.envoy.image.tag' ./install/kubernetes/cilium/values.yaml)"
17+
image_sha256="$(yq '.envoy.image.digest' ./install/kubernetes/cilium/values.yaml)"
1818

19-
sed -i -E "s|(FROM ${image}:)(.*)(@sha256:[0-9a-z]*)( as cilium-envoy)|\1${image_tag}@${image_sha256}\4|" ./images/cilium/Dockerfile
19+
# pre-check for sed, in case that this script may fail to detect change when the `sed` command fails to replace the string and return code 0
20+
image_regular="(FROM ${image}:)(.*)(@sha256:[0-9a-z]*)( as cilium-envoy)"
21+
grep -E "${image_regular}" ./images/cilium/Dockerfile &>/dev/null || exit 1
22+
sed -i -E "s|${image_regular}|\1${image_tag}@${image_sha256}\4|" ./images/cilium/Dockerfile
2023

2124
echo "Checking for different Cilium Envoy images"
2225
git diff --exit-code ./images/cilium/Dockerfile

images/scripts/update-cilium-envoy-image.sh

+14-13
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ github_repo="cilium/proxy"
1717
github_branch="main"
1818
image="quay.io/cilium/cilium-envoy"
1919

20-
latest_commit_sha="$(curl -s https://api.github.com/repos/${github_repo}/commits/${github_branch} | jq -r '.sha')"
20+
latest_commit_sha="$(curl -s https://api.github.com/repos/${github_repo}/commits/${github_branch} | jq -r --exit-status '.sha')"
2121
envoy_version="$(curl -s https://raw.githubusercontent.com/${github_repo}/"${latest_commit_sha}"/ENVOY_VERSION)"
2222

2323
image_tag="${envoy_version//envoy-/v}-${latest_commit_sha}"
@@ -30,17 +30,18 @@ fi
3030

3131
echo "Latest image from branch ${github_branch}: ${image_full}"
3232

33-
echo "Updating image in ./images/cilium/Dockerfile"
34-
sed -i -E "s|(FROM ${image}:)(.*)(@sha256:[0-9a-z]*)( as cilium-envoy)|\1${image_tag}@${image_sha256}\4|" ./images/cilium/Dockerfile
33+
DOCKERFILEPATH="./images/cilium/Dockerfile"
34+
echo "Updating image in ${DOCKERFILEPATH}"
35+
sed -i -E "s|(FROM ${image}:)(.*)(@sha256:[0-9a-z]*)( as cilium-envoy)|\1${image_tag}@${image_sha256}\4|" ${DOCKERFILEPATH}
3536

36-
echo "Updating image in ./install/kubernetes/cilium/values.yaml.tmpl"
37-
# Using tr to workaround matching the multiline regex with sed
38-
# yq would change formatting: https://github.com/mikefarah/yq/issues/465
39-
# use of envoy.image.override (which would allow match in one line) isn't optimal either
40-
< ./install/kubernetes/cilium/values.yaml.tmpl tr '\n' '\f' |
41-
sed -E "s|(# -- Envoy container image\..*tag: \")(v[0-9a-zA-Z\.-]*)(\")|\1${image_tag}\3|" |
42-
sed -E "s|(# -- Envoy container image\..*digest: \")(sha256:[0-9a-z]*)(\")|\1${image_sha256}\3|" |
43-
tr '\f' '\n' > ./install/kubernetes/cilium/values.yaml.tmpl_tmp &&
44-
mv ./install/kubernetes/cilium/values.yaml.tmpl_tmp ./install/kubernetes/cilium/values.yaml.tmpl
37+
MAKEFILEPATH="./install/kubernetes/Makefile.values"
38+
echo "Updating image in ${MAKEFILEPATH}"
39+
sed -i -E "s|export[[:space:]]+CILIUM_ENVOY_VERSION:=.*|export CILIUM_ENVOY_VERSION:=${image_tag}|" ${MAKEFILEPATH}
40+
sed -i -E "s|export[[:space:]]+CILIUM_ENVOY_DIGEST:=.*|export CILIUM_ENVOY_DIGEST:=${image_sha256}|" ${MAKEFILEPATH}
4541

46-
echo "Please don't forget to execute 'make -C Documentation update-helm-values && make -C install/kubernetes'"
42+
if git diff --exit-code ./install/kubernetes/Makefile.values ./images/cilium/Dockerfile &>/dev/null ; then
43+
echo "The envoy image is already up to date"
44+
else
45+
echo "Updated the envoy image to be a latest version"
46+
echo "Please don't forget to execute 'make -C Documentation update-helm-values && make -C install/kubernetes'"
47+
fi

install/kubernetes/Makefile.values

+5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ export CILIUM_NODEINIT_REPO:=quay.io/cilium/startup-script
4949
export CILIUM_NODEINIT_VERSION:=c54c7edeab7fde4da68e59acd319ab24af242c3f
5050
export CILIUM_NODEINIT_DIGEST:=sha256:8d7b41c4ca45860254b3c19e20210462ef89479bb6331d6760c4e609d651b29c
5151

52+
# renovate: datasource=docker
53+
export CILIUM_ENVOY_REPO:=quay.io/cilium/cilium-envoy
54+
export CILIUM_ENVOY_VERSION:=v1.29.9-1726784081-a90146d13b4cd7d168d573396ccf2b3db5a3b047
55+
export CILIUM_ENVOY_DIGEST:=sha256:9762041c3760de226a8b00cc12f27dacc28b7691ea926748f9b5c18862db503f
56+
5257
# renovate: datasource=docker
5358
export ETCD_REPO:=quay.io/coreos/etcd
5459
export ETCD_VERSION:=v3.5.4

install/kubernetes/cilium/values.yaml.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -1857,10 +1857,10 @@ envoy:
18571857
# -- Envoy container image.
18581858
image:
18591859
override: ~
1860-
repository: "quay.io/cilium/cilium-envoy"
1861-
tag: "v1.29.9-1726784081-a90146d13b4cd7d168d573396ccf2b3db5a3b047"
1860+
repository: "${CILIUM_ENVOY_REPO}"
1861+
tag: "${CILIUM_ENVOY_VERSION}"
18621862
pullPolicy: "${PULL_POLICY}"
1863-
digest: "sha256:9762041c3760de226a8b00cc12f27dacc28b7691ea926748f9b5c18862db503f"
1863+
digest: "${CILIUM_ENVOY_DIGEST}"
18641864
useDigest: true
18651865

18661866
# -- Additional containers added to the cilium Envoy DaemonSet.

0 commit comments

Comments
 (0)