diff --git a/istioctl/pkg/writer/envoy/clusters/clusters.go b/istioctl/pkg/writer/envoy/clusters/clusters.go index 1f52259bac01..4144e36d9fc1 100644 --- a/istioctl/pkg/writer/envoy/clusters/clusters.go +++ b/istioctl/pkg/writer/envoy/clusters/clusters.go @@ -65,11 +65,19 @@ func (c *ConfigWriter) Prime(b []byte) error { } func retrieveEndpointAddress(host *adminapi.HostStatus) string { - return host.Address.GetSocketAddress().Address + addr := host.Address.GetSocketAddress() + if addr != nil { + return addr.Address + } + return "unix://" + host.Address.GetPipe().Path } func retrieveEndpointPort(l *adminapi.HostStatus) uint32 { - return l.Address.GetSocketAddress().GetPortValue() + addr := l.Address.GetSocketAddress() + if addr != nil { + return addr.GetPortValue() + } + return 0 } func retrieveEndpointStatus(l *adminapi.HostStatus) core.HealthStatus { @@ -125,7 +133,12 @@ func (c *ConfigWriter) PrintEndpointsSummary(filter EndpointFilter) error { clusterEndpoint = retrieveSortedEndpointClusterSlice(clusterEndpoint) fmt.Fprintln(w, "ENDPOINT\tSTATUS\tOUTLIER CHECK\tCLUSTER") for _, ce := range clusterEndpoint { - endpoint := ce.address + ":" + strconv.Itoa(ce.port) + var endpoint string + if ce.port != 0 { + endpoint = ce.address + ":" + strconv.Itoa(ce.port) + } else { + endpoint = ce.address + } fmt.Fprintf(w, "%v\t%v\t%v\t%v\n", endpoint, core.HealthStatus_name[int32(ce.status)], printFailedOutlierCheck(ce.failedOutlierCheck), ce.cluster) } diff --git a/istioctl/pkg/writer/envoy/clusters/testdata/clusters.json b/istioctl/pkg/writer/envoy/clusters/testdata/clusters.json index b5ef8dddc03d..ac140c6e31e9 100644 --- a/istioctl/pkg/writer/envoy/clusters/testdata/clusters.json +++ b/istioctl/pkg/writer/envoy/clusters/testdata/clusters.json @@ -348,6 +348,56 @@ } } ] + }, + { + "name": "inbound_9092", + "host_statuses": [ + { + "address": { + "pipe": { + "path": "/sock/mixer.socket" + } + }, + "stats": [ + { + "value": "64", + "name": "cx_connect_fail" + }, + { + "value": "72", + "name": "cx_total" + }, + { + "value": "78", + "name": "rq_error" + }, + { + "value": "300076", + "name": "rq_success" + }, + { + "name": "rq_timeout" + }, + { + "value": "300076", + "name": "rq_total" + }, + { + "type": "GAUGE", + "value": "8", + "name": "cx_active" + }, + { + "type": "GAUGE", + "name": "rq_active" + } + ], + "health_status": { + "eds_health_status": "HEALTHY" + }, + "weight": 1 + } + ] } ] } diff --git a/istioctl/pkg/writer/envoy/clusters/testdata/clustersnofiltered.txt b/istioctl/pkg/writer/envoy/clusters/testdata/clustersnofiltered.txt index 61e875ad76d6..b8caf34e00a7 100644 --- a/istioctl/pkg/writer/envoy/clusters/testdata/clustersnofiltered.txt +++ b/istioctl/pkg/writer/envoy/clusters/testdata/clustersnofiltered.txt @@ -347,5 +347,55 @@ } } ] + }, + { + "name": "inbound_9092", + "hostStatuses": [ + { + "address": { + "pipe": { + "path": "/sock/mixer.socket" + } + }, + "stats": [ + { + "value": "64", + "name": "cx_connect_fail" + }, + { + "value": "72", + "name": "cx_total" + }, + { + "value": "78", + "name": "rq_error" + }, + { + "value": "300076", + "name": "rq_success" + }, + { + "name": "rq_timeout" + }, + { + "value": "300076", + "name": "rq_total" + }, + { + "type": "GAUGE", + "value": "8", + "name": "cx_active" + }, + { + "type": "GAUGE", + "name": "rq_active" + } + ], + "healthStatus": { + "edsHealthStatus": "HEALTHY" + }, + "weight": 1 + } + ] } ] diff --git a/istioctl/pkg/writer/envoy/clusters/testdata/clustersummary.txt b/istioctl/pkg/writer/envoy/clusters/testdata/clustersummary.txt index 11916eea202d..7fc8758db719 100644 --- a/istioctl/pkg/writer/envoy/clusters/testdata/clustersummary.txt +++ b/istioctl/pkg/writer/envoy/clusters/testdata/clustersummary.txt @@ -1,9 +1,10 @@ -ENDPOINT STATUS OUTLIER CHECK CLUSTER -172.17.0.13:443 HEALTHY OK outbound|443||istio-ingressgateway.istio-system.svc.cluster.local -172.17.0.14:15014 UNHEALTHY OK outbound|15014||istio-policy.istio-system.svc.cluster.local -172.17.0.19:443 HEALTHY OK outbound|443||istio-galley.istio-system.svc.cluster.local -172.17.0.24:9080 HEALTHY OK outbound|9080||reviews.default.svc.cluster.local -172.17.0.26:9080 HEALTHY OK outbound|9080||reviews.default.svc.cluster.local -172.17.0.27:9080 HEALTHY FAILED outbound|9080||reviews.default.svc.cluster.local -172.17.0.4:443 HEALTHY OK outbound|443||istio-sidecar-injector.istio-system.svc.cluster.local -172.17.0.6:443 HEALTHY OK outbound|443||istio-egressgateway.istio-system.svc.cluster.local +ENDPOINT STATUS OUTLIER CHECK CLUSTER +172.17.0.13:443 HEALTHY OK outbound|443||istio-ingressgateway.istio-system.svc.cluster.local +172.17.0.14:15014 UNHEALTHY OK outbound|15014||istio-policy.istio-system.svc.cluster.local +172.17.0.19:443 HEALTHY OK outbound|443||istio-galley.istio-system.svc.cluster.local +172.17.0.24:9080 HEALTHY OK outbound|9080||reviews.default.svc.cluster.local +172.17.0.26:9080 HEALTHY OK outbound|9080||reviews.default.svc.cluster.local +172.17.0.27:9080 HEALTHY FAILED outbound|9080||reviews.default.svc.cluster.local +172.17.0.4:443 HEALTHY OK outbound|443||istio-sidecar-injector.istio-system.svc.cluster.local +172.17.0.6:443 HEALTHY OK outbound|443||istio-egressgateway.istio-system.svc.cluster.local +unix:///sock/mixer.socket HEALTHY OK inbound_9092