Skip to content

fix: preserve split-form (--flag value) user-managed broker-router co…#1137

Draft
rogueslasher wants to merge 1 commit into
Kuadrant:mainfrom
rogueslasher:fix/broker-router-split-form-flags
Draft

fix: preserve split-form (--flag value) user-managed broker-router co…#1137
rogueslasher wants to merge 1 commit into
Kuadrant:mainfrom
rogueslasher:fix/broker-router-split-form-flags

Conversation

@rogueslasher

@rogueslasher rogueslasher commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the broker-router command reconciliation logic to correctly handle user-managedflags written in split form (--flag value) instead of only --flag=value.Previously mergeCommand dropped the value token of such flags on reconcile, and
filterManagedFlags could report false drift for the orphaned value token.

Details

internal/controller/broker_router.go:

  • Added commandEntry / parseCommandEntries to split a container command into logical entries (binary name, --flag=value, --flag value pair, or bare --flag).
  • Rewrote filterManagedFlags and mergeCommand to operate on these logical entries instead of raw argv tokens, so split-form flags and their valuesare preserved/compared as a unit.
  • Switched managed-flag matching from strings.HasPrefix to an exact matchon the flag name (extracted before =), avoiding accidental prefixcollisions. All existing managed flags are not prefixes of one another, soexisting behavior is unchanged.

internal/controller/deployment_test.go:

  • TestFilterManagedFlags: added cases for a user split-form flag (stripped)and a managed split-form flag (kept as a unit).
  • TestMergeCommand: added cases for preserving user split-form flags, mixedmanaged =-form + user split-form flags, and a managed split-form flagbeing replaced by the desired =-form value.
  • TestDeploymentNeedsUpdate: added a no-op case for a user-managedsplit-form flag (previously reported false drift).

Summary by CodeRabbit

  • Refactor

    • Improved command-parsing to treat command tokens as flag entries, correctly handling both --flag=value and split --flag value forms; preserves binary name and groups flag/value pairs.
  • Tests

    • Added coverage ensuring user split-form flags are preserved/ignored as intended and managed flags are merged or replaced correctly across mixed scenarios.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8efb457c-dcb7-447f-9ba0-34b89aa7553b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot added the review-effort/medium Medium review effort (3): few files, moderate logic label Jun 13, 2026
…mmand flags

Signed-off-by: rogueslasher <aniketpandey25092005@gmail.com>
@rogueslasher rogueslasher force-pushed the fix/broker-router-split-form-flags branch from 7db6013 to 24217aa Compare June 13, 2026 12:02
@david-martin david-martin added the triage/needs-issue PR needs a linked issue label Jun 22, 2026
@rogueslasher rogueslasher marked this pull request as draft June 22, 2026 10:37
@rogueslasher

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Labels

review-effort/medium Medium review effort (3): few files, moderate logic triage/needs-issue PR needs a linked issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants