Skip to content

Conversation

@fletcherw
Copy link
Contributor

@fletcherw fletcherw commented Oct 17, 2025

/kind bug

What this PR does / why we need it:
When ecr-credential-provider is configured to use ServiceAccountTokens for fetching ECR credentials, it should allow ignoring those credentials if the service account doesn't have the corresponding annotations.

Update the provider to try to use a ServiceAccountToken and fall back to standard local credentials otherwise.


Kind of related to #1264.

Does this PR introduce a user-facing change?

Changed ecr-credential-provider to fall back to using default credentials when a ServiceAccountToken is provided but there is no corresponding role ARN provided to assume. This should not cause changes for users using the default credential provider config.

When ecr-credential-provider is configured to use ServiceAccountTokens
for fetching ECR credentials, it should allow ignoring those credentials
if the service account doesn't have the corresponding annotations.

Update the provider to try to use a ServiceAccountToken and fall back to
standard local credentials otherwise.
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 17, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If cloud-provider-aws contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 17, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @fletcherw. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 17, 2025
Copy link

Choose a reason for hiding this comment

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

So far as I know, you can only assign 1 IAM role to a pod through IRSA. However, it's unclear whether SA token authentication requires IRSA. If the ecr-role-arn and role-arn have to be the same, then we should update this PR to only use role-arn as that is key that IRSA uses.

Copy link
Contributor Author

@fletcherw fletcherw Oct 21, 2025

Choose a reason for hiding this comment

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

I'm a little new to this but this is my understanding

Each pod has exactly one service account associated with it. By default, if you annotate that service account with eks.amazonaws.com/role-arn, the pod identity agent webhook will get a service account token for that node account, assume that role and pass those credentials into the pod's containers.

Separately, before a pod is created, if there is a CredentialProvider that has matchImages matching the image URL and that configures tokenAttributes, the kubelet will also create a Service Account token and pass that to the credential provider.

I don't see why the IAM role that the credential provider assumes would have to match the role that the pod identity webhook assumes, though I'm sure that for many people they will be the same.

Copy link
Member

Choose a reason for hiding this comment

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

i agree that we shouldn't force to use the same arn for application and the image.

@jicowan
Copy link

jicowan commented Oct 21, 2025 via email

@fletcherw
Copy link
Contributor Author

What credential provider config were you using in that situation? If you had specified "requiredServiceAccountAnnotationKeys": ["eks.amazonaws.com/ecr-role-arn", "eks.amazonaws.com/role-arn"] it makes sense it would require both, but with optionalServiceAccountAnnotationKeys instead I think just one would be fine.

@jicowan
Copy link

jicowan commented Oct 22, 2025 via email

@kmala
Copy link
Member

kmala commented Oct 31, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 31, 2025
@fletcherw
Copy link
Contributor Author

/release-note-edit

Changed ecr-credential-provider to fall back to using default credentials when a ServiceAccountToken is provided but there is no corresponding role ARN provided to assume. This should not cause changes for users using the default credential provider config from EKS AMIs.

@k8s-ci-robot
Copy link
Contributor

@fletcherw: You must be an org member to edit the release note.

In response to this:

/release-note-edit

Changed ecr-credential-provider to fall back to using default credentials when a ServiceAccountToken is provided but there is no corresponding role ARN provided to assume. This should not cause changes for users using the default credential provider config from EKS AMIs.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kmala
Copy link
Member

kmala commented Nov 6, 2025

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 6, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kmala

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:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 6, 2025
@kmala
Copy link
Member

kmala commented Nov 6, 2025

/release-note-none

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 6, 2025
@k8s-ci-robot k8s-ci-robot merged commit 988a546 into kubernetes:master Nov 6, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants