-
Notifications
You must be signed in to change notification settings - Fork 524
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
Enable environment variables for Kubernetes credential providers #2934
Conversation
@@ -11,8 +11,15 @@ providers: | |||
{{/each}} | |||
defaultCacheDuration: "{{default "12h" this.cache-duration}}" | |||
apiVersion: credentialprovider.kubelet.k8s.io/v1alpha1 | |||
{{#if (eq @key "ecr-credential-provider")}} | |||
{{#if (or (eq @key "ecr-credential-provider") this.env-variables)}} |
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.
😅
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.
Right?!
#[serde(rename_all = "kebab-case")] | ||
pub struct CredentialProvider { | ||
enabled: bool, | ||
image_patterns: Vec<SingleLineString>, | ||
cache_duration: Option<KubernetesDurationValue>, | ||
env_variables: Option<EnvVarMap>, |
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.
Probably doesn't matter here, but these will be randomly ordered when iterated for the config 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.
Yep, it shouldn't matter what order these come in as in the final rendering of the template. They all just end up being environment variables in the credential process.
I briefly considered using a BTreeMap
, but it ultimately doesn't matter.
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!
This adds the capability to provide environment variables that can be passed through to the Kubernetes credential provider configuration. Signed-off-by: Sean McGinnis <[email protected]>
4bb3562
to
2fcb890
Compare
Issue number:
Closes #2602
Description of changes:
This adds the capability to provide environment variables that can be passed through to the Kubernetes credential provider configuration.
This makes it possible to provide user data settings like:
and have that show up in the credential provider configuration file as:
Testing done:
Deployed node and verified launched successfully.
Ran:
Checked
kubelet
status and cat'd `/etc/kubernetes/kubelet/credential-provider-config.yaml to make sure it reflected normal (pre-this change) configuration.Ran:
Checked
kubelet
status and cat'd/etc/kubernetes/kubelet/credential-provider-config.yaml to see that it now contained the expected
env:` entries.On new clean nodes, tried specifying all settings at once, and only current settings with adding environment variables later to make sure there was proper handling for template generation in all cases.
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.