Skip to content

Conversation

nogueiraanderson
Copy link
Contributor

@nogueiraanderson nogueiraanderson commented Sep 1, 2025

Adds PMM public IP as environment variable (PMM_IP) for downstream jobs.

Changes:

  • Retrieves public IP from OpenShift ingress controller (router-default service)
  • Resolves AWS ELB hostname to IP address
  • Exports as PMM_IP environment variable
  • Displays in job output and stores in metadata

Usage: ${env.PMM_IP} (returns N/A if unavailable)

Jira: PMM-14287

- Modified deployPMM function to retrieve PMM service IP address
- Added logic to get IP from monitoring-service LoadBalancer or ClusterIP
- Export PMM_IP as environment variable in the pipeline
- Display PMM IP address in post-creation output
- Store PMM IP in cluster metadata for reference
- Display PMM IP in the Jenkins job description HTML
- Fix incorrect parameter references (MASTER_NODES -> 3, WORKER_NODES -> WORKER_COUNT, etc.)
- Fix password reference to use env.PMM_PASSWORD instead of env.PMM_ADMIN_PASSWORD
- Moved all OpenShift cluster management files from cloud/jenkins to pmm/openshift
- Updated script paths in YAML files to reflect new location
- Aligns with organizational structure changes from PR #3504
…epository

- Changed branch from 'feature/openshift-shared-libraries' to 'master'
- Updated repository URL from personal fork to official Percona-Lab repository
…sterIP

The monitoring-service in PMM namespace is a ClusterIP service (internal only),
not a LoadBalancer. The actual public access goes through the OpenShift ingress
controller (router-default service in openshift-ingress namespace).

This fix:
- Gets the public IP from the ingress controller LoadBalancer
- Resolves the hostname to IP address for external access
- Removes the incorrect fallback to ClusterIP which returns internal IPs

Testing confirmed:
- Old approach returned 172.30.x.x (internal, not accessible)
- New approach returns actual public IP (e.g., 3.129.202.84)
- External tools can now connect to PMM using the correct IP
The previous logic was flawed - it would try hostname first and only fall back
to IP if hostname wasn't available. But if a provider gives us a direct IP,
we should just use it without DNS resolution.

New logic:
1. First check if LoadBalancer provides direct IP (GCP, some bare metal)
2. If no IP, check for hostname (AWS, Azure) and resolve it
3. If neither, try to get external IP from worker node (on-prem setups)

This ensures we get a working IP address across all cloud providers and
deployment scenarios.
Since this is entirely AWS, remove unnecessary fallback logic:
- Remove check for direct IP (AWS always provides hostname)
- Remove worker node external IP fallback (not applicable to AWS)
- Keep only the AWS ELB hostname resolution logic

This makes the code cleaner and more maintainable by focusing only
on the AWS use case that actually applies.
@nogueiraanderson
Copy link
Contributor Author

Closing in favor of PR #3519 (clean branch without cloud/ path in commit history)

@nogueiraanderson nogueiraanderson changed the title Add PMM_IP environment variable to openshift-cluster-create job PMM-14287: Add PMM_IP environment variable to openshift-cluster-create job Sep 1, 2025
- getent is available by default on Oracle Linux 9 Jenkins agents
- nslookup requires bind-utils package which may not be installed
- Added fallback to nslookup if getent fails for any reason
- Tested with real AWS ELB hostnames and confirmed working

This ensures DNS resolution works reliably on Jenkins agents without requiring additional packages.
@nogueiraanderson nogueiraanderson merged commit 3b7bc24 into master Sep 1, 2025
@nogueiraanderson nogueiraanderson deleted the feature/add-pmm-ip-env-variable branch September 1, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants