feat(chart): expose automountServiceAccountToken and extra volumes - #461
Conversation
The chart never rendered automountServiceAccountToken, so several Gatekeeper policies reject the workload for leaving it to the cluster default rather than setting it explicitly. There was also no way to add volumes, which is what you need to run without an automounted token. Renders serviceAccount.automountServiceAccountToken on both the ServiceAccount and the pod spec, and adds extraVolumes and extraVolumeMounts. Default stays true so nothing changes for existing installs. Turning it off on its own is not enough to keep the controller working. It authenticates with rest.InClusterConfig(), which wants token, ca.crt and namespace under /var/run/secrets/kubernetes.io/serviceaccount, so all three have to come back through a projected volume. values.yaml carries that example rather than leaving people to work it out. Signed-off-by: tejassinghbhati <tejassinghbhati077@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tejassinghbhati The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for node-readiness-controller canceled.
|
|
Hi @tejassinghbhati. 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 Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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-sigs/prow repository. |
Description
Implements #442.
The chart never rendered
automountServiceAccountToken, so Gatekeeper policies that require it to be set explicitly reject the workload for leaving it to the cluster default. There was also no way to add volumes, which is exactly what you need in order to run without an automounted token.This renders
serviceAccount.automountServiceAccountTokenon both the ServiceAccount and the pod spec, and addsextraVolumes/extraVolumeMounts. The default staystrue, so nothing changes for existing installs.Worth being explicit about one thing, because turning the flag off on its own leaves you with a controller that cannot reach the API server. It authenticates through
rest.InClusterConfig(), which needstoken,ca.crtandnamespaceunder/var/run/secrets/kubernetes.io/serviceaccount. Disabling the automount removes all three, so they have to come back via a projected volume. Rather than leave that to be rediscovered,values.yamlcarries the full working example inline.Related Issue
Fixes #442
Type of Change
/kind feature
Testing
New
automount_test.yamlsuite. Chart tests go from 37 to 43, all green, andhelm lintis clean.The suite covers the default on both objects, the explicit
falsecase, extra volumes and mounts being wired through, and one case that seemed worth pinning: the chart already mounts webhook and metrics certificates, so it asserts those survive alongside the extra entries rather than being replaced.I also rendered the exact configuration from the issue end to end:
One test assertion I got wrong first time, mentioning it since it is mildly surprising:
volumes:is rendered unconditionally by the template, so on a default install the key exists with nothing under it rather than being absent. The test usesisNullOrEmptyinstead ofisNull.Checklist
make testpassesmake lintpassesDoes this PR introduce a user-facing change?