-
Notifications
You must be signed in to change notification settings - Fork 372
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
Integrate AWS Identity with EKS Auth #302
Comments
This would also need to provide adding |
I've actually solved this issue long time ago. I have also learned the wonders of Mutating Webhooks in k8s which can handle this task well. |
@kferrone do you have working example? |
Sure. Here is the item in the resources array within the composition: name: eks-aws-auth-config
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
deletionPolicy: Orphan
forProvider:
manifest:
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-auth
namespace: kube-system
data:
mapRoles: ""
mapUsers: ""
patches:
- &lbls
type: PatchSet
patchSetName: labels
- fromFieldPath: &name metadata.name
transforms:
- type: string
string:
fmt: "%s-aws-auth"
- fromFieldPath: *name
toFieldPath: spec.providerConfigRef.name
- fromFieldPath: spec.parameters.awsAuth.mapAccounts
toFieldPath: spec.forProvider.manifest.data.mapAccounts
- fromFieldPath: spec.parameters.awsAuth.mapUsers
toFieldPath: spec.forProvider.manifest.data.mapUsers
# now add the data
- type: CombineFromComposite
toFieldPath: spec.forProvider.manifest.data.mapRoles
combine:
variables:
- fromFieldPath: status.ngRoleArn
- fromFieldPath: spec.parameters.awsAuth.mapRoles
strategy: string
string:
fmt: |
- rolearn: %s
username: system:node:{{EC2PrivateDNSName}}
groups:
- system:bootstrappers
- system:nodes
%s I'm currently writing a Python webhook to select the Roles based on certain labels. It's not high priority for me so it may take a while. |
@kferrone I must be missing something from your example. What is status.ngRoleArn and where does it come from? What does the definition for the awsAuth.mapRoles parameter look like? Is it a string or an array of strings? Thanks in advance. |
So the Basically in the patches of the IAM role: name: ng-role
base:
apiVersion: iam.aws.crossplane.io/v1beta1
kind: Role
...
patches:
...
- type: ToCompositeFieldPath
fromFieldPath: status.atProvider.arn
toFieldPath: status.ngRoleArn Lastly, all of the keys on the aws-auth ConfigMap are simply strings with yaml inside. It's just a ConfigMap. I personally don't use the MapUsers section fyi, so I didn't actually patch it in my case. |
Thanks. I did end up figuring out that I needed to add that |
One more note for anyone that stumbles upon this thread. To store the composite fields your definition needs to define them. See: crossplane/crossplane#2300 (comment) |
I seem to have a massive block imagining how the mapRoles parameter is supposed to look like, Has any of you a example of the definition and data? |
added inviteaccepter resource for securityhub group
Hey |
Hey👋, I'm wondering if anyone can share his composition and definition how to add/map user to aws-auth configmap. It would be very useful for everyone that stuck here. |
What problem are you facing?
There is no declarative way of mapping IAM resources to the EKS aws-auth ConfigMap. When creating any of the resources from
identity.aws.crossplane.io
, you would still have to manually update theaws-auth
configmap.How could Crossplane help solve your problem?
Maybe there could be an optional feature on the
identity.aws.crossplane.io
resources which could integrate with the EKSaws-auth
ConfigMap.The resource could look like so:
Then in the
aws-auth
ConfigMap, there would be a new entry for the user like so:Here are the docs to how to map IAM to k8s for OIDC/Oath2: https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html
The text was updated successfully, but these errors were encountered: