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

Add credential-plugin authentication support #15

Merged
merged 1 commit into from
May 7, 2019
Merged

Conversation

svend
Copy link
Contributor

@svend svend commented Apr 1, 2019

This adds support for credential-plugin authentication.

https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins

This is used by the Kubernetes AWS IAM authenticator.

https://github.com/kubernetes-sigs/aws-iam-authenticator

I took the data types from here:

https://github.com/kubernetes/client-go/blob/03bfb9bdcfe5482795b999f39ca3ed9ad42ce5bb/pkg/apis/clientauthentication/v1beta1/types.go

There is a timestamp that should probably be converted to a time object. I haven't looked into how the Go client handles refreshing the credentials.

@ynqa
Copy link
Owner

ynqa commented Apr 18, 2019

@svend Thanks for your contributions :) How is it going? (I didn't mean to rush you!)

@svend
Copy link
Contributor Author

svend commented Apr 18, 2019

@ynqa Thanks for checking. This is functional. I don't have the bandwidth to look into automatically refreshing credentials, which would be a more complex change. Do you think the current PR is useful as-is?

@svend svend changed the title [WIP] Add credential-plugin authentication support Add credential-plugin authentication support Apr 18, 2019
@ynqa
Copy link
Owner

ynqa commented Apr 19, 2019

@svend Yes, of course! For EKS cluster, this plugin is necessary and I can accept the functions whether it is complex or not.

Ref?

@svend
Copy link
Contributor Author

svend commented Apr 19, 2019

@ynqa Thanks. As far as I can tell, this PR is functionally similar to the Python implementation (https://github.com/kubernetes-client/python/pull/619/files). It is possible for an exec token to expire or become invalid, but I don't see the Python code checking expirationTimestamp.

Is exec authentication token auto-renewal required, or could that be implemented later?

Are there any other changes you would like to see for this PR?

@ynqa
Copy link
Owner

ynqa commented Apr 20, 2019

@svend It's okay to implement refreshing token later. And also please fix conflicts from #16 and if you're possible, check listing up Pods for EKS.

@svend
Copy link
Contributor Author

svend commented Apr 26, 2019

I have rebased my PR and fixed the conflicts. I'll verify that the updated PR works with aws-iam-authenticator (which is what EKS uses).

@svend
Copy link
Contributor Author

svend commented Apr 26, 2019

I successfully tested listing pods for a cluster using aws-iam-authenticator exec plugin with the latest version of this PR.

The test code is here:

https://github.com/svend/k8s-rust-exec-test
https://github.com/svend/k8s-rust-exec-test/blob/9fecacea6002c0f9893a9808ba171b415b47a0e7/Cargo.toml#L12
https://github.com/svend/k8s-rust-exec-test/blob/9fecacea6002c0f9893a9808ba171b415b47a0e7/Cargo.lock#L498

Let me know if there are any changes you want to see to the PR.

@ynqa
Copy link
Owner

ynqa commented Apr 30, 2019

@svend Wow, thanks! And sorry for response delay again... I'll review this one and #17 later!

Copy link
Owner

@ynqa ynqa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! @svend Thanks for your huge contributions!

@ynqa ynqa merged commit 97f76bb into ynqa:master May 7, 2019
svend pushed a commit to svend/kubernetes-rust that referenced this pull request Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants