Skip to content

Mc/rox 33465 openshift autosensing 6#19968

Draft
mclasmeier wants to merge 28 commits intomasterfrom
mc/ROX-33465-openshift-autosensing-6
Draft

Mc/rox 33465 openshift autosensing 6#19968
mclasmeier wants to merge 28 commits intomasterfrom
mc/ROX-33465-openshift-autosensing-6

Conversation

@mclasmeier
Copy link
Copy Markdown
Contributor

Description

change me!

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

change me!

Moritz Clasmeier added 28 commits April 12, 2026 20:59
Adjust computation in central/graphql/resolvers/cluster_vulnerabilities_postgres_test.go
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 13, 2026

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

@mclasmeier
Copy link
Copy Markdown
Contributor Author

/test ocp-4-21-qa-e2e-tests
/test ocp-4-12-qa-e2e-tests

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The new OpenShift version validation relies on matching specific error message substrings in tests (e.g., "You have specified OpenShift version 3"); consider exposing a dedicated error type/value and asserting on that instead to make the tests less brittle to message wording changes.
  • The error message text for unsupported OpenShift versions is duplicated in multiple places (Helm templates, roxctl commands, renderer tests); factoring this into a shared constant or helper would reduce the risk of the messages drifting out of sync over time.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new OpenShift version validation relies on matching specific error message substrings in tests (e.g., `"You have specified OpenShift version 3"`); consider exposing a dedicated error type/value and asserting on that instead to make the tests less brittle to message wording changes.
- The error message text for unsupported OpenShift versions is duplicated in multiple places (Helm templates, `roxctl` commands, renderer tests); factoring this into a shared constant or helper would reduce the risk of the messages drifting out of sync over time.

## Individual Comments

### Comment 1
<location path="image/templates/helm/shared/templates/_openshift.tpl" line_range="10-11" />
<code_context>
-    If "true" is passed for $._rox.env.openshift the OpenShift version is detected based on the Kubernetes cluster version.
-    If the Kubernetes version is not available (i.e. when using Helm template) auto-sensing falls back on OpenShift 3 to be
-    backward compatible.
+    If "true" is passed for $._rox.env.openshift, this is unconditionally mapped to OpenShift version "4", because that is the only
+    major version we currently support.
   */}}

</code_context>
<issue_to_address>
**issue (bug_risk):** The documented behavior for passing "true" does not match the implemented behavior.

This comment now states that passing "true" for `$._rox.env.openshift` always maps to OpenShift 4, but the code only special-cases `kindIs "bool" $env.openshift`. If a user sets `openshift: "true"` (string) in values, it will go through the `int` cast instead and likely fail rendering. Please either handle the string values "true"/"false" explicitly, or update the docs to clarify that `openshift` must be a boolean, not a string.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +10 to +11
If "true" is passed for $._rox.env.openshift, this is unconditionally mapped to OpenShift version "4", because that is the only
major version we currently support.
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.

issue (bug_risk): The documented behavior for passing "true" does not match the implemented behavior.

This comment now states that passing "true" for $._rox.env.openshift always maps to OpenShift 4, but the code only special-cases kindIs "bool" $env.openshift. If a user sets openshift: "true" (string) in values, it will go through the int cast instead and likely fail rendering. Please either handle the string values "true"/"false" explicitly, or update the docs to clarify that openshift must be a boolean, not a string.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Deprecation

    • Removed OpenShift 3 support across platform. Only OpenShift 4 is now supported. Clusters using OpenShift 3 will be rejected with an error message.
    • Deprecated OPENSHIFT_CLUSTER enum value; use OPENSHIFT4_CLUSTER instead.
  • Refactor

    • Simplified Helm charts and deployment logic by removing OpenShift 3 compatibility handling and version-detection code.

Walkthrough

This pull request removes OpenShift 3 support from the codebase. Changes include deprecating the OPENSHIFT_CLUSTER enum value, eliminating OpenShift 3 validation and generation logic, updating Helm templates to only support OpenShift 4, removing OpenShift 3 test cases, and updating test schemas from 3.11.0 and 4.1.0 to 4.12.

Changes

Cohort / File(s) Summary
Protocol Definition
proto/storage/cluster.proto
Marked OPENSHIFT_CLUSTER enum value as deprecated.
Documentation
CHANGELOG.md
Added entry documenting removal of OpenShift 3 support from Helm charts and roxctl manifest bundle generation.
Validation & Cluster Operations
pkg/cluster/validation.go, pkg/cluster/validation_test.go
Changed validation to reject OPENSHIFT_CLUSTER type with message "OpenShift 3.x is not supported anymore" regardless of admission controller configuration; updated test expectations.
OpenShift Sensor Generation
roxctl/sensor/generate/openshift.go, roxctl/sensor/generate/generate_test.go
Removed OpenShift 3 version handling; simplified to accept only version 4; updated error handling and flag help text.
Central Helm Chart Generation
roxctl/central/generate/k8s.go, roxctl/central/generate/generate_test.go
Removed OpenShift 3 cluster type selection; updated error handling for unsupported versions; removed OpenShift 3 test cases.
Renderer Bundle Tests
pkg/renderer/central_db_test.go, pkg/renderer/kubernetes_test.go
Removed OPENSHIFT_CLUSTER from success path; added new tests asserting that OPENSHIFT_CLUSTER renders fail with version 3 error message.
Helm Template: OpenShift Detection
image/templates/helm/shared/templates/_openshift.tpl
Reworked srox.autoSenseOpenshiftVersion to support only OpenShift 4; replaced API resource probe; removed Kubernetes version-based OpenShift 3 vs 4 branching; added validation guard rejecting values other than 0 or 4.
Helm Template: Scanner & SCC Configuration
image/templates/helm/shared/templates/02-scanner-v4-01-security.yaml, image/templates/helm/stackrox-secured-cluster/internal/defaults/30-base-config.yaml.htpl, image/templates/helm/stackrox-secured-cluster/templates/_init.tpl.htpl
Removed conditional OpenShift 3 branches; now unconditionally apply SCC/RBAC resources and admission controller listenOnEvents when OpenShift is enabled; removed validation errors for OpenShift 3 incompatibilities.
Helm Template: Admission Controller
image/templates/helm/stackrox-secured-cluster/templates/admission-controller.yaml
Simplified SCC annotation gating from strict version 4 check to truthy check; unconditionally use admissionregistration.k8s.io/v1 API version; removed conditional gating of sideEffects and admissionReviewVersions for non-OpenShift 3 clusters.
Helm Template: Cluster Configuration
image/templates/helm/stackrox-secured-cluster/internal/cluster-config.yaml.tpl.htpl, image/templates/helm/stackrox-secured-cluster/internal/compatibility-translation.yaml, image/templates/helm/stackrox-secured-cluster/values.yaml.htpl
Simplified cluster type selection to always use OPENSHIFT4_CLUSTER when OpenShift is enabled; updated compatibility translation to check only for OPENSHIFT4_CLUSTER; removed conditional disabling of listenOnEvents for OpenShift 3.
Helm Template: Documentation
image/templates/helm/stackrox-secured-cluster/sensor-chart-upgrade.md.htpl
Updated upgrade documentation to reference OPENSHIFT4_CLUSTER instead of OPENSHIFT_CLUSTER.
Chart Embedding & Manifest Generation
image/embed_charts.go
Updated script asset selection to only match OPENSHIFT4_CLUSTER type; OpenShift non-4 types now fall through to invalid cluster type error path.
Central Services Helm Tests
pkg/helm/charts/tests/centralservices/testdata/helmtest/*.test.yaml
Updated server.availableSchemas from openshift-4.1.0 to openshift-4.12 across central.test.yaml, openshift-auth.test.yaml, scanner.test.yaml, scanner-v4.test.yaml; removed OpenShift 3 test scenarios from injected-cabundle-cm.test.yaml, openshift-autosense.test.yaml, openshift-monitoring.test.yaml; updated openshift-autosense.test.yaml to expect error for explicit env.openshift: 3.
Secured Cluster Services Helm Tests (Feature Flags)
pkg/helm/charts/tests/securedclusterservices/feature-flags/testdata/helmtest/admission-controller-config-disabled/admission-control.test.yaml, pkg/helm/charts/tests/securedclusterservices/feature-flags/testdata/helmtest/admission-controller-config/admission-control.test.yaml
Updated schema version to openshift-4.12; removed entire test cases for OpenShift 3.11.0 that validated feature incompatibilities.
Secured Cluster Services Helm Tests (Flavor)
pkg/helm/charts/tests/securedclusterservices/flavor/testdata/helmtest/*/...test.yaml
Updated all scanner image test configurations to use openshift-4.12 instead of openshift-4.1.0 across development, release, and product-variant flavors (opensource, rhacs, stackrox, override).
Secured Cluster Services Helm Tests (Core)
pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/admission-control.test.yaml, pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/audit-logs.test.yaml, pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/env.test.yaml, pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/injected-cabundle-cm.test.yaml, pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/legacy-settings.test.yaml, pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/openshift-monitoring.test.yaml, pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/scanner-slim.test.yaml, pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/scanner-v4.test.yaml
Updated schema versions from openshift-4.1.0 to openshift-4.12; removed extensive OpenShift 3 test scenarios covering auto-detection, monitoring, audit logs, and admission controller configurations; updated legacy-settings to remove OpenShift 3 detection validation tests.
Datastore Tests
central/cluster/datastore/datastore_impl_postgres_test.go
Removed OPENSHIFT_CLUSTER test case from "Audit logs" table in TestAddDefaults.
GraphQL & View Tests
central/clusters/zip/render_test.go, central/graphql/resolvers/cluster_vulnerabilities_postgres_test.go, central/graphql/resolvers/test_utils.go, central/views/platformcve/view_test.go
Updated render test to use OPENSHIFT4_CLUSTER; updated CVE test to derive cluster count dynamically; removed OPENSHIFT_CLUSTER cluster entries from test utilities; updated platformcve view test to use OpenShift 4 clusters exclusively with schema version openshift-4.12.
Telemetry
central/telemetry/centralclient/client.go
Added clarifying comment on OpenShift cluster-orchestrator selection explaining intentional retention of OPENSHIFT_CLUSTER behavior for compatibility.
Integration Tests
tests/roxctl/bats-tests/cluster/scanner-generate.bats, tests/roxctl/bats-tests/cluster/sensor-generate-bundle.bats
Removed OpenShift 3 success-path test; converted to failure-path validation asserting error message "only '4' is currently supported" when --openshift-version 3 is used.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

