diff --git a/cli/cmd/proxy/list/command.go b/cli/cmd/proxy/list/command.go index 4389eec0db..cc09278861 100644 --- a/cli/cmd/proxy/list/command.go +++ b/cli/cmd/proxy/list/command.go @@ -204,6 +204,8 @@ func (c *ListCommand) output(pods []v1.Pod) { for _, pod := range pods { var proxyType string + + // Get the type for ingress, mesh, and terminating gateways. switch pod.Labels["component"] { case "ingress-gateway": proxyType = "Ingress Gateway" @@ -211,9 +213,15 @@ func (c *ListCommand) output(pods []v1.Pod) { proxyType = "Mesh Gateway" case "terminating-gateway": proxyType = "Terminating Gateway" - case "api-gateway": + } + + // Determine if the pod is an API Gateway. + if pod.Labels["api-gateway.consul.hashicorp.com/managed"] == "true" { proxyType = "API Gateway" - default: + } + + // Fallback to "Sidecar" as a default + if proxyType == "" { proxyType = "Sidecar" } diff --git a/cli/cmd/proxy/list/command_test.go b/cli/cmd/proxy/list/command_test.go index f0d552ca7f..df6aaf024b 100644 --- a/cli/cmd/proxy/list/command_test.go +++ b/cli/cmd/proxy/list/command_test.go @@ -225,7 +225,7 @@ func TestListCommandOutput(t *testing.T) { "consul.*mesh-gateway.*Mesh Gateway", "consul.*terminating-gateway.*Terminating Gateway", "default.*ingress-gateway.*Ingress Gateway", - "consul.*api-gateway.*Sidecar", + "consul.*api-gateway.*API Gateway", "default.*pod1.*Sidecar", } notExpected := []string{