Skip to content

Commit

Permalink
revise based on comments
Browse files Browse the repository at this point in the history
Signed-off-by: xiaopeng <hanxiaop8@outlook.com>
  • Loading branch information
hanxiaop committed Feb 23, 2024
1 parent 94b701b commit 8bc249f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/cmd/egctl/envoy_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func newEnvoyDashboardCmd() *cobra.Command {

dashboardCmd := &cobra.Command{
Use: "envoy-proxy <name> -n <namespace>",
Short: "Retrieves Envoy admin dashboard for the specified pod",
Short: "Retrieve Envoy admin dashboard for the specified pod",
Long: `Retrieve Envoy admin dashboard for the specified pod.`,
Example: ` # Retrieve Envoy admin dashboard for the specified pod.
egctl experimental dashboard envoy-proxy <pod-name> -n <namespace>
Expand All @@ -47,6 +47,10 @@ func newEnvoyDashboardCmd() *cobra.Command {
return nil
},
RunE: func(c *cobra.Command, args []string) error {
if listenPort > 65535 || listenPort < 0 {
return fmt.Errorf("invalid port number range")
}

Check warning on line 52 in internal/cmd/egctl/envoy_dashboard.go

View check run for this annotation

Codecov / codecov/patch

internal/cmd/egctl/envoy_dashboard.go#L49-L52

Added lines #L49 - L52 were not covered by tests

kubeClient, err := getCLIClient()
if err != nil {
return err
Expand All @@ -66,7 +70,7 @@ func newEnvoyDashboardCmd() *cobra.Command {
podNamespace = pl.Items[0].Namespace

Check warning on line 70 in internal/cmd/egctl/envoy_dashboard.go

View check run for this annotation

Codecov / codecov/patch

internal/cmd/egctl/envoy_dashboard.go#L54-L70

Added lines #L54 - L70 were not covered by tests
}

return portForward(podName, podNamespace, "http://%s", adminPort, kubeClient, c.OutOrStdout())
return portForward(podName, podNamespace, "http://%s", listenPort, kubeClient, c.OutOrStdout())

Check warning on line 73 in internal/cmd/egctl/envoy_dashboard.go

View check run for this annotation

Codecov / codecov/patch

internal/cmd/egctl/envoy_dashboard.go#L73

Added line #L73 was not covered by tests
},
}
dashboardCmd.PersistentFlags().StringArrayVarP(&labelSelectors, "labels", "l", nil, "Labels to select the envoy proxy pod.")
Expand Down
18 changes: 18 additions & 0 deletions site/content/en/latest/user/egctl.md
Original file line number Diff line number Diff line change
Expand Up @@ -795,3 +795,21 @@ product backend ResolvedRefs True ResolvedRefs

[Multi-tenancy]: ../deployment-mode#multi-tenancy
[EnvoyProxy]: ../../api/extension_types#envoyproxy


## egctl experimental dashboard

This subcommand streamlines the process for users to access the Envoy admin dashboard. By executing the following command:

```bash
egctl x dashboard envoy-proxy -n envoy-gateway-system envoy-engw-eg-a9c23fbb-558f94486c-82wh4
```

You will see the following output:

```bash
egctl x dashboard envoy-proxy -n envoy-gateway-system envoy-engw-eg-a9c23fbb-558f94486c-82wh4
http://localhost:19000
```

the Envoy admin dashboard will automatically open in your default web browser. This eliminates the need to manually locate and expose the admin port.

0 comments on commit 8bc249f

Please sign in to comment.