ingress2gateway icon indicating copy to clipboard operation
ingress2gateway copied to clipboard

feat: add --output-file flag (#145)

Open ipsum-0320 opened this issue 10 months ago • 19 comments

What type of PR is this?

/kind feature

What this PR does / why we need it: To separate the output and logs, we have introduced a new --output-file flag to allow users to dump the converted resources into a specific file, while the console only outputs log messages/warnings. The --output-file has the following requirements:

  1. By default, --output-file is "./ingress2gateway.yaml" or "./ingress2gateway.json", depending on whether the output flag is set to "yaml" or "json".
  2. If the user customizes the filename, the file must have a ".yaml" extension (when the output flag is "yaml"), or a ".json" extension (when the output flag is "json").

Which issue(s) this PR fixes:

Fixes #145

Does this PR introduce a user-facing change?:

Added a new `--output-file` flag to support dumping converted resources into a specific file and logs/warnings to the console.

ipsum-0320 avatar Apr 06 '24 13:04 ipsum-0320

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: ipsum-0320 / name: ipsum-0320 (580b0fe9721de4c65332dabafaff4d51afb3e37b)

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ipsum-0320 Once this PR has been reviewed and has the lgtm label, please assign robscott for approval. For more information see the Kubernetes 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 avatar Apr 06 '24 13:04 k8s-ci-robot

Welcome @ipsum-0320!

It looks like this is your first PR to kubernetes-sigs/ingress2gateway 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/ingress2gateway has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Apr 06 '24 13:04 k8s-ci-robot

Hi @ipsum-0320. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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/test-infra repository.

k8s-ci-robot avatar Apr 06 '24 13:04 k8s-ci-robot

@Xunzhuo @levikobi PTAL 😊

ipsum-0320 avatar Apr 06 '24 14:04 ipsum-0320

/ok-to-test

Xunzhuo avatar Apr 06 '24 15:04 Xunzhuo

@Xunzhuo @levikobi can u review the code again? Thanks! 😊

ipsum-0320 avatar Apr 07 '24 02:04 ipsum-0320

@LiorLieberman @mlavacca Could you please review my code? The other two reviewers didn't seem to have time. I have a lot of time to contribute to the project, please feel free to give me your insights on my code 😊

ipsum-0320 avatar Apr 08 '24 08:04 ipsum-0320

sorry for not getting to this one yet @ipsum-0320, I will get to it within the next two days

levikobi avatar Apr 10 '24 05:04 levikobi

sorry for not getting to this one yet @ipsum-0320, I will get to it within the next two days

@levikobi ok, thanks!

ipsum-0320 avatar Apr 12 '24 05:04 ipsum-0320

Thanks @ipsum-0320. This PR intends to always dump the results to a file? If yes, why dont we maintain the current functionality to print the results to the console while letting people the option to specify an output-file?

/hold

LiorLieberman avatar Apr 14 '24 05:04 LiorLieberman

Thanks @ipsum-0320. 谢谢 。 This PR intends to always dump the results to a file? If yes, why dont we maintain the current functionality to print the results to the console while letting people the option to specify an output-file? 这个 PR 打算总是将结果转储到文件中吗?如果是,为什么我们不保留当前的功能以将结果打印到控制台,同时让人们可以选择指定输出文件?

/hold /抓住

hi, @LiorLieberman . As mentioned in issue #145, if we output any other log messages to the console, such messages will also be dumped into the output file, thus contaminating the .yaml/.json file.

ipsum-0320 avatar Apr 14 '24 15:04 ipsum-0320

That I understand. I am saying why we default to a file? Why we dont keep the default to the console ?

LiorLieberman avatar Apr 14 '24 16:04 LiorLieberman

That I understand. I am saying why we default to a file? Why we dont keep the default to the console ?

Oh, @LiorLieberman I think if we force it to output to a file, we can completely avoid contaminating the conversion results with log messages. Of course, outputting to the console is more convenient... I'll make it optional.

ipsum-0320 avatar Apr 14 '24 16:04 ipsum-0320

New changes are detected. LGTM label has been removed.

k8s-ci-robot avatar Apr 15 '24 07:04 k8s-ci-robot

@levikobi @LiorLieberman hi guys, PTAL 😊

ipsum-0320 avatar Apr 16 '24 02:04 ipsum-0320

@mlavacca PTAL 😊

ipsum-0320 avatar Apr 24 '24 08:04 ipsum-0320

PR needs rebase.

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/test-infra repository.

k8s-ci-robot avatar May 03 '24 16:05 k8s-ci-robot

👋 @ipsum-0320, how are things going? If you need any help in addressing the comments and move this one forward, please let us know

mlavacca avatar Jul 04 '24 12:07 mlavacca

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Oct 02 '24 13:10 k8s-triage-robot