fix(registration): JMX URL defaults to reusing callback host part (backport #414) #415
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.
Fixes #413
Rather than using the
CRYOSTAT_AGENT_HOSTNAME
property/env var to set the hostname used in JMX Service URL construction, this adds a new property (true
by default) to reuse the host part of the Agent callback URL as the host part of the JMX Service URL. This is under the assumption that if the Agent is properly configured for use with a given Cryostat server, then the callback URL contains a reachable and resolvable host part. This is already used for the Agent HTTP URL, so reusing this for the JMX Service URL makes sense and keeps the URLs consistent with each other.The user could work around this previously by setting the
CRYOSTAT_AGENT_HOSTNAME
manually, but this would mean adding more configuration on the user's side that they have to ensure both theHOSTNAME
andCALLBACK
are set appropriately, separately, just to make sure the Agent uses the same host part for both HTTP and JMX URLs. It seems better to do as in this PR and make that behaviour the automatic default, and allow the user to override that if for some reason they need it to behave differently.Deployed in Kubernetes for example, getting both URLs to use the Pod IP address for the host part requires a Deployment with this:
With this patch, the
CRYOSTAT_AGENT_HOSTNAME
part can be omitted.This is an automatic backport of pull request #414 done by Mergify.