Skip to content

Conversation

Honny1
Copy link
Member

@Honny1 Honny1 commented Oct 14, 2025

This PR enables podman kube play and podman kube down to accept multiple YAML files and URLs in a single command.

Fixes: #26274
Fixes: https://issues.redhat.com/browse/RUN-3586

Does this PR introduce a user-facing change?

podman kube play|down support multiple file as arguments

@openshift-ci openshift-ci bot added release-note do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Oct 14, 2025
@Honny1 Honny1 force-pushed the pr-multi-file-support-kube branch from 80a686e to 45988c5 Compare October 14, 2025 17:36
@Honny1
Copy link
Member Author

Honny1 commented Oct 14, 2025

cc @axel7083

@Honny1
Copy link
Member Author

Honny1 commented Oct 14, 2025

The CI is failing due to an unrelated test: Podman search with wildcards.

@Honny1 Honny1 marked this pull request as ready for review October 14, 2025 18:43
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 14, 2025
}
return response.Body, nil
default:
return os.Open(fileName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just struck me that we're using http.Get() and I don't think we've set it to use TLS? Should we? Also, can this Get ever hang and never timeout?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should automatically use TLS. I'm not sure about the request timeout, though. I just reused the same function as before, which we're already using in multiple places. Is this considered bad practice in Go?

@TomSweeneyRedHat
Copy link
Member

A couple of questions for consideration.
Otherwise, LGTM

reader = f

if i < len(args)-1 {
combined.WriteString("\n---\n")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment on top that this is file seperator ? Maybe also have \n---\n in a const string

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a comment and moved it into a const string.

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment, PR looks good overall

@Honny1 Honny1 force-pushed the pr-multi-file-support-kube branch from 45988c5 to 6e57e92 Compare October 20, 2025 12:27
Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@Honny1 Honny1 force-pushed the pr-multi-file-support-kube branch from 6e57e92 to 62c5e9b Compare October 20, 2025 18:19
@Honny1
Copy link
Member Author

Honny1 commented Oct 21, 2025

/packit retest-failed

return bytes.NewReader(combined.Bytes()), nil
}

func readerFromArg(fileName string) (io.ReadCloser, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fileName is confusing here, it can do files or URLs

@mheon
Copy link
Member

mheon commented Oct 21, 2025

What happens if the user gives us a bunch of files, but one of them isn't valid YAML. Do we fail with a parse error?

@mheon
Copy link
Member

mheon commented Oct 21, 2025

/approve

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 21, 2025
@Honny1
Copy link
Member Author

Honny1 commented Oct 22, 2025

What happens if the user gives us a bunch of files, but one of them isn't valid YAML. Do we fail with a parse error?

Yes, we fail with parse error.

Signed-off-by: axel7083 <[email protected]>

fix: update kube play command cobra use

Signed-off-by: axel7083 <[email protected]>

Add multi-file support to podman kube play/down

- Support multiple YAML files and URLs in single command
- Combine files with YAML document separators (---)
- Refactor for better testability with dependency injection
- Update documentation with examples for multiple inputs
- Improve memory efficiency with streaming I/O operations

Fixes: containers#26274
Fixes: https://issues.redhat.com/browse/RUN-3586

Signed-off-by: Jan Rodák <[email protected]>
@Honny1 Honny1 force-pushed the pr-multi-file-support-kube branch from 62c5e9b to 9bda788 Compare October 22, 2025 10:11
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Comment on lines +10 to +45
var configMapYAML = strings.Join([]string{
"apiVersion: v1",
"kind: ConfigMap",
"metadata:",
" name: my-config",
"data:",
" key: value",
}, "\n")

var podYAML = strings.Join([]string{
"apiVersion: v1",
"kind: Pod",
"metadata:",
" name: my-pod",
}, "\n")

var serviceYAML = strings.Join([]string{
"apiVersion: v1",
"kind: Service",
"metadata:",
" name: my-service",
}, "\n")

var secretYAML = strings.Join([]string{
"apiVersion: v1",
"kind: Secret",
"metadata:",
" name: my-secret",
}, "\n")

var namespaceYAML = strings.Join([]string{
"apiVersion: v1",
"kind: Namespace",
"metadata:",
" name: my-namespace",
}, "\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is quite ugly, go supports multi line strings just fine with the backtick escapes which would make this more readable, but not worth to push again just for this

want := strings.TrimSpace(tt.expected)

if got != want {
t.Errorf("unexpected output:\n--- got ---\n%s\n--- want ---\n%s", got, want)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another nit: we already depend on assert so might as well use the nicer test hallper such as assert.Equal(), etc...

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 22, 2025
Copy link
Contributor

openshift-ci bot commented Oct 22, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Honny1, Luap99, mheon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Honny1
Copy link
Member Author

Honny1 commented Oct 22, 2025

@Luap99 Should I fix nits?

@Luap99
Copy link
Member

Luap99 commented Oct 22, 2025

@Luap99 Should I fix nits?

No its fine like this

@openshift-merge-bot openshift-merge-bot bot merged commit c15e845 into containers:main Oct 22, 2025
81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kube Quadlet should support multiple YAML

6 participants