-
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
Allow opt-out of service account token automounting #3983
Allow opt-out of service account token automounting #3983
Conversation
Welcome @gilles-gosuin! |
Hi @gilles-gosuin. 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. |
Hello @gilles-gosuin, Thanks for taking the time to open this PR. It's a good idea to disable But, on |
I can't see a use for this as Metrics Server needs the service account token to function correctly. |
Our use case is simple: we have corporate policies that mandate that the service account token automounting feature be disabled. In order for external-dns to function properly, Helm users who disable automounting should manually mount the token in containers that need it using the |
@gilles-gosuin are you referring to ServiceAccount token volume projection? |
I am indeed |
@gilles-gosuin I can see the value in this for the ServiceAccount but I'm not convinced we need to support it on the Deployment given that we expect SA to Deployment to be a 1-2-1 relationship. Also the key checking pattern is overkill for a boolean where we expect a specific behaviour. I think the value can be set to |
To put it all in context, I'm requesting this feature because Azure Defender checks for the flag on the Deployment and creates a Security Recommendation if it is not set to false. It does not check for the flag on the ServiceAccount that is assigned to the Pod. Having the possibility to set that flag in the Deployment would allow us to have a Defender-compliant external-dns simply by updating the Helm values.
That's the approach I initially took, then I realized it might not be backward-compatible in some "extreme" cases. You could have for instance, someone who's facing the same issue as I am (corporate policies mandating automounting to be turned off) and who embarked on writing a webhook to handle this on the fly. eg. if the flag is not set, set it to false and mount the token manually. |
@gilles-gosuin fair enough on the reason to support it on the Deployment, although it does seem a lot like security theater. On the implementation side, the value key should be present and I can't see a reason why it can't be explicitly set. Alternatively the value key could be left empty and a |
It sure does indeed (and it sure is...)
Unfortunately, the default assumed by k8s is I explained the reason why it might be problematic if a default is set in the Chart's values.yaml:
Forcing a default value (which could only be |
@gilles-gosuin good point about the |
So if I understand correctly:
Is that what you have in mind? |
/ok-to-test |
I added the default (empty) values for both flags and kept the "hasKey" checks in the templates, as I can't think of a more idiomatic way of doing what's required by the specs you described. |
/lgtm |
/lgtm |
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.
@gilles-gosuin could you please add an entry to the CHANGELOG for this PR.
/label tide/merge-method-squash
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 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 |
Description
Two new Helm values have been introduced:
automountServiceAccountToken
andserviceAccount.automountServiceAccountToken
.The values have been willingly left commented out in the default values file and the template won't output anything if the value is not explicitly set, so that existing manifests are left unchanged. Opting out of the feature (or explicitly enabling it) requires the chart user to add the values in their values file.
Fixes #3982
Checklist