Skip to content

Conversation

anik120
Copy link
Contributor

@anik120 anik120 commented Oct 15, 2025

Description of the change:

Adds support for OpenShift service-ca-operator alongside existing cert-manager support for authenticated metrics endpoints. This enables the metrics authentication feature to work in both upstream Kubernetes (with cert-manager) and OpenShift (with service-ca) environments.

Changes:

  • Add explicit RBAC permissions for tokenreviews and subjectaccessreviews required by authentication filters
  • Add serviceCa configuration section to values.yaml with configurable secret/service names
  • Update deployment templates to support both certManager and serviceCa modes conditionally
  • Update service templates to conditionally add service-ca annotations when enabled
  • Maintain backward compatibility with existing certManager and monitoring configurations

Motivation for the change:

Testing remarks:

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Bug fixes are accompanied by regression test(s)
  • e2e tests and flake fixes are accompanied evidence of flake testing, e.g. executing the test 100(0) times
  • tech debt/todo is accompanied by issue link(s) in comments in the surrounding code
  • Tests are comprehensible, e.g. Ginkgo DSL is being used appropriately
  • Docs updated or added to /doc
  • Commit messages sensible and descriptive
  • Tests marked as [FLAKE] are truly flaky and have an issue
  • Code is properly formatted

@openshift-ci openshift-ci bot requested review from kevinrizza and tmshort October 15, 2025 17:41
Copy link

openshift-ci bot commented Oct 15, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign oceanc80 for approval. For more information see the Code Review Process.

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

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

@tmshort
Copy link
Contributor

tmshort commented Oct 16, 2025

Is there an OPRUN ticket associated with this?

Comment on lines +11 to +22
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these additions needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not needed for this PR, but I noticed that we're doing apigroups/resources : * access for a lot of verbs. Ideally we'd reduce scope, starting with this change that explicitly lists the api groups and resources.

kind: Service
metadata:
name: olm-operator-metrics
name: {{ if .Values.serviceCa.enabled }}{{ .Values.serviceCa.olmOperator.serviceName }}{{ else }}olm-operator-metrics{{ end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

What if .Values.serviceCa.olmOperator.serviceName is blank? Or is that something you'll ensure downstream?
Perhaps the serviceName itself should be in the values.yaml file with a default of olm-operator-metrics?

Copy link
Contributor

Choose a reason for hiding this comment

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

Kinda like what you do for service-cert-secret-name below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍🏽 Done, PTAL

@tmshort
Copy link
Contributor

tmshort commented Oct 16, 2025

My main comments are:

  • Why the RBAC change
  • Are there concerns about values not being set downstream... because this will require additional changes to the downstream values.yaml file

Adds support for OpenShift service-ca-operator alongside existing cert-manager support for authenticated metrics
endpoints. This enables the metrics authentication feature to work in both upstream Kubernetes (with cert-manager) and
OpenShift (with service-ca) environments.

 - Add explicit RBAC permissions for `tokenreviews` and `subjectaccessreviews` required by authentication filters
 - Add `serviceCa` configuration section to values.yaml with configurable secret/service names
 - Update deployment templates to support both `certManager` and `serviceCa` modes conditionally
 - Update service templates to conditionally add service-ca annotations when enabled
 - Maintain backward compatibility with existing `certManager` and `monitoring` configurations
@anik120 anik120 force-pushed the metrics-auth-openshift-compatibility branch from d8fd680 to 8f9d4d2 Compare October 17, 2025 15:36
Copy link
Contributor Author

@anik120 anik120 left a comment

Choose a reason for hiding this comment

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

@tmshort did not make an OPRUN ticket for this since it's a fix we need for sync, so part of the original ticket technically?

Comment on lines +11 to +22
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not needed for this PR, but I noticed that we're doing apigroups/resources : * access for a lot of verbs. Ideally we'd reduce scope, starting with this change that explicitly lists the api groups and resources.

kind: Service
metadata:
name: olm-operator-metrics
name: {{ if .Values.serviceCa.enabled }}{{ .Values.serviceCa.olmOperator.serviceName }}{{ else }}olm-operator-metrics{{ end }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍🏽 Done, PTAL

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.

2 participants