Fix namespace always showing up in topology graph (#6236)

* Fix namespace always showing up in topology graph

Fixes #6211

In #6091, code was added to include the the namespace in the list of all
stat resource types. This was added to so that we'd have a complete list
of resources types that could be suggested by the CLI autocompletion
code. However, this list was also used by the web frontend in a query
that gathered metrics from all resource types. This then caused the
query to inadvertently create an inbound metric for deployment that
showed traffic from given namespace.

This change, breaks up the code so that we have a separate list for the
autocompletion code without the namespace value and the original list
used by the web frontend prior to #6091.

Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
This commit is contained in:
Dennis Adjei-Baah 2021-06-09 05:01:11 -05:00 committed by GitHub
parent f32022cea5
commit c61f5af1e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 9 deletions

View File

@ -48,11 +48,11 @@ func (c *CommandCompletion) Complete(args []string, toComplete string) ([]string
suggestions := []string{}
if len(args) == 0 && toComplete == "" {
return StatAllResourceTypes, nil
return CompletionResourceTypes, nil
}
if len(args) == 0 && toComplete != "" {
for _, t := range StatAllResourceTypes {
for _, t := range CompletionResourceTypes {
if strings.HasPrefix(t, toComplete) {
suggestions = append(suggestions, t)
}

View File

@ -62,6 +62,21 @@ var AllResources = []string{
// StatAllResourceTypes represents the resources to query in StatSummary when Resource.Type is "all"
var StatAllResourceTypes = []string{
DaemonSet,
StatefulSet,
Job,
Deployment,
ReplicationController,
Pod,
Service,
TrafficSplit,
Authority,
CronJob,
ReplicaSet,
}
// CompletionResourceTypes represents resources the CLI's uses for autocompleting resource type names
var CompletionResourceTypes = []string{
Namespace,
DaemonSet,
StatefulSet,

View File

@ -1316,13 +1316,6 @@ status:
},
},
},
{
Table: &pb.StatTable_PodGroup_{
PodGroup: &pb.StatTable_PodGroup{
Rows: []*pb.StatTable_PodGroup_Row{},
},
},
},
{
Table: &pb.StatTable_PodGroup_{
PodGroup: &pb.StatTable_PodGroup{