-
Notifications
You must be signed in to change notification settings - Fork 132
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
feat(pc): add providerconfig example for aws eks pod identity feature #1254
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# SPDX-FileCopyrightText: 2024 The Crossplane Authors <https://crossplane.io> | ||
# | ||
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
apiVersion: aws.upbound.io/v1beta1 | ||
kind: ProviderConfig | ||
metadata: | ||
name: pod-identity | ||
spec: | ||
credentials: | ||
source: WebIdentity | ||
webIdentity: | ||
roleARN: arn:aws:iam::123456789012:role/pod-identity-role | ||
tokenConfig: | ||
fs: | ||
path: /var/run/secrets/pods.eks.amazonaws.com/serviceaccount/eks-pod-identity-token | ||
source: Filesystem | ||
--- | ||
apiVersion: iam.aws.upbound.io/v1beta1 | ||
kind: OpenIDConnectProvider | ||
metadata: | ||
name: pod-identity | ||
spec: | ||
forProvider: | ||
clientIdList: | ||
- pods.eks.amazonaws.com | ||
thumbprintList: | ||
- 9e99a48a9960b14926bb7f3b02e22da2b0ab7280 | ||
url: oidc.eks.<REGION>.amazonaws.com/id/<UNIQUE_ID> | ||
--- | ||
apiVersion: iam.aws.upbound.io/v1beta1 | ||
kind: Role | ||
metadata: | ||
name: pod-identity-role | ||
labels: | ||
testing.upbound.io/example-name: pod-identity | ||
spec: | ||
forProvider: | ||
assumeRolePolicy: | | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "pods.eks.amazonaws.com" | ||
}, | ||
"Action": [ | ||
"sts:AssumeRole", | ||
"sts:TagSession" | ||
] | ||
Comment on lines
+44
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are there no conditions in the trust policy? If we're creating an example for others to follow, we should demonstrate best practices, like ensuring that only the specified pods can assume the role. As I read it, this trust policy allows any pod in any EKS cluster in this aws account to assume the role. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need any other conditions because you have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
] | ||
} |
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.
maybe this is a future improvement in crossplane but it would be nice if we could have this be easier to implement without having to hard code path 🤔
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.
I'm surprised that it's necessary to set this explicitly, and that the SDK doesn't "Just Work" when instantiated in a pod that's assigned a PodIdentity. Maybe what we really need is to add an explicit
PodIdentity
to the list of supported auth types?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.
today we need to set it explicit - because our GO SDK is not up2date with this feature
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.
Is there an issue to track that?
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.
Quick question, if not a clarification:
IRSAv1 had a huge pain point in needing to include the roleARN that you're going to annotate service accounts with, so that the OIDC trust loop worked.
With IRSAv2 (Pod Identity Controller) I can configure all the AWS IAM/EKS components out of cluster, and as long as a pod starts up in the nominated namespace, and with the service account I picked, it should inherit the permissions at start via the injected token provided by the pod access controller.
Given this; if I have to mangle my helm to be coupled to the IAM ARN, I'm not sure I'm saving any hassle here - I want to just add a pod identity out of band (outside EKS, not involving Crossplane, since the host cluster is managed with terraform) and have Crossplane start up and use the IAM permissions granted to it.
Am I misunderstanding things here?
It's a relatively new concept but I've had success with this decoupled model with External Secrets controller for example.
Additionally as pointed out by @mbbush if we need to configure this, rather than letting it fall through the SDK default authentication methods a lot of the benefit of "it just works". Namely that; the pod identity controller, the associated admission mutation webhook and the tokens just being in the expected on the filsystem... start to lose some value.