-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
helm: support initContainers #3838
Conversation
Signed-off-by: Calvin Bui <[email protected]>
Welcome @calvinbui! |
Hi @calvinbui. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: Calvin Bui <[email protected]>
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 this PR.
At first, I was thinking about asking to add tests but ... there is no tests in external-dns
chart FTM.
@calvinbui thanks for the PR, could you update the README to add the new |
Signed-off-by: Calvin Bui <[email protected]>
Forgot about that! Added. Yes, I have tested templating with the initContainers value. |
@@ -54,6 +54,10 @@ spec: | |||
{{- with .Values.dnsPolicy }} | |||
dnsPolicy: {{ . }} | |||
{{- end }} | |||
{{- with .Values.initContainers }} | |||
initContainers: | |||
{{- toYaml . | nindent 8 }} |
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.
{{- toYaml . | nindent 8 }} | |
{{- tpl (toYaml .) . | nindent 8 }} |
By using tpl
, it will allow to use {{ include "external-dns.image" . }}
in the values
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've never seen any templating possible through values?
it doesn't work for me:
initContainers:
- name: init-jitter
image: {{ include "external-dns.image" . }}
command:
- /bin/sh
- -c
- 'FOR=$((RANDOM % 10))s;echo "Sleeping for $FOR";sleep $FOR'
Error: cannot load values.yaml: error converting YAML to JSON: yaml: invalid map key: map[interface {}]interface {}{"include \"external-dns.image\" .":interface {}(nil)}
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.
@mloiseleur that would be incorrect, tpl
shouldn't be used like this. If you want tpl
support you'd need to support init containers as either a string or an array and only template when it's been provided as a string. I'd prefer this to stay as it is.
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.
@calvinbui It has been done on Traefik Helm Chart, see this PR for instance.
@stevehipwell I understand. It's ok for me.
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.
@mloiseleur this is a well known anti-pattern that looks like it should work, works in very simple scenarios but fails hard for anything more complex. To prove this attempt to use the selector labels template for traefik affinity match labels and you will see what I mean.
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.
Yes, you're right.
/ok-to-test |
@calvinbui The CI has been fixed with #3829. If you rebase this PR, CI should be able to pass as expected. |
/test pull-external-dns-lint |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: calvinbui, mloiseleur, stevehipwell The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
Description
Support initContainers on Helm chart
Fixes #3830
Checklist