Add additive extraArgs support for Velero server and node-agent#2230
Add additive extraArgs support for Velero server and node-agent#2230Shreyashxredhat wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughThis PR adds ChangesExtraArgs feature for Velero and Node-Agent
🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (14 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Hi @Shreyashxredhat. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Shreyashxredhat The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@api/v1alpha1/dataprotectionapplication_types.go`:
- Around line 373-377: Update the comment for the ExtraArgs field(s) to
explicitly document the full precedence order including the unsupported-args
annotation as the final override; specifically, in
dataprotectionapplication_types.go update the comment above the ExtraArgs
map[string]string `json:"extraArgs,omitempty"` (and the similar comment at the
other occurrence) to state that ExtraArgs are applied additively on top of
operator defaults and Args, and then any unsupported-args annotation on the
resource is applied last and overrides conflicting keys.
In `@config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml`:
- Around line 297-304: The extraArgs map currently allows arbitrary keys; add a
propertyNames schema to constrain map keys to valid flag names (no leading "--",
no whitespace or empty strings). Update the extraArgs schema (identifier:
extraArgs in the YAML) to include a propertyNames block with a regex pattern
(e.g. ^[A-Za-z0-9][A-Za-z0-9_.-]*$ or other agreed flag-name pattern) and
optionally minLength: 1 so invalid keys like "--log-level", empty strings or
strings with spaces are rejected at the CRD boundary.
🪄 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: 891c2791-4260-4690-bb85-edc1fc97c193
⛔ Files ignored due to path filters (1)
api/v1alpha1/zz_generated.deepcopy.gois excluded by!**/zz_generated*
📒 Files selected for processing (9)
api/v1alpha1/dataprotectionapplication_types.gobundle/manifests/oadp.openshift.io_dataprotectionapplications.yamlconfig/crd/bases/oadp.openshift.io_dataprotectionapplications.yamlinternal/controller/nodeagent.gointernal/controller/nodeagent_test.gointernal/controller/velero.gointernal/controller/velero_test.gopkg/common/common.gopkg/common/common_test.go
…cument precedence - Remove fmt.Printf/cmp.Diff debug logging that could expose sensitive ExtraArgs values; replace with structured log.Info - Add normalizeExtraArgKeys() to strip leading dashes and skip empty/whitespace keys at runtime - Document full precedence order in API docs and CRD descriptions: operator defaults / Args < ExtraArgs < unsupported-args annotation - Add test cases for key normalization behavior Co-authored-by: Cursor <cursoragent@cursor.com>
Why the changes were made
Closes #2209
Currently, configuring additional Velero server or node-agent arguments requires using full argument overrides, which forces users to replicate the operator-generated defaults. This approach is difficult to maintain and can lead to configuration drift when defaults change in future releases.
This change introduces a new
extraArgsfield for bothVeleroConfigandNodeAgentConfig. The field allows users to add or override specific command-line arguments while preserving the operator-managed defaults.Key behaviors:
extraArgsare merged with the operator-generated arguments.extraArgs.--flag=valueand--flag valueargument formats.Precedence order:
How to test the changes made
Deploy the operator with this change.
Create a DPA with
extraArgsconfigured:Verify that specifying an existing flag in
extraArgsoverrides the operator-generated value.Run the test suite:
make testExpected results:
extraArgs.extraArgs.Summary by CodeRabbit