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

Adjust min serviceaccounttoken expiration to 10min #207

Conversation

gauravpriyolkar
Copy link

@gauravpriyolkar gauravpriyolkar commented Jan 29, 2024

Issue #: #155

Description of changes:
The desired expiration time for serviceaccount tokens can be set via the eks.amazonaws.com/token-expiration annotation on the serviceaccount.

Currently, the 1hr minimum overrides token requests for shorter expiration: https://github.com/aws/amazon-eks-pod-identity-webhook/blob/master/pkg/validation.go#L17

This change aligns minimum serviceaccount token expiration to 10min to match the minimum permissible at apiserver: https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/validation/validation.go#L1148

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@gauravpriyolkar gauravpriyolkar requested a review from a team as a code owner January 29, 2024 14:36
Copy link
Contributor

@DanielCKennedy DanielCKennedy left a comment

Choose a reason for hiding this comment

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

make test is failing. Can you update rawPodMinTokenExpiration.pod.yaml to change the expectedPatch on line 11 to have "expirationSeconds":600 instead of 3600

https://github.com/aws/amazon-eks-pod-identity-webhook/blob/master/pkg/handler/testdata/rawPodMinTokenExpiration.pod.yaml#L11

@tingrui-AWS-EKS-auth
Copy link
Contributor

Test Case:

  1. Test image building.
  2. Update pod-identity-webhook manifest in the cluster with new image. Confirm pod-identity-webhook start workin without errors.
  3. Follow the EKS Walkthrough in the README file, to create node role, service account. Set the token-expiration of pods from 3600 to 600 seconds.
  4. Create node, and pods using service account. Get pod information, comfirm the token-expiration is 600s instead of 3600.
  5. Exec into pods, test aws command like aws iam list-roles, to check the pod working normally.

Copy link
Contributor

@prateekgogia prateekgogia left a comment

Choose a reason for hiding this comment

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

LGTM!

@prateekgogia prateekgogia merged commit f9a3c33 into aws:master Jan 30, 2024
1 check passed
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

4 participants