-
Couldn't load subscription status.
- Fork 596
Description
Describe the bug
The authn/kubernetes keychain currently reads both the .imagePullSecrets and .secrets associated with a ServiceAccount. While this is appropriate for image pull operations, it causes issues when the keychain is used for push operations.
Specifically, if:
.imagePullSecrets includes a read-only credential for a target registry, and
.secrets includes a different credential with write access for the same registry,
then the existing New function will consolidate both sets of secrets and return the first matching credential for the registry which is always the read-only one from .imagePullSecrets. This is because of the way secrets are appended in the current function while processing.
This results in push attempts failing despite appropriate write credentials being present in the ServiceAccount.
A option is needed to skip .imagePullSecrets when the keychain is being used for push operations.
To Reproduce
The Tekton Chains controller uses this library to determine the authentication required to push content to the user provided registry. Chains controller establishes auth only to push content using the ServiceAccount. Whenever the serviceAccount has .imagePullSecrets & .secrets targeting the same registry, push attempts by chains fails. For additional details please refer (issue)[https://github.com/tektoncd/chains/issues/1336]
Expected behavior
Add an option to ignore .imagePullSecrets when constructing the Kubernetes authn.Keychain, specifically for use cases involving image PUSH operations.
Additional context
- Registry used - Quay