Skip to content

CNF-25115: Include supported values in validation error messages#440

Open
sebrandon1 wants to merge 1 commit into
openshift:masterfrom
sebrandon1:improve-validation-error-messages
Open

CNF-25115: Include supported values in validation error messages#440
sebrandon1 wants to merge 1 commit into
openshift:masterfrom
sebrandon1:improve-validation-error-messages

Conversation

@sebrandon1

@sebrandon1 sebrandon1 commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

  • When users pass unsupported args, env vars, labels, or resources to the CertManager CR, the validation error now lists the supported values so they can self-correct without consulting documentation
  • Updated all 4 validation functions in deployment_overrides_validation.go

Before

validation failed due to unsupported arg "--foo"="bar"

After

validation failed due to unsupported arg "--foo"="bar"; supported args are: --acme-http01-solver-nameservers, --dns01-recursive-nameservers, --v, -V, ...

Test plan

  • go test ./pkg/controller/certmanager/... passes (all validation tests updated)
  • make lint clean (no new issues)
  • CI e2e tests pass

Summary by CodeRabbit

  • Improvements
    • Enhanced validation error messages to include the full set of supported values when invalid container arguments, environment variables, pod label keys, or resource request/limit configurations are provided.
    • Updated related tests to match the new, more informative error output.

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

Copy link
Copy Markdown

@sebrandon1: This pull request explicitly references no jira issue.

Details

In response to this:

Summary

  • When users pass unsupported args, env vars, labels, or resources to the CertManager CR, the validation error now lists the supported values so they can self-correct without consulting documentation
  • Updated all 4 validation functions in deployment_overrides_validation.go

Before

validation failed due to unsupported arg "--foo"="bar"

After

validation failed due to unsupported arg "--foo"="bar"; supported args are: --acme-http01-solver-nameservers, --dns01-recursive-nameservers, --v, -V, ...

Test plan

  • go test ./pkg/controller/certmanager/... passes (all validation tests updated)
  • make lint clean (no new issues)
  • CI e2e tests pass

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 16, 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: f39be920-b96e-4dfd-bfc2-7a5653867965

📥 Commits

Reviewing files that changed from the base of the PR and between 0d543d2 and c58c31c.

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

Walkthrough

Validation errors now append supported-value lists for unsupported container args, env vars, pod labels, and resources. Related hook tests expect the expanded error strings.

Changes

Override validation feedback

Layer / File(s) Summary
Supported values in validation errors
pkg/controller/certmanager/deployment_overrides_validation.go
Adds comma-joined supported-value lists to unsupported argument, environment variable, label, and resource errors.
Updated validation expectations
pkg/controller/certmanager/deployment_overrides_validation_test.go
Updates controller, webhook, and cainjector unsupported-argument expectations, including restricted --v, -V cases.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Suggested reviewers: bharath-b-rh, mytreya-rh

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 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 supported values to validation error messages.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
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 The changed test file uses static tc.name strings and t.Run names; no dynamic data, generated IDs, dates, or runtime values appear in titles.
Test Structure And Quality ✅ Passed PASS: These are table-driven unit tests, not Ginkgo; setup uses t.Cleanup and helper timeouts, and there are no cluster resources or indefinite waits.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the PR only updates certmanager unit validation code/tests and uses no MicroShift-unsupported APIs or features.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Only unit validation code and Go testing tests changed; no new Ginkgo/e2e specs or multi-node/SNO assumptions were added.
Topology-Aware Scheduling Compatibility ✅ Passed The PR only changes validation error text/tests in deployment_overrides_validation.go; no new pod affinity, replicas, node selectors, or topology-aware scheduling constraints were added.
Ote Binary Stdout Contract ✅ Passed The PR only changes validation error strings in a library file; no main/init/suite stdout writes were added in the touched code.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR only changes certmanager validation code and standard Go unit tests; no new Ginkgo e2e tests or network-dependent assumptions were added.
No-Weak-Crypto ✅ Passed Only validation error strings/imports changed; no crypto primitives, custom crypto, or secret/token comparisons were added.
Container-Privileges ✅ Passed Only validation error text and tests changed; no manifests or privilege-related fields (privileged, hostPID, root, etc.) were added.
No-Sensitive-Data-In-Logs ✅ Passed The patch only changes returned validation errors; the touched file adds no logging calls/imports, so no new sensitive-data logging is introduced.
✨ 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 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sebrandon1
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

@sebrandon1 sebrandon1 changed the title NO-JIRA: Include supported values in validation error messages CNF-25115: Include supported values in validation error messages Jun 16, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 16, 2026

Copy link
Copy Markdown

@sebrandon1: This pull request references CNF-25115 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:

Summary

  • When users pass unsupported args, env vars, labels, or resources to the CertManager CR, the validation error now lists the supported values so they can self-correct without consulting documentation
  • Updated all 4 validation functions in deployment_overrides_validation.go

Before

validation failed due to unsupported arg "--foo"="bar"

After

validation failed due to unsupported arg "--foo"="bar"; supported args are: --acme-http01-solver-nameservers, --dns01-recursive-nameservers, --v, -V, ...

Test plan

  • go test ./pkg/controller/certmanager/... passes (all validation tests updated)
  • make lint clean (no new issues)
  • CI e2e tests pass

Summary by CodeRabbit

  • Improvements
  • Validation error messages now include the complete list of supported values when invalid container arguments, environment variables, pod labels, or resource configurations are provided, making it easier to identify valid options during configuration.

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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 18, 2026
@sebrandon1 sebrandon1 force-pushed the improve-validation-error-messages branch from 6d0d9e9 to 0d543d2 Compare June 24, 2026 19:51
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 24, 2026
@sebrandon1 sebrandon1 force-pushed the improve-validation-error-messages branch from 0d543d2 to 7739a23 Compare July 6, 2026 16:17
@sebrandon1

Copy link
Copy Markdown
Member Author

/retest

When users pass unsupported args, env vars, labels, or resources to
the CertManager CR, the error now lists the supported values so they
can self-correct without consulting documentation.
@sebrandon1 sebrandon1 force-pushed the improve-validation-error-messages branch from 7739a23 to c58c31c Compare July 13, 2026 17:58
@openshift-ci

openshift-ci Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@sebrandon1: 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/e2e-operator-tech-preview c58c31c link false /test e2e-operator-tech-preview
ci/prow/e2e-operator c58c31c link true /test e2e-operator
ci/prow/unit c58c31c link true /test unit

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

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.

2 participants