test(sampleapp): configure Cryostat Agent sample app to use k8s serviceaccount token auth #983
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Welcome to Cryostat! 👋
Before contributing, make sure you have:
main
branch[chore, ci, docs, feat, fix, test]
git commit -S -m "YOUR_COMMIT_MESSAGE"
See #928
See cryostatio/cryostat-agent#383
Description of the change:
Reconfigures the
make sample_app_agent
to use the automatic Kubernetes serviceaccount token detection for authentication/authorization to the auth proxy. This will automatically in OpenShift. In other Kubernetes environments the user will need to patch the resulting Deployment to addCRYOSTAT_AGENT_AUTHORIZATION
orCRYOSTAT_AGENT_AUTHORIZATION_TYPE
+CRYOSTAT_AGENT_AUTHORIZATION_VALUE
environment variables to match anyoauth2-proxy
Basic
authentication that may be optionally configured.Motivation for the change:
Exercises the latest best practice of using injected serviceaccount tokens managed by cluster RBAC, rather than using hardcoded long-lived tokens as part of the Deployment spec.
This probably still isn't exactly the best practice, as this grants the Role to the whole workload application and not only its Agent, so it's adding extra privileges to the workload that are not strictly required. It is useful and convenient as an example for testing and development, to demonstrate how the serviceaccount token system works with the Agent and the auth proxy, and it's better than giving the Agent an admin user token via environment variable which was commonly done for testing before.
The even more ideal situation is to configure the Agent with TLS client certificates properly and have it talk to the new TLS gateway proxy. I think that would be a good setup to exercise as a new sample app configuration at some point.
How to manually test:
cryostat-sample
, exmake create_cryostat_cr
make sample_app_agent