-
Notifications
You must be signed in to change notification settings - Fork 40.2k
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
Appended OS's environment variables to the ones configured in Credent… #103231
Appended OS's environment variables to the ones configured in Credent… #103231
Conversation
Hi @n4j. Thanks for your PR. I'm waiting for a kubernetes 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. |
/ok-to-test |
/sig node |
/test pull-kubernetes-integration |
@n4j: The label In response to this:
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. |
@thockin @smarterclayton Can anyone of you guys review this PR? |
@adisky Can you accept the triage on this PR? |
/priority important-soon |
/triage accepted |
/test pull-kubernetes-e2e-kind-ipv6 |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, n4j 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 |
@liggitt How do I get this merged in |
this can wait until master reopens for 1.23, and be picked to release-1.22 for 1.22.1 if needed |
/test all |
/meow caturday |
@n4j: In response to this:
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. |
/retest |
/test all |
/retest |
mergedEnvVars := sysEnvVars | ||
for _, credProviderVar := range credProviderVars { | ||
mergedEnvVars = append(mergedEnvVars, credProviderVar) | ||
} | ||
return mergedEnvVars |
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 effectively
return append(sysEnvVars, credProviderVars...)
I don't think we need a separate method to accomplish the same thing as the built-in append
method.
var configEnvVars []string | ||
for _, v := range e.envVars { | ||
configEnvVars = append(configEnvVars, fmt.Sprintf("%s=%s", v.Name, v.Value)) | ||
} | ||
|
||
// Append current system environment variables, to the ones configured in the | ||
// credential provider file. Failing to do so may result in unsuccessful execution | ||
// of the provider binary, see https://github.com/kubernetes/kubernetes/issues/102750 | ||
// also, this behaviour is inline with Credential Provider Config spec | ||
cmd.Env = mergeEnvVars(e.environ(), configEnvVars) |
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 unit test is only exercising mergeEnvVars, not the inputs to it given the environ()
and e.envVars
values.
Computing the env like this:
cmd.Env = e.computeEnv()
would let us put the entire implementation calling environ()
call and appending e.envVars
in a unit testable location.
@liggitt Since this PR was approved and the branch for Thoughts? |
Sure, a follow up is fine |
I'm having a hard time following the breadcrumbs here - did this ever get cleaned up and/or backported to 1.21 and 1.22? |
yeah, this is only resolved in 1.23 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
According to the behaviour described in the
kubelete-credential-provider
documentation, the environment variables provided in the config file should be appended with the OS env vars.However, this seems to be a missed out case and credential providers may fail to execute if
$PATH
and$HOME
are missing.This bug was verified for
ecr-credential-provider
Which issue(s) this PR fixes:
Fixes #102750
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: