fix: preserve split-form (--flag value) user-managed broker-router co…#1137
Draft
rogueslasher wants to merge 1 commit into
Draft
fix: preserve split-form (--flag value) user-managed broker-router co…#1137rogueslasher wants to merge 1 commit into
rogueslasher wants to merge 1 commit into
Conversation
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
…mmand flags Signed-off-by: rogueslasher <aniketpandey25092005@gmail.com>
7db6013 to
24217aa
Compare
Contributor
Author
|
@coderabbitai review |
✅ Action performedReview finished.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.PreviouslymergeCommanddropped the value token of such flags on reconcile, andfilterManagedFlagscould report false drift for the orphaned value token.Details
internal/controller/broker_router.go:commandEntry/parseCommandEntriesto split a container command into logical entries (binary name,--flag=value,--flag valuepair, or bare--flag).filterManagedFlagsandmergeCommandto operate on these logical entries instead of raw argv tokens, so split-form flags and their valuesare preserved/compared as a unit.strings.HasPrefixto 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
--flag=valueand split--flagvalueforms; preserves binary name and groups flag/value pairs.Tests