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

authconfigmap: command to manipulate aws auth configmap #625

Closed
rndstr opened this issue Mar 13, 2019 · 6 comments · Fixed by #814
Closed

authconfigmap: command to manipulate aws auth configmap #625

rndstr opened this issue Mar 13, 2019 · 6 comments · Fixed by #814
Milestone

Comments

@rndstr
Copy link
Contributor

rndstr commented Mar 13, 2019

PR #623 attempted to add a command to modify the auth configmap but its location and command hierarchy needs a bit more discussion.

The auth ConfigMap is in kube-system and named aws-auth. It contains various mappings of IAM/AWS entities to Kubernetes groups.

More information at

A. command design

The command should provide the following invocations (with description of current implementation of feature)

Some ideas and the start of the discussion can be found in #623.

It seems like that the following fulfills most of our constraints:

eksctl get aws-auth
eksctl update aws-auth add-role <arn> --username <string> --groups <csv>
eksctl update aws-auth remove-role <arn>
eksctl update aws-auth add-account <number>
eksctl update aws-auth remove-account

some variations:

  • add => map && remove => unmap
  • aws-auth => auth

B. command behavior

Further discussion can be had about changing the way commands behave:

  • remove a role
    • TBD: remove by role arn only? or match username and groups?
@rndstr rndstr added the kind/feature New feature or request label Mar 13, 2019
@errordeveloper
Copy link
Contributor

For the record, we have a712049 that reverted the first implementation, so that can be reverted back.

@errordeveloper
Copy link
Contributor

xref #62

@rndstr
Copy link
Contributor Author

rndstr commented Mar 14, 2019

Somre more thoughts on naming

  • the flag --update-auth-config-map for eksctl create|delete nodegroup describes the same thing
  • iam-auth-bindings has been brought up to bring it on par with upcoming IAM features

So more options

  • eksctl update iam-auth-bindings|iam-auth
  • eksctl update auth-config-map|auth-configmap

@StevenACoffman
Copy link
Contributor

StevenACoffman commented Apr 30, 2019

If it is helpful, our use case is that we have four IAM roles: eksctl, read-only, developer, and admin. Our AWS accounts have no access rights except to assume one (or more) of those roles based on group membership.

When we create a new cluster, we have a horrible bash script that inserts into the aws-auth configmap a few lines after the line: mapRoles: |:

    - rolearn: arn:aws:iam::${AWS_ACCOUNT_ID}:role/${EKSCTL_ROLE}
      username: admin:{{AccountID}}:{{SessionName}}
      groups:
        - system:masters
    - rolearn: arn:aws:iam::${AWS_ACCOUNT_ID}:role/${ADMIN_ROLE}
      username: admin:{{AccountID}}:{{SessionName}}
      groups:
        - admins
    - rolearn: arn:aws:iam::${AWS_ACCOUNT_ID}:role/${EDIT_ROLE}
      username: editor:{{AccountID}}:{{SessionName}}
      groups:
        - editors
    - rolearn: arn:aws:iam::${AWS_ACCOUNT_ID}:role/${VIEW_ROLE}
      username: viewer:{{AccountID}}:{{SessionName}}
      groups:
        - viewers

The RBAC parts we can manage easily enough, but automated edits to that file are a real pain.

@rndstr
Copy link
Contributor Author

rndstr commented May 14, 2019

Keeping in mind the replacement of the aws-auth configmap with a CRD, see

which will have single role mappings as custom objects named iamidentitymapping, I would suggest to use it as a first-class object with our verbs

eksctl get iamidentitymapping [arn]
eksctl create iamidentitymapping <arn> [--username USER] [--groups GROUP0,GROUP2]
eksctl delete iamidentitymapping <arn>

Some remarks

@christopherhein
Copy link
Contributor

@rndstr correct as of now it uses canonicalARN but that is autogenerated for you and stored in the Status all that is necessary is adding username, arn, groups.

Couple things to to note, these are cluster wide resources so namespacing shouldn't be taken into consideration since they only provide authentication not authorization.

mapAccounts hasn't been moved over but you can assume this could be in the future to iamaccountmappings for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants