Skip to content

Add openshift resource detector for distribution: openshift#2330

Merged
jinja2 merged 11 commits intomainfrom
openshift-resource-detector
Apr 2, 2026
Merged

Add openshift resource detector for distribution: openshift#2330
jinja2 merged 11 commits intomainfrom
openshift-resource-detector

Conversation

@jinja2
Copy link
Copy Markdown
Collaborator

@jinja2 jinja2 commented Mar 27, 2026

Description:

  1. Enable the openshift resource detection processor when distribution is set to openshift. This provides cloud.provider, cloud.platform, cloud.region, and k8s.cluster.name attributes via the OpenShift API.
  • Add openshift detector and resource_attributes config in _common.tpl
  • Add config.openshift.io RBAC permissions to clusterRole
  • Update testdata
  1. Fix bug where non-EKS clusters on AWS would not have cloud attributes set.
  • The chart was using the eks detector for non-EKS AWS clusters. However, the eks detector internally checks for EKS-specific signals (IRSA/Pod Identity token paths, the OIDC issuer URL, and the cluster version string containing -eks-). On non-EKS clusters these checks fail and the detector returns empty. EC2 metadata (host.id, cloud.account.id, cloud.availability_zone, etc.) was never collected. Switched to the ec2 detector, which works on any AWS instance with IMDS access.
  • The condition for detecting non-EKS AWS clusters only matched when distribution was unset (empty string), excluding the OpenShift distribution that can run on AWS but is not EKS. Broadened the condition to match any non-EKS distribution on AWS.
  1. Fix schema to not allow eks/fargate with empty clusterName. The previous schema check was only looking for eks* which would match eks/fargate but the eks detector is not added in fargate.

  2. Adds unittests for resourcedetectors are set as expected for all combinations of cloudProvider + distribution allowed, and check pipelines which have resourcedetection processors

resourceMetrics:
- resource:
attributes:
- key: cloud.platform
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ec2 detector resources are missing in the test cluster because openshift has restriction on IMDS access originating from non-host network. User can run the clusterReceiver in hostNetwork or they can give IAM permission to the pod.

- name: "customfield2"
value: "customvalue2"

clusterName: ci-k8s-cluster
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed to test the cluster name is retrieved correctly

- key: cloud.platform
value:
stringValue: abcd
stringValue: aws_eks
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I excluded this attribute from the normalization done in test; this is a good attr value to ascertain that the order of detectors are correct

@jinja2 jinja2 force-pushed the openshift-resource-detector branch 2 times, most recently from 03af54c to 0ab49a5 Compare March 27, 2026 23:58
@jinja2 jinja2 marked this pull request as ready for review March 30, 2026 16:06
@jinja2 jinja2 requested review from a team as code owners March 30, 2026 16:06
Copilot AI review requested due to automatic review settings March 30, 2026 16:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables OpenShift-aware resource detection when distribution=openshift and fixes AWS non-EKS resource detection by switching from the eks detector to ec2, ensuring cloud/host attributes are populated correctly across more cluster types.

Changes:

  • Add OpenShift (openshift) and non-EKS AWS (ec2) resource detection configuration and update cluster-name auto-detection logic.
  • Extend OpenShift RBAC to allow reading config.openshift.io infrastructure resources needed for detection.
  • Update functional test normalization and expected resource attribute fixtures to reflect stable cloud.platform values and OpenShift/AWS attributes.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
helm-charts/splunk-otel-collector/values.yaml Updates clusterName guidance to include OpenShift auto-discovery behavior.
helm-charts/splunk-otel-collector/values.schema.json Makes clusterName optional for openshift distributions via schema conditional.
helm-charts/splunk-otel-collector/templates/config/_common.tpl Enables openshift detector and adds ec2 detector for non-EKS AWS; configures resource attributes for both.
helm-charts/splunk-otel-collector/templates/clusterRole.yaml Adds OpenShift config.openshift.io RBAC permissions (guarded by distribution=openshift).
helm-charts/splunk-otel-collector/templates/_helpers.tpl Makes clusterName optional for OpenShift and broadens non-EKS-on-AWS detection logic.
functional_tests/functional/testdata/values/rosa_upgrade_from_previous_release_values.yaml Updates ROSA upgrade test values (clusterName).
functional_tests/functional/testdata/values/rosa_test_values.yaml.tmpl Removes explicit ROSA clusterName to exercise auto-detection.
functional_tests/functional/testdata/expected_rosa_values/expected_resource_attributes_cluster_receiver.yaml Updates expected ROSA cluster-receiver resource attributes (OpenShift cloud attributes + cluster name).
functional_tests/functional/testdata/expected_rosa_values/expected_resource_attributes_agent.yaml Updates expected ROSA agent resource attributes (adds EC2 host/cloud metadata + OpenShift cloud.platform).
functional_tests/functional/testdata/expected_gke_values/expected_resource_attributes_cluster_receiver.yaml Updates expected cloud.platform value for GKE.
functional_tests/functional/testdata/expected_gke_values/expected_resource_attributes_agent.yaml Updates expected cloud.platform value for GKE.
functional_tests/functional/testdata/expected_eks_values/expected_resource_attributes_cluster_receiver.yaml Updates expected cloud.platform value for EKS.
functional_tests/functional/testdata/expected_eks_values/expected_resource_attributes_agent.yaml Updates expected cloud.platform value for EKS.
functional_tests/functional/testdata/expected_eks_auto_mode_values/expected_resource_attributes_cluster_receiver.yaml Updates expected cloud.platform value for EKS auto-mode.
functional_tests/functional/testdata/expected_eks_auto_mode_values/expected_resource_attributes_agent.yaml Updates expected cloud.platform value for EKS auto-mode.
functional_tests/functional/testdata/expected_aks_values/expected_resource_attributes_cluster_receiver.yaml Updates expected cloud.platform value for AKS.
functional_tests/functional/testdata/expected_aks_values/expected_resource_attributes_agent.yaml Updates expected cloud.platform value for AKS.
functional_tests/functional/functional_test.go Preserves cloud.platform during normalization to assert exact platform values.
examples/distribution-openshift/rendered_manifests/deployment-cluster-receiver.yaml Updates rendered manifest checksum due to config changes.
examples/distribution-openshift/rendered_manifests/daemonset.yaml Updates rendered manifest checksum due to config changes.
examples/distribution-openshift/rendered_manifests/configmap-cluster-receiver.yaml Shows openshift detector enabled and configured in rendered output.
examples/distribution-openshift/rendered_manifests/configmap-agent.yaml Shows openshift detector enabled and configured in rendered output.
examples/distribution-openshift/rendered_manifests/clusterRole.yaml Updates rendered ClusterRole to include new OpenShift RBAC rules.
.chloggen/openshift-resource-detection.yaml Changelog entry for OpenShift resource detection enhancement.
.chloggen/fix-non-eks-aws-ec2-detector.yaml Changelog entry for non-EKS AWS detection bug fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 30, 2026 17:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 30, 2026 19:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jinja2 jinja2 force-pushed the openshift-resource-detector branch from b92df4c to e638844 Compare March 30, 2026 19:47
Copilot AI review requested due to automatic review settings March 31, 2026 18:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

jinja2 added 6 commits April 1, 2026 13:11
Enable the openshift resource detection processor when distribution is set to
openshift. This provides cloud.provider, cloud.platform, cloud.region, and
k8s.cluster.name attributes via the OpenShift API (no IMDS dependency).

- Add openshift detector and resource_attributes config in _common.tpl
- Add config.openshift.io RBAC permissions to clusterRole
- Fix bug where non-EKS clusters on AWS would not have cloud attributes set
@jinja2 jinja2 force-pushed the openshift-resource-detector branch from 6462034 to dc4252f Compare April 1, 2026 20:13
Copilot AI review requested due to automatic review settings April 1, 2026 22:33
@jinja2 jinja2 force-pushed the openshift-resource-detector branch from dc4252f to e3f7ecd Compare April 1, 2026 22:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jinja2 jinja2 merged commit 83785c8 into main Apr 2, 2026
156 of 160 checks passed
@jinja2 jinja2 deleted the openshift-resource-detector branch April 2, 2026 04:46
@github-actions github-actions bot locked and limited conversation to collaborators Apr 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants