Skip to content

RFE-9580: Add scanRequests field to ScanSetting CRD for configurable resource requests - #1314

Open
Chauguleshubhada wants to merge 1 commit into
ComplianceAsCode:masterfrom
Chauguleshubhada:feature/scan-requests-configuration
Open

RFE-9580: Add scanRequests field to ScanSetting CRD for configurable resource requests#1314
Chauguleshubhada wants to merge 1 commit into
ComplianceAsCode:masterfrom
Chauguleshubhada:feature/scan-requests-configuration

Conversation

@Chauguleshubhada

@Chauguleshubhada Chauguleshubhada commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • Adds a new scanRequests field to ComplianceScanSettings struct, allowing users to configure resource requests for scan pods via the ScanSetting CRD
  • Functions identically to the existing scanLimits but applies to container resource requests rather than limits
  • Enables cluster admins to right-size scan workloads for quota-managed or resource-constrained clusters

Motivation

Currently, only resource limits can be configured via scanLimits. Resource requests are hardcoded (50Mi/10m for scanner, 20Mi/10m for api-resource-collector). Customers need to configure requests to ensure proper pod scheduling across all cluster nodes.

Resolves: RFE-9580

Changes

Category Files Description
API Type compliancescan_types.go Added ScanRequests field to ComplianceScanSettings
DeepCopy zz_generated.deepcopy.go Added deep copy logic for the new map field
Controller scan.go Added scanRequests() helper; applied to all scanner containers
CRD Manifests 9 YAML files Added scanRequests schema to ScanSetting, ComplianceScan, ComplianceSuite CRDs
E2E Tests framework/common.go, scan-config/main_test.go Added CheckPodRequest helper and TestScannerAndAPICollectorRequestsConfigurable

Usage Example

apiVersion: compliance.openshift.io/v1alpha1
kind: ScanSetting
metadata:
  name: custom-resource-setting
spec:
  scanRequests:
    memory: "128Mi"
    cpu: "50m"
  scanLimits:
    memory: "1Gi"
    cpu: "200m"
  roles:
    - master
    - worker

Test Plan

  • go build ./... compiles cleanly
  • make manifests generate regenerates CRDs matching committed YAML
  • E2E test TestScannerAndAPICollectorRequestsConfigurable passes
  • ScanSetting with scanRequests propagates correctly to scanner pod specs
  • Default behavior (no scanRequests) is unchanged (backward compatible)
  • Partial override (only memory or only CPU) works correctly

…equests

This adds a new `scanRequests` field to the ComplianceScanSettings struct,
allowing users to configure resource requests for scan pods via the
ScanSetting CRD. The field functions identically to the existing
`scanLimits` but applies to container resource requests rather than limits.

By default, the operator uses sensible defaults (50Mi memory, 10m CPU for
the scanner container and 20Mi memory, 10m CPU for the api-resource-collector
container). The new field allows overriding these defaults.

Changes:
- Add ScanRequests field to ComplianceScanSettings (compliancescan_types.go)
- Add scanRequests() helper function mirroring scanLimits() (scan.go)
- Apply scanRequests to all scanner containers (OpenSCAP, CEL, collector)
- Update deepcopy generated code (zz_generated.deepcopy.go)
- Update all CRD manifests (config/crd, config/helm, bundle)
- Add CheckPodRequest e2e test helper (framework/common.go)
- Add TestScannerAndAPICollectorRequestsConfigurable e2e test

Resolves: RFE-9580
Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-ci
openshift-ci Bot requested review from Vincent056 and vickeybrown July 29, 2026 16:31
@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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

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

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown

Hi @Chauguleshubhada. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@Chauguleshubhada Chauguleshubhada changed the title Add scanRequests field to ScanSetting CRD for configurable resource requests RFE-9580: Add scanRequests field to ScanSetting CRD for configurable resource requests Jul 29, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Collaborator

@Chauguleshubhada: This pull request references RFE-9580 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the feature request to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Adds a new scanRequests field to ComplianceScanSettings struct, allowing users to configure resource requests for scan pods via the ScanSetting CRD
  • Functions identically to the existing scanLimits but applies to container resource requests rather than limits
  • Enables cluster admins to right-size scan workloads for quota-managed or resource-constrained clusters

Motivation

Currently, only resource limits can be configured via scanLimits. Resource requests are hardcoded (50Mi/10m for scanner, 20Mi/10m for api-resource-collector). Customers need to configure requests to ensure proper pod scheduling across all cluster nodes.

Resolves: RFE-9580

Changes

Category Files Description
API Type compliancescan_types.go Added ScanRequests field to ComplianceScanSettings
DeepCopy zz_generated.deepcopy.go Added deep copy logic for the new map field
Controller scan.go Added scanRequests() helper; applied to all scanner containers
CRD Manifests 9 YAML files Added scanRequests schema to ScanSetting, ComplianceScan, ComplianceSuite CRDs
E2E Tests framework/common.go, scan-config/main_test.go Added CheckPodRequest helper and TestScannerAndAPICollectorRequestsConfigurable

Usage Example

apiVersion: compliance.openshift.io/v1alpha1
kind: ScanSetting
metadata:
 name: custom-resource-setting
spec:
 scanRequests:
   memory: "128Mi"
   cpu: "50m"
 scanLimits:
   memory: "1Gi"
   cpu: "200m"
 roles:
   - master
   - worker

Test Plan

  • go build ./... compiles cleanly
  • make manifests generate regenerates CRDs matching committed YAML
  • E2E test TestScannerAndAPICollectorRequestsConfigurable passes
  • ScanSetting with scanRequests propagates correctly to scanner pod specs
  • Default behavior (no scanRequests) is unchanged (backward compatible)
  • Partial override (only memory or only CPU) works correctly

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants