Skip to content

Conversation

@chiragkyal
Copy link
Member

@chiragkyal chiragkyal commented Jan 5, 2026

Summary

This PR introduces the TrustManager API and supporting static manifests, which will be managed by cert-manager-operator to handle the lifecycle of the trust-manager operand.

Key additions

  • New TrustManager Custom Resource Definition
  • Static manifests for trust-manager deployment (RBAC, Service, Deployment, ValidatingWebhookConfiguration, etc.)
  • Automated script (hack/update-trust-manager-manifests.sh) to generate trust-manager manifests from upstream

TrustManager API Features

The TrustManager resource is a cluster-scoped singleton (name must be cluster) that provides:

  • Logging configuration: Configurable log level (1-5) and format (text/json)
  • Trust namespace: Specify where trust-manager looks for CA certificate sources
  • Secret targets policy: Control trust bundle writing to Secrets (Disabled/All/Specific)
  • Expired certificate filtering: Option to filter expired certificates from bundles
  • Default CA package: Integration with OpenShift's trusted CA bundle injection
  • Pod configuration: Resource requirements, affinity, tolerations, and node selectors
  • Operator controls: Custom labels and annotations for created resources

Closes

@openshift-ci openshift-ci bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jan 5, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 5, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai
Copy link

coderabbitai bot commented Jan 5, 2026

Walkthrough

Adds cluster-scoped TrustManager and Bundle CRDs, generated Go client/informer/lister/apply-configuration code, embedded trust-manager Kubernetes manifests and assets, a Makefile variable plus script to update upstream trust-manager manifests, CSV/samples updates, and deepcopy/apply-config boilerplate.

Changes

