-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(cmd): podman kube play support multiple arguments #26280
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
feat(cmd): podman kube play support multiple arguments #26280
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: axel7083 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
6353c5a
to
ad961d7
Compare
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
2 similar comments
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
ad961d7
to
ee57ddd
Compare
Need rebase after |
Signed-off-by: axel7083 <[email protected]>
Signed-off-by: axel7083 <[email protected]>
e37a183
to
3a509ac
Compare
A friendly reminder that this PR had no activity for 30 days. |
@axel7083 Hope you're doing well. Just wanted to follow up on this PR. Are you still planning to work on it? No worries if not, I can pick it up from here if needed. Let me know! Thanks. |
Hey @Honny1, Sorry I kinda forgot about this, I had a blocker with the tests, not able to fix them, if someone could take a look or takeover, would be lovely. Thanks in advance |
@axel7083 I'll investigate the problem, and then we can discuss the next steps. |
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've checked the test results, and the main problem seems to be with autocompletion. I think the other CI failures are just flakes.
I have suggested some fixes for the autocompletion issue and left a review. This change will also require a documentation update.
@axel7083 What do you think? Do you want to finish this PR, or should I take over?
return play(cmd, args) | ||
} | ||
|
||
func readerFromArgs(args []string) (*bytes.Reader, error) { |
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.
Nonblocking: This function could be optimized to reduce buffer operations and avoid reading whole files.
files: []string{ | ||
`apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: my-config`, | ||
}, |
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.
Nonblocking: I'm not a fan of these log strings. They visually disrupt the file's appearance. You could do something like this instead:
files: []string{ | |
`apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: my-config`, | |
}, | |
files: []string{strings.Join([]string{ | |
"apiVersion: v1", | |
"kind: ConfigMap", | |
"metadata:", | |
" name: my-config", | |
}, "\n"),}, |
} | ||
|
||
func TestReaderFromArgs(t *testing.T) { | ||
tests := []struct { |
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 see several duplicate file definitions. This could be reduced with some constants.
|
||
It("all arguments should be read", func() { | ||
// let's create a matrix of pod name => filename | ||
pods := [][]string{ |
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 think this matrix is needed. Instead, you can simply add or remove the .yaml
extension from the podname
.
} | ||
|
||
// run the podman command | ||
kube := podmanTest.Podman(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.
You can use podmanTest.PodmanExitCleanly()
.
|
||
// for each pods, let's ensure it has been created nicely | ||
for _, test := range pods { | ||
inspect := podmanTest.Podman([]string{"pod", "inspect", test[0]}) |
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.
You can use podmanTest.PodmanExitCleanly()
and also check the output of inspect.
RunE: down, | ||
Args: cobra.ExactArgs(1), | ||
Args: cobra.MinimumNArgs(1), | ||
ValidArgsFunction: common.AutocompleteDefaultOneArg, |
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.
ValidArgsFunction: common.AutocompleteDefaultOneArg, | |
ValidArgsFunction: completion.AutocompleteDefault, |
RunE: play, | ||
Args: cobra.ExactArgs(1), | ||
Args: cobra.MinimumNArgs(1), | ||
ValidArgsFunction: common.AutocompleteDefaultOneArg, |
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.
ValidArgsFunction: common.AutocompleteDefaultOneArg, | |
ValidArgsFunction: completion.AutocompleteDefault, |
RunE: playKube, | ||
Args: cobra.ExactArgs(1), | ||
Args: cobra.MinimumNArgs(1), | ||
ValidArgsFunction: common.AutocompleteDefaultOneArg, |
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.
ValidArgsFunction: common.AutocompleteDefaultOneArg, | |
ValidArgsFunction: completion.AutocompleteDefault, |
} | ||
|
||
// prepare our podman command | ||
var cmd = []string{"play", "kube"} |
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.
var cmd = []string{"play", "kube"} | |
var cmd = []string{"kube", "play"} |
Does this PR introduce a user-facing change?
Required for #26274