-
Notifications
You must be signed in to change notification settings - Fork 220
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
feat(sdk/go): add kubernetes authentication provider #2703
Conversation
…er to KuberneteAuthenticationProvider
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2703 +/- ##
=======================================
Coverage 73.02% 73.02%
=======================================
Files 85 85
Lines 8370 8370
=======================================
Hits 6112 6112
Misses 1880 1880
Partials 378 378 ☔ View full report in Codecov by Sentry. |
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.
looking great!
Something funny going on in actions land. The env var we generate for use in naming the upload artefacts is occassionally going missing 🤔 . Some builds it gets generated appropriately, sometimes not. I think something funny is going on in the actions environment. |
OK, I see this only appears to happen when the test itself fails because it steps over the env var setting. |
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 great!
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 great! mind updating the docs as well?
This adds a new
AuthenticationProvider
which automatically configures the client to use our Kubernetes authentication method.With this provider configured, the client automatically authenticates using the Kubernetes method, by exchanging the service account token on the host with the target Flipt instance. It uses the default service account token path, which can be overridden. While the previously exchanged client token exists and is valid (not expired) within some configurable leeway, it uses the previously exchanged client token.
When the token draws close to expiry it exchanged it automatically for a new one. It does so by re-reading the service account token and exchanging with Flipt again. This is important, because Kubernetes will update the contents of that file, as its own service account tokens are automatically refreshed.
This PR additionally introduces k8s auth method to the matrix of methods used in the integration tests.
Doing so allows us to ensure the Go SDK works across the entire API with this authentication method.
To achieve this, there is a little thin JWKS provider implementation added that supports using its own CA.
This is to mimic how Kubernetes runs its own OIDC discovery mechanisms in-cluster.