🚥 Pre-merge checks | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description consists entirely of placeholder template text ('change me!') with unchecked boxes; it provides no meaningful explanation of the changes, rationale, testing, or validation performed. Replace placeholder text with a detailed description of the OpenShift 3 removal changes, explain the rationale and impact, document testing/validation, and check appropriate documentation and testing checkboxes.
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title is vague and uses non-descriptive phrasing (e.g., 'Mc/rox 33465 openshift autosensing 6'), lacking clarity about the main change despite extensive modifications removing OpenShift 3 support. Revise the title to clearly summarize the primary change, e.g., 'Remove OpenShift 3 support across Helm charts, roxctl, and core components' or similar descriptive phrasing.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mc/ROX-33465-openshift-autosensing-6

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Trivy (0.69.3)

Failed to read Trivy output file: ENOENT: no such file or directory, open '/inmem/1269/nsjail-db70a2cc-09f0-4323-962d-88456cf54a56/merged/.trivy-output.json'


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

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

⚠️ Outside diff range comments (2)
roxctl/central/generate/k8s.go (1)

166-186: ⚠️ Potential issue | 🟡 Minor

Reject explicit --openshift-version=0 as well.

This still treats 0 as a valid version, so roxctl central generate openshift --openshift-version=0 succeeds even though Line 173 and Line 186 now advertise that only 4 is supported. The simplest fix is to default the flag to 4 and remove case 0, or otherwise track whether the flag was omitted versus explicitly set.

Suggested fix
 	var openshiftVersion int
 	c := k8sBasedOrchestrator(cliEnvironment, k8sConfig, "openshift", "Openshift", func() (storage.ClusterType, error) {
 		clusterType := storage.ClusterType_OPENSHIFT4_CLUSTER
 		switch openshiftVersion {
-		case 0:
 		case 4:
 		default:
 			return 0, errox.InvalidArgs.Newf("invalid OpenShift version %d, only '4' is currently supported", openshiftVersion)
 		}
 		return clusterType, nil
 	})
