Skip to content

Read resources from multiple files#258

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
carmal891:feat/enhance-input-logic
Feb 17, 2026
Merged

Read resources from multiple files#258
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
carmal891:feat/enhance-input-logic

Conversation

@carmal891
Copy link
Copy Markdown
Member

What type of PR is this?

/kind feature

What this PR does / why we need it:
Read resources from multiple files

Which issue(s) this PR fixes:

Fixes #106

Does this PR introduce a user-facing change?:

The --input-file flag now supports multiple files and directories. When multiple inputs are provided, each file's conversion results are displayed under individual file headers.

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 17, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 17, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @carmal891. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 17, 2025
@carmal891 carmal891 force-pushed the feat/enhance-input-logic branch from 88cd652 to 4c8175c Compare November 17, 2025 02:40
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 2025
@carmal891 carmal891 force-pushed the feat/enhance-input-logic branch 2 times, most recently from 6605bd4 to b92cee2 Compare November 17, 2025 03:26
Comment thread cmd/print.go Outdated
Comment thread cmd/print.go Outdated
@Stevenjin8
Copy link
Copy Markdown
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 17, 2025
@carmal891 carmal891 force-pushed the feat/enhance-input-logic branch from b92cee2 to d9fbcca Compare January 16, 2026 19:05
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 16, 2026
@carmal891 carmal891 requested a review from Stevenjin8 January 16, 2026 19:09
@carmal891 carmal891 force-pushed the feat/enhance-input-logic branch from d9fbcca to 4206cc9 Compare January 16, 2026 19:48
Comment thread cmd/print.go Outdated
Comment thread cmd/print.go
Comment thread cmd/print.go Outdated
@carmal891 carmal891 requested a review from manju956 February 4, 2026 14:02
@carmal891 carmal891 force-pushed the feat/enhance-input-logic branch 2 times, most recently from cfdb7ef to 9504ef6 Compare February 4, 2026 15:57
@carmal891
Copy link
Copy Markdown
Member Author

@Stevenjin8 Kindly help to review this once again when possible. It would be much appreciated

Comment thread cmd/print.go Outdated
Comment thread cmd/print.go Outdated
Comment thread cmd/print.go Outdated
Comment thread cmd/print.go Outdated
Copy link
Copy Markdown
Contributor

@Stevenjin8 Stevenjin8 left a 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 we need to deal with folders. The shell already lets you do that: path/to/my/folder/*.{json,yaml,yml}

@carmal891 carmal891 force-pushed the feat/enhance-input-logic branch from 252e284 to fe8ed61 Compare February 6, 2026 15:12
@carmal891 carmal891 requested a review from Stevenjin8 February 6, 2026 15:27
Comment thread cmd/print.go Outdated
@carmal891 carmal891 requested a review from Stevenjin8 February 11, 2026 17:40
@carmal891 carmal891 force-pushed the feat/enhance-input-logic branch from fe8ed61 to 3c3e85b Compare February 11, 2026 18:33
@carmal891
Copy link
Copy Markdown
Member Author

@Stevenjin8 All review suggestions are addressed

@Stevenjin8
Copy link
Copy Markdown
Contributor

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 11, 2026
Comment thread cmd/print.go Outdated
Comment thread cmd/print.go Outdated
Comment thread cmd/print.go
readers = append(readers, f)

if i < len(allFiles)-1 {
readers = append(readers, strings.NewReader("\n---\n"))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Are we sure this will not break JSONs ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes this was looked into, the NewYAMLOrJSONDecoder supports multi-document streams and treats JSON as valid YAML. So when we add --- between files, the decoder simply interprets it as a document separator and cleanly decodes each object one by one. Therefore, it does not break JSON inputs.

Comment thread cmd/print.go
if statErr != nil {
return fmt.Errorf("input path does not exist: %s", path)
}
if info.IsDir() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It is common for Kubernetes tools to support directory inputs by recursively searching for .yaml or .json files. Maybe we should consider the same here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think as @Stevenjin8 has mentioned here, users can already achieve the same behaviour via shell expansion:

path/to/my/folder/*.{json,yaml,yml}

Since this provides equivalent functionality without adding complexity to our implementation, I think it’s reasonable to keep the current behaviour and avoid handling directories internally.

@carmal891 carmal891 force-pushed the feat/enhance-input-logic branch from 3c3e85b to 8a9e107 Compare February 14, 2026 20:05
@carmal891 carmal891 requested a review from bexxmodd February 14, 2026 20:06
@carmal891
Copy link
Copy Markdown
Member Author

@bexxmodd I have addressed your comments. Please go through once again

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bexxmodd, carmal891, Stevenjin8

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

The pull request process is described here

Details 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

@carmal891
Copy link
Copy Markdown
Member Author

@Stevenjin8 Can this be merged now that it has been approved by you and @bexxmodd ?

@Stevenjin8
Copy link
Copy Markdown
Contributor

@bexxmodd can you /lgtm

@bexxmodd
Copy link
Copy Markdown

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 17, 2026
@k8s-ci-robot k8s-ci-robot merged commit 85b7527 into kubernetes-sigs:main Feb 17, 2026
4 checks passed
chakravardhan pushed a commit to chakravardhan/ingress2gateway that referenced this pull request Feb 19, 2026
rajashish pushed a commit to rajashish/ingress2gateway1 that referenced this pull request Feb 23, 2026
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read resources from multiple files

5 participants