Skip to content

CM-1033: Add performance tuning parameters to the supported args whitelist#439

Open
chiragkyal wants to merge 1 commit into
openshift:masterfrom
chiragkyal:perf-config
Open

CM-1033: Add performance tuning parameters to the supported args whitelist#439
chiragkyal wants to merge 1 commit into
openshift:masterfrom
chiragkyal:perf-config

Conversation

@chiragkyal

@chiragkyal chiragkyal commented Jun 15, 2026

Copy link
Copy Markdown
Member

Description

Adds --concurrent-workers, --kube-api-qps, --kube-api-burst, and --max-concurrent-challenges to the cert-manager controller's supported overrideArgs whitelist, enabling users to tune cert-manager performance via the CertManager CR without relying on unsupportedConfigOverrides.

Changes

  • Add 4 performance-tuning flag constants to the controller args whitelist
  • Add validateBurstQPS() that checks burst >= qps when both are specified
  • Unit tests: acceptance of new flags + rejection when burst < qps
  • E2E tests: valid flags propagate to deployment + burst < qps causes Degraded

Summary by CodeRabbit

  • New Features
    • Added validation for controller performance settings, including kube API QPS and burst parameters, ensuring burst is greater than or equal to QPS.
  • Bug Fixes
    • Prevents invalid controller performance configurations from being accepted, avoiding misconfigured controller deployments.
  • Tests
    • Expanded unit and e2e coverage for controller override argument validation, including equality and negative cases for burst vs. QPS.

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

openshift-ci-robot commented Jun 15, 2026

Copy link
Copy Markdown

@chiragkyal: This pull request references CM-1033 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 story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

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 15, 2026

Copy link
Copy Markdown

Walkthrough

Adds four flag-name constants for controller performance tuning (--concurrent-workers, --kube-api-qps, --kube-api-burst, --max-concurrent-challenges) to the cert-manager controller override allowlist and introduces a validateBurstQPS helper that rejects configurations where --kube-api-burst is numerically less than --kube-api-qps. Unit and e2e tests cover both the valid acceptance path and the degraded-operator rejection path.

Changes

Burst/QPS Validation for Controller Override Args

Layer / File(s) Summary
Constants and allowlist refactoring
pkg/controller/certmanager/deployment_overrides_validation.go
Adds strconv import and four new flag-name constants; refactors the controller argument allowlist to use the new constants instead of inline strings.
Validation wiring and implementation
pkg/controller/certmanager/deployment_overrides_validation.go
Extends the controller override-arg validation flow to call validateBurstQPS after supported-arg validation; implements validateBurstQPS to parse both --kube-api-qps and --kube-api-burst as floats and return an error when burst < qps.
Unit test coverage
pkg/controller/certmanager/deployment_overrides_validation_test.go
Extends TestWithContainerArgsValidateHook with test cases that accept the new performance-tuning flags, a case where burst equals qps, and a negative case where burst is less than qps expecting the validation error.
E2e test coverage
test/e2e/overrides_test.go
Extends valid controller override args list with the new flags; adds a negative subtest verifying operator degradation and non-application of invalid args when kube-api-burst is less than kube-api-qps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 12 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ⚠️ Warning E2E test assertions lack meaningful messages (lines 162-177). BeforeEach and other tests use messages like "Operator is expected to be healthy"; new test has 3 bare Expect(err).NotTo(HaveOccurred()... Add meaningful assertion messages to the 3 Expect() calls in the new e2e test to help diagnose failures, e.g., Expect(err).NotTo(HaveOccurred(), "failed to add invalid burst < qps args")
Microshift Test Compatibility ⚠️ Warning New e2e test "When adding kube-api-burst less than kube-api-qps" uses the CertManager API (operator.openshift.io/v1alpha1), which is not available on MicroShift, and lacks MicroShift protection mec... Add [apigroup:operator.openshift.io] tag to the test, or add [Skipped:MicroShift] label, or guard with exutil.IsMicroShiftCluster() check with g.Skip().
✅ Passed checks (12 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding performance tuning parameters to the supported arguments whitelist for cert-manager controller.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed All test names in the PR are stable and deterministic. The unit tests in deployment_overrides_validation_test.go use hardcoded literal strings ("controller accepts performance tuning flags", "contr...
Single Node Openshift (Sno) Test Compatibility ✅ Passed The new e2e test "When adding kube-api-burst less than kube-api-qps" tests configuration validation of QPS/burst arguments and has no multi-node assumptions. It validates that invalid configuration...
Topology-Aware Scheduling Compatibility ✅ Passed PR only adds argument validation for performance tuning flags (QPS, burst, workers); no deployment manifests, scheduling constraints, node selectors, affinity rules, or topology assumptions are int...
Ote Binary Stdout Contract ✅ Passed Modified files are test and non-main package code with no process-level functions, init(), TestMain(), or direct stdout writes that would violate OTE binary stdout contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The new e2e test case "When adding kube-api-burst less than kube-api-qps" (lines 156-175 in test/e2e/overrides_test.go) contains no IPv4 assumptions or external connectivity requirements. It uses o...
No-Weak-Crypto ✅ Passed Pull request contains no cryptographic algorithms, custom crypto implementations, or non-constant-time secret comparisons; it only adds performance tuning parameter validation.
Container-Privileges ✅ Passed PR contains only Go source code changes for validation logic. No Kubernetes manifests with container security configurations are modified, and no privileged settings, capabilities, or insecure acce...
No-Sensitive-Data-In-Logs ✅ Passed No sensitive data logging found. Error messages log only numeric performance values (qps/burst) and non-sensitive configuration parameter names/values.

✏️ 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 added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 15, 2026
@openshift-ci openshift-ci Bot requested review from TrilokGeer and swghosh June 15, 2026 19:14
@openshift-ci

openshift-ci Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chiragkyal
Once this PR has been reviewed and has the lgtm label, please assign swghosh 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

Add --concurrent-workers, --kube-api-qps, --kube-api-burst, and
--max-concurrent-challenges to the controller's supported overrideArgs,
allowing to tune cert-manager throughput via the CertManager CR.

Signed-off-by: chiragkyal <ckyal@redhat.com>
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 15, 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

🤖 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/controller/certmanager/deployment_overrides_validation.go`:
- Around line 146-148: The validateBurstQPS function silently ignores parsing
errors by returning nil when errQ or errB are not nil, which allows malformed
numeric inputs to bypass validation. Instead of returning nil when either error
is non-nil, the function should return an error describing what failed to parse,
so that invalid QPS or burst values are properly rejected rather than silently
accepted. This ensures that parsing failures are not ignored and callers can
detect when the values are invalid.
🪄 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: 40911c5e-5f7a-4b04-afff-b02d6dba7f1d

📥 Commits

Reviewing files that changed from the base of the PR and between 514b381 and d8eba57.

📒 Files selected for processing (3)
  • pkg/controller/certmanager/deployment_overrides_validation.go
  • pkg/controller/certmanager/deployment_overrides_validation_test.go
  • test/e2e/overrides_test.go

Comment on lines +146 to +148
if errQ != nil || errB != nil {
return nil
}

@coderabbitai coderabbitai Bot Jun 15, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Do not silently accept unparsable kube-api QPS/burst values.

validateBurstQPS currently returns nil when parsing fails, so malformed numeric inputs bypass validation and can still be applied.

Suggested fix
 	qps, errQ := strconv.ParseFloat(qpsStr, 64)
 	burst, errB := strconv.ParseFloat(burstStr, 64)
-	if errQ != nil || errB != nil {
-		return nil
-	}
+	if errQ != nil {
+		return fmt.Errorf("validation failed: %s must be numeric, got %q: %w", argKubeAPIQPS, qpsStr, errQ)
+	}
+	if errB != nil {
+		return fmt.Errorf("validation failed: %s must be numeric, got %q: %w", argKubeAPIBurst, burstStr, errB)
+	}

As per coding guidelines, Go security (prodsec-skills): “Never ignore error returns”.

📝 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 errQ != nil || errB != nil {
return nil
}
if errQ != nil {
return fmt.Errorf("validation failed: %s must be numeric, got %q: %w", argKubeAPIQPS, qpsStr, errQ)
}
if errB != nil {
return fmt.Errorf("validation failed: %s must be numeric, got %q: %w", argKubeAPIBurst, burstStr, errB)
}
🤖 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/controller/certmanager/deployment_overrides_validation.go` around lines
146 - 148, The validateBurstQPS function silently ignores parsing errors by
returning nil when errQ or errB are not nil, which allows malformed numeric
inputs to bypass validation. Instead of returning nil when either error is
non-nil, the function should return an error describing what failed to parse, so
that invalid QPS or burst values are properly rejected rather than silently
accepted. This ensures that parsing failures are not ignored and callers can
detect when the values are invalid.

Source: Coding guidelines

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.

@chiragkyal I agree with the suggestion.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

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

♻️ Duplicate comments (1)
pkg/controller/certmanager/deployment_overrides_validation.go (1)

147-149: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Do not silently accept unparsable kube-api QPS/burst values.

validateBurstQPS currently returns nil when parsing fails, so malformed numeric inputs bypass validation and can still be applied. As per coding guidelines, Go security (prodsec-skills): "Never ignore error returns".

🐛 Proposed fix
 	qps, errQ := strconv.ParseFloat(qpsStr, 64)
 	burst, errB := strconv.ParseFloat(burstStr, 64)
-	if errQ != nil || errB != nil {
-		return nil
-	}
+	if errQ != nil {
+		return fmt.Errorf("validation failed: %s must be numeric, got %q: %w", argKubeAPIQPS, qpsStr, errQ)
+	}
+	if errB != nil {
+		return fmt.Errorf("validation failed: %s must be numeric, got %q: %w", argKubeAPIBurst, burstStr, errB)
+	}
🤖 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/controller/certmanager/deployment_overrides_validation.go` around lines
147 - 149, The validateBurstQPS function silently accepts unparsable QPS/burst
values by returning nil when parsing errors occur. When errQ or errB are not nil
(indicating parsing failures for QPS or burst values), the current code returns
nil instead of propagating the error. Fix this by returning an error when either
errQ or errB is not nil, ensuring that malformed numeric inputs are properly
rejected during validation rather than being silently accepted.

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.

Duplicate comments:
In `@pkg/controller/certmanager/deployment_overrides_validation.go`:
- Around line 147-149: The validateBurstQPS function silently accepts unparsable
QPS/burst values by returning nil when parsing errors occur. When errQ or errB
are not nil (indicating parsing failures for QPS or burst values), the current
code returns nil instead of propagating the error. Fix this by returning an
error when either errQ or errB is not nil, ensuring that malformed numeric
inputs are properly rejected during validation rather than being silently
accepted.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: cc8a0c42-90b9-41de-9c77-e269dce0d78b

📥 Commits

Reviewing files that changed from the base of the PR and between d8eba57 and 722986c.

📒 Files selected for processing (3)
  • pkg/controller/certmanager/deployment_overrides_validation.go
  • pkg/controller/certmanager/deployment_overrides_validation_test.go
  • test/e2e/overrides_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/controller/certmanager/deployment_overrides_validation_test.go
  • test/e2e/overrides_test.go


// validateBurstQPS ensures that if both --kube-api-burst and --kube-api-qps are
// specified, burst is not less than qps (cert-manager crashes if burst < qps).
func validateBurstQPS(argMap map[string]string) error {

@chiragkyal chiragkyal Jun 15, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Still good to have, I think.

@chiragkyal

Copy link
Copy Markdown
Member Author

/cc @bharath-b-rh @mytreya-rh

@openshift-ci

openshift-ci Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

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

@bharath-b-rh bharath-b-rh 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.

LGTM, except for few suggestions.

)

const (
argConcurrentWorkers = "--concurrent-workers"

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.

Needs gofmt fix here.

Comment on lines +146 to +148
if errQ != nil || errB != nil {
return nil
}

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.

@chiragkyal I agree with the suggestion.


const (
argConcurrentWorkers = "--concurrent-workers"
argKubeAPIQPS = "--kube-api-qps"

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.

Are these constants necessary? They are not made use of in uts or e2es.

Comment on lines +77 to 84
argConcurrentWorkers,
// Maximum queries-per-second to the Kubernetes API server. (default 20)
argKubeAPIQPS,
// Maximum burst queries-per-second to the Kubernetes API server. Must be >= kube-api-qps. (default 50)
argKubeAPIBurst,
// Maximum number of challenges that can be scheduled as 'processing' at once. (default 60)
argMaxConcurrentChallenges,
}

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: It would be good to have some sanity checks for the args. It's not there for others, but good to start from these. The operator doesn't monitor the pod status once after deployment resource creation, and if any of these args have invalid values and causes CrashLoopBackOff error stays in that state until someone notices and fixes it. There is liveness probe in-place, so no downtime is expected though.


// validateBurstQPS ensures that if both --kube-api-burst and --kube-api-qps are
// specified, burst is not less than qps (cert-manager crashes if burst < qps).
func validateBurstQPS(argMap map[string]string) error {

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.

Still good to have, I think.

})
})

Context("When adding kube-api-burst less than kube-api-qps", func() {

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.

Could we add a happy path test case too?

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants