Skip to content

CNTRLPLANE-3212: Enable configurable PKI for cert rotation#5842

Open
sanchezl wants to merge 2 commits into
openshift:mainfrom
sanchezl:CNTRLPLANE-3212-configurable-pki
Open

CNTRLPLANE-3212: Enable configurable PKI for cert rotation#5842
sanchezl wants to merge 2 commits into
openshift:mainfrom
sanchezl:CNTRLPLANE-3212-configurable-pki

Conversation

@sanchezl

@sanchezl sanchezl commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Details

  • Added configInformerFactory and featureGatesHandler parameters to the cert rotation controller constructor
  • Conditionally creates PKIProfileProvider using pki.NewClusterPKIProfileProvider() when the ConfigurablePKI feature gate is enabled
  • Registers PKI informer cache sync
  • Sets CertificateName and PKIProfileProvider on RotatedSigningCASecret and RotatedSelfSignedCertKeySecret:
    • machine-config.machine-config-server-signer
    • machine-config.machine-config-server-serving

References

Summary by CodeRabbit

  • New Features

    • The certificate rotation controller now supports configurable PKI profiles through external configuration sources. When the ConfigurablePKI feature gate is enabled, this provides enhanced flexibility in certificate and key management.
  • Chores

    • Updated library-go dependency to a newer version.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

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

This repository is configured in: LGTM mode

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

openshift-ci-robot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

@sanchezl: This pull request references CNTRLPLANE-3212 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 sub-task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Details

  • Added configInformerFactory and featureGatesHandler parameters to the cert rotation controller constructor
  • Conditionally creates PKIProfileProvider using pki.NewClusterPKIProfileProvider() when the ConfigurablePKI feature gate is enabled
  • Registers PKI informer cache sync
  • Sets CertificateName and PKIProfileProvider on RotatedSigningCASecret and RotatedSelfSignedCertKeySecret:
  • machine-config-operator.machine-config-server-signer
  • machine-config-operator.machine-config-server-serving

References

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

@coderabbitai

coderabbitai Bot commented Apr 10, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: dd0d54c0-0510-43e3-93b3-f52dac3afbb5

📥 Commits

Reviewing files that changed from the base of the PR and between 1949b40 and 4b3fa69.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • cmd/machine-config-controller/start.go
  • go.mod
  • pkg/controller/certrotation/certrotation_controller.go
  • pkg/controller/certrotation/certrotation_controller_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/machine-config-controller/start.go
  • pkg/controller/certrotation/certrotation_controller.go

Walkthrough

The cert-rotation controller New(...) now accepts a shared external config informer factory; cachesToSync and PKIProfileProvider wiring are conditional on FeatureGateConfigurablePKI. Call site and tests were updated to the new arity. go.mod bumps an openshift library-go pseudo-version.

Changes

Cert rotation controller

Layer / File(s) Summary
Controller imports and constructor
pkg/controller/certrotation/certrotation_controller.go
Adds external config informer imports; New(...) gains configInformerFactory; builds cachesToSync dynamically and conditionally constructs a PKIProfileProvider when FeatureGateConfigurablePKI is enabled; cert rotator configs set CertificateName and accept the optional PKI provider.
Start command and tests
cmd/machine-config-controller/start.go, pkg/controller/certrotation/certrotation_controller_test.go
Start command call updated to pass ConfigInformerFactory; tests updated to insert a nil argument for the new parameter in controller constructor calls.
Dependencies
go.mod
Bumped github.com/openshift/library-go pseudo-version.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the changeset: integrating configurable PKI support into the certificate rotation controller.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed All test names in certrotation_controller_test.go are stable and deterministic. Test names use static descriptive strings like "IRI secret is updated on CA rotation" and "matching SANs", with no dy...
Test Structure And Quality ✅ Passed PR test changes are minimal mechanical updates (+1/-0) to match new function signature. Existing tests follow quality patterns: meaningful assertion messages, proper fixtures for setup/cleanup, and...
Microshift Test Compatibility ✅ Passed PR contains no new Ginkgo e2e tests. Changes are controller code, unit tests (using Go testing package), and dependency updates only. Check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR does not add any new Ginkgo e2e tests. Changes are limited to application code and standard Go unit tests, making the SNO test compatibility check not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed This PR integrates configurable PKI into the cert rotation controller via dependency updates and controller parameter changes. No scheduling constraints, deployment manifests, pod affinity/anti-aff...
Ote Binary Stdout Contract ✅ Passed PR passes OTE stdout contract check: klog configured to stderr in runStartCmd() before logging; New() function uses only klog (no fmt.Print/os.Stdout); no process-level code violations detected.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR adds no new Ginkgo e2e tests. Changes are limited to controller implementation, dependency updates, and unit tests using Go's standard testing framework.
No-Weak-Crypto ✅ Passed No weak cryptographic patterns detected. Code uses standard Go crypto libs and openshift/library-go, with proper constant-time comparison via bytes.Equal() for sensitive data.
Container-Privileges ✅ Passed PR only modifies Go source code and dependencies; no container/K8s manifest files with privilege settings were changed.
No-Sensitive-Data-In-Logs ✅ Passed No sensitive data logging found. The PR adds PKI profile provider initialization and configuration without logging configInformerFactory, featureGatesHandler, credentials, or sensitive PKI data. Al...

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

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

@sanchezl sanchezl force-pushed the CNTRLPLANE-3212-configurable-pki branch 2 times, most recently from fd94f6b to 5ff69a5 Compare April 10, 2026 02:49

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/controller/certrotation/certrotation_controller_test.go (1)

114-115: Please add one test for the enabled ConfigurablePKI path.

This helper only exercises the legacy nil, nil branch. A focused test with a real config informer factory plus a stub FeatureGatesHandler returning true would protect the new PKI provider/cache-sync wiring from regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/controller/certrotation/certrotation_controller_test.go` around lines 114
- 115, Add a test exercising the ConfigurablePKI branch by calling New (the
constructor used in certrotation_controller_test.go) with a real config informer
factory and a stub FeatureGatesHandler that returns true instead of the current
nil, nil args; instantiate a fake config informer (or shared informer factory)
and wire it into the New call, provide a FeatureGatesHandler implementation that
always enables the configurable PKI, then assert New returns no error and the
controller uses the ConfigurablePKI provider/cache-sync path (e.g., by checking
the returned controller/fields or that relevant informers/handlers were
initialized) to protect the new PKI provider/cache-sync wiring from regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/controller/certrotation/certrotation_controller.go`:
- Around line 140-147: The CertificateName value is using the cluster-scoped
"machine-config.*" identifier so configurable PKI profiles keyed under the
operator-scoped names are never matched; update the CertificateName fields in
the cert rotation setup (the entries that set CertificateName:
"machine-config.machine-config-server-signer" and the other similar occurrences
around lines 174-179) to use the operator-scoped names (e.g.,
"machine-config-operator.machine-config-server-signer" or the correct
operator-prefixed identifiers) so the PKIProfileProvider resolves the intended
profile; keep the surrounding parameters (Validity, Refresh, PKIProfileProvider,
Informer mcoSecretInformer, Lister c.mcoSecretLister, Client
kubeClient.CoreV1(), EventRecorder recorder) unchanged.

---

Nitpick comments:
In `@pkg/controller/certrotation/certrotation_controller_test.go`:
- Around line 114-115: Add a test exercising the ConfigurablePKI branch by
calling New (the constructor used in certrotation_controller_test.go) with a
real config informer factory and a stub FeatureGatesHandler that returns true
instead of the current nil, nil args; instantiate a fake config informer (or
shared informer factory) and wire it into the New call, provide a
FeatureGatesHandler implementation that always enables the configurable PKI,
then assert New returns no error and the controller uses the ConfigurablePKI
provider/cache-sync path (e.g., by checking the returned controller/fields or
that relevant informers/handlers were initialized) to protect the new PKI
provider/cache-sync wiring from regressions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d652483c-e5a6-4b64-a91e-6443f5df86f3

📥 Commits

