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

[NET-11256] Add gateway list command to consul-k8s CLI #4433

Merged
merged 2 commits into from
Dec 1, 2024

Conversation

nathancoleman
Copy link
Member

@nathancoleman nathancoleman commented Nov 27, 2024

Note

This PR is blocked by the bug fix in #4434 which is preventing tests from passing

Changes proposed in this PR

This PR adds a new command, consul-k8s gateway list, which collects the various components of configuration for all Gateways in a given K8s cluster or namespace – Gateway, attached HTTPRoutes, attached TCPRoutes, etc. – into a single zip file containing one yaml file per Gateway.

It can output an archive named gateways.zip into the current directory, or it can output JSON to the terminal.

# Output a zip archive for all gateways in the current namespace on your kubecontext
$ consul-k8s gateway list --output archive

# Output JSON to the terminal for all gateways in the <my-namespace> namespace
$ consul-k8s gateway list --namespace my-namespace --output json

# Output JSON to the terminal for all gateways in the k8s cluster
$ consul-k8s gateway list --all-namespaces --output json

How I've tested this PR

Create one or more Gateways in your Kube cluster. Example for this config is available here.

Run the commands above to inspect the various forms of output, making sure to use both the implicit namespace on your kubecontext and an explicit --namespace <my-namespace> arg.

How I expect reviewers to test this PR

See above

Checklist

@nathancoleman nathancoleman changed the title Add gateway list command to consul-k8s CLI [NET-11256] Add gateway list command to consul-k8s CLI Nov 27, 2024
@nathancoleman nathancoleman marked this pull request as ready for review November 27, 2024 19:49
@nathancoleman nathancoleman requested a review from a team as a code owner November 27, 2024 19:49
f.StringVar(&flag.StringVar{
Name: "context",
Target: &c.flagKubeContext,
Usage: "Set the Kubernetes context to use.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should there be Aliases for this flag?

Copy link
Member Author

@nathancoleman nathancoleman Nov 27, 2024

Choose a reason for hiding this comment

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

I made it consistent with the existing consul-k8s proxy list command which doesn't specify an alias. I'm not finding any other commands that specify an alias, so I think it makes sense not to have one here for consistency.

f.StringVar(&flag.StringVar{
Name: flagNameKubeContext,
Target: &c.flagKubeContext,
Default: "",
Usage: "Set the Kubernetes context to use.",
})

Base automatically changed from cli-gateway-read to main November 29, 2024 03:52
@nathancoleman nathancoleman added the pr/no-backport signals that a PR will not contain a backport label label Nov 30, 2024
@nathancoleman nathancoleman added backport/1.6.x Changes are backported to 1.6 area/cli CLI and removed pr/no-backport signals that a PR will not contain a backport label labels Nov 30, 2024
@nathancoleman nathancoleman enabled auto-merge (squash) November 30, 2024 14:58
@nathancoleman nathancoleman merged commit 19ab7e0 into main Dec 1, 2024
56 of 57 checks passed
@nathancoleman nathancoleman deleted the cli-gateway-list branch December 1, 2024 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli CLI backport/1.6.x Changes are backported to 1.6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants