Skip to content

CM-1367: Bump trust-manager operand to v0.25.0 - #495

Open
arun717 wants to merge 7 commits into
openshift:masterfrom
arun717:CM-1367-trust-manager-operand-v0.24.0
Open

arun717 wants to merge 7 commits into
openshift:masterfrom
arun717:CM-1367-trust-manager-operand-v0.24.0

Conversation

@arun717

@arun717 arun717 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bump the trust-manager operand from v0.20.3 to v0.25.0 (Makefile, RELATED_IMAGE / CSV, Helm bindata, Bundle CRD).
  • Apply Helm trust-manager-cluster-view (read-only bundles + aggregate-to-cluster-reader). This stays a separate ClusterRole so cluster-reader does not inherit operand write rules.
  • Align webhook CA injection with Helm 0.25: cert-manager.io/inject-ca-from-secret on trust-manager-tls, plus Certificate secretTemplate cert-manager.io/allow-direct-injection: "true".
  • Bump operator/test/tools modules to Kubernetes v0.36.4 and openshift/api release-5.0 (31af9f93e31e), with matching openshift/client-go, library-go, and controller-runtime v0.24.1.
  • Move test/go.mod to trust-manager v0.25.0 and update e2e Bundle builders for the v0.25 API (InLine string, value TargetMetadata). Upstream trust-manager still requires k8s 0.37; the test module replace-pins k8s 0.36.4 for OpenShift 5.0.

This is the operand half of CM-1367. The TrustManager filterNonCACerts API lives in #494. Merge this PR first: --filter-non-ca-certs exists only from v0.21.0, so 494’s Enabled path will CrashLoop a v0.20.3 operand.

Jira: https://issues.redhat.com/browse/CM-1367

