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 support for Kubernetes 1.24 #187

Merged
merged 6 commits into from
Aug 3, 2022
Merged

Add support for Kubernetes 1.24 #187

merged 6 commits into from
Aug 3, 2022

Conversation

glrf
Copy link
Contributor

@glrf glrf commented Aug 2, 2022

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.

This PR changes getServiceAccountToken to fetch all service-account-token secrets in the namespace and finds the one with the matching annotation. If there are more than one matching secrets it will return the oldest one.

The API does not create the secret, but relies on the Operator to do so.

Closes #185

Checklist

  • Keep pull requests small so they can be easily reviewed.
  • Categorize the PR by setting a good title and adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog
  • Link this PR to related issues.

@glrf glrf added the enhancement New feature or request label Aug 2, 2022
@glrf glrf self-assigned this Aug 2, 2022
@glrf glrf force-pushed the feat/get-sa-k8s-1.24 branch from 930fd20 to a10055e Compare August 2, 2022 12:38
@glrf glrf marked this pull request as ready for review August 2, 2022 16:04
@glrf glrf requested review from bastjan and simu August 2, 2022 16:04
Copy link
Member

@simu simu left a comment

Choose a reason for hiding this comment

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

LGTM overall

pkg/service/api_service_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@bastjan bastjan left a comment

Choose a reason for hiding this comment

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

LGTM!

@glrf glrf force-pushed the feat/get-sa-k8s-1.24 branch from 19a54e2 to 2e98074 Compare August 3, 2022 07:14
@glrf glrf merged commit ccf9d4f into master Aug 3, 2022
@glrf glrf deleted the feat/get-sa-k8s-1.24 branch August 3, 2022 07:20
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 this pull request may close these issues.

Update getServiceAccountToken() to work correctly on Kubernetes 1.24+
3 participants