Cohort / File(s) Summary
API types & meta
api/operator/v1alpha1/trustmanager_types.go, api/operator/v1alpha1/meta.go
New cluster-scoped TrustManager API types, enums, validation/default annotations, and minor comment update to ConditionalStatus.
DeepCopy generation
api/operator/v1alpha1/zz_generated.deepcopy.go
Generated DeepCopy methods for all TrustManager-related types.
CRDs & CSV
config/crd/bases/operator.openshift.io_trustmanagers.yaml, config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml, bundle/manifests/*
Adds full CRD YAMLs for TrustManager and Bundle (OpenAPI schemas, status subresource, printer columns, singleton validation) and updates CSV owned/description entries.
Samples & kustomize
config/samples/tech-preview/*, config/crd/kustomization.yaml, config/manifests/bases/cert-manager-operator.clusterserviceversion.yaml
Adds TrustManager/Bundle sample manifests and kustomization entries; CSV/sample references updated.
Trust-manager manifests & assets
bindata/trust-manager/resources/*.yml, pkg/operator/assets/bindata.go
Adds trust-manager deployment, RBAC, webhook, service, issuer, certificate, serviceaccount manifests; embeds them in bindata and updates asset registry.
Makefile & update script
Makefile, hack/update-trust-manager-manifests.sh
Adds TRUST_MANAGER_VERSION variable and extends update-manifests to call the new script which fetches, patches, and splits upstream Helm charts.
ApplyConfiguration types & registry
pkg/operator/applyconfigurations/internal/internal.go, pkg/operator/applyconfigurations/operator/v1alpha1/*.go, pkg/operator/applyconfigurations/utils.go
Generated apply-configuration types and builders for TrustManager and subtypes; registers kinds in applyconfig registry and updates ForKind mapping.
Clientset, fake & expansion
pkg/operator/clientset/versioned/typed/operator/v1alpha1/{trustmanager.go,fake_trustmanager.go,operator_client.go,generated_expansion.go}
Adds TrustManagersGetter, TrustManagerInterface (CRUD/Apply/Status), concrete and fake client implementations, and expansion hook.
Informers & listers
pkg/operator/informers/externalversions/operator/v1alpha1/{trustmanager.go,interface.go}, pkg/operator/informers/externalversions/generic.go, pkg/operator/listers/operator/v1alpha1/{trustmanager.go,expansion_generated.go}
Adds TrustManager informer, lister, factory wiring, and ForResource mapping.
Misc. minor edits
bundle/manifests/operator.openshift.io_istiocsrs.yaml, config/crd/bases/operator.openshift.io_istiocsrs.yaml
Minor documentation text change referencing the operand deployment.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 71445da and 4591f79.

📒 Files selected for processing (32)
  • api/operator/v1alpha1/meta.go
  • api/operator/v1alpha1/zz_generated.deepcopy.go
  • bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
  • bundle/manifests/operator.openshift.io_istiocsrs.yaml
  • bundle/manifests/operator.openshift.io_trustmanagers.yaml
  • bundle/manifests/trust.cert-manager.io_bundles.yaml
  • config/crd/bases/operator.openshift.io_istiocsrs.yaml
  • config/crd/bases/operator.openshift.io_trustmanagers.yaml
  • config/crd/kustomization.yaml
  • config/manifests/bases/cert-manager-operator.clusterserviceversion.yaml
  • config/samples/tech-preview/kustomization.yaml
  • config/samples/tech-preview/operator.openshift.io_v1alpha1_trustmanager.yaml
  • config/samples/tech-preview/trust.cert-manager.io_v1alpha1_bundle.yaml
  • pkg/operator/applyconfigurations/internal/internal.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go
  • pkg/operator/applyconfigurations/utils.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/operator_client.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go
  • pkg/operator/informers/externalversions/generic.go
  • pkg/operator/informers/externalversions/operator/v1alpha1/interface.go
  • pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go
  • pkg/operator/listers/operator/v1alpha1/expansion_generated.go
  • pkg/operator/listers/operator/v1alpha1/trustmanager.go
🚧 Files skipped from review as they are similar to previous changes (13)
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go
  • pkg/operator/listers/operator/v1alpha1/trustmanager.go
  • bundle/manifests/operator.openshift.io_istiocsrs.yaml
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/operator_client.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go
  • config/manifests/bases/cert-manager-operator.clusterserviceversion.yaml
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go
  • config/samples/tech-preview/trust.cert-manager.io_v1alpha1_bundle.yaml
  • pkg/operator/listers/operator/v1alpha1/expansion_generated.go
  • config/crd/bases/operator.openshift.io_istiocsrs.yaml
  • bundle/manifests/operator.openshift.io_trustmanagers.yaml
  • config/crd/kustomization.yaml
  • pkg/operator/informers/externalversions/generic.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go
  • config/samples/tech-preview/kustomization.yaml
  • pkg/operator/informers/externalversions/operator/v1alpha1/interface.go
  • pkg/operator/applyconfigurations/utils.go
  • api/operator/v1alpha1/meta.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go
  • bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
  • config/samples/tech-preview/operator.openshift.io_v1alpha1_trustmanager.yaml
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go
  • bundle/manifests/trust.cert-manager.io_bundles.yaml
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go
  • config/crd/bases/operator.openshift.io_trustmanagers.yaml
  • api/operator/v1alpha1/zz_generated.deepcopy.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go
  • pkg/operator/applyconfigurations/internal/internal.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go
🧬 Code graph analysis (10)
pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go (4)
pkg/operator/listers/operator/v1alpha1/trustmanager.go (2)
  • TrustManagerLister (14-22)
  • NewTrustManagerLister (30-32)
pkg/operator/informers/externalversions/internalinterfaces/factory_interfaces.go (1)
  • TweakListOptionsFunc (24-24)
pkg/operator/informers/externalversions/operator/v1alpha1/interface.go (1)
  • Interface (10-17)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (1)
  • TrustManager (25-31)
pkg/operator/informers/externalversions/operator/v1alpha1/interface.go (1)
pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go (1)
  • TrustManagerInformer (21-24)
pkg/operator/applyconfigurations/utils.go (9)
api/operator/v1alpha1/groupversion_info.go (1)
  • SchemeGroupVersion (29-29)
pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)
  • DefaultCAPackageConfigApplyConfiguration (11-13)
pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go (1)
  • SecretTargetsConfigApplyConfiguration (11-14)
pkg/operator/applyconfigurations/operator/v1alpha1/serverconfig.go (1)
  • ServerConfigApplyConfiguration (7-10)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (1)
  • TrustManagerApplyConfiguration (16-21)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go (1)
  • TrustManagerConfigApplyConfiguration (12-23)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go (1)
  • TrustManagerControllerConfigApplyConfiguration (7-10)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go (1)
  • TrustManagerSpecApplyConfiguration (7-10)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go (1)
  • TrustManagerStatusApplyConfiguration (12-18)
pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)
api/operator/v1alpha1/trustmanager_types.go (1)
  • DefaultCAPackagePolicy (238-238)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go (1)
api/operator/v1alpha1/trustmanager_types.go (2)
  • SecretTargetsPolicy (225-225)
  • DefaultCAPackagePolicy (238-238)
pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go (5)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (2)
  • TrustManager (25-31)
  • TrustManagerApplyConfiguration (16-21)
api/operator/v1alpha1/trustmanager_types.go (1)
  • TrustManagerList (16-23)
pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go (1)
  • FakeOperatorV1alpha1 (11-13)
pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go (1)
  • TrustManagerInterface (24-39)
api/operator/v1alpha1/groupversion_info.go (1)
  • SchemeGroupVersion (29-29)
pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go (1)
pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go (1)
  • TrustManagerInterface (24-39)
api/operator/v1alpha1/zz_generated.deepcopy.go (2)
api/operator/v1alpha1/trustmanager_types.go (1)
  • TrustManagerList (16-23)
api/operator/v1alpha1/meta.go (1)
  • ConditionalStatus (44-51)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go (3)
pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go (1)
  • SecretTargetsConfigApplyConfiguration (11-14)
api/operator/v1alpha1/trustmanager_types.go (1)
  • FilterExpiredCertificatesPolicy (214-214)
pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)
  • DefaultCAPackageConfigApplyConfiguration (11-13)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (3)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go (1)
  • TrustManagerSpecApplyConfiguration (7-10)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go (1)
  • TrustManagerStatusApplyConfiguration (12-18)
pkg/operator/applyconfigurations/internal/internal.go (1)
  • Parser (12-21)
🔇 Additional comments (26)
api/operator/v1alpha1/meta.go (1)

43-51: LGTM!

Good documentation update—generalizing from "istio-csr agent" to "operand deployment" correctly reflects that ConditionalStatus is now shared across multiple operands (IstioCSR and TrustManager).

config/samples/tech-preview/kustomization.yaml (1)

3-4: LGTM!

The new sample resources for TrustManager and Bundle are correctly added to the kustomization.

config/crd/bases/operator.openshift.io_trustmanagers.yaml (3)

1-57: LGTM! Well-structured CRD definition.

The CRD is properly configured with:

  • Cluster scope with singleton enforcement via x-kubernetes-validations
  • Appropriate labels and categories
  • Clear description and printer columns for observability

1124-1161: LGTM! Good CEL validation rules for secretTargets.

The cross-field validation ensuring authorizedSecrets is populated when policy: Custom (and empty otherwise) is well implemented.


1223-1310: LGTM! Status schema follows Kubernetes conventions.

The status section properly includes conditions with standard fields and reflects key configuration state.

config/samples/tech-preview/operator.openshift.io_v1alpha1_trustmanager.yaml (1)

1-12: LGTM! Good sample configuration.

The sample demonstrates key TrustManager configuration options including the default CA package integration, which is a common use case for trust-manager with OpenShift.

bundle/manifests/trust.cert-manager.io_bundles.yaml (1)

1-506: Upstream-managed CRD - no review required.

Per prior discussion, the Bundle CRD is imported from upstream trust-manager (v0.20.3) via the manifest update script. Any issues should be addressed in the upstream project.

bundle/manifests/cert-manager-operator.clusterserviceversion.yaml (3)

237-272: LGTM! alm-examples are now consistent.

The TrustManager example correctly enables defaultCAPackage.policy: Enabled, which aligns with the Bundle example using useDefaultCAs: true. This ensures the examples work together out-of-the-box.


316-321: LGTM! Owned CRD declarations are correct.

Both Bundle and TrustManager are properly declared as owned CRDs with appropriate descriptions.

Also applies to: 389-396


856-856: LGTM!

Adding trust-manager to keywords appropriately reflects the new capability.

pkg/operator/informers/externalversions/operator/v1alpha1/interface.go (1)

15-16: LGTM!

Generated informer interface correctly adds TrustManagers accessor following the cluster-scoped CertManagers pattern (no namespace parameter), which aligns with the PR's cluster-scoped TrustManager CRD design.

Also applies to: 39-43

pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go (1)

23-25: LGTM!

Generated fake client method correctly follows the cluster-scoped CertManagers pattern without namespace parameter.

pkg/operator/applyconfigurations/internal/internal.go (1)

46-55: LGTM!

Generated schema entry for TrustManager follows the identical pattern used for CertManager and IstioCSR.

pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go (1)

1-37: LGTM!

Generated fake client implementation correctly:

  • Uses empty namespace for cluster-scoped resource
  • Wires proper GVR (trustmanagers) and GVK (TrustManager)
  • Follows standard gentype.FakeClientWithListAndApply patterns
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go (1)

1-44: LGTM!

Generated apply configuration follows standard patterns with proper nil-map initialization and fluent builder methods for Labels and Annotations.

pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)

1-27: LGTM!

Standard auto-generated apply configuration following established patterns.

pkg/operator/applyconfigurations/utils.go (1)

37-68: LGTM!

Generated ForKind mappings correctly added for all TrustManager-related types, maintaining alphabetical ordering.

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go (1)

1-69: LGTM!

Well-structured auto-generated status apply configuration with proper embedding and fluent builders.

pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go (1)

1-85: LGTM!

Standard auto-generated informer implementation. The namespace indexer on line 76 is safe for cluster-scoped resources as MetaNamespaceIndexFunc returns an empty string for objects without a namespace.

api/operator/v1alpha1/zz_generated.deepcopy.go (4)

281-294: LGTM!

DefaultCAPackageConfig deepcopy correctly uses shallow copy for value-type fields.


553-571: LGTM!

SecretTargetsConfig deepcopy correctly handles the AuthorizedSecrets slice with proper allocation and copy.


588-650: LGTM!

TrustManager and TrustManagerConfig deepcopy implementations correctly handle all nested types, pointers, slices, and maps.


652-744: LGTM!

TrustManagerControllerConfig, TrustManagerList, TrustManagerSpec, and TrustManagerStatus deepcopy implementations are correct and follow established patterns.

pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go (1)

1-58: LGTM!

Standard client-gen output for the TrustManager resource. The interface and implementation correctly follow Kubernetes client patterns, including proper support for the cluster-scoped resource (empty namespace parameter on line 53) and status subresource operations.

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go (1)

1-117: LGTM!

Standard applyconfiguration-gen output for TrustManagerConfig. The struct fields and fluent builder methods correctly cover all configuration options including pod scheduling (Resources, Affinity, Tolerations, NodeSelector) and trust-manager-specific settings.

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (1)

1-263: LGTM!

Standard applyconfiguration-gen output for the TrustManager CRD. The extraction helpers (ExtractTrustManager, ExtractTrustManagerStatus) properly support extract/modify/apply workflows using managed fields, and the fluent builder methods correctly cover all metadata, spec, and status fields.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

@chiragkyal chiragkyal changed the title wip: Add TrustManager API and Static Manifests Add TrustManager API and Static Manifests Jan 8, 2026
@chiragkyal chiragkyal marked this pull request as ready for review January 8, 2026 11:56
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 8, 2026
@openshift-ci openshift-ci bot requested review from bharath-b-rh and swghosh January 8, 2026 11:57
@chiragkyal
Copy link
Member Author

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 8, 2026
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 8, 2026
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 9, 2026
@chiragkyal chiragkyal changed the title Add TrustManager API and Static Manifests CM-862, CM-863: Add TrustManager API and Static Manifests Jan 9, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 9, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 9, 2026

@chiragkyal: This pull request references CM-862 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 either version "4.22." or "openshift-4.22.", but it targets "cert-manager-1.19" instead.

This pull request references CM-863 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 either version "4.22." or "openshift-4.22.", but it targets "cert-manager-1.19" instead.

Details

In response to this:

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
bundle/manifests/cert-manager-operator.clusterserviceversion.yaml (1)

403-688: Blocker: CSV RBAC is missing permissions for the new TrustManager (and likely Bundle) APIs

clusterPermissions includes operator.openshift.io rules for certmanagers and istiocsrs, but not trustmanagers. If this CSV ships as-is, the operator will fail to list/watch/reconcile TrustManager resources.

Proposed fix (add API rules)
         - apiGroups:
           - operator.openshift.io
           resources:
           - certmanagers
+          - trustmanagers
           verbs:
           - create
           - delete
           - get
           - list
           - patch
           - update
           - watch
         - apiGroups:
           - operator.openshift.io
           resources:
           - certmanagers/finalizers
           - istiocsrs/finalizers
+          - trustmanagers/finalizers
           verbs:
           - update
         - apiGroups:
           - operator.openshift.io
           resources:
           - certmanagers/status
           - istiocsrs/status
+          - trustmanagers/status
           verbs:
           - get
           - patch
           - update
+        - apiGroups:
+          - trust.cert-manager.io
+          resources:
+          - bundles
+          - bundles/status
+          verbs:
+          - get
+          - list
+          - watch
🤖 Fix all issues with AI agents
In @bindata/trust-manager/resources/deployment_trust-manager.yml:
- Line 66: The Deployment currently has an empty resources block ("resources:
{}"); update the Pod template's container spec (spec.template.spec.containers
for the trust-manager container) to define sensible CPU and memory requests and
limits (e.g., requests for baseline scheduling and limits to prevent OOM/CPU
runaway) based on expected load; ensure both request and limit fields are set
for cpu and memory for the trust-manager container, and document or comment that
values should be tuned after load testing.

In @bundle/manifests/cert-manager-operator.clusterserviceversion.yaml:
- Around line 236-268: The alm-example is inconsistent:
Bundle.spec.sources[].useDefaultCAs is true while the TrustManager example
(TrustManager.spec.trustManagerConfig) does not enable
spec.trustManagerConfig.defaultCAPackage.policy (which defaults to Disabled);
update the examples so they align by either setting
TrustManager.spec.trustManagerConfig.defaultCAPackage.policy to Enabled on the
TrustManager resource (so default CAs are allowed) or change
Bundle.spec.sources[].useDefaultCAs to false; reference the TrustManager and
Bundle symbols when making the change
(TrustManager.spec.trustManagerConfig.defaultCAPackage.policy and
Bundle.spec.sources[].useDefaultCAs).

In @bundle/manifests/operator.openshift.io_trustmanagers.yaml:
- Around line 1218-1223: The description for the TrustManager CRD's
status.conditions is incorrect (it mentions the "istio-csr agent deployment");
update the properties.status.conditions description in the TrustManager CRD
(operator.openshift.io_trustmanagers.yaml) to reference the TrustManager
resource status instead—for example: "conditions holds information about the
current observed state of the TrustManager." Ensure you replace the misleading
"istio-csr agent deployment" phrase with wording that clearly refers to the
TrustManager status.

In @bundle/manifests/trust.cert-manager.io_bundles.yaml:
- Around line 424-428: The CRD description under the `conditions` field
incorrectly says "Known condition types are `Bundle`" but the printer columns
expect `.status.conditions[?(@.type == "Synced")]`; update the `conditions`
description text to reference the actual condition type(s) used (e.g., `Synced`)
or list both expected types, ensuring the `conditions.description` string
matches the `.status.conditions[?(@.type == "Synced")]` usage in the printer
columns.
🧹 Nitpick comments (6)
api/operator/v1alpha1/trustmanager_types.go (1)

59-150: Verify omitempty behavior for optional nested structs (may serialize as {})
Fields like TrustManagerSpec.ControllerConfig, TrustManagerConfig.SecretTargets, and TrustManagerConfig.DefaultCAPackage are non-pointer structs tagged omitempty. In Go’s standard encoding/json, structs are not omitted; if your serialization behaves similarly, these “optional” blocks may always appear in stored objects and patch/apply diffs. If that’s undesirable, consider switching these optional subobjects to pointers (*...).

bindata/trust-manager/resources/role_trust-manager:leaderelection.yml (1)

13-23: Restrict Lease RBAC with resourceNames for least privilege
The deployment uses --leader-elect=true without explicitly specifying a lease name, which defaults to the controller name. Add resourceNames: ["trust-manager"] to the Role to limit lease access to only the required resource.

Example
rules:
  - apiGroups:
      - "coordination.k8s.io"
    resources:
      - "leases"
    resourceNames:
      - "trust-manager"
    verbs:
      - "get"
      - "create"
      - "update"
      - "watch"
      - "list"
bindata/trust-manager/resources/certificate_trust-manager.yml (1)

13-22: Optional: specify TLS certificate intent/rotation knobs (usages, privateKey, duration)

This is structurally fine, but if the trust-manager serving cert has specific requirements, consider explicitly setting spec.usages (e.g., server auth) and spec.privateKey (algorithm/size/rotationPolicy), and optionally duration/renewBefore to avoid relying on defaults across cert-manager versions.

hack/update-trust-manager-manifests.sh (2)

37-38: Add safety checks before destructive rm operations.

The rm -rf commands on Lines 37-38 could be dangerous if MANIFESTS_PATH or the directory paths are empty or misconfigured, potentially deleting unintended files.

🛡️ Recommended safety improvements
 # regenerate all bindata
-rm -rf bindata/trust-manager/resources
-rm -f config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml
+if [ -d bindata/trust-manager/resources ]; then
+  rm -rf bindata/trust-manager/resources
+fi
+if [ -f config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml ]; then
+  rm -f config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml
+fi

1-5: Verify required tools are installed.

The script depends on helm and yq but doesn't verify they are available before executing. This could lead to cryptic errors if these tools are not installed.

🔧 Optional dependency check
 #!/bin/bash
 
 set -e
 
+# Check required tools
+for cmd in helm yq; do
+  if ! command -v "$cmd" &> /dev/null; then
+    echo "Error: $cmd is not installed" >&2
+    exit 1
+  fi
+done
+
 TRUST_MANAGER_VERSION=${1:?"missing trust-manager version. Please specify a version from https://github.com/cert-manager/trust-manager/releases"}
bindata/trust-manager/resources/deployment_trust-manager.yml (1)

14-14: Consider high availability for production deployments.

The deployment runs a single replica, which means:

  • No high availability during pod restarts or node failures
  • Single point of failure for webhook validation
  • Potential service interruption during upgrades

For production environments, consider:

  • Increasing replicas to at least 2 for HA
  • Adding pod anti-affinity rules to spread replicas across nodes
  • Implementing PodDisruptionBudget to maintain availability during cluster maintenance
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between da0c512 and a9b8263.

📒 Files selected for processing (47)
  • Makefile
  • api/operator/v1alpha1/trustmanager_types.go
  • api/operator/v1alpha1/zz_generated.deepcopy.go
  • bindata/trust-manager/resources/certificate_trust-manager.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/operator.openshift.io_trustmanagers.yaml
  • bundle/manifests/trust.cert-manager.io_bundles.yaml
  • config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml
  • config/crd/bases/operator.openshift.io_trustmanagers.yaml
  • config/crd/kustomization.yaml
  • config/manifests/bases/cert-manager-operator.clusterserviceversion.yaml
  • config/samples/tech-preview/kustomization.yaml
  • config/samples/tech-preview/operator.openshift.io_v1alpha1_trustmanager.yaml
  • config/samples/tech-preview/trust.cert-manager.io_v1alpha1_bundle.yaml
  • hack/update-trust-manager-manifests.sh
  • pkg/operator/applyconfigurations/internal/internal.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go
  • pkg/operator/applyconfigurations/utils.go
  • pkg/operator/assets/bindata.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/operator_client.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go
  • pkg/operator/informers/externalversions/generic.go
  • pkg/operator/informers/externalversions/operator/v1alpha1/interface.go
  • pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go
  • pkg/operator/listers/operator/v1alpha1/expansion_generated.go
  • pkg/operator/listers/operator/v1alpha1/trustmanager.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • bindata/trust-manager/resources/rolebinding_trust-manager.yml
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/operator_client.go
  • bindata/trust-manager/resources/rolebinding_trust-manager:leaderelection.yml
  • bindata/trust-manager/resources/validatingwebhookconfiguration_trust-manager.yml
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go
  • bindata/trust-manager/resources/role_trust-manager.yml
  • bindata/trust-manager/resources/issuer_trust-manager.yml
  • pkg/operator/informers/externalversions/generic.go
  • Makefile
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go
  • config/samples/tech-preview/kustomization.yaml
  • bindata/trust-manager/resources/role_trust-manager:leaderelection.yml
  • hack/update-trust-manager-manifests.sh
  • config/samples/tech-preview/operator.openshift.io_v1alpha1_trustmanager.yaml
  • pkg/operator/informers/externalversions/operator/v1alpha1/interface.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go
  • config/crd/kustomization.yaml
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go
  • pkg/operator/listers/operator/v1alpha1/expansion_generated.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go
  • bindata/trust-manager/resources/clusterrole_trust-manager.yml
  • config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml
  • bindata/trust-manager/resources/service_trust-manager.yml
  • api/operator/v1alpha1/trustmanager_types.go
  • config/crd/bases/operator.openshift.io_trustmanagers.yaml
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go
  • pkg/operator/listers/operator/v1alpha1/trustmanager.go
  • bindata/trust-manager/resources/deployment_trust-manager.yml
  • bundle/manifests/trust.cert-manager.io_bundles.yaml
  • bindata/trust-manager/resources/serviceaccount_trust-manager.yml
  • bindata/trust-manager/resources/service_trust-manager-metrics.yml
  • config/samples/tech-preview/trust.cert-manager.io_v1alpha1_bundle.yaml
  • pkg/operator/assets/bindata.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go
  • api/operator/v1alpha1/zz_generated.deepcopy.go
  • pkg/operator/applyconfigurations/utils.go
  • bindata/trust-manager/resources/certificate_trust-manager.yml
  • pkg/operator/applyconfigurations/internal/internal.go
  • bindata/trust-manager/resources/clusterrolebinding_trust-manager.yml
  • pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go
  • bundle/manifests/operator.openshift.io_trustmanagers.yaml
  • bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
  • config/manifests/bases/cert-manager-operator.clusterserviceversion.yaml
🧬 Code graph analysis (11)
pkg/operator/clientset/versioned/typed/operator/v1alpha1/operator_client.go (1)
pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go (2)
  • TrustManagersGetter (19-21)
  • TrustManagerInterface (24-39)
pkg/operator/informers/externalversions/generic.go (1)
api/operator/v1alpha1/groupversion_info.go (1)
  • SchemeGroupVersion (29-29)
pkg/operator/informers/externalversions/operator/v1alpha1/interface.go (1)
pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go (1)
  • TrustManagerInformer (21-24)
pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go (1)
api/operator/v1alpha1/trustmanager_types.go (1)
  • SecretTargetsPolicy (221-221)
pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)
api/operator/v1alpha1/trustmanager_types.go (1)
  • DefaultCAPackagePolicy (234-234)
api/operator/v1alpha1/trustmanager_types.go (3)
api/operator/v1alpha1/groupversion_info.go (1)
  • SchemeBuilder (32-32)
api/operator/v1alpha1/istiocsr_types.go (1)
  • ControllerConfig (299-308)
api/operator/v1alpha1/meta.go (1)
  • ConditionalStatus (43-50)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go (1)
api/operator/v1alpha1/trustmanager_types.go (2)
  • SecretTargetsPolicy (221-221)
  • DefaultCAPackagePolicy (234-234)
pkg/operator/listers/operator/v1alpha1/trustmanager.go (3)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (1)
  • TrustManager (25-31)
pkg/operator/listers/operator/v1alpha1/expansion_generated.go (1)
  • TrustManagerListerExpansion (19-19)
api/operator/v1alpha1/groupversion_info.go (1)
  • Resource (40-42)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go (3)
pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go (1)
  • SecretTargetsConfigApplyConfiguration (11-14)
api/operator/v1alpha1/trustmanager_types.go (1)
  • FilterExpiredCertificatesPolicy (210-210)
pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)
  • DefaultCAPackageConfigApplyConfiguration (11-13)
api/operator/v1alpha1/zz_generated.deepcopy.go (2)
api/operator/v1alpha1/trustmanager_types.go (1)
  • TrustManagerList (16-23)
api/operator/v1alpha1/meta.go (1)
  • ConditionalStatus (43-50)
pkg/operator/applyconfigurations/utils.go (7)
api/operator/v1alpha1/groupversion_info.go (1)
  • SchemeGroupVersion (29-29)
pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)
  • DefaultCAPackageConfigApplyConfiguration (11-13)
pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go (1)
  • SecretTargetsConfigApplyConfiguration (11-14)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (1)
  • TrustManagerApplyConfiguration (16-21)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go (1)
  • TrustManagerConfigApplyConfiguration (12-23)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go (1)
  • TrustManagerControllerConfigApplyConfiguration (7-10)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go (1)
  • TrustManagerSpecApplyConfiguration (7-10)
🔇 Additional comments (45)
Makefile (2)

9-9: LGTM! Consistent version management pattern.

The addition of TRUST_MANAGER_VERSION follows the established pattern for managing component versions in the Makefile.


151-151: LGTM! Properly integrates trust-manager manifest generation.

The addition correctly integrates trust-manager manifest updates into the update-manifests target, following the same pattern as cert-manager and istio-csr.

config/crd/kustomization.yaml (1)

13-14: LGTM! CRD resources correctly added.

The new TrustManager and Bundle CRD resources are properly integrated into the kustomization configuration, following the existing pattern.

config/samples/tech-preview/kustomization.yaml (1)

3-4: LGTM! Sample resources correctly referenced.

The new TrustManager and Bundle sample files are properly integrated into the tech-preview kustomization.

config/samples/tech-preview/operator.openshift.io_v1alpha1_trustmanager.yaml (1)

1-10: LGTM! Well-structured TrustManager sample.

The TrustManager sample provides a clear and complete configuration example with sensible defaults. The metadata.name: cluster aligns with the singleton enforcement pattern for this cluster-scoped resource.

pkg/operator/applyconfigurations/internal/internal.go (1)

46-55: LGTM! Generated schema entry is consistent.

The TrustManager schema entry follows the same pattern as existing CertManager and IstioCSR entries, ensuring consistent structured-merge-diff behavior.

pkg/operator/listers/operator/v1alpha1/expansion_generated.go (1)

16-19: LGTM! Generated expansion interface is consistent.

The TrustManagerListerExpansion interface follows the established pattern, enabling custom method additions to TrustManagerLister.

pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)

1-27: LGTM! Generated apply-configuration follows standard patterns.

The DefaultCAPackageConfigApplyConfiguration correctly implements the declarative apply-configuration pattern with fluent builder methods.

pkg/operator/listers/operator/v1alpha1/trustmanager.go (1)

1-32: LGTM! Generated lister implementation follows client-go patterns.

The TrustManagerLister correctly uses ResourceIndexer with proper resource type initialization, enabling standard list/get operations for TrustManager resources.

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go (1)

1-44: LGTM! Generated apply-configuration correctly handles map fields.

The TrustManagerControllerConfigApplyConfiguration properly implements fluent builders for Labels and Annotations, with correct lazy map initialization and entry merging.

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go (3)

10-18: Generated apply-config type looks consistent with client-go apply patterns
Pointer fields + embedded ConditionalStatusApplyConfiguration are what applyconfiguration-gen typically emits; no issues spotted.


29-37: Panic-on-nil in WithConditions is OK for generated fluent APIs; just ensure callers never pass nil
This is standard for these builders, but it will crash the reconciler if misused.


58-69: Verify policy enum types match the API package definitions
WithSecretTargetsPolicy / WithDefaultCAPackagePolicy take operatorv1alpha1.{SecretTargetsPolicy,DefaultCAPackagePolicy}; ensure those are the canonical API types (not duplicated/aliased elsewhere) to avoid subtle conversions or schema drift.

api/operator/v1alpha1/trustmanager_types.go (4)

8-10: Scheme registration for TrustManager types is correct
Registers both TrustManager and TrustManagerList.


25-57: Singleton enforcement via XValidation is a good guardrail
Requiring .metadata.name == "cluster" is clear and prevents accidental multi-instance creation.


152-176: SecretTargets XValidations look correct and cover both directions
The “Specific requires non-empty authorizedSecrets” and “non-Specific requires empty authorizedSecrets” constraints are complementary and should prevent ambiguous configs.


208-241: Policy enums are well-scoped and explicit
Clear Enabled/Disabled and Disabled/All/Specific options with kubebuilder Enum validation.

bindata/trust-manager/resources/rolebinding_trust-manager.yml (1)

1-20: RoleBinding wiring is correct (Role -> ServiceAccount in same namespace)
Looks consistent for binding Role/trust-manager to ServiceAccount/trust-manager in cert-manager.

pkg/operator/informers/externalversions/generic.go (1)

44-45: Informer factory mapping for TrustManager GVR is correct
Uses v1alpha1.SchemeGroupVersion.WithResource("trustmanagers") and returns the expected typed informer.

bindata/trust-manager/resources/issuer_trust-manager.yml (1)

1-14: Issuer manifest is straightforward and valid
A namespaced self-signed Issuer is a common pattern for generating serving certs.

bindata/trust-manager/resources/service_trust-manager-metrics.yml (1)

14-22: No action required—Service selector labels and metrics port correctly match the Deployment.

Service selector app: cert-manager-trust-manager matches the Deployment pod labels, and targetPort: 9402 matches the container port exposed by the Deployment. The port name metrics is also consistent.

pkg/operator/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go (1)

5-9: LGTM: consistent client-gen expansion hook

Follows the existing *Expansion pattern and keeps future custom methods possible without forking generated code.

pkg/operator/clientset/versioned/typed/operator/v1alpha1/operator_client.go (1)

13-18: TrustManager client is correctly surfaced as cluster-scoped

The interface embedding and TrustManagers() accessor match the TrustManagersGetter / TrustManagerInterface pattern. The newTrustManagers(c) constructor correctly implements cluster-scoped behavior: the namespace parameter is an empty string ("" at line 53 of trustmanager.go), which is the standard Kubernetes client-go pattern for cluster-scoped resources. The REST path uses no namespace segments.

bindata/trust-manager/resources/rolebinding_trust-manager:leaderelection.yml (1)

13-20: The corresponding Role manifest is already included in the bundle.

The role_trust-manager:leaderelection.yml file exists in the same directory with the correct name and namespace. Both manifests will be applied together as part of the static bundle, so there is no risk of the install failing due to a missing Role.

Likely an incorrect or invalid review comment.

bindata/trust-manager/resources/role_trust-manager.yml (1)

13-21: The list/watch permissions on Secrets are upstream-mandated and necessary

These role manifests are auto-generated from the upstream cert-manager/trust-manager Helm chart (via hack/update-trust-manager-manifests.sh), so the RBAC permissions cannot be modified locally without forking. The list/watch verbs are required because the Bundle CRD allows referencing Secrets as data sources, and trust-manager must watch these Secrets for changes via Kubernetes informers. The permissions are read-only and appropriately scoped to the cert-manager namespace, matching the CRD design that limits secret access to that namespace by default.

bindata/trust-manager/resources/clusterrole_trust-manager.yml (1)

33-37: Verify necessity of broad ConfigMaps permissions.

The ClusterRole grants delete permission on all ConfigMaps cluster-wide. Ensure that trust-manager requires this level of access, as ConfigMaps may contain sensitive configuration data. If trust-manager only manages specific ConfigMaps (e.g., those with certain labels or in specific namespaces), consider using a more restrictive RBAC setup.

pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go (1)

23-25: LGTM!

The generated fake client method follows the standard Kubernetes client-go pattern and is consistent with the existing CertManagers() and IstioCSRs() methods.

bindata/trust-manager/resources/serviceaccount_trust-manager.yml (1)

3-3: Verify that service account token automounting is necessary.

While automountServiceAccountToken: true is likely required for trust-manager to access the Kubernetes API, confirm this is needed. If trust-manager doesn't require API access, consider setting this to false to reduce the attack surface.

pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go (1)

1-37: LGTM!

The generated fake TrustManager client follows standard Kubernetes client-go patterns and correctly implements the TrustManagerInterface using the FakeClientWithListAndApply pattern. The cluster-scoped nature (empty namespace on line 22) aligns with TrustManager being a cluster-level resource.

pkg/operator/informers/externalversions/operator/v1alpha1/interface.go (1)

15-16: LGTM!

The generated informer interface and implementation for TrustManagers correctly follows the Kubernetes informer-gen pattern and is consistent with the existing CertManagers() implementation, both being cluster-scoped resources.

Also applies to: 40-43

bindata/trust-manager/resources/validatingwebhookconfiguration_trust-manager.yml (1)

27-30: Verify webhook availability strategy with failurePolicy: Fail.

The failurePolicy: Fail setting means that if the trust-manager webhook becomes unavailable, all Bundle CREATE/UPDATE operations will be blocked. While this is appropriate for validation, ensure that:

  • The trust-manager deployment has appropriate readiness probes and health checks
  • Deployment strategies account for zero-downtime upgrades
  • Documentation warns operators about this behavior

Based on the deployment manifest, the readiness probe is configured (Lines 40-45 in deployment_trust-manager.yml), which is good. However, verify that the operator handles webhook availability during upgrades to prevent blocking critical operations.

bindata/trust-manager/resources/deployment_trust-manager.yml (1)

67-76: LGTM! Strong security posture.

The security context configuration follows best practices:

  • Read-only root filesystem prevents runtime modifications
  • Non-root execution reduces attack surface
  • All capabilities dropped follows least privilege
  • RuntimeDefault seccomp profile adds syscall filtering
bindata/trust-manager/resources/service_trust-manager.yml (1)

1-22: LGTM! Service configuration is correct.

The Service configuration properly:

  • Maps port 443 (standard HTTPS) to targetPort 6443 (webhook container port)
  • Uses selector app: cert-manager-trust-manager which matches the Deployment pod labels
  • Exposes the webhook endpoint for the ValidatingWebhookConfiguration
bindata/trust-manager/resources/clusterrolebinding_trust-manager.yml (1)

1-19: LGTM! RBAC binding is correctly configured.

The ClusterRoleBinding properly:

  • References the trust-manager ClusterRole
  • Binds to the trust-manager ServiceAccount in the cert-manager namespace
  • Uses consistent naming across all RBAC resources
  • Follows standard Kubernetes RBAC patterns
config/manifests/bases/cert-manager-operator.clusterserviceversion.yaml (1)

109-122: LGTM - New CRD definitions added correctly.

The Bundle and TrustManager CRD entries follow the established pattern used by existing CRDs like IstioCSR. The TrustManager singleton semantics (name must be 'cluster') and deployment namespace are clearly documented.

Also applies to: 156-156

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go (1)

1-32: LGTM - Standard generated apply configuration.

Auto-generated file following the established apply configuration pattern used throughout the codebase.

pkg/operator/assets/bindata.go (1)

3088-3125: LGTM - Trust-manager static manifests properly embedded.

The trust-manager resources include appropriate security configurations:

  • Non-root execution with read-only filesystem
  • Dropped capabilities and RuntimeDefault seccomp profile
  • Least-privilege RBAC with scoped secret access only in the trust namespace
pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go (1)

1-38: LGTM - Standard generated apply configuration.

Auto-generated file with proper handling of the Policy field and list-append semantics for AuthorizedSecrets.

config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml (1)

1-476: LGTM - Well-structured Bundle CRD.

The CRD follows Kubernetes conventions with comprehensive OpenAPI validation, proper list-type annotations, and status subresource support. The JKS deprecation notice provides clear migration guidance to PKCS12.

pkg/operator/applyconfigurations/utils.go (1)

37-68: LGTM - ForKind updated with new TrustManager types.

Auto-generated additions follow the established pattern, adding all necessary apply configuration type mappings for the TrustManager API surface.

pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go (1)

1-85: LGTM - Standard generated informer for TrustManager.

Auto-generated informer following established patterns with both legacy and context-aware list/watch implementations.

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (1)

14-246: Generated TrustManager apply-configuration looks consistent and complete

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go (1)

10-117: Generated TrustManagerConfig apply-configuration looks good

api/operator/v1alpha1/zz_generated.deepcopy.go (1)

281-650: > Likely an incorrect or invalid review comment.

pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go (1)

1-58: Generated code follows standard Kubernetes client patterns — LGTM.

This is auto-generated client code (client-gen) that correctly implements the typed client for the cluster-scoped TrustManager resource. The empty namespace on line 53 is appropriate for cluster-scoped resources, and the generic client wiring is consistent with modern client-go conventions.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 9, 2026

@chiragkyal: This pull request references CM-862 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 either version "4.22." or "openshift-4.22.", but it targets "cert-manager-1.19" instead.

This pull request references CM-863 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 either version "4.22." or "openshift-4.22.", but it targets "cert-manager-1.19" instead.

Details

In response to this:

Summary

This PR introduces the TrustManager API and supporting static manifests, which will be managed by cert-manager-operator to handle the lifecycle of the trust-manager operand.

Key additions

  • New TrustManager Custom Resource Definition
  • Static manifests for trust-manager deployment (RBAC, Service, Deployment, ValidatingWebhookConfiguration, etc.)
  • Automated script (hack/update-trust-manager-manifests.sh) to generate trust-manager manifests from upstream

TrustManager API Features

The TrustManager resource is a cluster-scoped singleton (name must be cluster) that provides:

  • Logging configuration: Configurable log level (1-5) and format (text/json)
  • Trust namespace: Specify where trust-manager looks for CA certificate sources
  • Secret targets policy: Control trust bundle writing to Secrets (Disabled/All/Specific)
  • Expired certificate filtering: Option to filter expired certificates from bundles
  • Default CA package: Integration with OpenShift's trusted CA bundle injection
  • Pod configuration: Resource requirements, affinity, tolerations, and node selectors
  • Operator controls: Custom labels and annotations for created resources

Closes

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
bundle/manifests/cert-manager-operator.clusterserviceversion.yaml (1)

168-176: Avoid using a real-looking email in alm-examples.

Consider swapping "aos-ci-cd@redhat.com" for a non-identifying placeholder (e.g., user@example.com) since this is user-facing sample content.

Proposed fix
-              "email": "aos-ci-cd@redhat.com",
+              "email": "user@example.com",
🤖 Fix all issues with AI agents
In @bundle/manifests/operator.openshift.io_trustmanagers.yaml:
- Around line 1218-1223: Update the CRD description for TrustManager: replace
the incorrect phrase "istio-csr agent deployment" in the status.conditions
description with a TrustManager-specific phrase (e.g., "current state of the
TrustManager" or "current state of the TrustManager controller/deployment") so
the 'status.conditions' entry accurately describes TrustManager state; edit the
properties entry for status -> conditions in the TrustManager CRD to reflect
this corrected wording.

In @bundle/manifests/trust.cert-manager.io_bundles.yaml:
- Around line 23-39: The manifest's additionalPrinterColumns describe the
condition as "Bundle" but the jsonPath targets condition type "Synced"; update
the schema descriptions to reference the "Synced" condition (or make the
jsonPath and condition type match) so the docs and printer columns are
consistent—specifically edit the additionalPrinterColumns entries under
additionalPrinterColumns that use jsonPath .status.conditions[?(@.type ==
"Synced")] (and the duplicate block mentioned around the later occurrence) to
replace "Bundle" wording with "Synced" (or change the jsonPath to point to the
"Bundle" condition if that is the intended type).

In @config/crd/bases/operator.openshift.io_trustmanagers.yaml:
- Around line 1218-1223: The CRD description for TrustManager status.conditions
incorrectly references “istio-csr”; update the API type comment that generates
this field (the Go struct comment for TrustManagerStatus or the Conditions field
on TrustManager) to mention TrustManager instead of istio-csr, then re-run
controller-gen to regenerate the CRD base and bundle so the description in
status.conditions is corrected across outputs.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between a9b8263 and 525ff10.

📒 Files selected for processing (24)
  • api/operator/v1alpha1/zz_generated.deepcopy.go
  • bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
  • bundle/manifests/operator.openshift.io_trustmanagers.yaml
  • bundle/manifests/trust.cert-manager.io_bundles.yaml
  • config/crd/bases/operator.openshift.io_trustmanagers.yaml
  • pkg/operator/applyconfigurations/internal/internal.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go
  • pkg/operator/applyconfigurations/utils.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/operator_client.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go
  • pkg/operator/informers/externalversions/generic.go
  • pkg/operator/informers/externalversions/operator/v1alpha1/interface.go
  • pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go
  • pkg/operator/listers/operator/v1alpha1/expansion_generated.go
  • pkg/operator/listers/operator/v1alpha1/trustmanager.go
🚧 Files skipped from review as they are similar to previous changes (6)
  • pkg/operator/listers/operator/v1alpha1/expansion_generated.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/operator_client.go
  • pkg/operator/informers/externalversions/generic.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go
  • pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • pkg/operator/informers/externalversions/operator/v1alpha1/interface.go
  • pkg/operator/listers/operator/v1alpha1/trustmanager.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go
  • bundle/manifests/trust.cert-manager.io_bundles.yaml
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go
  • bundle/manifests/operator.openshift.io_trustmanagers.yaml
  • bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
  • config/crd/bases/operator.openshift.io_trustmanagers.yaml
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go
  • api/operator/v1alpha1/zz_generated.deepcopy.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go
  • pkg/operator/applyconfigurations/utils.go
  • pkg/operator/applyconfigurations/internal/internal.go
🧬 Code graph analysis (9)
pkg/operator/listers/operator/v1alpha1/trustmanager.go (3)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (1)
  • TrustManager (25-31)
pkg/operator/listers/operator/v1alpha1/expansion_generated.go (1)
  • TrustManagerListerExpansion (19-19)
api/operator/v1alpha1/groupversion_info.go (1)
  • Resource (40-42)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go (1)
api/operator/v1alpha1/trustmanager_types.go (2)
  • SecretTargetsPolicy (221-221)
  • DefaultCAPackagePolicy (234-234)
pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)
api/operator/v1alpha1/trustmanager_types.go (1)
  • DefaultCAPackagePolicy (234-234)
pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go (1)
api/operator/v1alpha1/trustmanager_types.go (1)
  • SecretTargetsPolicy (221-221)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go (3)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go (2)
  • TrustManagerConfig (27-29)
  • TrustManagerConfigApplyConfiguration (12-23)
api/operator/v1alpha1/istiocsr_types.go (1)
  • ControllerConfig (299-308)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go (1)
  • TrustManagerControllerConfigApplyConfiguration (7-10)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go (3)
pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go (1)
  • SecretTargetsConfigApplyConfiguration (11-14)
api/operator/v1alpha1/trustmanager_types.go (1)
  • FilterExpiredCertificatesPolicy (210-210)
pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)
  • DefaultCAPackageConfigApplyConfiguration (11-13)
pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go (1)
pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go (1)
  • TrustManagerInterface (24-39)
api/operator/v1alpha1/zz_generated.deepcopy.go (7)
pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)
  • DefaultCAPackageConfig (17-19)
pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go (1)
  • SecretTargetsConfig (18-20)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go (1)
  • TrustManagerConfig (27-29)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go (1)
  • TrustManagerControllerConfig (14-16)
api/operator/v1alpha1/trustmanager_types.go (1)
  • TrustManagerList (16-23)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go (1)
  • TrustManagerSpec (14-16)
api/operator/v1alpha1/meta.go (1)
  • ConditionalStatus (43-50)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (3)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go (1)
  • TrustManagerSpecApplyConfiguration (7-10)
pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go (1)
  • TrustManagerStatusApplyConfiguration (12-18)
pkg/operator/applyconfigurations/internal/internal.go (1)
  • Parser (12-21)
🔇 Additional comments (28)
pkg/operator/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go (1)

8-9: LGTM! Consistent with existing expansion patterns.

The TrustManagerExpansion interface follows the same pattern as CertManagerExpansion and IstioCSRExpansion, providing a standard extension point for the generated client.

pkg/operator/informers/externalversions/operator/v1alpha1/interface.go (2)

15-16: LGTM! Standard informer interface addition.

The TrustManagers() method addition follows the established pattern for informer interfaces.


40-43: LGTM! Correctly implements cluster-scoped informer.

The implementation follows the same pattern as CertManagers(), correctly omitting the namespace parameter to indicate that TrustManager is a cluster-scoped resource.

pkg/operator/listers/operator/v1alpha1/trustmanager.go (1)

1-32: LGTM! Standard generated lister implementation.

The TrustManagerLister implementation follows established patterns:

  • Interface provides standard List/Get methods
  • Implementation uses listers.ResourceIndexer generic
  • Constructor properly instantiates with resource type

All components are consistent with existing listers for CertManager and IstioCSR.

pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)

1-27: LGTM! Standard apply configuration pattern.

The DefaultCAPackageConfigApplyConfiguration follows Kubernetes conventions for apply configurations:

  • Pointer field for optional Policy value
  • Empty constructor
  • Fluent builder pattern with WithPolicy method

The implementation correctly takes the value parameter and stores its address, enabling proper omitempty/nil semantics for declarative apply operations.

api/operator/v1alpha1/zz_generated.deepcopy.go (8)

281-294: LGTM! Correct deepcopy for simple struct.

The DefaultCAPackageConfig deepcopy implementation correctly performs a simple struct copy, which is appropriate since the type contains only a Policy field (a string type) with no nested pointers or slices requiring deep copying.


553-571: LGTM! Proper slice deep copy.

The SecretTargetsConfig deepcopy correctly handles the AuthorizedSecrets string slice with proper nil checks, allocation, and copy operations.


588-613: LGTM! Standard Kubernetes CR deepcopy pattern.

The TrustManager deepcopy implementation follows the standard pattern for custom resources:

  • Properly calls DeepCopyInto on nested ObjectMeta, Spec, and Status
  • Implements DeepCopyObject to satisfy the runtime.Object interface

615-650: LGTM! Comprehensive deepcopy with proper handling of complex fields.

The TrustManagerConfig deepcopy correctly handles all field types:

  • Nested structs via DeepCopyInto calls
  • Pointer fields with nil checks and allocation
  • Slices with proper allocation and element-wise copying
  • Maps with proper allocation and entry copying

All patterns align with generated deepcopy best practices.


652-679: LGTM! Proper map deep copying.

The TrustManagerControllerConfig deepcopy correctly handles both Labels and Annotations maps with proper nil checks, allocation, and entry copying.


681-711: LGTM! Standard list deepcopy implementation.

The TrustManagerList deepcopy follows Kubernetes conventions for list types:

  • Proper handling of ListMeta
  • Correct allocation and element-wise copying of the Items slice
  • DeepCopyObject implementation for runtime.Object interface

713-728: LGTM! Correct delegation to nested types.

The TrustManagerSpec deepcopy properly delegates to the DeepCopyInto methods of its embedded TrustManagerConfig and ControllerConfig fields.


730-744: LGTM! Proper status deepcopy.

The TrustManagerStatus deepcopy correctly delegates to ConditionalStatus.DeepCopyInto, which properly handles the nested Conditions slice.

pkg/operator/applyconfigurations/internal/internal.go (1)

46-55: Schema entry for TrustManager matches existing untyped/atomic+separable patterns (LGTM).

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go (1)

1-32: Generated TrustManagerSpec apply-configuration looks consistent with client-go apply patterns.

pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go (1)

1-38: Generated SecretTargetsConfig apply-configuration is straightforward and consistent.

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go (2)

1-25: Remaining TrustManagerStatus apply-configuration fields/setters are consistent with generated patterns.

Also applies to: 39-69


26-37: The WithConditions panic-on-nil behavior is consistent with all other generated applyconfiguration builders in the repository. All four WithConditions implementations (TrustManagerStatus, ConditionalStatus, IstioCSRStatus, and CertManagerStatus) use the identical pattern. This is the standard convention for these generated builders.

pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go (1)

23-25: TrustManager client signature is correct. Verified that the fake TrustManagers() method matches the real interface exactly—both return TrustManagerInterface without a namespace parameter. TrustManager is cluster-scoped per the +genclient:nonNamespaced marker, and the status subresource is enabled (+kubebuilder:subresource:status), so the generated UpdateStatus() and ApplyStatus() methods are available. The wiring is consistent with CertManagers().

pkg/operator/applyconfigurations/utils.go (1)

16-71: ForKind GVK → ApplyConfiguration mappings look correct.

The new cases follow the existing pattern and returning nil for unknown kinds is consistent with current behavior.

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go (1)

10-117: TrustManagerConfig apply-configuration builder looks good.

Fluent methods correctly set pointers and safely merge NodeSelector entries.

pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go (1)

17-58: TrustManager client implementation is correct and consistent with other cluster-scoped resources.

The cluster-scoped namespace "" usage matches CertManager and other cluster-scoped clients in the repository. The code follows the established pattern correctly.

bundle/manifests/cert-manager-operator.clusterserviceversion.yaml (1)

611-648: The RBAC additions for TrustManager are not required. While TrustManager is declared as an owned CRD in the CSV, the operator does not actually reconcile TrustManager resources. The only registered controller is for IstioCSR (see pkg/operator/setup_manager.go). The TrustManager client, informer, and lister code are auto-generated infrastructure that is never invoked by any controller code in the operator.

Likely an incorrect or invalid review comment.

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (5)

1-21: LGTM! Generated apply configuration follows standard Kubernetes patterns.

The struct definition correctly embeds TypeMetaApplyConfiguration and ObjectMetaApplyConfiguration from client-go, with optional Spec and Status fields referencing the related apply configuration types. This is consistent with the Kubernetes apply configuration generator output.


23-31: LGTM! Constructor correctly initializes the TrustManager apply configuration.


33-66: LGTM! Extraction functions follow the standard Kubernetes apply configuration pattern.

The use of managedfields.ExtractInto with the internal parser and proper error handling is correct. The type path com.github.openshift.cert-manager-operator.api.operator.v1alpha1.TrustManager aligns with the module path convention.


67-241: LGTM! Fluent builder methods follow standard Kubernetes apply configuration patterns.

The IsApplyConfiguration() marker method and all With* builders are correctly implemented. The nil-check with panic in WithOwnerReferences is consistent with the Kubernetes generated code convention.


243-263: LGTM! Getter methods are correctly implemented.

The getters properly retrieve values from the embedded configurations. The ensureObjectMetaApplyConfigurationExists() call in GetName and GetNamespace follows the standard generated pattern to handle cases where ObjectMetaApplyConfiguration hasn't been initialized.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 525ff10 and 093cbd2.

📒 Files selected for processing (5)
  • api/operator/v1alpha1/meta.go
  • bundle/manifests/operator.openshift.io_istiocsrs.yaml
  • bundle/manifests/operator.openshift.io_trustmanagers.yaml
  • config/crd/bases/operator.openshift.io_istiocsrs.yaml
  • config/crd/bases/operator.openshift.io_trustmanagers.yaml
✅ Files skipped from review due to trivial changes (2)
  • config/crd/bases/operator.openshift.io_istiocsrs.yaml
  • bundle/manifests/operator.openshift.io_istiocsrs.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • bundle/manifests/operator.openshift.io_trustmanagers.yaml
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • api/operator/v1alpha1/meta.go
  • config/crd/bases/operator.openshift.io_trustmanagers.yaml
🔇 Additional comments (4)
api/operator/v1alpha1/meta.go (1)

43-51: LGTM - Documentation update correctly generalizes the type.

The change from "istio-csr agent deployment" to "operand deployment" appropriately broadens the scope of ConditionalStatus for reuse across multiple operands (e.g., istio-csr, trust-manager).

config/crd/bases/operator.openshift.io_trustmanagers.yaml (3)

1-38: CRD definition + singleton intent are clear and consistent.

Group/name/scope align with a cluster-scoped singleton API, and the description sets expectations well.


1308-1314: Singleton enforcement via CEL is a good guardrail.

The .metadata.name == 'cluster' validation is the right place to prevent accidental multi-instance creation.


1123-1149: RBAC is already appropriately restricted to cluster-admin by design—no additional controls needed.

While secretTargets.policy=All grants cluster-wide Secret write capability to trust-manager, the TrustManager CR itself can only be updated by cluster-admin users. No explicit RBAC rules grant trustmanagers permissions to regular users; unlike CertManager (which has a certmanager-editor-role), no trustmanager-editor-role exists. The operator's own manager-role does not include permissions for trustmanagers. By default Kubernetes/OpenShift RBAC model, only cluster-admin can manage cluster-scoped resources without explicit role bindings, so no privilege escalation path exists unless the user already has cluster-admin privileges.

@chiragkyal
Copy link
Member Author

Signed-off-by: chiragkyal <ckyal@redhat.com>
Signed-off-by: chiragkyal <ckyal@redhat.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In @api/operator/v1alpha1/trustmanager_types.go:
- Around line 59-154: The nested config structs should be pointers so omitempty
works and to preserve unset vs empty states: change
TrustManagerSpec.TrustManagerConfig to *TrustManagerConfig and
TrustManagerSpec.ControllerConfig to *TrustManagerControllerConfig, and inside
TrustManagerConfig change SecretTargets to *SecretTargetsConfig and
DefaultCAPackage to *DefaultCAPackageConfig (keep json:"...,omitempty" tags).
After updating the types (and any constructors/usage), re-run the code
generators to refresh deepcopy, CRDs and applyconfig.

In @bundle/manifests/cert-manager-operator.clusterserviceversion.yaml:
- Around line 236-269: The alm-examples show a Bundle with "useDefaultCAs: true"
but the TrustManager example (kind: TrustManager, metadata.name: "cluster") does
not enable the corresponding default CA package; update the TrustManager's
spec.trustManagerConfig to set the defaultCAPackage flag (e.g.,
defaultCAPackage: true) so the TrustManager example matches the Bundle's
useDefaultCAs usage and will work out-of-the-box; ensure you modify the
TrustManager resource (trustManagerConfig) rather than the Bundle and keep
existing fields like trustNamespace and logLevel intact.
- Around line 313-319: The CSV is missing RBAC rules for the owned CRDs; add
permission rules in the CSV's permissions section granting appropriate verbs
(get,list,watch,create,update,patch,delete) for API group operator.openshift.io
on resources trustmanagers and subresources trustmanagers/status and
trustmanagers/finalizers, and for API group trust.cert-manager.io on resources
bundles and subresources bundles/status and bundles/finalizers (include
create/update/patch/get/list/watch and delete as appropriate); ensure the rules
reference the exact resource names trustmanagers and bundles and include
subresource entries (status and finalizers) so the operator can manage those
CRDs it declares as owned.

In @config/crd/bases/operator.openshift.io_trustmanagers.yaml:
- Around line 1205-1219: spec.trustManagerConfig.trustNamespace currently only
has length checks; add a DNS_LABEL pattern validation so Kubernetes rejects
invalid namespace names (use regex ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$). Update the
OpenAPI validation for trustNamespace (the x-kubernetes-validations entry for
trustNamespace) to include this pattern rule, or preferably add the
corresponding kubebuilder annotation on the Go field for
Spec.TrustManagerConfig.TrustNamespace (e.g.,
+kubebuilder:validation:Pattern="<DNS_LABEL>") and re-run controller-gen to
regenerate the CRD so the x-kubernetes-validations and schema include the
DNS_LABEL pattern.
🧹 Nitpick comments (1)
api/operator/v1alpha1/trustmanager_types.go (1)

92-103: Consider adding a namespace-name Pattern validation for TrustNamespace (not just length).

Proposed kubebuilder annotation
 	// +kubebuilder:validation:MinLength:=1
 	// +kubebuilder:validation:MaxLength:=63
+	// +kubebuilder:validation:Pattern:="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
 	// +kubebuilder:validation:XValidation:rule="oldSelf == '' || self == oldSelf",message="trustNamespace is immutable once set"
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 093cbd2 and 71445da.

📒 Files selected for processing (50)
  • Makefile
  • api/operator/v1alpha1/meta.go
  • api/operator/v1alpha1/trustmanager_types.go
  • api/operator/v1alpha1/zz_generated.deepcopy.go
  • bindata/trust-manager/resources/certificate_trust-manager.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/operator.openshift.io_istiocsrs.yaml
  • bundle/manifests/operator.openshift.io_trustmanagers.yaml
  • bundle/manifests/trust.cert-manager.io_bundles.yaml
  • config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml
  • config/crd/bases/operator.openshift.io_istiocsrs.yaml
  • config/crd/bases/operator.openshift.io_trustmanagers.yaml
  • config/crd/kustomization.yaml
  • config/manifests/bases/cert-manager-operator.clusterserviceversion.yaml
  • config/samples/tech-preview/kustomization.yaml
  • config/samples/tech-preview/operator.openshift.io_v1alpha1_trustmanager.yaml
  • config/samples/tech-preview/trust.cert-manager.io_v1alpha1_bundle.yaml
  • hack/update-trust-manager-manifests.sh
  • pkg/operator/applyconfigurations/internal/internal.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go
  • pkg/operator/applyconfigurations/utils.go
  • pkg/operator/assets/bindata.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/operator_client.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go
  • pkg/operator/informers/externalversions/generic.go
  • pkg/operator/informers/externalversions/operator/v1alpha1/interface.go
  • pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go
  • pkg/operator/listers/operator/v1alpha1/expansion_generated.go
  • pkg/operator/listers/operator/v1alpha1/trustmanager.go
🚧 Files skipped from review as they are similar to previous changes (22)
  • bindata/trust-manager/resources/certificate_trust-manager.yml
  • config/crd/kustomization.yaml
  • bindata/trust-manager/resources/deployment_trust-manager.yml
  • config/samples/tech-preview/trust.cert-manager.io_v1alpha1_bundle.yaml
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/operator_client.go
  • pkg/operator/informers/externalversions/operator/v1alpha1/interface.go
  • bindata/trust-manager/resources/rolebinding_trust-manager.yml
  • hack/update-trust-manager-manifests.sh
  • bindata/trust-manager/resources/clusterrole_trust-manager.yml
  • pkg/operator/listers/operator/v1alpha1/expansion_generated.go
  • bindata/trust-manager/resources/serviceaccount_trust-manager.yml
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerspec.go
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/trustmanager.go
  • bindata/trust-manager/resources/issuer_trust-manager.yml
  • config/samples/tech-preview/operator.openshift.io_v1alpha1_trustmanager.yaml
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagercontrollerconfig.go
  • bundle/manifests/operator.openshift.io_istiocsrs.yaml
  • bindata/trust-manager/resources/rolebinding_trust-manager:leaderelection.yml
  • bindata/trust-manager/resources/role_trust-manager.yml
  • bindata/trust-manager/resources/clusterrolebinding_trust-manager.yml
  • pkg/operator/applyconfigurations/internal/internal.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go
  • pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go
  • config/samples/tech-preview/kustomization.yaml
  • pkg/operator/informers/externalversions/generic.go
  • pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go
  • Makefile
  • pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go
  • pkg/operator/applyconfigurations/utils.go
  • pkg/operator/assets/bindata.go
  • config/crd/bases/operator.openshift.io_trustmanagers.yaml
  • config/crd/bases/operator.openshift.io_istiocsrs.yaml
  • pkg/operator/listers/operator/v1alpha1/trustmanager.go
  • api/operator/v1alpha1/zz_generated.deepcopy.go
  • bundle/manifests/operator.openshift.io_trustmanagers.yaml
  • config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml
  • api/operator/v1alpha1/meta.go
  • bindata/trust-manager/resources/role_trust-manager:leaderelection.yml
  • pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go
  • bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
  • bundle/manifests/trust.cert-manager.io_bundles.yaml
  • api/operator/v1alpha1/trustmanager_types.go
  • bindata/trust-manager/resources/service_trust-manager.yml
  • bindata/trust-manager/resources/validatingwebhookconfiguration_trust-manager.yml
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go
  • bindata/trust-manager/resources/service_trust-manager-metrics.yml
  • config/manifests/bases/cert-manager-operator.clusterserviceversion.yaml
  • pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go
🔇 Additional comments (31)
pkg/operator/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go (1)

8-9: LGTM!

The new TrustManagerExpansion interface follows the established pattern for the existing CertManagerExpansion and IstioCSRExpansion interfaces. This is standard client-gen boilerplate that correctly complements the new TrustManager API being introduced in this PR.

Makefile (1)

9-9: LGTM!

The new TRUST_MANAGER_VERSION variable and the script invocation in update-manifests follow the established patterns for CERT_MANAGER_VERSION and ISTIO_CSR_VERSION.

Also applies to: 151-151

pkg/operator/informers/externalversions/generic.go (1)

44-45: LGTM!

The new case for trustmanagers follows the established pattern used by certmanagers and istiocsrs. This is generated code that correctly integrates the TrustManager informer.

bindata/trust-manager/resources/role_trust-manager:leaderelection.yml (1)

1-23: LGTM!

The Role manifest correctly defines leader election permissions for the trust-manager ServiceAccount. The rules granting get, create, update, watch, list on leases in the coordination.k8s.io API group are standard for Kubernetes leader election.

Note: The AI summary incorrectly described this as a RoleBinding, but the manifest correctly defines a Role.

bindata/trust-manager/resources/service_trust-manager-metrics.yml (1)

1-22: LGTM!

The metrics Service is correctly configured with ClusterIP type, exposing port 9402 for Prometheus metrics scraping. The selector matches the expected deployment labels.

pkg/operator/clientset/versioned/typed/operator/v1alpha1/fake/fake_trustmanager.go (1)

1-37: LGTM!

This is generated client code that correctly implements the fake TrustManager client for testing. The empty namespace string (line 22) correctly indicates that TrustManager is a cluster-scoped resource, consistent with the PR objectives stating it's a "cluster-scoped TrustManager Custom Resource Definition (singleton named 'cluster')".

config/crd/bases/operator.openshift.io_istiocsrs.yaml (1)

1379-1382: Doc-only CRD description tweak looks good.

pkg/operator/listers/operator/v1alpha1/trustmanager.go (1)

12-32: Verify the resource string format in the listers.New() call is consistent with other generated listers.

The code uses Resource("trustmanager") (singular). Confirm this matches the pattern used by other listers in this repository. If the convention is to use plural form (e.g., Resource("trustmanagers")), the resource string should be corrected to ensure consistency in NotFound error messages and resource naming across the codebase.

config/samples/tech-preview/kustomization.yaml (1)

1-4: Verify the referenced sample files exist in the repository. Ensure both operator.openshift.io_v1alpha1_trustmanager.yaml and trust.cert-manager.io_v1alpha1_bundle.yaml are present in config/samples/tech-preview/ before merging, as broken file references will cause the kustomization to fail.

bindata/trust-manager/resources/service_trust-manager.yml (1)

1-22: Verify selector/ports match the trust-manager Deployment (labels + container port 6443). If the Deployment doesn't expose 6443 or uses different labels, the webhook service will blackhole traffic.

bindata/trust-manager/resources/validatingwebhookconfiguration_trust-manager.yml (1)

1-35: CA injection target and webhook service/path alignment are correctly configured. Certificate trust-manager exists in cert-manager namespace with secret trust-manager-tls, Service trust-manager is properly defined in cert-manager, and the Deployment uses the upstream trust-manager image (v0.20.3) on port 6443. The ValidatingWebhookConfiguration correctly references the service with the expected webhook path. With failurePolicy: Fail, ensure the trust-manager Pod is healthy during rollouts to prevent blocking Bundle create/update operations.

pkg/operator/applyconfigurations/operator/v1alpha1/defaultcapackageconfig.go (1)

1-27: LGTM!

This is standard generated apply-configuration code following the expected fluent builder pattern for the DefaultCAPackageConfig type.

api/operator/v1alpha1/meta.go (1)

43-51: LGTM!

The ConditionalStatus type is well-defined with appropriate kubebuilder markers for strategic merge patch semantics on the conditions field. This enables proper condition management across operand deployments.

config/crd/bases/customresourcedefinition_bundles.trust.cert-manager.io.yml (1)

1-477: LGTM!

The Bundle CRD is well-structured with:

  • Proper cluster-scoped configuration
  • Comprehensive OpenAPI v3 schema with appropriate validations
  • Correct strategic merge markers for status conditions (x-kubernetes-list-map-keys, x-kubernetes-list-type: map)
  • Useful printer columns for kubectl get bundles output
  • The helm.sh/resource-policy: keep annotation appropriately prevents accidental CRD deletion during upgrades
pkg/operator/assets/bindata.go (4)

3088-3110: LGTM!

The trust-manager Certificate manifest correctly references the self-signed Issuer and configures TLS for the webhook service.


3222-3307: LGTM - Deployment manifest is well-configured.

The trust-manager Deployment includes proper security hardening:

  • runAsNonRoot: true with seccompProfile: RuntimeDefault
  • Dropped all capabilities with read-only root filesystem
  • Leader election enabled for HA scenarios
  • Appropriate node selector for Linux nodes

The resources: {} placeholder will be populated by the operator based on TrustManager CR configuration.


3614-3664: LGTM!

The ValidatingWebhookConfiguration is properly configured with:

  • CA injection via cert-manager.io/inject-ca-from annotation
  • failurePolicy: Fail ensuring invalid Bundle resources are rejected
  • Appropriate timeout and admission review versions

3781-3793: LGTM!

The _bindata map and _bintree structure are correctly updated to include all trust-manager resource assets, enabling proper asset lookup and directory traversal.

Also applies to: 3916-3932

pkg/operator/applyconfigurations/operator/v1alpha1/secrettargetsconfig.go (1)

1-38: LGTM!

This is standard generated apply-configuration code. The fluent builder pattern for SecretTargetsConfig correctly handles both the Policy field (single value) and AuthorizedSecrets field (append semantics for multiple values).

pkg/operator/applyconfigurations/utils.go (1)

37-68: LGTM!

The generated ForKind switch cases for the new TrustManager-related types follow the established pattern and are correctly wired to return the appropriate ApplyConfiguration types.

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerstatus.go (1)

1-69: LGTM!

The generated TrustManagerStatusApplyConfiguration type and its builder methods follow the standard Kubernetes apply configuration patterns. The nil-value panic in WithConditions is consistent with other generated apply configurations.

pkg/operator/informers/externalversions/operator/v1alpha1/trustmanager.go (1)

1-85: LGTM!

The generated TrustManager informer correctly implements the SharedIndexInformer pattern with both legacy and context-aware list/watch functions. The cache.NamespaceIndex in defaultInformer is standard generated code and works correctly for cluster-scoped resources.

bundle/manifests/operator.openshift.io_trustmanagers.yaml (1)

1-1326: LGTM!

The TrustManager CRD is well-structured with:

  • Proper singleton enforcement via CEL validation (self.metadata.name == 'cluster')
  • Immutability protection for trustNamespace
  • Sound CEL validation for secretTargets.authorizedSecrets ensuring policy consistency
  • Appropriate bounds on configurable values (logLevel 1-5, maxLength/maxItems constraints)
  • Status subresource and informative printer columns
bundle/manifests/trust.cert-manager.io_bundles.yaml (1)

1-506: LGTM!

The Bundle CRD correctly defines the trust-manager bundle resource with:

  • Comprehensive schema for sources (configMap, secret, inLine, useDefaultCAs) and targets
  • Appropriate validation constraints (minLength, maxItems: 100)
  • JKS format deprecation notice preserved from upstream
  • Proper status subresource with conditions
  • helm.sh/resource-policy: keep annotation for lifecycle management
config/crd/bases/operator.openshift.io_trustmanagers.yaml (2)

35-39: Singleton enforcement via CEL XValidation looks correct.

Also applies to: 1314-1316


1124-1161: Verify namespace scoping for SecretTargets "Custom" policy implementation.

The API defines authorizedSecrets as a list of secret names only (no namespace information). If RBAC enforcement translates these directly to ClusterRole resourceNames, secrets with the same name in different namespaces cannot be distinguished, creating potential cross-namespace access risks. Confirm whether namespace scoping is applied during RBAC rule generation, or document the security boundary clearly if same-name collisions across namespaces are intentional.

api/operator/v1alpha1/zz_generated.deepcopy.go (1)

281-295: Generated DeepCopy additions for TrustManager types look consistent (nil checks, slice/map copies).

Also applies to: 553-572, 588-745

config/manifests/bases/cert-manager-operator.clusterserviceversion.yaml (1)

109-122: Owned CRD entries + keyword for trust-manager are correctly added.

Also applies to: 156-156

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanagerconfig.go (1)

10-117: Apply-configuration builder looks standard and correct.

pkg/operator/applyconfigurations/operator/v1alpha1/trustmanager.go (2)

14-31: Generated apply surface wiring (constructor + WithSpec/WithStatus) looks good.

Also applies to: 227-241


55-66: The type string com.github.openshift.cert-manager-operator.api.operator.v1alpha1.TrustManager is properly registered in the parser schema. This is auto-generated code from applyconfiguration-gen, and the type is explicitly defined in the schemaYAML alongside CertManager and IstioCSR with identical structure. No runtime issue exists.

Likely an incorrect or invalid review comment.

Comment on lines +59 to +154
// TrustManagerSpec defines the desired state of TrustManager.
// Note: trust-manager operand is always deployed in the cert-manager namespace.
type TrustManagerSpec struct {
// trustManagerConfig configures the trust-manager operand's behavior.
// +kubebuilder:validation:Required
// +required
TrustManagerConfig TrustManagerConfig `json:"trustManagerConfig"`

// controllerConfig configures the operator's behavior for resource creation.
// +kubebuilder:validation:Optional
// +optional
ControllerConfig TrustManagerControllerConfig `json:"controllerConfig,omitempty"`
}

// TrustManagerConfig configures the trust-manager operand's behavior.
type TrustManagerConfig struct {
// logLevel configures the verbosity of trust-manager logging.
// Follows [Kubernetes logging guidelines](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#what-method-to-use).
// +kubebuilder:default:=1
// +kubebuilder:validation:Minimum:=1
// +kubebuilder:validation:Maximum:=5
// +kubebuilder:validation:Optional
// +optional
LogLevel int32 `json:"logLevel,omitempty"`

// logFormat specifies the output format for trust-manager logging.
// Supported formats are "text" and "json".
// +kubebuilder:validation:Enum:="text";"json"
// +kubebuilder:default:="text"
// +kubebuilder:validation:Optional
// +optional
LogFormat string `json:"logFormat,omitempty"`

// trustNamespace is the namespace where trust-manager looks for trust sources
// (ConfigMaps and Secrets containing CA certificates).
// Defaults to "cert-manager" if not specified.
// This field is immutable once set.
// This field can have a maximum of 63 characters.
// +kubebuilder:default:="cert-manager"
// +kubebuilder:validation:MinLength:=1
// +kubebuilder:validation:MaxLength:=63
// +kubebuilder:validation:XValidation:rule="oldSelf == '' || self == oldSelf",message="trustNamespace is immutable once set"
// +kubebuilder:validation:Optional
// +optional
TrustNamespace string `json:"trustNamespace,omitempty"`

// secretTargets configures whether trust-manager can write trust bundles to Secrets.
// +kubebuilder:validation:Optional
// +optional
SecretTargets SecretTargetsConfig `json:"secretTargets,omitempty"`

// filterExpiredCertificates controls whether trust-manager filters out
// expired certificates from trust bundles before distributing them.
// When set to "Enabled", expired certificates are removed from bundles.
// When set to "Disabled", expired certificates are included (default behavior).
// +kubebuilder:default:="Disabled"
// +kubebuilder:validation:Optional
// +optional
FilterExpiredCertificates FilterExpiredCertificatesPolicy `json:"filterExpiredCertificates,omitempty"`

// defaultCAPackage configures the default CA package for trust-manager.
// When enabled, the operator will use OpenShift's trusted CA bundle injection mechanism.
// +kubebuilder:validation:Optional
// +optional
DefaultCAPackage DefaultCAPackageConfig `json:"defaultCAPackage,omitempty"`

// resources defines the compute resource requirements for the trust-manager pod.
// ref: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
// +kubebuilder:validation:Optional
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`

// affinity defines scheduling constraints for the trust-manager pod.
// ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/
// +kubebuilder:validation:Optional
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`

// tolerations allows the trust-manager pod to be scheduled on tainted nodes.
// ref: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
// +listType=atomic
// +kubebuilder:validation:MinItems:=0
// +kubebuilder:validation:MaxItems:=50
// +kubebuilder:validation:Optional
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

// nodeSelector restricts which nodes the trust-manager pod can be scheduled on.
// ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
// +mapType=atomic
// +kubebuilder:validation:MinProperties:=0
// +kubebuilder:validation:MaxProperties:=50
// +kubebuilder:validation:Optional
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Make optional nested configs pointers; current omitempty on non-pointer structs likely won’t omit and loses “unset vs empty”.

Proposed API shape change (then re-run generators to refresh CRDs/deepcopy/applyconfig)
 type TrustManagerSpec struct {
@@
-	ControllerConfig TrustManagerControllerConfig `json:"controllerConfig,omitempty"`
+	ControllerConfig *TrustManagerControllerConfig `json:"controllerConfig,omitempty"`
 }

 type TrustManagerConfig struct {
@@
-	SecretTargets SecretTargetsConfig `json:"secretTargets,omitempty"`
+	SecretTargets *SecretTargetsConfig `json:"secretTargets,omitempty"`
@@
-	DefaultCAPackage DefaultCAPackageConfig `json:"defaultCAPackage,omitempty"`
+	DefaultCAPackage *DefaultCAPackageConfig `json:"defaultCAPackage,omitempty"`
 }

Also applies to: 156-210

🤖 Prompt for AI Agents
In @api/operator/v1alpha1/trustmanager_types.go around lines 59 - 154, The
nested config structs should be pointers so omitempty works and to preserve
unset vs empty states: change TrustManagerSpec.TrustManagerConfig to
*TrustManagerConfig and TrustManagerSpec.ControllerConfig to
*TrustManagerControllerConfig, and inside TrustManagerConfig change
SecretTargets to *SecretTargetsConfig and DefaultCAPackage to
*DefaultCAPackageConfig (keep json:"...,omitempty" tags). After updating the
types (and any constructors/usage), re-run the code generators to refresh
deepcopy, CRDs and applyconfig.

Comment on lines +1205 to +1219
trustNamespace:
default: cert-manager
description: |-
trustNamespace is the namespace where trust-manager looks for trust sources
(ConfigMaps and Secrets containing CA certificates).
Defaults to "cert-manager" if not specified.
This field is immutable once set.
This field can have a maximum of 63 characters.
maxLength: 63
minLength: 1
type: string
x-kubernetes-validations:
- message: trustNamespace is immutable once set
rule: oldSelf == '' || self == oldSelf
type: object
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add Kubernetes namespace format validation for spec.trustManagerConfig.trustNamespace (currently only length-validated).

Without a DNS_LABEL pattern (e.g., ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$), the API can accept values the operator/operand can’t use reliably.

Proposed change (prefer generating via kubebuilder annotations in the Go type and re-running controller-gen)
                   trustNamespace:
                     default: cert-manager
                     description: |-
@@
                     maxLength: 63
                     minLength: 1
+                    pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
                     type: string
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
trustNamespace:
default: cert-manager
description: |-
trustNamespace is the namespace where trust-manager looks for trust sources
(ConfigMaps and Secrets containing CA certificates).
Defaults to "cert-manager" if not specified.
This field is immutable once set.
This field can have a maximum of 63 characters.
maxLength: 63
minLength: 1
type: string
x-kubernetes-validations:
- message: trustNamespace is immutable once set
rule: oldSelf == '' || self == oldSelf
type: object
trustNamespace:
default: cert-manager
description: |-
trustNamespace is the namespace where trust-manager looks for trust sources
(ConfigMaps and Secrets containing CA certificates).
Defaults to "cert-manager" if not specified.
This field is immutable once set.
This field can have a maximum of 63 characters.
maxLength: 63
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
x-kubernetes-validations:
- message: trustNamespace is immutable once set
rule: oldSelf == '' || self == oldSelf
type: object
🤖 Prompt for AI Agents
In @config/crd/bases/operator.openshift.io_trustmanagers.yaml around lines 1205
- 1219, spec.trustManagerConfig.trustNamespace currently only has length checks;
add a DNS_LABEL pattern validation so Kubernetes rejects invalid namespace names
(use regex ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$). Update the OpenAPI validation for
trustNamespace (the x-kubernetes-validations entry for trustNamespace) to
include this pattern rule, or preferably add the corresponding kubebuilder
annotation on the Go field for Spec.TrustManagerConfig.TrustNamespace (e.g.,
+kubebuilder:validation:Pattern="<DNS_LABEL>") and re-run controller-gen to
regenerate the CRD so the x-kubernetes-validations and schema include the
DNS_LABEL pattern.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Is there any suggestions to be incorporated from EP review?

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 14, 2026
Signed-off-by: chiragkyal <ckyal@redhat.com>
Signed-off-by: chiragkyal <ckyal@redhat.com>
Signed-off-by: chiragkyal <ckyal@redhat.com>
@chiragkyal
Copy link
Member Author

Is there any suggestions to be incorporated from EP review?

Till today, the API changes suggested in the EP align with this PR. If anything else comes in the future, we need to incorporate that, but nothing for now.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 15, 2026

@chiragkyal: all tests passed!

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.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

/lgtm

/hold till the EP is the merged.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 15, 2026
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 15, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 15, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bharath-b-rh, chiragkyal

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

The pull request process is described 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

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants