Skip to content
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

Add new command to list flags for documentation #165

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omerap12
Copy link
Member

@omerap12 omerap12 commented Jul 5, 2024

What type of PR is this?
/kind documentation
/kind feature

-->

What this PR does / why we need it:
Adds list-flags command to print flag details directly.
usage:

./ingress2gateway list-flags

Output:

 
### `print` command

+-----------------------------+---------------+----------+--------------------------------+
|            FLAG             | DEFAULT VALUE | REQUIRED |          DESCRIPTION           |
+-----------------------------+---------------+----------+--------------------------------+
| all-namespaces              | false         | false    | If present, list the           |
|                             |               |          | requested object(s) across     |
|                             |               |          | all namespaces. Namespace in   |
|                             |               |          | current context is ignored     |
|                             |               |          | even if specified with         |
|                             |               |          | --namespace.                   |
| input-file                  |               | true     | Path to the manifest file.     |
|                             |               |          | When set, the tool will        |
|                             |               |          | read ingresses from the file   |
|                             |               |          | instead of reading from the    |
|                             |               |          | cluster. Supported files are   |
|                             |               |          | yaml and json.                 |
| namespace                   |               | true     | If present, the namespace      |
|                             |               |          | scope for this CLI request.    |
| openapi3-backend            |               | true     | Provider-specific: openapi3.   |
|                             |               |          | The name of the backend        |
|                             |               |          | service to use in the          |
|                             |               |          | HTTPRoutes.                    |
| openapi3-gateway-class-name |               | true     | Provider-specific: openapi3.   |
|                             |               |          | The name of the gateway class  |
|                             |               |          | to use in the Gateways.        |
| openapi3-gateway-tls-secret |               | true     | Provider-specific: openapi3.   |
|                             |               |          | The name of the secret for the |
|                             |               |          | TLS certificate references in  |
|                             |               |          | the Gateways.                  |
| output                      | yaml          | true     | Output format. One of: (json,  |
|                             |               |          | yaml).                         |
| providers                   | []            | true     | If present, the tool will      |
|                             |               |          | try to convert only resources  |
|                             |               |          | related to the specified       |
|                             |               |          | providers, supported values    |
|                             |               |          | are [apisix gce ingress-nginx  |
|                             |               |          | istio kong openapi3].          |
+-----------------------------+---------------+----------+--------------------------------+

Which issue(s) this PR fixes:

As part of issue #162, we're adding a new command to list flags for documentation. This will aid in automating the process of generating a list of available flags for creating a README.md file.

Does this PR introduce a user-facing change?:

None

@k8s-ci-robot k8s-ci-robot added kind/documentation Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 5, 2024
@k8s-ci-robot k8s-ci-robot requested review from levikobi and Xunzhuo July 5, 2024 08:24
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 5, 2024
Copy link
Member

@levikobi levikobi left a comment

Choose a reason for hiding this comment

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

Hi @omerap12, sorry for the long delay.
This looks great, thank you!

/lgtm
/cc @LiorLieberman @mlavacca

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 21, 2024
@omerap12
Copy link
Member Author

Hi @omerap12, sorry for the long delay. This looks great, thank you!

/lgtm /cc @LiorLieberman @mlavacca

sure, no problem :)

Copy link
Member

@mlavacca mlavacca left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, @omerap12!

Even if the addition of such a flag is valuable and something I like us to have, the original issue was about a slightly different topic: we need to generate such a list of flags and with some machinery include it in our README here.

@omerap12
Copy link
Member Author

Thanks for this PR, @omerap12!

Even if the addition of such a flag is valuable and something I like us to have, the original issue was about a slightly different topic: we need to generate such a list of flags and with some machinery include it in our README here.

Hey, I understand your point. My intention was to add this flag to enable automated generation of the README.md (saving the output to a file when the flag is called). I wanted to break this into smaller steps rather than submitting a large PR all at once. I can continue with this approach if you allow me to. :)

@LiorLieberman
Copy link
Member

/assign @mlavacca
/cc @mlavacca

@mlavacca
Copy link
Member

Thanks for this PR, @omerap12!
Even if the addition of such a flag is valuable and something I like us to have, the original issue was about a slightly different topic: we need to generate such a list of flags and with some machinery include it in our README here.

Hey, I understand your point. My intention was to add this flag to enable automated generation of the README.md (saving the output to a file when the flag is called). I wanted to break this into smaller steps rather than submitting a large PR all at once. I can continue with this approach if you allow me to. :)

I saw no mention about this approach neither in the PR description nor in the code, so I assumed this was the contribution to fix #162. Splitting this task into sub-tasks sounds good to me, but I ask you to clarify such in the PR description and to change "fixes #issue" to something like "part of #issue", otherwise the issue will be closed by the merge of this PR.

@omerap12
Copy link
Member Author

omerap12 commented Jul 29, 2024

Thanks for this PR, @omerap12!
Even if the addition of such a flag is valuable and something I like us to have, the original issue was about a slightly different topic: we need to generate such a list of flags and with some machinery include it in our README here.

Hey, I understand your point. My intention was to add this flag to enable automated generation of the README.md (saving the output to a file when the flag is called). I wanted to break this into smaller steps rather than submitting a large PR all at once. I can continue with this approach if you allow me to. :)

I saw no mention about this approach neither in the PR description nor in the code, so I assumed this was the contribution to fix #162. Splitting this task into sub-tasks sounds good to me, but I ask you to clarify such in the PR description and to change "fixes #issue" to something like "part of #issue", otherwise the issue will be closed by the merge of this PR.

Yes, you are right sorry about that. fixing it now

cmd/flags.go Outdated Show resolved Hide resolved
cmd/flags.go Outdated Show resolved Hide resolved
cmd/flags.go Outdated Show resolved Hide resolved
@mlavacca
Copy link
Member

Thanks for this PR, @omerap12!
Even if the addition of such a flag is valuable and something I like us to have, the original issue was about a slightly different topic: we need to generate such a list of flags and with some machinery include it in our README here.

Hey, I understand your point. My intention was to add this flag to enable automated generation of the README.md (saving the output to a file when the flag is called). I wanted to break this into smaller steps rather than submitting a large PR all at once. I can continue with this approach if you allow me to. :)

I saw no mention about this approach neither in the PR description nor in the code, so I assumed this was the contribution to fix #162. Splitting this task into sub-tasks sounds good to me, but I ask you to clarify such in the PR description and to change "fixes #issue" to something like "part of #issue", otherwise the issue will be closed by the merge of this PR.

Yes, you are right sorry about that. fixing it now

No worries, and thanks again for this contribution!

@omerap12
Copy link
Member Author

Thanks for this PR, @omerap12!
Even if the addition of such a flag is valuable and something I like us to have, the original issue was about a slightly different topic: we need to generate such a list of flags and with some machinery include it in our README here.

Hey, I understand your point. My intention was to add this flag to enable automated generation of the README.md (saving the output to a file when the flag is called). I wanted to break this into smaller steps rather than submitting a large PR all at once. I can continue with this approach if you allow me to. :)

I saw no mention about this approach neither in the PR description nor in the code, so I assumed this was the contribution to fix #162. Splitting this task into sub-tasks sounds good to me, but I ask you to clarify such in the PR description and to change "fixes #issue" to something like "part of #issue", otherwise the issue will be closed by the merge of this PR.

Yes, you are right sorry about that. fixing it now

No worries, and thanks again for this contribution!

It’s my pleasure! :) I’ll adjust the code according to your review later.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 29, 2024
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: omerap12
Once this PR has been reviewed and has the lgtm label, please ask for approval from mlavacca. 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

@omerap12
Copy link
Member Author

should I set this?

table.SetRowLine(true)

@LiorLieberman
Copy link
Member

/cc @mlavacca for review

@k8s-ci-robot
Copy link
Contributor

@LiorLieberman: GitHub didn't allow me to request PR reviews from the following users: for, review.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @mlavacca for review

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.

@LiorLieberman
Copy link
Member

/assign
/cc

Copy link
Member

@mlavacca mlavacca left a comment

Choose a reason for hiding this comment

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

Hi @omerap12, I somehow missed this PR, sorry about that.

I know you implemented this after my suggestion, but after a thorough look, using this table does not make much sense to me: we want it to be used in a .md file, therefore it should be proper .md code, and not this custom terminal-oriented format.

I think your first implementation was in the right direction, we just need to find a way to avoid the hardcoded formatting. Apologise for all the back and forth on this.

@omerap12
Copy link
Member Author

Hi @omerap12, I somehow missed this PR, sorry about that.

I know you implemented this after my suggestion, but after a thorough look, using this table does not make much sense to me: we want it to be used in a .md file, therefore it should be proper .md code, and not this custom terminal-oriented format.

I think your first implementation was in the right direction, we just need to find a way to avoid the hardcoded formatting. Apologise for all the back and forth on this.

Sure, no problem. Could you please provide an example of how you'd like the output to look?

@mlavacca
Copy link
Member

mlavacca commented Sep 1, 2024

Hi @omerap12, I somehow missed this PR, sorry about that.
I know you implemented this after my suggestion, but after a thorough look, using this table does not make much sense to me: we want it to be used in a .md file, therefore it should be proper .md code, and not this custom terminal-oriented format.
I think your first implementation was in the right direction, we just need to find a way to avoid the hardcoded formatting. Apologise for all the back and forth on this.

Sure, no problem. Could you please provide an example of how you'd like the output to look?

Your first implementation was in the right direction, we just need to find a good way not to have hardcoded table formatting, as it can lead to many problems.

@k8s-triage-robot
Copy link

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-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 30, 2024
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/documentation Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants