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

fix: Wrong STS audience in OIDC provider in China partition #2271

Closed

Conversation

pkolakow
Copy link

@pkolakow pkolakow commented Oct 12, 2022

Description

Change STS Audience service endpoint to point to the correct partition.

Motivation and Context

When deploying EKS cluster in china partition you have to specify the following variable because the EKS have amazonaws.com not amazonaws.cn dns_suffix:

cluster_iam_role_dns_suffix = "amazonaws.com"

Unfortunatelly, this variable is also used to determine STS Audience in OIDC provider when IRSA is enabled.
The correct STS endpoint in China partion is sts.amazonaws.com.cn not sts.amazonaws.com and should not depend on cluster_iam_role_dns_suffix variable.

Breaking Changes

The OIDC provider will be forcfully replaced but because of the wrong STS audience it wasn't usable anyway.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

@pkolakow pkolakow changed the title Fix wrong STS Audience in OIDC provider in China partition fix: wrong STS audience in OIDC provider in China partition Oct 12, 2022
@pkolakow pkolakow changed the title fix: wrong STS audience in OIDC provider in China partition fix: Wrong STS audience in OIDC provider in China partition Oct 12, 2022
@pkolakow pkolakow changed the title fix: Wrong STS audience in OIDC provider in China partition fix: Wrong STS audience in OIDC provider in China partition Oct 12, 2022
@bryantbiggs
Copy link
Member

I believe what we have is correct - you can see the history here:

@pkolakow
Copy link
Author

pkolakow commented Oct 13, 2022

@bryantbiggs I disagree. IMO #2026 introduced a bug. I've got multiple environments in China partition and the correct way is to have the following trust relationship for the cluster IAM role:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "EKSClusterAssumeRole",
            "Effect": "Allow",
            "Principal": {
                "Service": "eks.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

and sts.amazonaws.com.cn in the audience in the OIDC provider.

They cannot have the same DNS suffix.

Thus, it is also required to this annotation to ServiceAccount:

eks.amazonaws.com/audience: "sts.amazonaws.com.cn"

Even if it is possible to use the sts.amazonaws.com audience and specify the corresponding annotation to ServiceAcount, the change introduced in #2026 is backward incompatible and will result in all Pods not being to authenticate to AWS until restarted (also there would be a need to change all ServiceAcount manifests on the cluster).

Maybe it would be reasonable to introduce a separate variable for the default STS audience?

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants