-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 command to manipulate IAM identity mappings #814
Conversation
865d8c3
to
9562731
Compare
Looks good to me! Would it be possible to add some tests? |
@rndstr thanks for your work. This will be very useful. Does this, or how is it suggested to use the commands for the following use cases. I am guessing some loops/tests based on exit codes. Is that the intention?
Questions:
|
@whereisaaron Some good questions. (I added a link to #625 (comment) which might be helpful)
Yep, tests are still to come, just wanted to post this to kick off the discussion some more.
It should be the last, actually. The code is at https://github.com/kubernetes-sigs/aws-iam-authenticator/blob/c2d2884d23a3bc04fa8cc4d5b032022b38469104/pkg/server/server.go#L167-L174 and it will overwrite previous mappings with the same role.
Just one currently. I think returning them all might be better, though. I did think about adding the following log messages
Yes,
Yes, it errors if it can't find the role. I'm thinking about doing a write-up that should cover more questions that I can think of. |
Yes please, and I suggest for the
Sounds good for interactive users, but I'd suggest those warnings not impact the exist code. Scripts can use another
|
My initial thought was it's not going to be representative to what But since
If a filter is given (
Yes, that log output would need to go to stderr or not log anything at all (could do log level
it should be an exit code error to be consistent with other |
4f24c08
to
6446eef
Compare
6446eef
to
bab02fb
Compare
@whereisaaron @martina-if this is now ready for review in case you want to give it a go. Added tests and updated the PR description to reflect latest changes and an example of interaction. |
// Valid ensures the identity is proper. | ||
func (i Identity) Valid() error { | ||
if len(i.Groups) == 0 { | ||
return errors.New("identity mapping needs at least 1 group") |
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 this actually true? or is a role mapping valid with just a rolearn
and username
?
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.
Looks good! I left one minor comment
76f4280
to
b4ca9a4
Compare
This solves a big problem for us so much appreciated for setting this up - awesome. When its merged can we use this functionality in the cluster.yaml file , or is it only supported in those three commands at first? |
For what its worth, I built this PR locally since I needed the functionality - everything works well for me 👍 |
It is commands only in this PR. |
LGTM 🎉 but let's wait for Ilya's review |
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.
LGTM, overall. Would like take another look soon.
@rndstr is it correct to assume that these new commands don't support |
@errordeveloper I won't get to it until next week so feel free to do a follow-up. |
Adds the following commands to get/create/delete IAM role mappings to Kubernetes username and groups. eksctl get iamidentitymapping [--role arn] eksctl create iamidentitymapping --role <arn> [--username=USER] --group=GROUP0 [--group=GROUP1] eksctl delete iamidentitymapping --role <arn> [--all] `eksctl get iamidentitymapping` Returns all mappings; if role filter is given it returns all matching roles (can be more than one). `eksctl create iamidentitymapping` Allows creating duplicates. Will warn if duplicates exist. `eksctl delete iamidentitymapping` Deletes a single mapping FIFO unless `--all` is given in which case it removes all matching. Will warn if more mappings matching this role are found.
b4ca9a4
to
e2006cf
Compare
@errordeveloper rebased, needs another approval |
It might be a little late to bring this up but is there a specific reason why only IAM roles (in the Just wanted to make sure this hasn't already been discussed outside Github before creating an issue. |
@patstrom I don't recall having a discussion about it, please open a new issue. It should be easy to add |
I noticed that eksctl
while Also I can just edit aws-auth yaml like this:
Do you need ticket on this ? Guess related to this feature request : #749 |
@nikolai-derzhak-distillery a ticket would be great, thanks! |
Here we go: #916 YW |
@errordeveloper, Hello, is this still in the pipeline? It would be really useful! |
Use the old topology key for e2e tests
Description
Adds the following commands to get/create/delete IAM role mappings to
Kubernetes username and groups.
eksctl get iamidentitymapping
Returns all mappings; if role filter is given it returns all matching
roles (can be more than one).
eksctl create iamidentitymapping
Allows creating duplicates. Will warn if duplicates exist.
eksctl delete iamidentitymapping
Deletes a single mapping FIFO unless
--all
is given in which case itremoves all matching. Will warn if more mappings matching this role are
found.
Closes #625
Some remarks about implementation at #625 (comment)
Checklist
make build
)make test
)make integration-test
)README.md
, andexamples
directory)Example of interaction