Notes for reviewers

  • Bundle CRD diff is regenerated with make bundle. Content is the upstream Bundle schema (CEL, length limits, descriptions), not a YAML reformat. Helm output stays in config/crd/bases/; do not copy it onto bundle/manifests/.
  • test/go.mod uses github.com/cert-manager/trust-manager v0.25.0. That module requires k8s.io/* v0.37.0; replace directives keep the selected Kubernetes/client stack at v0.36.4 to match the operator and OpenShift 5.0.
  • images/ci/trustmanager.Dockerfile sets RELEASE_BRANCH=v0.25.0 and clones openshift/cert-manager-trust-manager. That fork’s latest tag is still v0.20.3; the Dockerfile clone will fail until midstream has the tag. CSV/RELATED_IMAGE uses quay.io/jetstack/trust-manager:v0.25.0.
  • cluster-view is applied at the end of RBAC reconcile. UpdateResourceLabels replaces labels, so the aggregate label is set again after that.

Test plan

  • Confirm CSV / manager related image is quay.io/jetstack/trust-manager:v0.25.0
  • TrustManager Ready on v0.25.0 with default args (no --filter-non-ca-certs)
  • Webhook annotation is cert-manager.io/inject-ca-from-secret=cert-manager/trust-manager-tls
  • oc get clusterrole trust-manager-cluster-view and cluster-reader aggregation
  • Operator go.mod pins k8s.io/* v0.36.4 and github.com/openshift/api release-5.0
  • E2e compiles against trust-manager v0.25.0 Bundle types (go test -tags e2e -count=0 ./test/...)
  • CI e2e that already covers TrustManager (no new operator API in this PR)

Summary by CodeRabbit

  • New Features

    • Upgraded trust-manager components to version 0.25.0.
    • Added a cluster-view permission role, enabling read access to Bundle resources.
    • Added direct injection support for generated certificate secrets.
    • Added automatic private-key rotation behavior for the trust-manager certificate.
    • Improved webhook CA injection using the trust-manager TLS secret.
  • Validation

    • Strengthened Bundle configuration validation, including source, target, format, length, and metadata constraints.

Refresh Helm bindata and the Bundle CRD, apply the cluster-view
ClusterRole, and pin related images. Needed so --filter-non-ca-certs
is available for the follow-up API PR.
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Sep 10, 2026
@openshift-ci-robot

openshift-ci-robot commented Sep 10, 2026

Copy link
Copy Markdown

@arun717: This pull request references CM-1367 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.1.0" version, but no target version was set.

Details

In response to this:

Summary

  • Bump the trust-manager operand from v0.20.3 to v0.24.0 (Makefile, RELATED_IMAGE / CSV, Helm bindata, Bundle CRD).
  • Apply Helm 0.24 trust-manager-cluster-view (read-only bundles + aggregate-to-cluster-reader). This stays a separate ClusterRole so cluster-reader does not inherit operand write rules.

This is the operand half of CM-1367. The TrustManager filterNonCACerts API lives in #494. Merge this PR first: --filter-non-ca-certs exists only from v0.21.0, so 494’s Enabled path will CrashLoop a v0.20.3 operand.

Jira: https://issues.redhat.com/browse/CM-1367

Notes for reviewers

  • Bundle CRD diff is regenerated with make bundle. Content is v0.24 schema (CEL, length limits, descriptions), not a YAML reformat. Helm output stays in config/crd/bases/; do not copy it onto bundle/manifests/.
  • test/go.mod stays github.com/cert-manager/trust-manager v0.20.3. go get @v0.24.0 pulled k8s 0.36 and broke openshift/api. E2e talks to the live Bundle CRD, not that module’s types.
  • images/ci/trustmanager.Dockerfile sets RELEASE_BRANCH=v0.24.0 and clones openshift/cert-manager-trust-manager. That fork’s latest tag is still v0.20.3; the Dockerfile clone will fail until midstream has the tag. CSV/RELATED_IMAGE uses quay.io/jetstack/trust-manager:v0.24.0.
  • cluster-view is applied at the end of RBAC reconcile. UpdateResourceLabels replaces labels, so the aggregate label is set again after that.

Test plan

  • Confirm CSV / manager related image is quay.io/jetstack/trust-manager:v0.24.0
  • TrustManager Ready on v0.24.0 with default args (no --filter-non-ca-certs)
  • oc get clusterrole trust-manager-cluster-view and cluster-reader aggregation
  • CI e2e that already covers TrustManager (no new API in this PR)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 02aed51d-5f39-404d-b60b-ae28e3f9fc6a

📥 Commits

Reviewing files that changed from the base of the PR and between 8270661 and a1877fd.

📒 Files selected for processing (26)
  • Makefile
  • bindata/trust-manager/resources/certificate_trust-manager.yml
  • bindata/trust-manager/resources/clusterrole_trust-manager-cluster-view.yml
  • bindata/trust-manager/resources/clusterrole_trust-manager.yml
  • bindata/trust-manager/resources/clusterrolebinding_trust-manager.yml
  • bindata/trust-manager/resources/deployment_trust-manager.yml
  • bindata/trust-manager/resources/issuer_trust-manager.yml
  • bindata/trust-manager/resources/role_trust-manager.yml
  • bindata/trust-manager/resources/role_trust-manager:leaderelection.yml
  • bindata/trust-manager/resources/rolebinding_trust-manager.yml
  • bindata/trust-manager/resources/rolebinding_trust-manager:leaderelection.yml
  • bindata/trust-manager/resources/service_trust-manager-metrics.yml
  • bindata/trust-manager/resources/service_trust-manager.yml
  • bindata/trust-manager/resources/serviceaccount_trust-manager.yml
  • bindata/trust-manager/resources/validatingwebhookconfiguration_trust-manager.yml
  • bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
  • bundle/manifests/trust.cert-manager.io_bundles.yaml
  • config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml
  • config/manager/manager.yaml
  • images/ci/trustmanager.Dockerfile
  • pkg/controller/trustmanager/certificates.go
  • pkg/controller/trustmanager/certificates_test.go
  • pkg/controller/trustmanager/webhooks.go
  • pkg/controller/trustmanager/webhooks_test.go
  • pkg/operator/assets/bindata.go
  • test/e2e/trustmanager_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • bindata/trust-manager/resources/clusterrole_trust-manager.yml
  • bundle/manifests/trust.cert-manager.io_bundles.yaml

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


Walkthrough

The change upgrades trust-manager to v0.25.0. It updates Kubernetes assets, strengthens Bundle CRD validation, changes certificate and webhook CA injection behavior, removes the /packages volume, and adds cluster-view RBAC reconciliation.

Changes

Trust-manager v0.25.0 upgrade

Layer / File(s) Summary
Release assets and generated resources
Makefile, config/manager/manager.yaml, images/ci/trustmanager.Dockerfile, bundle/manifests/..., bindata/trust-manager/resources/*, pkg/operator/assets/bindata.go
Release references and Kubernetes resources now use v0.25.0. The deployment removes the /packages volume, updates event permissions, and includes the cluster-view asset.
Bundle CRD validation
bundle/manifests/trust.cert-manager.io_bundles.yaml, config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml
Bundle source, target, format, metadata, and status schemas gain exclusivity rules, bounds, property constraints, and updated descriptions.
Certificate and webhook integration
pkg/controller/trustmanager/certificates.go, pkg/controller/trustmanager/certificates_test.go, pkg/controller/trustmanager/webhooks.go, pkg/controller/trustmanager/webhooks_test.go, test/e2e/trustmanager_test.go
Certificate reconciliation compares direct-injection annotations and private-key rotation policy. Webhook CA injection now references the trust-manager TLS Secret.
Cluster-view RBAC reconciliation
bindata/trust-manager/resources/clusterrole_trust-manager-cluster-view.yml, pkg/controller/trustmanager/constants.go, pkg/controller/trustmanager/rbacs.go, pkg/controller/trustmanager/rbacs_test.go, pkg/operator/assets/bindata.go
A read-only cluster-view ClusterRole is embedded, registered, aggregated into cluster-reader, reconciled, and covered by drift and policy tests.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant RBACReconciler
  participant AssetStore
  participant KubernetesAPI
  participant ClusterReader
  RBACReconciler->>AssetStore: Load cluster-view ClusterRole asset
  RBACReconciler->>KubernetesAPI: Get and server-side apply ClusterRole
  KubernetesAPI->>ClusterReader: Aggregate Bundle read access
  KubernetesAPI-->>RBACReconciler: Return reconciliation result
Loading

Merge Risk: ⚪ Minimal · up to a1877

The trust-manager upgrade assets, injection configuration, CRD validation, and read-only cluster-view role show no identified merge-blocking issue.

🚥 Pre-merge checks | ✅ 13 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 9 files. (20 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ⚠️ Warning The changed Ginkgo code adds and modifies assertions without meaningful failure messages. The webhook annotation assertions at the changed spec lines call Should(HaveKeyWithValue(...)) without a mes… Add diagnostic messages to every new or modified assertion. For example, state that the webhook must use cert-manager.io/inject-ca-from-secret with the trust-manager TLS Secret, that the Certificate must define SecretTemplate, and that …
✅ Passed checks (13 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No changed Ginkgo title contains dynamic data. The added test and subtest names are static descriptions, including "sets secret template for direct CA injection", "sets private key rotation policy Alw…
Microshift Test Compatibility ✅ Passed PASS: The pull request adds no new Ginkgo e2e test declarations. It modifies existing tests only. The added assertions use standard Kubernetes and cert-manager resources, with no listed MicroShift-inc…
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests were added. The e2e diff only updates assertions in existing It blocks for CA injection and Certificate annotations. The Ginkgo declaration list is unchanged between the base…
Topology-Aware Scheduling Compatibility ✅ Passed No topology-sensitive scheduling constraint was introduced. The trust-manager Deployment changes only its image/version and removes the /packages volume; its existing replicas: 1 and `nodeSelector…
Ote Binary Stdout Contract ✅ Passed PASS: The PR introduces no stdout write in process-level code. The changed Go files contain controller reconciliation logic, unit tests, generated assets, and E2E assertions. The added logging calls a…
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PASS: The pull request adds no new Ginkgo e2e declarations. The existing test/e2e/trustmanager_test.go cases only gain assertions for the cluster-local trust-manager-tls Secret annotation and Cert…
No-Weak-Crypto ✅ Passed The reviewed diff introduces no MD5, SHA-1, DES, 3DES, RC4, Blowfish, or ECB usage. It adds no cryptographic implementation or crypto package usage. The new comparisons cover Certificate metadata and …
Container-Privileges ✅ Passed No listed container privilege condition is introduced. The authoritative PR patch adds no lines containing privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, runAsUser, or allowPrivilegeEscalation.…
No-Sensitive-Data-In-Logs ✅ Passed No sensitive-data logging was introduced. The added RBAC logs and event record only use the fixed ClusterRole name (trust-manager-cluster-view) and generic reconciliation messages. The webhook and c…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the primary change: updating the trust-manager operand to v0.25.0. It matches the main version, image, and resource updates in the pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 9 files. (20 skipped: 20 unsupported.)

Full details: Test Structure And Quality

Explanation

The changed Ginkgo code adds and modifies assertions without meaningful failure messages. The webhook annotation assertions at the changed spec lines call Should(HaveKeyWithValue(...)) without a message, and the new Certificate assertions for SecretTemplate and allow-direct-injection also omit messages. This violates requirement 4. The changed Eventually calls have explicit timeouts, and the suite uses shared BeforeEach/AfterEach cleanup, so no separate timeout or lifecycle failure was found.

Resolution

Add diagnostic messages to every new or modified assertion. For example, state that the webhook must use cert-manager.io/inject-ca-from-secret with the trust-manager TLS Secret, that the Certificate must define SecretTemplate, and that the template must contain cert-manager.io/allow-direct-injection=true.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

Refresh Helm bindata and pin related images. Align webhook CA
injection with Helm 0.25 (inject-ca-from-secret on the TLS Secret).
@arun717 arun717 closed this Sep 16, 2026
@arun717
arun717 deleted the CM-1367-trust-manager-operand-v0.24.0 branch September 16, 2026 11:41
@arun717
arun717 restored the CM-1367-trust-manager-operand-v0.24.0 branch September 16, 2026 11:43
@arun717 arun717 reopened this Sep 16, 2026
@arun717 arun717 changed the title CM-1367: Bump trust-manager operand to v0.24.0 CM-1367: Bump trust-manager operand to v0.25.0 Sep 16, 2026

@bharath-b-rh bharath-b-rh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Regarding test/go.mod stays github.com/cert-manager/trust-manager v0.20.3. It should be fine updating the k8s packages to v0.36.4 and also the openshift/api package to release-5.0 commit.

Comment thread pkg/controller/trustmanager/certificates.go Outdated
})
}

const clusterReaderAggregateLabel = "rbac.authorization.k8s.io/aggregate-to-cluster-reader"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Static manifest already has this label added, what would be need for adding it here again?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

UpdateResourceLabels replaces the object's labels (SetLabels) rather than merging them, so the aggregate label from the static manifest is dropped when we apply getResourceLabels().

We set rbac.authorization.k8s.io/aggregate-to-cluster-reader=true again afterward so cluster-reader still aggregates Bundle get/list/watch. Without this, the applied ClusterRole would lose that label.

Comment thread pkg/controller/trustmanager/webhooks.go Outdated
Comment thread bindata/trust-manager/resources/certificate_trust-manager.yml
app.kubernetes.io/instance: cert-manager-trust-manager
app.kubernetes.io/version: "v0.25.0"
app.kubernetes.io/managed-by: cert-manager-operator
rbac.authorization.k8s.io/aggregate-to-cluster-reader: "true"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for this to work, we also need to create deploy/charts/trust-manager/templates/clusterrole-aggregate.yaml, which otherwise has value I think.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also the whole aggregation is an opt-in feature using the aggregateClusterRoles helm value, shouldn't we be also doing the same?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks like we do not need another copy of clusterrole-aggregate.yaml.
That Helm file is this ClusterRole:

  • name: trust-manager-cluster-view
  • rules: get/list/watch on trust.cert-manager.io/bundles
  • label: rbac.authorization.k8s.io/aggregate-to-cluster-reader: "true"

The operator already has that as clusterrole_trust-manager-cluster-view.yml and applies it in createOrApplyClusterViewClusterRole.
There is no extra aggregator object in the chart, just this labeled ClusterRole.

Aggregation is performed by OpenShift’s existing cluster-reader, which already selects that label. Creating a second YAML with the same content would be a duplicate.

Also, the aggregation part is configurable but it is not opt-in in the usual sense.
Upstream Helm gates the ClusterRole with global.rbac.aggregateClusterRoles. That value defaults to true, so aggregation is on unless you turn it off (opt-out).

The template only skips clusterrole-aggregate.yaml when you set it to false (or disable RBAC entirely with global.rbac.create: false).
Please do let me know what you think. As of now not making any code change related to this in the current PR.

…t-ca-from stripping.

Detect PrivateKey.RotationPolicy drift without comparing cert-manager-defaulted key fields, and stop deleting inject-ca-from from user webhook annotations.
…er v0.25.0 test types.

Bump operator and e2e modules to k8s v0.36.4 and openshift/api release-5.0 so test/go.mod can use trust-manager v0.25.0 Bundle APIs.
Fix verify by committing make generate output and unifying duplicate
dependency versions across root, tools, and test modules.
The v0.25.0 operand ClusterRole creates events.k8s.io events, and
Kubernetes blocks that grant unless the operator already holds it.
Webhook override e2e failed when static-resources Degraded stayed False
while deployment Degraded was True, because Any still failed on order.
@openshift-ci

openshift-ci Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

@arun717: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-operator 449a725 link true /test e2e-operator
ci/prow/e2e-operator-tech-preview 449a725 link false /test e2e-operator-tech-preview

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants