-
Notifications
You must be signed in to change notification settings - Fork 828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue in extraCommandArgs field #1541
Conversation
c2b7eb0
to
e8ed105
Compare
e8ed105
to
06d0795
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any logic to address the 3rd problem reported in the Jira issue
3. Adding argument and value as a single element causes the pod to crash
Other than that, it looks good to me.
Thanks John, for 3rd point -
|
|
Re-ran the tests |
All the tests are passing now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rizwana777 - Can we allow users to override params? There may be cases where tuning of default params could be useful.
9624248
to
0079ddb
Compare
@svghadi I have updated the code which allow the users to override existing params, PTAL |
controllers/argocd/deployment.go
Outdated
// appendUniqueArgs appends extraArgs to cmd while ignoring any duplicate flags. | ||
func appendUniqueArgs(cmd []string, extraArgs []string) []string { | ||
// Parse cmd into a map to track flags and their indices | ||
existingArgs := make(map[string]int) // Map to track index of each flag in cmd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on our Slack discussion, could you try using a map[string]string
to simplify the logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@svghadi I tried updating the logic to use map[string]string but found issues as mentioned-
-
map[string]string creates a map of flags to values, meaning it's expecting each flag to be associated with a value (or an empty string if no value is provided) this approach has the risk of treating arguments like --staticassets as executable commands if there is an issue in the flag parsing. If the function expects this argument to be passed as part of a command and it's incorrectly handled (i.e., not paired with a valid value), this could lead to the error like - create failed: unable to start container process: exec: "--staticassets": executable file not found in $PATH"
-
On the other hand, map[string]int keeps track of the exact positions of flags in the original cmd array, so any updates or additions to cmd are carefully done by index. This prevents the accidental misinterpretation of arguments and ensures the correct structure for the final command.
I may be mistaken, but PTAL and let me know your thoughts. I'm open to any suggestions
337c5e3
to
33b914b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition, it appears that ExtraRepoCommandArgs
, which controls extra repo server args, is missing from this PR.
Signed-off-by: Rizwana777 <[email protected]>
Signed-off-by: Rizwana777 <[email protected]>
Signed-off-by: Rizwana777 <[email protected]>
Signed-off-by: Rizwana777 <[email protected]>
Signed-off-by: Rizwana777 <[email protected]>
Rebased to latest from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @Rizwana777!
JIRA - https://issues.redhat.com/browse/GITOPS-5200