Skip to content

CNTRLPLANE-3624: add tls security profile configuration for the control-plane-pki-operator - #8768

Merged
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
ricardomaraschini:CNTRLPLANE-3624
Jun 29, 2026
Merged

CNTRLPLANE-3624: add tls security profile configuration for the control-plane-pki-operator#8768
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
ricardomaraschini:CNTRLPLANE-3624

Conversation

@ricardomaraschini

@ricardomaraschini ricardomaraschini commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Configure the control-plane-pki-operator to use the TLS security profile settings from the HostedCluster resource. This ensures the operator's metric endpoint uses ciphers and minimum TLS version that match the cluster's security requirements.

Implementation:

Note

This follows what has been done for the Image Registry Operator, almost verbatim.

  • Add ConfigMap adapter to generate configv1.GenericControllerConfig with TLS settings derived from hcp.spec.configuration.apiServer.tlsSecurityProfile.
  • Mount the config and use it via --config flag on the operator deployment.
  • Reuse existing config.CipherSuites() and config.minTLSVersion() helper functions for consistency with other control plane components.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • New Features
    • PKI operator now generates TLS serving settings (bind address, minimum TLS version, and applicable cipher suites) from the HostedControlPlane TLS security profile via a ConfigMap-backed configuration.
  • Chores
    • Updated the PKI operator Deployment to load configuration from a mounted, read-only ConfigMap file using explicit startup arguments.
  • Tests
    • Added unit tests covering multiple TLS security profile scenarios, defaulting behavior, and ensuring unrelated ConfigMap data remains unchanged.

@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 Jun 18, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 18, 2026

Copy link
Copy Markdown

@ricardomaraschini: This pull request references CNTRLPLANE-3624 which is a valid jira issue.

Details

In response to this:

What this PR does / why we need it:

Configure the control-plane-pki-operator to use the TLS security profile settings from the HostedCluster resource. This ensures the operator's metric endpoint uses ciphers and minimum TLS version that match the cluster's security requirements.

Implementation:

[!NOTE]
This follows what has been done for the Image Registry Operator, almost verbatim.

  • Add ConfigMap adapter to generate configv1.GenericControllerConfig with TLS settings derived from hcp.spec.configuration.apiServer.tlsSecurityProfile.
  • Mount the config and use it via --config flag on the operator deployment.
  • Reuse existing config.CipherSuites() and config.minTLSVersion() helper functions for consistency with other control plane components.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

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 Jun 18, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

A new controller-config.yaml ConfigMap asset is introduced for the control-plane-pki-operator, carrying a base servingInfo.bindAddress of 0.0.0.0:8443. The operator's Deployment is updated to mount this ConfigMap as a read-only volume and pass --config and --terminate-on-files flags pointing to the mounted path. NewComponent is wired to invoke a new adaptControllerConfig function, which reads the HostedControlPlane's TLS security profile and populates the ConfigMap's config.yaml key with a GenericControllerConfig containing the derived cipher suites and minimum TLS version. A table-driven unit test covers all standard TLS profile variants.

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and specifically describes the main change: adding TLS security profile configuration support to the control-plane-pki-operator, which is the primary objective of the changeset.
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 This PR contains only standard Go tests (using testing.T), not Ginkgo tests. The new test in configmap_test.go uses t.Run() with static, deterministic test names that do not contain dynamic values,...
Test Structure And Quality ✅ Passed The test added uses standard Go testing with Gomega matchers, not Ginkgo. The custom check is specifically for Ginkgo test code and is not applicable to standard Go tests.
Topology-Aware Scheduling Compatibility ✅ Passed PR introduces no topology-unfriendly scheduling constraints. Changes are configuration-only (TLS settings), with no modifications to replica counts, affinity rules, nodeSelectors, topology spread c...
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo e2e tests added in this PR. Changes include only unit tests (standard Go testing), YAML manifests, and support functions. Custom check is inapplicable.
No-Weak-Crypto ✅ Passed No weak cryptographic algorithms (MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB), custom crypto implementations, or insecure comparisons found. Uses only strong ciphers (ECDHE, CHACHA20) via vetted conf...
Container-Privileges ✅ Passed No privileged security settings detected in the PR. The deployment.yaml contains no securityContext, privileged: true, host namespace access, or dangerous capabilities. Only TLS configuration is ad...
No-Sensitive-Data-In-Logs ✅ Passed PR contains no logging that could expose sensitive data. Configuration data includes only TLS cipher suite names, TLS versions, and public binding addresses. Error messages use safe %w format.

✏️ 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.

@openshift-ci
openshift-ci Bot requested a review from sdminonne June 18, 2026 08:37
@openshift-ci openshift-ci Bot added area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release and removed do-not-merge/needs-area labels Jun 18, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`:
- Around line 26-27: Remove the unrecognized `--files` flag from the deployment
arguments in the control-plane-pki-operator deployment. The `--files` argument
is not a valid flag for the control-plane-pki-operator binary and will be
silently ignored at runtime. Delete the line containing
`--files=/var/run/configmaps/control-plane-pki-operator-config/config.yaml` and
keep only the `--config` flag argument on the preceding line.
🪄 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: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 9e6e14d1-6237-4d4a-b260-12932e20c314

📥 Commits

Reviewing files that changed from the base of the PR and between c35f662 and 4322832.

⛔ Files ignored due to path filters (15)
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
📒 Files selected for processing (5)
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/controller-config.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/component.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap_test.go

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.86486% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.87%. Comparing base (c35f662) to head (4937212).
⚠️ Report is 155 commits behind head on main.

Files with missing lines Patch % Lines
...ers/hostedcontrolplane/v2/pkioperator/configmap.go 72.72% 6 Missing and 3 partials ⚠️
...ers/hostedcontrolplane/v2/pkioperator/component.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8768      +/-   ##
==========================================
+ Coverage   41.84%   41.87%   +0.02%     
==========================================
  Files         759      760       +1     
  Lines       94073    94138      +65     
==========================================
+ Hits        39361    39416      +55     
- Misses      51956    51959       +3     
- Partials     2756     2763       +7     
Files with missing lines Coverage Δ
...ers/hostedcontrolplane/v2/pkioperator/component.go 42.85% <0.00%> (-10.09%) ⬇️
...ers/hostedcontrolplane/v2/pkioperator/configmap.go 72.72% <72.72%> (ø)

... and 3 files with indirect coverage changes

Flag Coverage Δ
cmd-support 35.13% <ø> (ø)
cpo-hostedcontrolplane 44.20% <64.86%> (+0.09%) ⬆️
cpo-other 43.45% <ø> (ø)
hypershift-operator 52.05% <ø> (+0.03%) ⬆️
other 31.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (2)
control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml (2)

21-27: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add explicit non-root container hardening in securityContext (Line 21 onward).

The container currently runs without explicit runAsNonRoot, allowPrivilegeEscalation: false, readOnlyRootFilesystem, and dropped Linux capabilities. Please enforce these defaults in the manifest.

Suggested patch
       - args:
         - operator
@@
         image: controlplane-pki-operator
         name: control-plane-pki-operator
+        securityContext:
+          runAsNonRoot: true
+          allowPrivilegeEscalation: false
+          readOnlyRootFilesystem: true
+          capabilities:
+            drop:
+            - ALL
         ports:

As per coding guidelines: “securityContext: runAsNonRoot, readOnlyRootFilesystem, allowPrivilegeEscalation: false” and “Drop ALL capabilities, add only what is required.”

Also applies to: 45-61

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`
around lines 21 - 27, Add a securityContext block to the container specification
in the deployment manifest to enforce non-root execution and filesystem
hardening. The container running the operator with args starting with
"operator", "--namespace", and other flags requires a securityContext that sets
runAsNonRoot to true, allowPrivilegeEscalation to false, readOnlyRootFilesystem
to true, and drops ALL Linux capabilities. Apply these same security hardening
settings to all container specifications in this manifest, including the
containers section starting at line 21 and any additional containers referenced
in the "Also applies to" section.

Sources: Coding guidelines, Linters/SAST tools


47-55: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Define container limits and health probes (Line 47 onward).

resources.limits and liveness/readiness probes are missing. This weakens runtime safety and rollout behavior.

Suggested patch
         ports:
         - containerPort: 8443
           name: metrics
           protocol: TCP
         resources:
           requests:
             cpu: 10m
             memory: 80Mi
+          limits:
+            cpu: 100m
+            memory: 256Mi
+        readinessProbe:
+          tcpSocket:
+            port: metrics
+          initialDelaySeconds: 5
+          periodSeconds: 10
+        livenessProbe:
+          tcpSocket:
+            port: metrics
+          initialDelaySeconds: 15
+          periodSeconds: 20

As per coding guidelines: “Resource limits (cpu, memory) on every container” and “Liveness + readiness probes defined.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`
around lines 47 - 55, The container definition in the control-plane-pki-operator
deployment.yaml is missing resource limits and health probes. Currently only
resources.requests is defined with cpu: 10m and memory: 80Mi, but
resources.limits is absent. Add a limits section under resources with
appropriate cpu and memory values, and add livenessProbe and readinessProbe
sections to the container spec (after the resources section) to define proper
health check behavior for the metrics endpoint on port 8443.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`:
- Around line 21-27: Add a securityContext block to the container specification
in the deployment manifest to enforce non-root execution and filesystem
hardening. The container running the operator with args starting with
"operator", "--namespace", and other flags requires a securityContext that sets
runAsNonRoot to true, allowPrivilegeEscalation to false, readOnlyRootFilesystem
to true, and drops ALL Linux capabilities. Apply these same security hardening
settings to all container specifications in this manifest, including the
containers section starting at line 21 and any additional containers referenced
in the "Also applies to" section.
- Around line 47-55: The container definition in the control-plane-pki-operator
deployment.yaml is missing resource limits and health probes. Currently only
resources.requests is defined with cpu: 10m and memory: 80Mi, but
resources.limits is absent. Add a limits section under resources with
appropriate cpu and memory values, and add livenessProbe and readinessProbe
sections to the container spec (after the resources section) to define proper
health check behavior for the metrics endpoint on port 8443.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: e1653be0-4481-44ea-9398-fe9bb48b2800

📥 Commits

Reviewing files that changed from the base of the PR and between 4322832 and ec63a44.

⛔ Files ignored due to path filters (15)
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
📒 Files selected for processing (5)
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/controller-config.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/component.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap_test.go
✅ Files skipped from review due to trivial changes (1)
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/controller-config.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/component.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap_test.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (2)
control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml (2)

21-61: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Harden container securityContext explicitly.

The container spec currently lacks explicit hardening controls (for example runAsNonRoot, allowPrivilegeEscalation: false, readOnlyRootFilesystem, and dropped capabilities). This weakens workload isolation for the PKI operator pod.

Suggested patch
       containers:
       - args:
         - operator
         - --namespace
         - $(HOSTED_CONTROL_PLANE_NAMESPACE)
         - --config=/var/run/configmaps/control-plane-pki-operator-config/config.yaml
         - --terminate-on-files=/var/run/configmaps/control-plane-pki-operator-config/config.yaml
+        securityContext:
+          runAsNonRoot: true
+          allowPrivilegeEscalation: false
+          readOnlyRootFilesystem: true
+          capabilities:
+            drop:
+            - ALL
         command:
         - /usr/bin/control-plane-pki-operator

As per coding guidelines, Kubernetes manifests must set these securityContext hardening fields and avoid privilege-escalation posture.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`
around lines 21 - 61, The control-plane-pki-operator container lacks explicit
security hardening controls in its specification. Add a securityContext section
to the container spec that includes runAsNonRoot set to true,
allowPrivilegeEscalation set to false, readOnlyRootFilesystem set to true, and a
capabilities section that drops ALL capabilities. This securityContext should be
added as a sibling to other container fields like image, name, ports, resources,
and volumeMounts to enforce proper workload isolation and follow Kubernetes
security best practices.

Sources: Coding guidelines, Linters/SAST tools


51-54: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add CPU/memory limits for this container.

At Line 51, only resource requests are set. Missing limits can let this control-plane component overconsume node resources during spikes.

Suggested patch
         resources:
           requests:
             cpu: 10m
             memory: 80Mi
+          limits:
+            cpu: 100m
+            memory: 160Mi

As per coding guidelines, every container should define resource limits in Kubernetes manifests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`
around lines 51 - 54, In the resources block where cpu and memory requests are
defined with 10m and 80Mi respectively, add a limits section at the same
indentation level as the requests block. This limits block should specify the
maximum cpu and memory values this container can consume, ensuring the
control-plane-pki-operator component cannot overconsume node resources during
load spikes.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`:
- Around line 21-61: The control-plane-pki-operator container lacks explicit
security hardening controls in its specification. Add a securityContext section
to the container spec that includes runAsNonRoot set to true,
allowPrivilegeEscalation set to false, readOnlyRootFilesystem set to true, and a
capabilities section that drops ALL capabilities. This securityContext should be
added as a sibling to other container fields like image, name, ports, resources,
and volumeMounts to enforce proper workload isolation and follow Kubernetes
security best practices.
- Around line 51-54: In the resources block where cpu and memory requests are
defined with 10m and 80Mi respectively, add a limits section at the same
indentation level as the requests block. This limits block should specify the
maximum cpu and memory values this container can consume, ensuring the
control-plane-pki-operator component cannot overconsume node resources during
load spikes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 918479f3-b90a-450c-b647-6845e918c852

📥 Commits

Reviewing files that changed from the base of the PR and between ec63a44 and 9c00ee3.

⛔ Files ignored due to path filters (15)
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
📒 Files selected for processing (5)
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/controller-config.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/component.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/controller-config.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/component.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (3)
control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml (3)

21-61: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Harden container security context and capabilities.

This container is missing explicit hardening controls (runAsNonRoot, allowPrivilegeEscalation: false, readOnlyRootFilesystem, dropping capabilities), which are required by the repo’s manifest policy.

Suggested patch
       containers:
       - args:
         - operator
@@
         image: controlplane-pki-operator
         name: control-plane-pki-operator
+        securityContext:
+          runAsNonRoot: true
+          allowPrivilegeEscalation: false
+          readOnlyRootFilesystem: true
+          capabilities:
+            drop:
+            - ALL
         ports:
         - containerPort: 8443

As per coding guidelines, Kubernetes/OpenShift manifests must set runAsNonRoot, readOnlyRootFilesystem, allowPrivilegeEscalation: false, and drop capabilities unless required.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`
around lines 21 - 61, The control-plane-pki-operator container in the deployment
manifest is missing required security hardening controls. Add a securityContext
field to the container specification that sets runAsNonRoot to true,
allowPrivilegeEscalation to false, readOnlyRootFilesystem to true, and includes
a capabilities section that drops ALL capabilities. This should be added as a
peer to the existing fields like image, name, ports, and volumeMounts within the
container specification.

Source: Coding guidelines


51-54: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add container resource limits (not only requests).

The manifest defines requests but no CPU/memory limits, which violates the manifest requirements and can cause noisy-neighbor risk.

Suggested patch
         resources:
           requests:
             cpu: 10m
             memory: 80Mi
+          limits:
+            cpu: 100m
+            memory: 160Mi

As per coding guidelines, resource limits (cpu, memory) should be set on every container.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`
around lines 51 - 54, The deployment manifest for the control-plane-pki-operator
container defines resource requests (cpu: 10m, memory: 80Mi) but is missing
resource limits. Add a limits section under the resources block with appropriate
CPU and memory limit values set for the container. This ensures compliance with
manifest requirements and prevents noisy-neighbor issues. Both requests and
limits should be defined for every container as per coding guidelines.

Source: Coding guidelines


45-50: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Define readiness and liveness probes for the operator container.

No health probes are configured, so kubelet cannot distinguish slow start from unhealthy state or recover stuck processes reliably.

As per coding guidelines, Kubernetes/OpenShift manifests should define both liveness and readiness probes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`
around lines 45 - 50, The control-plane-pki-operator container lacks readiness
and liveness probes which prevents kubelet from detecting unhealthy states or
performing automatic recovery. Add both livenessProbe and readinessProbe fields
to the container specification for control-plane-pki-operator. Configure these
probes to use HTTP checks against port 8443 (the metrics port already defined)
with an appropriate health check endpoint such as /healthz or /metrics. Set
reasonable initial delay, timeout, period, and failure threshold values suitable
for operator startup and health monitoring.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`:
- Around line 21-61: The control-plane-pki-operator container in the deployment
manifest is missing required security hardening controls. Add a securityContext
field to the container specification that sets runAsNonRoot to true,
allowPrivilegeEscalation to false, readOnlyRootFilesystem to true, and includes
a capabilities section that drops ALL capabilities. This should be added as a
peer to the existing fields like image, name, ports, and volumeMounts within the
container specification.
- Around line 51-54: The deployment manifest for the control-plane-pki-operator
container defines resource requests (cpu: 10m, memory: 80Mi) but is missing
resource limits. Add a limits section under the resources block with appropriate
CPU and memory limit values set for the container. This ensures compliance with
manifest requirements and prevents noisy-neighbor issues. Both requests and
limits should be defined for every container as per coding guidelines.
- Around line 45-50: The control-plane-pki-operator container lacks readiness
and liveness probes which prevents kubelet from detecting unhealthy states or
performing automatic recovery. Add both livenessProbe and readinessProbe fields
to the container specification for control-plane-pki-operator. Configure these
probes to use HTTP checks against port 8443 (the metrics port already defined)
with an appropriate health check endpoint such as /healthz or /metrics. Set
reasonable initial delay, timeout, period, and failure threshold values suitable
for operator startup and health monitoring.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: aa1b5698-4d6c-4e16-94cf-5dc62eab6c03

📥 Commits

Reviewing files that changed from the base of the PR and between 9c00ee3 and f7516d8.

⛔ Files ignored due to path filters (15)
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
📒 Files selected for processing (5)
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/controller-config.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/component.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/component.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/controller-config.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap_test.go

configure the control-plane-pki-operator to use the tls security profile
settings from the hostedcontrolplane resource. this ensures the
operator's metrics endpoint uses ciphers and minimum tls version that
match the cluster's security requirements.

implementation:
- add configmap adapter to generate genericcontrollerconfig with tls
  settings derived from hcp.spec.configuration.tlssecurityprofile
- mount the config and uses --config flag on the operator deployment
- reuse existing config.ciphersuites() and config.mintlsversion()
  helper functions for consistency with other control plane components

this implementation is very similar to the registry operator
implementation.
we have changed the control plane pki operator deployment and added a
new config map to the equation. we need to regenerate the testdata to
incorporate these changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml (1)

22-27: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add mandatory container securityContext hardening.

This Deployment still allows insecure defaults (root-capable runtime and privilege escalation by default). Please set runAsNonRoot, readOnlyRootFilesystem, allowPrivilegeEscalation: false, and drop all capabilities for control-plane-pki-operator.

Suggested patch
       - args:
         - operator
         - --namespace
         - $(HOSTED_CONTROL_PLANE_NAMESPACE)
         - --config=/var/run/configmaps/control-plane-pki-operator-config/config.yaml
         - --terminate-on-files=/var/run/configmaps/control-plane-pki-operator-config/config.yaml
         command:
         - /usr/bin/control-plane-pki-operator
+        securityContext:
+          allowPrivilegeEscalation: false
+          runAsNonRoot: true
+          readOnlyRootFilesystem: true
+          capabilities:
+            drop:
+            - ALL
         env:

As per coding guidelines, Kubernetes/OpenShift manifests must enforce runAsNonRoot, readOnlyRootFilesystem, allowPrivilegeEscalation: false, and drop ALL capabilities.

Also applies to: 59-61

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`
around lines 22 - 27, Add a securityContext specification to the
control-plane-pki-operator container to enforce security hardening. Within the
container specification (where the args are defined), add a securityContext
block that sets runAsNonRoot to true, readOnlyRootFilesystem to true,
allowPrivilegeEscalation to false, and includes a capabilities section that
drops ALL. Apply the same securityContext hardening to the other container
referenced at lines 59-61.

Sources: Coding guidelines, Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml`:
- Around line 22-27: Add a securityContext specification to the
control-plane-pki-operator container to enforce security hardening. Within the
container specification (where the args are defined), add a securityContext
block that sets runAsNonRoot to true, readOnlyRootFilesystem to true,
allowPrivilegeEscalation to false, and includes a capabilities section that
drops ALL. Apply the same securityContext hardening to the other container
referenced at lines 59-61.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 7ae58a56-9d32-4fa6-b8a1-e77b2699a161

📥 Commits

Reviewing files that changed from the base of the PR and between f7516d8 and 4937212.

⛔ Files ignored due to path filters (15)
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/AROSwift/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/GCP/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/IBMCloud/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_config_configmap.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_controlplanecomponent.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/testdata/control-plane-pki-operator/zz_fixture_TestControlPlaneComponents_control_plane_pki_operator_deployment.yaml is excluded by !**/testdata/**
📒 Files selected for processing (5)
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/controller-config.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/deployment.yaml
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/component.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap_test.go
✅ Files skipped from review due to trivial changes (1)
  • control-plane-operator/controllers/hostedcontrolplane/v2/assets/control-plane-pki-operator/controller-config.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/component.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/pkioperator/configmap_test.go

@kaleemsiddiqu

Copy link
Copy Markdown
Contributor

/lgtm
/verified by @kaleemsiddiqu
Tested locally and it is working as expected.

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jun 22, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@kaleemsiddiqu: This PR has been marked as verified by @kaleemsiddiqu.

Details

In response to this:

/lgtm
/verified by @kaleemsiddiqu
Tested locally and it is working as expected.

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 openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 22, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-azure-v2-self-managed
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-gke

@cwbotbot

cwbotbot commented Jun 22, 2026

Copy link
Copy Markdown

Test Results

e2e-aws

e2e-aks

@ricardomaraschini

Copy link
Copy Markdown
Contributor Author

/retest

@hypershift-jira-solve-ci

hypershift-jira-solve-ci Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Now I have the full picture. The PR adds TLS security profile configuration to the control-plane-pki-operator via a ConfigMap, but this is completely unrelated to the global-pull-secret-syncer DaemonSet issue. The failure is a pre-existing flaky test.

Test Failure Analysis Complete

Job Information

Test Failure Analysis

Error

failed to wait for DaemonSet global-pull-secret-syncer to be ready: context deadline exceeded

TestCreateCluster/Main/EnsureGlobalPullSecret/When_management-cluster_hostedCluster.Spec.PullSecret_is_updated_in-place_it_should_propagate_to_guest_without_rollout (1205.08s)

Summary

The TestCreateCluster/Main/EnsureGlobalPullSecret test timed out waiting for the global-pull-secret-syncer DaemonSet to reach 3/3 pods ready (stuck at 2/3 for the full 20-minute timeout). This is a pre-existing flaky test unrelated to the PR's changes. The PR modifies only control-plane-pki-operator TLS security profile configuration (ConfigMap, deployment args, test fixtures) and does not touch any global-pull-secret, DaemonSet, or test code. All 588 other e2e tests passed.

Root Cause

The EnsureGlobalPullSecret test patches the management-cluster pull secret, which triggers the Hosted Cluster Config Operator (HCCO) to reconcile the global-pull-secret-syncer DaemonSet. This reconciliation caused 6 rapid DaemonSet generation bumps between 09:33:23 and 09:34:00 UTC, producing a cascade of pod deletions and creations (at least 12 pods cycled through 3 nodes in ~37 seconds).

After the churn settled, all 3 final pods (9922d, zksnm, fkb7h) were Running and Ready (confirmed in the hostedcluster dump collected after test completion — zero restarts, no errors in container logs). However, the waitForDaemonSetReady polling function continued to observe NumberReady=2 from the DaemonSet status for the entire 20-minute timeout (1205 seconds), indicating a lag between individual pod readiness and the DaemonSet controller's aggregated .status.numberReady field during the rapid rolling update storm.

The secondary failure (Check_if_the_config.json_is_correct_in_all_of_the_nodes) is a cascading error — it attempted to create the kubelet-config-verifier DaemonSet which already existed from the previous subtest's setup, producing an AlreadyExists error (the cleanup from the timed-out subtest didn't remove it).

This failure is unrelated to PR #8768. The PR changes are scoped to:

  • Adding a control-plane-pki-operator-config ConfigMap with TLS cipher suites and minimum TLS version
  • Adding --config and --terminate-on-files args to the control-plane-pki-operator deployment
  • Updating test fixtures for the above changes

None of these changes affect the global-pull-secret-syncer DaemonSet, the HCCO reconciler, the pull secret propagation logic, or the e2e test code.

Recommendations
  1. Retest the PR — This failure is a pre-existing flake in the EnsureGlobalPullSecret test and is not caused by the PR's changes. A /retest should pass.

  2. File a bug for the flaky test — The waitForDaemonSetReady function polls DaemonSet.Status.NumberReady which can lag behind actual pod readiness during rapid rolling updates. The test could be made more resilient by:

    • Waiting for the DaemonSet's ObservedGeneration == Generation AND UpdatedNumberScheduled == DesiredNumberScheduled before checking readiness (ensuring the rollout is complete)
    • Adding a brief stabilization delay after the pull secret patch before checking DaemonSet readiness, to allow the HCCO reconciliation to settle
  3. No changes needed to PR CNTRLPLANE-3624: add tls security profile configuration for the control-plane-pki-operator #8768 — The control-plane-pki-operator was healthy during the test (generation 1, 1/1 replicas ready, all conditions satisfied).

Evidence
Evidence Detail
Failed test TestCreateCluster/Main/EnsureGlobalPullSecret/When_management-cluster_hostedCluster.Spec.PullSecret_is_updated_in-place_it_should_propagate_to_guest_without_rollout
Failure duration 1205.08s (20-minute waitForDaemonSetReady timeout)
DaemonSet status at failure global-pull-secret-syncer stuck at 2/3 pods ready
DaemonSet status at dump time 3/3 pods Ready, generation=6, observedGeneration=6, 0 restarts
Pod churn 12+ pods created/deleted between 09:33:23–09:34:00 across 6 DaemonSet generations
Pod logs All 3 final pods healthy — no errors, syncing every 30s as expected
PR scope Only modifies control-plane-pki-operator TLS config (ConfigMap, deployment args, fixtures) — 0 matches for globalps, global.pull.secret, pull-secret-syncer in diff
control-plane-pki-operator health Generation 1, 1/1 replicas ready, Available=True
Other test results 588 passed, 30 skipped — all 5 failures in the same EnsureGlobalPullSecret chain
Cascading failure Check_if_the_config.json_is_correct_in_all_of_the_nodes failed with daemonsets.apps "kubelet-config-verifier" already exists (cleanup from timed-out sibling test)

@jparrill jparrill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dropped some comments. Thanks!

ServingInfo: configv1.HTTPServingInfo{
ServingInfo: configv1.ServingInfo{
BindAddress: "0.0.0.0:8443",
BindNetwork: "tcp4",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey Ricardo — I noticed you're adding BindNetwork: "tcp4" but the registryoperator (which you reference as the baseline) doesn't set it. In the repo, only KAS uses "tcp4". Is there a specific reason to force IPv4-only on the PKI operator? If not, dropping it would let it work on dual-stack clusters out of the box.

Related: "0.0.0.0:8443" also forces IPv4. The registry uses ":60000" (no IP). Could you use ":8443" for consistency?

Note: the base asset template (controller-config.yaml, lines 10-11) also has these IPv4-only values. While the adapter overwrites the template entirely at runtime, it'd be good to keep them consistent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this comment. This difference was indeed based on the APIServer config generation (which seems to enforce 0.0.0.0 and tcp4). The long story short is that, differently from the Registry Operator, we need to specify an IP and a port as per validation here (the slightly longer story tells that the registry predates this whole library-go tooling). Failing to do so makes the pki operator not to start.

I assumed that this was OK as if the API Server does not come up nothing else would.

Please advice.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For sake of easier understanding, this is what happens if the IP isn't set: https://go.dev/play/p/dkPew1VSLjd

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Humm you're right, what about:

0.0.0.0 + tcp4 forces IPv4-only, which would break on dual-stack or IPv6-only clusters. Maybe we can use [::] (the IPv6 unspecified address) instead:

BindAddress: "[::]:8443",
// drop BindNetwork entirely

This should work because:

  1. Passes library-go validation: net.SplitHostPort("[::]:8443")host="::", and net.ParseIP("::") returns a valid IP.
  2. Dual-stack safe: with no BindNetwork set, CreateListener in k8s.io/apiserver defaults to "tcp", and tcp + [::] listens on both IPv4 and IPv6.
  3. IPv4-only clusters still work: Linux maps IPv4 connections onto IPv6 sockets by default (net.ipv6.bindv6only=0).

The asset template (controller-config.yaml) should match:

servingInfo:
  bindAddress: "[::]:8443"

WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK, I will do as instructed.

@jparrill jparrill Jun 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Discussed this on Slack. Ricardo were right initially because the config is for the inner pod not the network layer. The KAS is configured in the same way. The network layer will do the translation from IPv6 to IPv4, so no issues.

shouldPreserveKey: "other-key",
},
{
name: "When TLS profile is nil it should use Intermediate profile",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: the "When TLS profile is nil" case sets Configuration and APIServer as non-nil with just TLSSecurityProfile = nil. But in production HCP.Spec.Configuration itself can be nil (it's an omitempty pointer field). Same for APIServer == nil.

GetTLSSecurityProfile() handles both safely (it has a nil-receiver guard), but it'd be nice to have a couple of extra test cases verifying those paths — something like:

{
    name:            "When Configuration is nil it should default to Intermediate profile",
    // don't set Configuration on the HCP
},

Not blocking, but if you're aiming to cover all nil paths like the registry does, this would round it out.

"sigs.k8s.io/yaml"
)

func Test_adaptControllerConfig(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor nit: would you mind adding t.Parallel() to the test function and subtests? The cases are independent (each creates its own HCP and ConfigMap). The registry doesn't do it either, so not blocking — just following repo conventions.

expectedMinTLS: configv1.TLSProfiles[configv1.TLSProfileIntermediateType].MinTLSVersion,
},
{
name: "When TLS profile is Modern it should use TLS 1.3 with empty cipher list",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI: the Modern profile produces an empty cipher suite slice (because OpenSSLToIANACipherSuites drops TLS 1.3 ciphers). The test assumes the field gets omitted from the YAML thanks to the omitempty struct tag upstream. If upstream ever changes those tags, this assertion would break silently.

I don't think anything needs to change right now — just leaving a note in case this test ever fails for no apparent reason.

@jparrill

Copy link
Copy Markdown
Contributor

/approve

@jparrill

Copy link
Copy Markdown
Contributor

/retest-required

@openshift-ci

openshift-ci Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jparrill, ricardomaraschini

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 29, 2026
@openshift-ci

openshift-ci Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

@ricardomaraschini: 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.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 73c2cd1 into openshift:main Jun 29, 2026
41 checks passed
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. area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release 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. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants