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 cluster details to the sts through headers #649

Merged
merged 5 commits into from
Sep 12, 2023

Conversation

kmala
Copy link
Member

@kmala kmala commented Aug 28, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR would add additional headers passing the clusters arn and cx account id when making calls to sts and making calls using an assumed roles.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

- Add cluster details as headers to STS when assuming a role to make requests.
- Add validation for role ARN passed in cloud config

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 28, 2023
@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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Aug 28, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @kmala. 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/test-infra 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 Aug 28, 2023
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 28, 2023
@dims
Copy link
Member

dims commented Aug 28, 2023

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Aug 28, 2023
@wongma7
Copy link
Contributor

wongma7 commented Aug 28, 2023

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 28, 2023
@dims
Copy link
Member

dims commented Sep 11, 2023

/assign @nckturner

Copy link
Contributor

@cartermckinnon cartermckinnon left a comment

Choose a reason for hiding this comment

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

Couple nits, nothing major.

/lgtm

pkg/providers/v1/aws_utils.go Outdated Show resolved Hide resolved
pkg/providers/v1/aws.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 12, 2023
pkg/providers/v1/aws.go Outdated Show resolved Hide resolved
pkg/providers/v1/aws.go Outdated Show resolved Hide resolved
pkg/providers/v1/aws.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 12, 2023
@kmala
Copy link
Member Author

kmala commented Sep 12, 2023

/retest

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Sep 12, 2023

@kmala: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cloud-provider-aws-e2e-kubetest2 14a13ad link false /test pull-cloud-provider-aws-e2e-kubetest2

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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/test-infra repository. I understand the commands that are listed here.

@kmala
Copy link
Member Author

kmala commented Sep 12, 2023

/retest

@nckturner
Copy link
Contributor

/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 Sep 12, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cartermckinnon, nckturner

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 Sep 12, 2023
@k8s-ci-robot k8s-ci-robot merged commit a21aeed into kubernetes:master Sep 12, 2023
10 of 12 checks passed
k8s-ci-robot added a commit that referenced this pull request Nov 2, 2023
[release-1.23] Cherry pick of #649: Add cluster details to the sts through headers
@xrstf
Copy link

xrstf commented Jan 5, 2024

Just as a heads up: So far we were (mis)using the AWS CCM and configured it using a cloud-config that looked like this:

[global]
Zone="eu-west-1x"
VPC="vpc-0b91611f9eac0a67e"
SubnetID=""
RouteTableID="rtb-0440fe43a1d83a5d6"
RoleARN="kubernetes-my-cluster-control-plane"
KubernetesClusterID="my-cluster"
DisableSecurityGroupIngress=false
ElbSecurityGroup=""

Even though the field was clearly named RoleARN, it also accepted a non-ARN value. This PR here however "broke" that (accidental?) compatibility, forcing us to change our code a bit. Which is fine, but the AWS CCM also documents that the CloudConfig should not change in a backwards-incompatible way.

So maybe this "break" would be worth highlighting in the release notes.

@kmala
Copy link
Member Author

kmala commented Jan 5, 2024

Even though the field was clearly named RoleARN, it also accepted a non-ARN value. This PR here however "broke" that (accidental?) compatibility, forcing us to change our code a bit. Which is fine, but the AWS CCM also documents that the CloudConfig should not change in a backwards-incompatible way.

There is no validation before this PR but it wouldn't have worked right?

So maybe this "break" would be worth highlighting in the release notes.

Yes, added to the release notes.

@xrstf
Copy link

xrstf commented Jan 5, 2024

It worked just fine with a broken ARN value in the RoleARN field. Just not anymore with the 0.29.x AWS CCM releases.

Yes, added to the release notes.

Thanks, but where can I find the release notes for 0.29? I cannot see a GitHub release and https://github.com/kubernetes/cloud-provider-aws/blob/master/docs/CHANGELOG.md stopped at 1.22. Just so in the future I know where to look :-)

haoranleo added a commit to haoranleo/kubernetes that referenced this pull request Aug 29, 2024
Description:
Add caller info (source account and source arn) to STS requests that legacy cloud provider makes
on behalf of customer through request headers, this is for confusion deputy issue protection. With
the change customer is able to configure global conditional key in their IAM role in addition to trust
policies https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html.

Upstream PR, Issue, KEP, etc. links:
We did same change in CCM kubernetes/cloud-provider-aws#649 but for versions < 1.27,
KCM still has in-tree legacy cloud provider. This patch is for these legacy cloud providers in KCM.

If this patch is based on an upstream commit, how (if at all) do this patch and the upstream source differ?
N/A

If this patch's changes have not been added by upstream, why not?
Versions < 1.27 are out of support upstream.

Other patches related to this patch:
N/A

Changes made to this patch after its initial creation and reasons for these changes:
N/A

Kubernetes version this patch can be dropped:
Till 1.22 is out of EKS support.

Signed-off-by: Leo Li <haoranr@amazon.com>
haoranleo added a commit to haoranleo/kubernetes that referenced this pull request Aug 29, 2024
Description:
Add caller info (source account and source arn) to STS requests that legacy cloud provider makes
on behalf of customer through request headers, this is for confusion deputy issue protection. With
the change customer is able to configure global conditional key in their IAM role in addition to trust
policies https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html.

Upstream PR, Issue, KEP, etc. links:
We did same change in CCM kubernetes/cloud-provider-aws#649 but for versions < 1.27,
KCM still has in-tree legacy cloud provider. This patch is for these legacy cloud providers in KCM.

If this patch is based on an upstream commit, how (if at all) do this patch and the upstream source differ?
N/A

If this patch's changes have not been added by upstream, why not?
Versions < 1.27 are out of support upstream.

Other patches related to this patch:
N/A

Changes made to this patch after its initial creation and reasons for these changes:
N/A

Kubernetes version this patch can be dropped:
Till 1.22 is out of EKS support.

Signed-off-by: Leo Li <haoranr@amazon.com>
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/feature Categorizes issue or PR as related to a new feature. 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 Denotes a PR that will be considered when it comes time to generate release notes. 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.

8 participants