@@
-	flagWrap.IntVar(&openshiftVersion, "openshift-version", 0, "The OpenShift major version to deploy on (currently only 4 is supported).")
+	flagWrap.IntVar(&openshiftVersion, "openshift-version", 4, "The OpenShift major version to deploy on (currently only 4 is supported).")

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

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

In `@roxctl/central/generate/k8s.go` around lines 166 - 186, The OpenShift branch
treats 0 as a valid version; update the flag handling so an explicit
--openshift-version=0 is rejected: either change the IntVar default from 0 to 4
and remove the switch's case 0 in the k8sBasedOrchestrator closure, or add a
bool/marker to detect whether the flag was set and if not default to 4; then
ensure the switch in that closure only accepts case 4 and returns an InvalidArgs
error for 0 and any other values. Target symbols: the openshiftVersion variable,
the flagWrap.IntVar call that defines "--openshift-version", and the anonymous
closure passed into k8sBasedOrchestrator.
roxctl/sensor/generate/openshift.go (1)

22-29: ⚠️ Potential issue | 🟡 Minor

0 is still an accepted user value here.

This switch keeps case 0, so roxctl sensor generate openshift --openshift-version=0 still passes even though the command now documents/runtime-errors as OpenShift-4-only. Please make the flag default to 4 and drop case 0, or use a flag type that can distinguish “unset” from an explicit 0.

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

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

In `@roxctl/sensor/generate/openshift.go` around lines 22 - 29, The switch in
sensorGenerateOpenShiftCommand.ConstructOpenShift accepts 0 as a valid
openshiftVersion, letting a user pass --openshift-version=0; remove the "case 0"
branch and ensure the flag defaults to 4 (or change the flag to a nullable type
like *int or a custom flag that can distinguish unset vs explicit 0) so that
unset uses OpenShift 4 and explicit 0 is rejected; update validation in
ConstructOpenShift to only accept case 4 and return the existing InvalidArgs
error for other values, and ensure the openshiftVersion field is initialized to
4 when the flag is not provided.
🧹 Nitpick comments (2)
pkg/cluster/validation_test.go (1)

82-88: Test name may be misleading after validation change.

The test name says "enabled admission controller webhooks should fail" but the new error message "OpenShift 3.x is not supported anymore" indicates all OpenShift 3 clusters fail regardless of webhook settings. Consider renaming the test to reflect the broader rejection:

Suggested rename
-		"OpenShift3 cluster and enabled admission controller webhooks should fail": {
+		"OpenShift3 cluster should fail": {
			configureClusterFn: func(cluster *storage.Cluster) {
-				cluster.AdmissionControllerEvents = true
				cluster.Type = storage.ClusterType_OPENSHIFT_CLUSTER
			},
			expectedErrors: []string{"OpenShift 3.x is not supported anymore"},
		},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/cluster/validation_test.go` around lines 82 - 88, Rename the test case
key string "OpenShift3 cluster and enabled admission controller webhooks should
fail" to reflect that OpenShift 3 clusters are rejected regardless of webhook
settings (e.g., "OpenShift3 cluster should fail validation regardless of
admission controller webhooks"), leaving configureClusterFn and expectedErrors
unchanged; update only the test name in the test map where the
configureClusterFn and expectedErrors fields are defined so the test description
matches the new "OpenShift 3.x is not supported anymore" validation behavior.
pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/scanner-v4.test.yaml (1)

32-34: Consider removing the now-redundant nested test case.

The "on openshift 4" test case (lines 32-34) only sets env.openshift: 4 and inherits the parent's expectations. With OpenShift 3 removed, there's no longer a contrasting case—this nested test may be unnecessary unless you want to explicitly verify OpenShift 4 behavior differs from the default/Kubernetes path.

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

In
`@pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/scanner-v4.test.yaml`
around lines 32 - 34, Remove the redundant nested test case named "on openshift
4" that only sets env.openshift: 4 and inherits the parent's expectations;
delete the block with name: "on openshift 4" and its set: env.openshift: 4
entries from the test YAML (scanner-v4.test.yaml) so the redundant OpenShift
4-only scenario is no longer present.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@central/telemetry/centralclient/client.go`:
- Around line 117-120: The code currently sets orchestrator =
storage.ClusterType_OPENSHIFT_CLUSTER.String(), which labels all OpenShift
installs as the deprecated OpenShift 3 type; change the mapping so OpenShift 4
installs use storage.ClusterType_OPENSHIFT4_CLUSTER.String() instead (update the
assignment of the orchestrator variable in client.go where
storage.ClusterType_OPENSHIFT_CLUSTER is used), and if compatibility logic is
required preserve any conditional branch by adding a detection/flag to choose
OPENSHIFT4_CLUSTER for v4 clusters while keeping OPENSHIFT_CLUSTER only for
explicit legacy/OpenShift3 cases.

---

Outside diff comments:
In `@roxctl/central/generate/k8s.go`:
- Around line 166-186: The OpenShift branch treats 0 as a valid version; update
the flag handling so an explicit --openshift-version=0 is rejected: either
change the IntVar default from 0 to 4 and remove the switch's case 0 in the
k8sBasedOrchestrator closure, or add a bool/marker to detect whether the flag
was set and if not default to 4; then ensure the switch in that closure only
accepts case 4 and returns an InvalidArgs error for 0 and any other values.
Target symbols: the openshiftVersion variable, the flagWrap.IntVar call that
defines "--openshift-version", and the anonymous closure passed into
k8sBasedOrchestrator.

In `@roxctl/sensor/generate/openshift.go`:
- Around line 22-29: The switch in
sensorGenerateOpenShiftCommand.ConstructOpenShift accepts 0 as a valid
openshiftVersion, letting a user pass --openshift-version=0; remove the "case 0"
branch and ensure the flag defaults to 4 (or change the flag to a nullable type
like *int or a custom flag that can distinguish unset vs explicit 0) so that
unset uses OpenShift 4 and explicit 0 is rejected; update validation in
ConstructOpenShift to only accept case 4 and return the existing InvalidArgs
error for other values, and ensure the openshiftVersion field is initialized to
4 when the flag is not provided.

---

Nitpick comments:
In `@pkg/cluster/validation_test.go`:
- Around line 82-88: Rename the test case key string "OpenShift3 cluster and
enabled admission controller webhooks should fail" to reflect that OpenShift 3
clusters are rejected regardless of webhook settings (e.g., "OpenShift3 cluster
should fail validation regardless of admission controller webhooks"), leaving
configureClusterFn and expectedErrors unchanged; update only the test name in
the test map where the configureClusterFn and expectedErrors fields are defined
so the test description matches the new "OpenShift 3.x is not supported anymore"
validation behavior.

In
`@pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/scanner-v4.test.yaml`:
- Around line 32-34: Remove the redundant nested test case named "on openshift
4" that only sets env.openshift: 4 and inherits the parent's expectations;
delete the block with name: "on openshift 4" and its set: env.openshift: 4
entries from the test YAML (scanner-v4.test.yaml) so the redundant OpenShift
4-only scenario is no longer present.
🪄 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: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a8d61af-78c0-4368-846c-1149e462eff6

📥 Commits

Reviewing files that changed from the base of the PR and between 75d765a and ea80cab.

⛔ Files ignored due to path filters (2)
  • generated/storage/cluster.pb.go is excluded by !**/*.pb.go, !**/generated/**
  • proto/storage/proto.lock is excluded by !**/*.lock
📒 Files selected for processing (51)
  • CHANGELOG.md
  • central/cluster/datastore/datastore_impl_postgres_test.go
  • central/clusters/zip/render_test.go
  • central/graphql/resolvers/cluster_vulnerabilities_postgres_test.go
  • central/graphql/resolvers/test_utils.go
  • central/telemetry/centralclient/client.go
  • central/views/platformcve/view_test.go
  • image/embed_charts.go
  • image/templates/helm/shared/templates/02-scanner-v4-01-security.yaml
  • image/templates/helm/shared/templates/_openshift.tpl
  • image/templates/helm/stackrox-secured-cluster/internal/cluster-config.yaml.tpl.htpl
  • image/templates/helm/stackrox-secured-cluster/internal/compatibility-translation.yaml
  • image/templates/helm/stackrox-secured-cluster/internal/defaults/30-base-config.yaml.htpl
  • image/templates/helm/stackrox-secured-cluster/sensor-chart-upgrade.md.htpl
  • image/templates/helm/stackrox-secured-cluster/templates/_init.tpl.htpl
  • image/templates/helm/stackrox-secured-cluster/templates/admission-controller.yaml
  • image/templates/helm/stackrox-secured-cluster/values.yaml.htpl
  • pkg/cluster/validation.go
  • pkg/cluster/validation_test.go
  • pkg/helm/charts/tests/centralservices/testdata/helmtest/central.test.yaml
  • pkg/helm/charts/tests/centralservices/testdata/helmtest/injected-cabundle-cm.test.yaml
  • pkg/helm/charts/tests/centralservices/testdata/helmtest/openshift-auth.test.yaml
  • pkg/helm/charts/tests/centralservices/testdata/helmtest/openshift-autosense.test.yaml
  • pkg/helm/charts/tests/centralservices/testdata/helmtest/openshift-monitoring.test.yaml
  • pkg/helm/charts/tests/centralservices/testdata/helmtest/scanner-v4.test.yaml
  • pkg/helm/charts/tests/centralservices/testdata/helmtest/scanner.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/feature-flags/testdata/helmtest/admission-controller-config-disabled/admission-control.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/feature-flags/testdata/helmtest/admission-controller-config/admission-control.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/flavor/testdata/helmtest/development_build-non-release/development_build.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/flavor/testdata/helmtest/development_build-release/development_build.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/flavor/testdata/helmtest/opensource-non-release/opensource.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/flavor/testdata/helmtest/opensource-release/opensource.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/flavor/testdata/helmtest/override/override.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/flavor/testdata/helmtest/rhacs/rhacs.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/flavor/testdata/helmtest/stackrox/stackrox.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/admission-control.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/audit-logs.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/env.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/injected-cabundle-cm.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/legacy-settings.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/openshift-monitoring.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/scanner-slim.test.yaml
  • pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/scanner-v4.test.yaml
  • pkg/renderer/central_db_test.go
  • pkg/renderer/kubernetes_test.go
  • proto/storage/cluster.proto
  • roxctl/central/generate/generate_test.go
  • roxctl/central/generate/k8s.go
  • roxctl/sensor/generate/openshift.go
  • tests/roxctl/bats-tests/cluster/scanner-generate.bats
  • tests/roxctl/bats-tests/cluster/sensor-generate-bundle.bats
💤 Files with no reviewable changes (8)
  • central/graphql/resolvers/test_utils.go
  • image/templates/helm/stackrox-secured-cluster/values.yaml.htpl
  • pkg/helm/charts/tests/securedclusterservices/feature-flags/testdata/helmtest/admission-controller-config/admission-control.test.yaml
  • image/templates/helm/stackrox-secured-cluster/internal/defaults/30-base-config.yaml.htpl
  • image/templates/helm/stackrox-secured-cluster/templates/_init.tpl.htpl
  • roxctl/central/generate/generate_test.go
  • central/cluster/datastore/datastore_impl_postgres_test.go
  • tests/roxctl/bats-tests/cluster/scanner-generate.bats

Comment on lines +117 to 120
// Should probably be changed to OPENSHIFT4_CLUSTER, but since this is production code, keeping it for now
// due to compatibility concerns.
orchestrator = storage.ClusterType_OPENSHIFT_CLUSTER.String()
}
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.

⚠️ Potential issue | 🟠 Major

Telemetry still reports the deprecated OpenShift 3 platform label.

At Line 119, all OpenShift deployments are still tagged as OPENSHIFT_CLUSTER, which now represents deprecated/unsupported OpenShift 3 semantics. This will misclassify OpenShift 4 telemetry.

Suggested fix
  if env.Openshift.BooleanSetting() {
-     // Should probably be changed to OPENSHIFT4_CLUSTER, but since this is production code, keeping it for now
-     // due to compatibility concerns.
-     orchestrator = storage.ClusterType_OPENSHIFT_CLUSTER.String()
+     orchestrator = storage.ClusterType_OPENSHIFT4_CLUSTER.String()
  }
📝 Committable suggestion

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

Suggested change
// Should probably be changed to OPENSHIFT4_CLUSTER, but since this is production code, keeping it for now
// due to compatibility concerns.
orchestrator = storage.ClusterType_OPENSHIFT_CLUSTER.String()
}
if env.Openshift.BooleanSetting() {
orchestrator = storage.ClusterType_OPENSHIFT4_CLUSTER.String()
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@central/telemetry/centralclient/client.go` around lines 117 - 120, The code
currently sets orchestrator = storage.ClusterType_OPENSHIFT_CLUSTER.String(),
which labels all OpenShift installs as the deprecated OpenShift 3 type; change
the mapping so OpenShift 4 installs use
storage.ClusterType_OPENSHIFT4_CLUSTER.String() instead (update the assignment
of the orchestrator variable in client.go where
storage.ClusterType_OPENSHIFT_CLUSTER is used), and if compatibility logic is
required preserve any conditional branch by adding a detection/flag to choose
OPENSHIFT4_CLUSTER for v4 clusters while keeping OPENSHIFT_CLUSTER only for
explicit legacy/OpenShift3 cases.

Comment on lines 7 to 11
{{- if not ._rox.env.openshift }}
type: KUBERNETES_CLUSTER
{{- else }}
type: {{ if eq (int ._rox.env.openshift) 4 -}} OPENSHIFT4_CLUSTER {{- else -}} OPENSHIFT_CLUSTER {{ end }}
type: OPENSHIFT4_CLUSTER
{{- end }}
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.

⚠️ Potential issue | 🟠 Major

Do not silently coerce deprecated OpenShift 3 input to OpenShift 4.

At Line 10, any truthy ._rox.env.openshift becomes OPENSHIFT4_CLUSTER. That lets env.openshift: 3 bypass the OpenShift 3 rejection (pkg/cluster/validation.go, Lines 64-66), which weakens the deprecation enforcement path.

Proposed fix
     {{- if not ._rox.env.openshift }}
     type: KUBERNETES_CLUSTER
-    {{- else }}
+    {{- else if eq (._rox.env.openshift | int) 3 }}
+    {{- fail "OpenShift 3.x is not supported anymore" }}
+    {{- else }}
     type: OPENSHIFT4_CLUSTER
     {{- end }}

Please also add one helmtest case asserting env.openshift: 3 errors, to prevent regressions.

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

📝 Committable suggestion

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

Suggested change
{{- if not ._rox.env.openshift }}
type: KUBERNETES_CLUSTER
{{- else }}
type: {{ if eq (int ._rox.env.openshift) 4 -}} OPENSHIFT4_CLUSTER {{- else -}} OPENSHIFT_CLUSTER {{ end }}
type: OPENSHIFT4_CLUSTER
{{- end }}
{{- if not ._rox.env.openshift }}
type: KUBERNETES_CLUSTER
{{- else if eq (._rox.env.openshift | int) 3 }}
{{- fail "OpenShift 3.x is not supported anymore" }}
{{- else }}
type: OPENSHIFT4_CLUSTER
{{- end }}

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

🚀 Build Images Ready

Images are ready for commit ea80cab. To use with deploy scripts:

export MAIN_IMAGE_TAG=4.11.x-655-gea80cab06f

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.56%. Comparing base (4a13459) to head (ea80cab).
⚠️ Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
central/telemetry/centralclient/client.go 0.00% 2 Missing ⚠️
roxctl/central/generate/k8s.go 0.00% 2 Missing ⚠️
image/embed_charts.go 0.00% 1 Missing ⚠️
roxctl/sensor/generate/openshift.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19968      +/-   ##
==========================================
- Coverage   49.56%   49.56%   -0.01%     
==========================================
  Files        2764     2764              
  Lines      208357   208406      +49     
==========================================
+ Hits       103269   103293      +24     
- Misses      97436    97457      +21     
- Partials     7652     7656       +4     
Flag Coverage Δ
go-unit-tests 49.56% <25.00%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 13, 2026

@mclasmeier: 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/ocp-4-12-qa-e2e-tests ea80cab link false /test ocp-4-12-qa-e2e-tests
ci/prow/ocp-4-21-qa-e2e-tests ea80cab link false /test ocp-4-21-qa-e2e-tests

Full PR test history. Your PR dashboard.

Details

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant