-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Expose secret keys in environment variables #18298
Conversation
Labelling this PR as size/L |
GCE e2e test build/test passed for commit 359c29429d89106f438c0b3ce917c215ec237ecd. |
// Selects a field of the pod; only name and namespace are supported. | ||
FieldRef *ObjectFieldSelector `json:"fieldRef,omitempty"` | ||
// Selects a key of a secret in the pod's namespace | ||
SecretKeyRef *SecretKeySelector `json:"secretKeyRef,omitempty"` |
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 assume once we have configData, there will be a 3rd line? Seems fine.
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.
correct
Should there be a validation that only one of the valueFrom options is non-nil? |
Seems like @bgrant0607 agreed with this approach in #4710. |
@erictune everything you pointed out i realized was a shortcoming of this PR after I started building another PR on top of it. I'll update w/ your feedback today. |
return result, err | ||
} | ||
case envVar.ValueFrom.SecretKeyRef != nil: | ||
runtimeVal, err = kl.secretKeySelectorRuntimeValue(envVar.ValueFrom.SecretKeyRef, pod) |
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.
it will probably be likely to use the same secret multiple times in a single pod (multiple keys, or one key in multiple containers)... pass something to secretKeySelectorRuntimeValue to let it avoid looking up the same secret multiple times per pod?
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.
doable, i will incorporate in my next pass through this code
// SecretKeySelector selects a key of a Secret. | ||
type SecretKeySelector struct { | ||
// The name of the secret in the pod's namespace to select from. | ||
SecretRef LocalObjectReference `json:"secretRef"` |
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.
You could consider inlining LocalObjectReference.
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.
Which you do in #18974
Are you planning to rework this to be more like #18974 or should I review now? |
@erictune Okay, PR is re-cut and ready for review, PTAL. |
Actually, @erictune, I realize there is still an unhandled feedback item on this PR from you that I need to do. |
GCE e2e test build/test passed for commit 394a7bb. |
GCE e2e test build/test passed for commit 60cf252. |
lgtm |
@k8s-bot unit test this please |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit 60cf252. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
Fixes #4710. @erictune @thockin
cc @resouer
cc @bgrant0607 for API changes