Reviewing files that changed from the base of the PR and between 449e78f and 5ff69a5.

⛔ Files ignored due to path filters (78)
  • go.sum is excluded by !**/*.sum
  • vendor/github.com/openshift/api/.golangci.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/types.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/types_dns.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/types_infrastructure.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-CustomNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-DevPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_dnses-TechPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.deepcopy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.featuregated-crd-manifests.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/types_cluster_monitoring.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/zz_generated.deepcopy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/config/v1alpha1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/envtest-releases.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/etcd/install.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/etcd/v1/Makefile is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/etcd/v1/doc.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/etcd/v1/register.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/etcd/v1/types_pacemakercluster.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/etcd/v1/zz_generated.deepcopy.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/etcd/v1/zz_generated.featuregated-crd-manifests.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/etcd/v1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/etcd/v1alpha1/types_pacemakercluster.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/etcd/v1alpha1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/features.md is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/features/features.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machineconfiguration/v1/types.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_controllerconfigs-CustomNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_controllerconfigs-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_controllerconfigs-DevPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_controllerconfigs-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_controllerconfigs-TechPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_kubeletconfigs.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machineconfiguration/v1/zz_generated.featuregated-crd-manifests.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/machineconfiguration/v1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/types_csi_cluster_driver.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/types_ingress.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_20_kube-apiserver_01_kubeapiservers-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_20_kube-apiserver_01_kubeapiservers-DevPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_20_kube-apiserver_01_kubeapiservers-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_20_kube-apiserver_01_kubeapiservers-TechPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_20_kube-apiserver_01_kubeapiservers.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_csi-driver_01_clustercsidrivers-CustomNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_csi-driver_01_clustercsidrivers-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_csi-driver_01_clustercsidrivers-DevPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_csi-driver_01_clustercsidrivers-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_csi-driver_01_clustercsidrivers-TechPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers-CustomNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers-Default.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers-DevPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers-OKD.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers-TechPreviewNoUpgrade.crd.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.featuregated-crd-manifests.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/quota/v1/generated.proto is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/quota/v1/types.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/api/quota/v1/zz_generated.featuregated-crd-manifests.yaml is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/crypto/cert_config.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/crypto/keygen.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/crypto/options.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/crypto/tls_adherence.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/operator/certrotation/client_cert_rotation_controller.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/operator/certrotation/target.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/operator/v1helpers/helpers.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/pki/profile.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/pki/provider.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/pki/resolve.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/library-go/pkg/pki/types.go is excluded by !vendor/**, !**/vendor/**
  • vendor/k8s.io/code-generator/generate-groups.sh is excluded by !vendor/**, !**/vendor/**
  • vendor/k8s.io/code-generator/generate-internal-groups.sh is excluded by !vendor/**, !**/vendor/**
  • vendor/modules.txt is excluded by !vendor/**, !**/vendor/**
📒 Files selected for processing (4)
  • cmd/machine-config-controller/start.go
  • go.mod
  • pkg/controller/certrotation/certrotation_controller.go
  • pkg/controller/certrotation/certrotation_controller_test.go

Comment thread pkg/controller/certrotation/certrotation_controller.go
@sanchezl sanchezl force-pushed the CNTRLPLANE-3212-configurable-pki branch from 5ff69a5 to 1949b40 Compare April 10, 2026 03:09

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/controller/certrotation/certrotation_controller_test.go (1)

114-114: Add test coverage for the ConfigurablePKI feature-gated path

Line 114 passes nil, nil for configInformerFactory and featureGatesHandler. The constructor has explicit nil-guards (see line 102-105 in certrotation_controller.go), so this is safe. However, the ConfigurablePKI code path—which initializes the PKI profile provider and syncs the PKI informer cache—is never exercised in this test fixture. Add a test case that provides a fake informer factory and enables the FeatureGateConfigurablePKI gate to ensure the feature-gated initialization logic is covered.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/controller/certrotation/certrotation_controller_test.go` at line 114, Add
a new test case in certrotation_controller_test.go that exercises the
ConfigurablePKI feature-gated path by calling New(...) with a fake
configInformerFactory and a featureGatesHandler that returns
FeatureGateConfigurablePKI enabled instead of passing nil for those parameters;
ensure you construct a fake informer factory that exposes the PKI-related
informer used by the controller (so the PKI profile provider and informer cache
sync code in the New constructor runs) and assert any side-effect or state
change the constructor produces (e.g., that the PKI provider was initialized or
the informer cache has been synced) to cover the feature-gated initialization
logic referenced in New and the nil-guarded code paths.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/controller/certrotation/certrotation_controller_test.go`:
- Line 114: Add a new test case in certrotation_controller_test.go that
exercises the ConfigurablePKI feature-gated path by calling New(...) with a fake
configInformerFactory and a featureGatesHandler that returns
FeatureGateConfigurablePKI enabled instead of passing nil for those parameters;
ensure you construct a fake informer factory that exposes the PKI-related
informer used by the controller (so the PKI profile provider and informer cache
sync code in the New constructor runs) and assert any side-effect or state
change the constructor produces (e.g., that the PKI provider was initialized or
the informer cache has been synced) to cover the feature-gated initialization
logic referenced in New and the nil-guarded code paths.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 86cfe2b3-f60c-4429-ae30-36feff48de2b

📥 Commits

Reviewing files that changed from the base of the PR and between 5ff69a5 and 1949b40.

📒 Files selected for processing (3)
  • cmd/machine-config-controller/start.go
  • pkg/controller/certrotation/certrotation_controller.go
  • pkg/controller/certrotation/certrotation_controller_test.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/controller/certrotation/certrotation_controller.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/machine-config-controller/start.go

@sanchezl

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci-robot

openshift-ci-robot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

@sanchezl: This pull request references CNTRLPLANE-3212 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 sub-task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Details

  • Added configInformerFactory and featureGatesHandler parameters to the cert rotation controller constructor
  • Conditionally creates PKIProfileProvider using pki.NewClusterPKIProfileProvider() when the ConfigurablePKI feature gate is enabled
  • Registers PKI informer cache sync
  • Sets CertificateName and PKIProfileProvider on RotatedSigningCASecret and RotatedSelfSignedCertKeySecret:
  • machine-config.machine-config-server-signer
  • machine-config.machine-config-server-serving

References

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.

@openshift-ci-robot

openshift-ci-robot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

@sanchezl: This pull request references CNTRLPLANE-3212 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 sub-task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Details

  • Added configInformerFactory and featureGatesHandler parameters to the cert rotation controller constructor
  • Conditionally creates PKIProfileProvider using pki.NewClusterPKIProfileProvider() when the ConfigurablePKI feature gate is enabled
  • Registers PKI informer cache sync
  • Sets CertificateName and PKIProfileProvider on RotatedSigningCASecret and RotatedSelfSignedCertKeySecret:
  • machine-config.machine-config-server-signer
  • machine-config.machine-config-server-serving

References

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.

@sanchezl

Copy link
Copy Markdown
Contributor Author

/payload-job-with-prs periodic-ci-openshift-release-master-nightly-4.22-e2e-aws-ovn-techpreview #5842

@openshift-ci

openshift-ci Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

@sanchezl: trigger 0 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

@openshift-ci

openshift-ci Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

@sanchezl: This PR was included in a payload test run from #5842
trigger 0 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

@sanchezl

Copy link
Copy Markdown
Contributor Author

/retest-required

@sanchezl

Copy link
Copy Markdown
Contributor Author

/payload-job-with-prs periodic-ci-openshift-release-main-ci-4.22-e2e-aws-ovn-techpreview #5842

@openshift-ci

openshift-ci Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

@sanchezl: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-4.22-e2e-aws-ovn-techpreview

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/48d7f230-34db-11f1-8b17-3ebe6e6b3dc7-0

@openshift-ci

openshift-ci Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

@sanchezl: This PR was included in a payload test run from #5842
trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-4.22-e2e-aws-ovn-techpreview

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/48d7f230-34db-11f1-8b17-3ebe6e6b3dc7-0

@sanchezl

Copy link
Copy Markdown
Contributor Author

/test e2e-gcp-op-ocl

@sanchezl

Copy link
Copy Markdown
Contributor Author

/test e2e-gcp-op-ocl-part2

@sanchezl

Copy link
Copy Markdown
Contributor Author

Verification: Cert Rotation Controller with Configurable PKI

Analyzed the passing e2e-gcp-op-ocl-part1 job artifacts to verify the cert rotation controller is working correctly with the new PKI integration.

Cert Rotation Controller — Running

04:10:54 certrotation_controller.go:187] Adding MCS CA/TLS cert rotator
04:10:54 certrotation_controller.go:209] Starting machineconfigcontroller-certrotationcontroller
04:10:54 base_controller.go:82]  Caches are synced for CertRotationController
04:10:54 base_controller.go:119] Starting #1 worker of CertRotationController controller ...

Certificates — RSA 2048-bit (expected default)

Secret Algorithm Key Size Signature Managed Label
machine-config-server-ca rsaEncryption 2048-bit sha256WithRSAEncryption signer
machine-config-server-tls rsaEncryption 2048-bit sha256WithRSAEncryption target

ConfigurablePKI Feature Gate — Disabled (correct)

Feature gate logs confirm ConfigurablePKI is disabled. This means:

  • PKIProfileProvider is nil — legacy RSA-2048 behavior preserved
  • No functional change from before this PR
  • When ConfigurablePKI is enabled in TechPreview, the controller will resolve key algorithms from the cluster PKI resource

No Rotation Triggered (expected)

Bootstrap created certs at 04:03:26Z. Controller started at 04:10:54Z, validated them, and found no rotation needed. This is correct behavior for a fresh install.

@sanchezl

Copy link
Copy Markdown
Contributor Author

/test e2e-gcp-op-single-node

@sanchezl

Copy link
Copy Markdown
Contributor Author

/test e2e-hypershift

1 similar comment
@sanchezl

Copy link
Copy Markdown
Contributor Author

/test e2e-hypershift

@sanchezl

Copy link
Copy Markdown
Contributor Author

/retest-required

@sanchezl

Copy link
Copy Markdown
Contributor Author

Hi @cheesesashimi @umohnani8 — could you review this when you have a moment? This integrates the ConfigurablePKI feature gate into MCO's MCS cert rotation controller (TechPreview only). The change adds PKIProfileProvider and CertificateName to the existing RotatedSigningCASecret/RotatedSelfSignedCertKeySecret. No behavior change when the feature gate is disabled (the default).

Cert rotation controller verified working in e2e (see verification comment above). CI retests are running now.

@openshift-ci

openshift-ci Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

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

Test name Commit Details Required Rerun command
ci/prow/e2e-hypershift 1949b40 link true /test e2e-hypershift
ci/prow/e2e-aws-ovn 1949b40 link true /test e2e-aws-ovn

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.

@sanchezl

sanchezl commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 2, 2026
@sanchezl sanchezl force-pushed the CNTRLPLANE-3212-configurable-pki branch from 1949b40 to 4b3fa69 Compare June 11, 2026 13:34
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 11, 2026
@openshift-ci

openshift-ci Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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

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

@openshift-ci-robot

openshift-ci-robot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@sanchezl: This pull request references CNTRLPLANE-3212 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 sub-task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

Details

  • Added configInformerFactory and featureGatesHandler parameters to the cert rotation controller constructor
  • Conditionally creates PKIProfileProvider using pki.NewClusterPKIProfileProvider() when the ConfigurablePKI feature gate is enabled
  • Registers PKI informer cache sync
  • Sets CertificateName and PKIProfileProvider on RotatedSigningCASecret and RotatedSelfSignedCertKeySecret:
  • machine-config.machine-config-server-signer
  • machine-config.machine-config-server-serving

References

Summary by CodeRabbit

  • New Features

  • The certificate rotation controller now supports configurable PKI profiles through external configuration sources. When the ConfigurablePKI feature gate is enabled, this provides enhanced flexibility in certificate and key management.

  • Chores

  • Updated library-go dependency to a newer version.

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.

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants