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

Update getServiceAccountToken() to work correctly on Kubernetes 1.24+ #185

Closed
simu opened this issue Jun 30, 2022 · 1 comment · Fixed by #187
Closed

Update getServiceAccountToken() to work correctly on Kubernetes 1.24+ #185

simu opened this issue Jun 30, 2022 · 1 comment · Fixed by #187
Labels
enhancement New feature or request

Comments

@simu
Copy link
Member

simu commented Jun 30, 2022

Context

Kubernetes 1.24+ doesn't create service account token secrets by default anymore. Additionally, when creating a token secret explicitly, the secret isn't added to field secrets in the ServiceAccount object.

We need to update getServiceAccountToken() to no longer find the token secret via the service account's secrets field, but instead by looking at the secret's kubernetes.io/service-account.name or kubernetes.io/service-account.uid annotations.

Since existing ServiceAccount token secrets already have those annotations (at least secrets created on Kubernetes 1.22+), we don't need to have multiple ways to lookup secrets based on whether the ServiceAccount and token secret were created on 1.24 or before.

Alternatives

Extend the operator to add the manually created secret to the ServiceAccount's secrets field.

@simu simu added the enhancement New feature or request label Jun 30, 2022
@liggitt
Copy link

liggitt commented Jul 12, 2022

Extend the operator to add the manually created secret to the ServiceAccount's secrets field.

unless you are mounting the manually created token into a pod, you should not add it to this list... this list is only for listing secrets that can be mounted into pods running as that service account

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants