Skip to content

Conversation

@carmal891
Copy link

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
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: carmal891
Once this PR has been reviewed and has the lgtm label, please assign youngnick for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@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
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.

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 from 4c8175c to 6605bd4 Compare November 17, 2025 03:23
@carmal891 carmal891 force-pushed the feat/enhance-input-logic branch from 6605bd4 to b92cee2 Compare November 17, 2025 03:26
if len(allFiles) > 0 {
for _, inputFile := range allFiles {
fmt.Fprintf(os.Stdout, "=== File: %s ===\n", inputFile)
gatewayResources, notificationTablesMap, err := i2gw.ToGatewayAPIResources(cmd.Context(), pr.namespaceFilter, inputFile, pr.providers, pr.getProviderSpecificFlags())
Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding here is this implementation is that the following would be more or less equivalent (i forget the specific flag names)

i2gw print --input-file a.yaml b.yaml c.yaml 

and

i2gw print --input-file a.yaml
i2gw print --input-file b.yaml
i2gw print --input-file c.yaml

I'm not super familiar with Ingress merging semantics, but could this not mean that we have duplicate resources in the output (maybe with slightly different names).

Ideally, the same set of kubernetes resources should create the same output regardless of which file each resources lives in.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for highlighting this. I got your point. So duplicate resource check should happen amongst the set of yaml files when provided as a set like i2gw print --input-file a.yaml b.yaml c.yaml

Copy link
Contributor

Choose a reason for hiding this comment

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

Its more like

i2gw print --input-file a.yaml b.yaml c.yaml

and

i2gw print --input-file <(cat a.yaml b.yaml c.yaml)

should be equivalent.

cmd.Flags().StringSliceVar(&pr.inputPaths, "input-file", []string{},
`Path to manifest file(s) or directory(s). When set, the tool will read ingresses from the specified files or all YAML files in directories. Supported files are yaml and json.`)

cmd.Flags().BoolVar(&pr.recursive, "recursive", false,
Copy link
Contributor

Choose a reason for hiding this comment

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

This one is more personal, but I think we can omit this path since users can already do -input-file manifest-dir/**/*.{yaml,yml,json}, but if this is a common enough pattern in other places I'm happy to include.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. needs-ok-to-test Indicates a PR that requires an org member to verify it 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

3 participants