-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Templatize helm template image references #20066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Templatize helm template image references #20066
Conversation
90ce1c7
to
ba5a725
Compare
OPERATOR_ALIBABACLOUD_DIGEST := "" | ||
OPERATOR_GENERIC_DIGEST := "" | ||
OPERATOR_DIGEST := "" | ||
export CILIUM_DIGEST := "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative to all this exporting is to just blanket export all variables to subshells via .EXPORT_ALL_VARIABLES
as a Special Target, but I wasn't sure if that might cause other issues since I don't know if that's scoped only to this Makefile or whether it could end up exporting other vars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm just one question about phony target. this is much cleaner 🚢
ba5a725
to
8976587
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tidying up the Makefiles, and fixing the defaults with "-ci" image tags.
# File generated by install/kubernetes/Makefile; DO NOT EDIT. | ||
# This file is based on install/kubernetes/cilium/values.yaml.tmpl. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How was this file generated? Helm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's generated using envsubst
. Maybe I could have described this better in the PR description. Broadly what this PR does is it adds a bunch of exported variables in install/kubernetes/Makefile.values
, then runs envsubst which takes in the values.yaml.tmpl
on stdin plus the environment variables, then substitutes all of the variables in the template and writes out to this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ I expanded the PR description to help explain this, hopefully that makes sense now.
$(ECHO_GEN)$@ | ||
echo -e "# File generated by $(RELATIVE_DIR)/Makefile; DO NOT EDIT." > $@ | ||
echo -e "# This file is based on $(RELATIVE_DIR)/cilium/values.yaml.tmpl.\n" >> $@ | ||
envsubst < $< >> $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the magic line, basically take $<
(the template file, first dependency in the list) as stdin to envsubst
, which also takes the exported environment variables as inputs, then redirect the output to $@
(the target values.yaml
file).
0c0bba3
to
bed5b6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @joestringer! Couple of comments but overall LGTM.
On the CI side, test-smoke.yaml
should detect changes to values.yaml.tmpl
without a corresponding values.yaml
update:
cilium/.github/workflows/tests-smoke.yaml
Lines 96 to 99 in 9580ea3
- name: Run helm-charts | |
run: | | |
make -C install/kubernetes | |
test -z "$(git status --porcelain)" || (echo "please run 'make -C install/kubernetes' and submit your changes"; exit 1) |
Looking at this workflow, "Run helm-docs" seems extraneous because "Run helm-charts" execute make -C install/kubernetes
and the default all
target has the docs
target as dependency. As this is kind of related to this PR, would you mind adding a commit to fix this (either remove "Run helm-docs" or make "Run helm-charts" execute the update-versions
target)? Happy to open another PR if you prefer.
bed5b6b
to
d6203ec
Compare
Addressed @kaworu's feedback, mainly with two new commits on top. Should reduce the amount of duplicate work on the tests-smoke.yaml GHA linting side, and properly track dependencies as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have only reviewed the changes falling under my codeowners, but LGTM.
d6203ec
to
7fc4299
Compare
Default these helm templates to install the latest version from the tip of master, for easy development. Signed-off-by: Joe Stringer <joe@cilium.io>
Signed-off-by: Joe Stringer <joe@cilium.io>
Split up the variables used here for better readability, and add the V=0 quiet line to indicate progress in the way the other targets do. Signed-off-by: Joe Stringer <joe@cilium.io>
The 'docs' target under install/kubernetes is already run by the 'helm-charts' step via the 'all' make target. Given some of the recent re-organizing, we should probably just add linting to the overall steps in the makefile and run all of the targets. This should avoid running these targets twice: * 2x Run cilium/values.yaml generation (via lint, all targets) * 2x Run docs (via docs, all targets) Suggested-by: Alexandre Perrin <alex@isovalent.com> Signed-off-by: Joe Stringer <joe@cilium.io>
Previously this script wouldn't work when invoked on the master branch via `make -C install/kubernetes check-docker-images`, because the script expected some images to be present on dockerhub when we don't keep them up to date there (startup-script, cilium-etcd-operator), and also because the tree specifies the image tag as "latest" which are only published on the quay.io/cilium/*-ci repositories. Teach the script to pick up the correct set of image dependencies to handle these cases. Signed-off-by: Joe Stringer <joe@cilium.io>
3bd8dc9
to
bab8e48
Compare
Following up on #20066, templatize preflight and clustermesh-apiserver repos. Signed-off-by: Michi Mutsuzaki <michi@isovalent.com>
Following up on #20066, templatize preflight and clustermesh-apiserver repos. Signed-off-by: Michi Mutsuzaki <michi@isovalent.com>
From the main commit:
Broadly this PR moves the
install/kubernetes/cilium/values.yaml
toinstall/kubernetes/cilium/values.yaml.tmpl
as the source of truth. This new values file template has variables wherever the docker repositories and tags are.Inside the Makefiles, we declare the repos/tags as variables, then when we run
envsubst
against theinstall/kubernetes/cilium/values.yaml.tmpl
, it substitutes the variables into the template and generates the final outputinstall/kubernetes/cilium/values.yaml
file.This looks like a big change (~2KLoC), but most of it is just making a copy of
install/kubernetes/values.yaml
in order to templatize it. Review commit-by-commit to see incremental changes.This PR also fixes the default helm in the master branch to point towards
quay.io/cilium/cilium-ci:latest
so that you can install directly from the repo. When we branch for the next release, we will update the repo and tag to point to the branch instead and then the helm charts should work for that target development branch.You can also override these default settings by making your own copy of
install/kubernetes/Makefile.values
and then running this withMAKEFILE_VALUES=/path/to/my/values.mk make -C install/kubernetes
.