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

fix(registration): JMX URL defaults to reusing callback host part #414

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Jun 12, 2024

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 the HOSTNAME and CALLBACK 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:

        - name: POD_IP
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: status.podIP
        - name: CRYOSTAT_AGENT_CALLBACK
          value: http://$(POD_IP):9977
        - name: CRYOSTAT_AGENT_HOSTNAME
          value: $(POD_IP)

With this patch, the CRYOSTAT_AGENT_HOSTNAME part can be omitted.

@github-actions github-actions bot added the needs-triage Needs thorough attention from code reviewers label Jun 12, 2024
@andrewazores andrewazores added fix safe-to-test and removed needs-triage Needs thorough attention from code reviewers labels Jun 12, 2024
@andrewazores andrewazores force-pushed the jmx-url-callback-host branch from 24a761d to 4cb5288 Compare June 12, 2024 18:30
@andrewazores andrewazores requested a review from mwangggg June 12, 2024 18:32
@andrewazores andrewazores merged commit c3031d1 into cryostatio:main Jun 12, 2024
18 checks passed
@andrewazores andrewazores deleted the jmx-url-callback-host branch June 12, 2024 18:50
mergify bot pushed a commit that referenced this pull request Jun 12, 2024
andrewazores added a commit that referenced this pull request Jun 12, 2024
…) (#415)

(cherry picked from commit c3031d1)

Co-authored-by: Andrew Azores <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Host part of dual-registration URLs can differ
2 participants