-
Notifications
You must be signed in to change notification settings - Fork 20
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
[Epic] Application annotations for Cryostat Agent integrations #784
Comments
Some more thoughts about the Agent injection/integration.
For point 1, packaging the Agent JAR version that corresponds to the Cryostat version which the Operator will deploy seems relatively simple. As discussed previously, the Operator can put this into some resource like a ConfigMap or Secret and mount it to the application Deployment. If the Operator is already modifying the Deployment then it is trivial to add environment variables for configuring the Agent, to point it at the correct Cryostat instance, use the Pod IP for the callback URL, etc. But how to actually attach the Agent to the application JVM? We have talked about trying to do some detection of the application's framework or base image and manipulating entry points, environment variables, etc. to add the -javaagent switch. This seems error-prone and conflict-prone. We have also experimented with running an Attach Agent as a sidecar process and connecting to the main container, but this might be tricky to put together in practice and probably runs into a lot of security constraints. What if we can do the equivalent of a operator-framework/operator-sdk#4302 https://github.com/zalando/postgres-operator/blob/master/pkg%2Fcluster%2Fexec.go#L18-L44 operator-framework/operator-sdk#1561 If the Agent JAR is already available in the application container (via mounted ConfigMap), then there is an easy solution when combined with agent dynamic attach: Just exec the Agent process in PID autodetect mode. |
If we can do an equivalent to |
While chatting with Chris, another interesting idea came up. There could be another annotation that the user can add to their Deployment so that the Agent is configured such that it creates a Flight Recording on the attached JVM immediately. This would save the user the additional step of either going to the Cryostat UI to manually create a recording, or else creating an Automated Rule on their Cryostat instance to trigger on matching Agent instances. After adding this annotation to their application and waiting a few moments, the user could go to the Cryostat UI and find that there is already JFR data available for analysis. I think this could be done by supplying the Agent instance with an agentmain argument for Smart Triggers: https://github.com/cryostatio/cryostat-agent?tab=readme-ov-file#smart-triggers
If the trigger condition was simply Either this annotation would need to have a few configuration options, or we should be careful to pick some sane defaults (event template, todisk/maxsize, etc.) |
Describe the feature
There should be some defined annotation prefix (like
io.cryostat/
) and keys likeinject-agent
,inject-tls-cert
. Users should be able to add these annotations to their applications (on the Deployment or Pod) within any Namespace associated with a Cryostat instance. When the Operator observes that an application has such an annotation, an integration feature should be enabled:-javaagent
JVM flag as well as setting environment variables to point the Agent at the correct Cryostat instanceThis way we can automate end-to-end TLS in both directions between Cryostats and their Agent instances, with the user doing as little work as possible to enable this security feature.
Tasks:
The text was updated successfully, but these errors were encountered: