Skip to content

feat(tracing): add TLS CA cert configuration for OTLP exporter - #10628

Open
Vallabh2909 wants to merge 1 commit into
tektoncd:mainfrom
Vallabh2909:feat/tracing-cacert-config
Open

feat(tracing): add TLS CA cert configuration for OTLP exporter#10628
Vallabh2909 wants to merge 1 commit into
tektoncd:mainfrom
Vallabh2909:feat/tracing-cacert-config

Conversation

@Vallabh2909

@Vallabh2909 Vallabh2909 commented Aug 18, 2026

Copy link
Copy Markdown

Fixes #9799

Part of the tracing improvements tracked in #9701.

Context

In-cluster OTLP collectors often use HTTPS with certificates signed by a custom CA (for example, OpenShift service-ca or cert-manager). The tracing exporter currently only trusts the system CA bundle, so TLS verification fails when connecting to those collectors over HTTPS.

This PR adds an optional cacert field to the config-tracing ConfigMap. Operators can set it to a mounted PEM file path or inline PEM. When tracing is enabled with an https endpoint, the OTLP HTTP exporter uses that CA via otlptracehttp.WithTLSClientConfig.

Downstream, the OpenShift operator is expected to mount the service-ca bundle and set cacert in config-tracing.

Changes

Add an optional cacert field to config-tracing so the OTLP HTTP exporter can verify HTTPS collectors signed by custom CAs (e.g. OpenShift service-ca).

The value may be a path to a mounted PEM bundle or inline PEM. When set for an https endpoint, the exporter uses the configured CA as RootCAs for TLS.

  • Parse cacert in pkg/apis/config/tracing.go
  • Load inline PEM or file path and configure TLS in pkg/tracing/
  • Document the new field in config/config-tracing.yaml and docs/developers/tracing.md
  • Add config and tracing unit tests

Submitter Checklist

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release (not applicable — no action required)

Release Notes

Added an optional `cacert` field to the `config-tracing` ConfigMap. When tracing is enabled with an `https` endpoint, operators can set `cacert` to a PEM file path or inline PEM so the OTLP exporter trusts custom CA certificates.

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Aug 18, 2026
@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 18, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Vallabh2909 / name: Vallabh Wasule (84f69f1)

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 18, 2026
@tekton-robot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign waveywaves after the PR has been reviewed.
You can assign the PR to them by writing /assign @waveywaves in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Vallabh2909

Copy link
Copy Markdown
Author

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 18, 2026
@waveywaves

Copy link
Copy Markdown
Member

@Vallabh2909 please follow the contributing guide and the pull request template here please

@Vallabh2909

Copy link
Copy Markdown
Author

Thanks @waveywaves , I've updated the PR description to match the template

@Vallabh2909
Vallabh2909 force-pushed the feat/tracing-cacert-config branch from bdd9cab to 84f69f1 Compare August 19, 2026 09:16
Comment thread pkg/tracing/cacert.go
if strings.Contains(cacert, "-----BEGIN") {
return cert.NewPoolFromBytes([]byte(cacert))
}
return cert.NewPool(cacert)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The CA file is only read when the provider starts. Rotated CA bundles will not be picked up. Please reload the file or document that a restart is required.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have documented that when cacert is a file path, the bundle is read at tracing provider initialization (startup or config-tracing change). Rotated CA files at the same path are not picked up until config-tracing is updated or the controller is restarted. Added notes in docs/developers/tracing.md and config/config-tracing.yaml

Comment thread pkg/tracing/cacert_test.go Outdated
CACert: string(pem),
}

tp, err := createTracerProvider("test-service", cfg, "", "")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This only tests provider creation. Please use a TLS test server to verify export succeeds with the CA and fails without it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have replaced the provider-creation-only test with TestCreateTracerProviderTLSExport, which uses an httptest TLS server to verify export succeeds with the correct CA and fails without it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the review, @waveywaves! I've pushed updates addressing both comments. Please take another look.

Add an optional cacert field to config-tracing so the OTLP HTTP exporter
can verify HTTPS collectors signed by custom CAs (e.g. OpenShift service-ca).

The value may be a path to a mounted PEM bundle or inline PEM. When set for
an https endpoint, the exporter uses the configured CA as RootCAs for TLS.

Document that file-based cacert values are read at provider initialization
and require a config-tracing update or controller restart to pick up rotated
CA bundles at the same path. Add an httptest TLS server test that verifies
trace export succeeds with the correct CA and fails without it.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Vallabh2909
Vallabh2909 force-pushed the feat/tracing-cacert-config branch from 8e42a10 to 681678f Compare August 22, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tracing): add TLS CA cert configuration for tracing exporter

3 participants