Skip to content
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

Add ecr-cred-injector #978

Merged
merged 1 commit into from
Sep 12, 2023
Merged

Conversation

d8660091
Copy link
Member

@d8660091 d8660091 commented Sep 11, 2023

Issue #, if available:

Description of changes: This change will allow packages controller to be able to pull charts from private ECR. It injects the credential(username:password) to the docker config file of the package controller container.

Manually tested that the injector works for regional ECR

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot eks-distro-bot added approved size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 11, 2023
@d8660091 d8660091 force-pushed the ecr-cred-injector branch 4 times, most recently from 9e9e04f to 56a3636 Compare September 11, 2023 19:57
pkg/registry/ecr_cred_injector.go Show resolved Hide resolved
pkg/registry/ecr_cred_injector.go Outdated Show resolved Hide resolved
FROM gcr.io/distroless/static:debug-nonroot
WORKDIR /
COPY --from=builder /workspace/ecr-token-refresh .
USER 65532:65532
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comment where this group/user number comes from?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea

}

if !IsECRRegistry(registry) {
a.log.Info("defaultRegistry is not ECR registry, skip injecting credential to docker config")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we missing a return here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good caught

pkg/registry/ecr_cred_injector.go Show resolved Hide resolved
@@ -146,6 +148,10 @@ spec:
defaultMode: 420
secretName: ecr-token
optional: true
- name: aws-secret
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about aws-config-secret? or is aws-secret the convention elsewhere?

checking my understanding: we can't use the existing ecr-token secret here because we don't have control over its renewal lifecycle?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"aws-secret" contains a field called "config", calling it "aws-config-secret" may imply that the volume is the "config" of "aws-secret".

ecr-token stores "username:password", it's not refreshed anymore perhaps because we have migrated to use credential-provider.

Copy link
Member

@jonathanmeier5 jonathanmeier5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: d8660091, jonathanmeier5

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:
  • OWNERS [d8660091,jonathanmeier5]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@eks-distro-bot eks-distro-bot merged commit c6330bc into aws:main Sep 12, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants