Skip to content

STOR-2954: inject TLS adherence from API to vsphere problem detector configmap - #718

Open
dfajmon wants to merge 2 commits into
openshift:mainfrom
dfajmon:STOR-2954
Open

STOR-2954: inject TLS adherence from API to vsphere problem detector configmap#718
dfajmon wants to merge 2 commits into
openshift:mainfrom
dfajmon:STOR-2954

Conversation

@dfajmon

@dfajmon dfajmon commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

https://redhat.atlassian.net/browse/STOR-2954

  1. Inject TLS configuration from the API into the vsphere-problem-detector ConfigMap.
  2. Refactor TLS utilities into a shared package for reuse across other components.

Summary by CodeRabbit

  • New Features
    • Added ConfigMap-backed operator configuration for the vSphere Problem Detector, with TLS settings derived from the cluster’s TLS security profile.
    • Updated the operator deployment to read its config from the mounted ConfigMap and support configuration/termination behavior via new CLI arguments.
  • Bug Fixes
    • Improved TLS configuration consistency across operator components and hosted control planes.
    • Ensures the required operator ConfigMap is reconciled before controllers start, failing early if it can’t be applied.

@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 Jul 20, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@dfajmon: This pull request references STOR-2954 which is a valid jira issue.

Details

In response to this:

https://redhat.atlassian.net/browse/STOR-2954

  1. Inject TLS configuration from the API into the vsphere-problem-detector ConfigMap.
  2. Refactor TLS utilities into a shared package for reuse across other components.

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 Jul 20, 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: fd2a8648-2aa2-4c09-8b4e-7013403629e2

📥 Commits

Reviewing files that changed from the base of the PR and between 9a32050 and 7183c22.

📒 Files selected for processing (3)
  • assets/vsphere_problem_detector/07_deployment.yaml
  • assets/vsphere_problem_detector/08_operator_config.yaml
  • pkg/operator/vsphereproblemdetector/vsphere_problem_detector_starter.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • assets/vsphere_problem_detector/08_operator_config.yaml
  • assets/vsphere_problem_detector/07_deployment.yaml
  • pkg/operator/vsphereproblemdetector/vsphere_problem_detector_starter.go

Walkthrough

The change exports shared TLS configuration helpers, updates CSI driver controllers to use them, and adds vSphere problem detector ConfigMap reconciliation. The deployment mounts the generated configuration and passes its path to the operator.

Changes

vSphere TLS configuration

Layer / File(s) Summary
Shared TLS helper exports
pkg/operator/tls/tls.go
Moves TLS helpers into the tls package and exports TLSSettingsFromProfile and OperatorConfigYAML while preserving their existing behavior.
Controller TLS helper integration
pkg/operator/csidriveroperator/deploymentcontroller.go, pkg/operator/csidriveroperator/hypershift_deployment_controller.go
Updates standard and HyperShift deployment controllers to use the shared TLS helpers for TLS settings and operator configuration YAML.
Problem detector ConfigMap reconciliation
pkg/operator/vsphereproblemdetector/vsphere_problem_detector_starter.go, assets/vsphere_problem_detector/07_deployment.yaml, assets/vsphere_problem_detector/08_operator_config.yaml
Reconciles a TLS-derived operator ConfigMap before starting vSphere controllers and mounts it at /var/run/configmaps/config for config.yaml loading and file-based termination.

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

Sequence Diagram(s)

sequenceDiagram
  participant VSphereProblemDetectorStarter
  participant APIServer
  participant TLSHelpers
  participant KubernetesAPI
  participant ProblemDetector
  VSphereProblemDetectorStarter->>APIServer: read cluster TLS security profile
  VSphereProblemDetectorStarter->>TLSHelpers: generate TLS settings and config.yaml
  VSphereProblemDetectorStarter->>KubernetesAPI: apply operator ConfigMap
  ProblemDetector->>KubernetesAPI: read mounted config.yaml
  ProblemDetector->>ProblemDetector: start with configured TLS settings
Loading

Suggested reviewers: mpatlasov, stephenfin

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 is specific and matches the main change: injecting API-derived TLS settings into the vSphere problem detector ConfigMap.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No test files or Ginkgo title changes were introduced; the diff only touches deployment/config and non-test Go code.
Test Structure And Quality ✅ Passed No Ginkgo specs were added or modified in this PR; the touched package’s tests are plain Go tests, so the requested Ginkgo test-structure check is not applicable.
Microshift Test Compatibility ✅ Passed PASS: The diff only touches YAML assets and a starter Go file; no new Ginkgo test files or It/Describe/Context/When blocks were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PASS: The PR changes only deployment/config/controller code; no new Ginkgo tests or SNO-sensitive assumptions were added.
Topology-Aware Scheduling Compatibility ✅ Passed Patch only adds configmap args/volume and configmap reconciliation; it does not change replicas, affinity, selectors, tolerations, or topology logic.
Ote Binary Stdout Contract ✅ Passed PASS: Touched files add controllers/assets only; no process-level fmt.Print/Stdout writes were introduced, and the test binary uses logs.InitLogs with klog defaulting to stderr.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo e2e test declarations were added in the touched files; the PR changes are controllers/assets only, with no IPv4 or external connectivity assumptions.
No-Weak-Crypto ✅ Passed Changed files contain no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, no custom crypto, and no secret/token compares; TLS logic delegates to shared OpenShift helpers.
Container-Privileges ✅ Passed No privileged/root/host* settings or SYS_ADMIN were added; the deployment keeps allowPrivilegeEscalation:false, runAsNonRoot:true, and drops ALL capabilities.
No-Sensitive-Data-In-Logs ✅ Passed PASS: The PR adds ConfigMap/TLS reconciliation but no new log statements or object dumps; no passwords, tokens, PII, or hostnames are logged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci
openshift-ci Bot requested review from mpatlasov and stephenfin July 20, 2026 15:39
@openshift-ci

openshift-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dfajmon

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 Jul 20, 2026

@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

Caution

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

⚠️ Outside diff range comments (1)
pkg/operator/tls/tls.go (1)

19-24: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Handle partially populated custom TLS profiles here. TLSSecurityProfile.Custom can arrive with MinTLSVersion or Ciphers unset, and this branch returns empty settings instead of the Intermediate defaults. Fall back when either field is missing, or reject the profile earlier; add tests for missing version, missing ciphers, and both.

🤖 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 `@pkg/operator/tls/tls.go` around lines 19 - 24, Update the custom-profile
handling in the TLS security profile logic to use the Intermediate profile
defaults whenever either Custom.MinTLSVersion or Custom.Ciphers is unset, while
preserving explicitly provided values. Add coverage for missing version, missing
ciphers, and both fields missing.
🤖 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 `@pkg/operator/vsphereproblemdetector/vsphere_problem_detector_starter.go`:
- Around line 245-249: Update the APIServer lookup handling in the controller
reconciliation flow around apiServerLister.Get("cluster") to return or propagate
the lookup error instead of assigning an empty configv1.APIServer and continuing
with the Intermediate TLS profile. Preserve the last reconciled ConfigMap and
allow controller retry behavior; only apply the TLS policy after a successful
lookup.

---

Outside diff comments:
In `@pkg/operator/tls/tls.go`:
- Around line 19-24: Update the custom-profile handling in the TLS security
profile logic to use the Intermediate profile defaults whenever either
Custom.MinTLSVersion or Custom.Ciphers is unset, while preserving explicitly
provided values. Add coverage for missing version, missing ciphers, and both
fields missing.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 85e3b965-aa96-4a42-930b-bf1c9ae76933

📥 Commits

Reviewing files that changed from the base of the PR and between 8ac4825 and dd93368.

📒 Files selected for processing (6)
  • assets/vsphere_problem_detector/07_deployment.yaml
  • assets/vsphere_problem_detector/08_operator_config.yaml
  • pkg/operator/csidriveroperator/deploymentcontroller.go
  • pkg/operator/csidriveroperator/hypershift_deployment_controller.go
  • pkg/operator/tls/tls.go
  • pkg/operator/vsphereproblemdetector/vsphere_problem_detector_starter.go

@dfajmon

dfajmon commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

/retest-required

1 similar comment
@dfajmon

dfajmon commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

/retest-required

@jsafrane

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 27, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-upgrade
/test e2e-azure-csi
/test e2e-azure-file-csi
/test e2e-gcp-csi
/test e2e-vsphere-csi

@dfajmon

dfajmon commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

/retest-required

@openshift-ci

openshift-ci Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@dfajmon: The following test 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/hypershift-e2e-aks 7183c22 link false /test hypershift-e2e-aks

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.

@dfajmon

dfajmon commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

/retest-required

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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants