-
Notifications
You must be signed in to change notification settings - Fork 527
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
Create a k8schain directly from pull secrets #1049
Conversation
The k8schain package creates a new keychain by resolving Kubernets secrets from service accounts and other image pull secrets specified by name. The k8s client gets the full secret content for these named resources. Sometimes it's desirable to pull the content of a secret from a cache, or to watch a resource for changes in a controller. In this situation it would be helpful to create a k8schain directly from resolved secrets, without making calls to the k8s api server. This change refactors the existing k8schain.New() method to separate the resolution of secrets from the creation of the keychain. This is only a refactoring of existing behavior to shortcut the k8s api lookups. There is no change in existing behavior for the keychain. Added: k8schain.NewFromPullSecrets(context.Context, []corev1.Secret) (authn.Keychain, error) Signed-off-by: Scott Andrews <andrewssc@vmware.com>
}) | ||
|
||
// Extend the default keyring with the pull secrets. | ||
kr, err := credentialprovidersecrets.MakeDockerKeyring(pullSecrets, keyring) |
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're okay with the default keyring here being the magical NewDockerKeyring()
thing?
I'm starting to lean away from that (#1042) because it's caused problems (knative/serving#10259).
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.
My goal for this PR was to not change the current behavior. I agree with the spirit of #1042
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.
Thanks!
Codecov Report
@@ Coverage Diff @@
## main #1049 +/- ##
==========================================
+ Coverage 75.47% 75.50% +0.02%
==========================================
Files 107 107
Lines 5092 5094 +2
==========================================
+ Hits 3843 3846 +3
+ Misses 704 703 -1
Partials 545 545
Continue to review full report at Codecov.
|
Ah sorry, can you fix the fmt error? |
@jonjohnsonjr done |
The k8schain package creates a new keychain by resolving Kubernets
secrets from service accounts and other image pull secrets specified by
name. The k8s client gets the full secret content for these named
resources.
Sometimes it's desirable to pull the content of a secret from a cache,
or to watch a resource for changes in a controller. In this situation
it would be helpful to create a k8schain directly from resolved secrets,
without making calls to the k8s api server.
This change refactors the existing k8schain.New() method to separate the
resolution of secrets from the creation of the keychain. This is only a
refactoring of existing behavior to shortcut the k8s api lookups. There
is no change in existing behavior for the keychain.
Added:
Signed-off-by: Scott Andrews andrewssc@vmware.com