-
Notifications
You must be signed in to change notification settings - Fork 82
Implement AuthN and K8S ServiceAccount DockerFile Keychain support #387
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
base: release-v1.0
Are you sure you want to change the base?
Conversation
9d9b7bd to
fbf223a
Compare
9c83b4f to
4abc60a
Compare
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.
Pull request overview
This PR implements a major refactoring to support Kubernetes-native authentication via ServiceAccount ImagePullSecrets and go-containerregistry's AuthN libraries. The changes replace the previous host-based client selection with a factory pattern and introduce keychain-based credential management.
Key changes:
- Introduces a new
keychainspackage for managing authentication via Pod/ServiceAccount credentials - Refactors client architecture from host-based to factory-based pattern
- Removes self-hosted and fallback clients in favor of OCI as the default
- Updates Helm charts to support
kubernetes.io/dockerconfigjsonsecret format
Reviewed changes
Copilot reviewed 80 out of 81 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/keychains/* | New package implementing Manager interface for Pod, ServiceAccount, and Manual credential modes |
| pkg/client/clientmanager.go | New client manager with factory-based client instantiation and keychain resolution |
| pkg/client/*/factory.go | Factory implementations for each registry client type |
| pkg/api/types.go | Updated ImageClient interface, added ImageClientFactory interface |
| pkg/controller/pod_controller.go | Updated to use ClientManager instead of Client |
| cmd/app/options.go | Added keychain flags and deprecated old auth flags |
| deploy/charts/version-checker/* | Updated Helm templates for new secret format and imagePullSecrets support |
| Dockerfile | Minor build optimization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| -}} | ||
| {{- $_ := set $auths $registry $entry }} | ||
| {{- else }} | ||
| {{- fail (printf "dockerconfigjson entry missing required fields: %#v" .) }} |
Copilot
AI
Dec 9, 2025
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 fail call here includes the entire pullSecrets entry in the error message using %#v, which will print sensitive fields like password or token to Helm output and any associated CI/CD logs. An attacker or unintended party with access to deployment logs could recover registry credentials if a misconfigured entry triggers this branch. To fix this, avoid logging secret values (only mention which field is missing or the entry index) and remove or redact sensitive fields from the formatted error message.
| {{- fail (printf "dockerconfigjson entry missing required fields: %#v" .) }} | |
| {{- $missing := list }} | |
| {{- if not $registry }}{{- $missing = append $missing "registry" }}{{- end }} | |
| {{- if not $username }}{{- $missing = append $missing "username" }}{{- end }} | |
| {{- if not $secret }}{{- $missing = append $missing (ternary "token or password" "password" (ne $token "")) }}{{- end }} | |
| {{- fail (printf "dockerconfigjson entry for registry '%s' is missing required field(s): %s" (default "<unknown>" $registry) (join $missing ", ")) }} |
This implements the go-containerregistry AuthN Libraries to support fetching and updating credentials from ServiceAccount ImagePullSecrets along with additional
kubernetes.io/dockerconfigjsonsecrets.There are significant breaking changes here:
docker/distributionAPI.A few things outstanding:
And some more, that I've likely forgotten 🙈
Resolves #322