mirror of https://github.com/linkerd/linkerd2.git
Fix --all-namespaces flag handling (#5085)
## Motivations Closes #5080 ## Solution When the `--all-namespaces` (`-A`) flag is set for the `linkerd edges` command, ignore the `namespace` value set by default or `-n`. This is similar to the behavior for `kubectl`. `kubectl get -A -n linkerd pods` showing pods in all namespaces. ### Behavior changes With linkerd and emojivoto installed, this results in: Before: ``` ❯ linkerd edges -A pods No edges found. ``` After: ``` ❯ linkerd edges -A pods SRC DST SRC_NS DST_NS SECURED vote-bot-6cb9cb9569-wl6w5 web-5d69bcfdb7-mxf8f emojivoto emojivoto √ web-5d69bcfdb7-mxf8f emoji-7dc976587b-rb9c5 emojivoto emojivoto √ web-5d69bcfdb7-mxf8f voting-bdf4f778c-pjkjg emojivoto emojivoto √ linkerd-prometheus-68d6897d75-ghmgm emoji-7dc976587b-rb9c5 linkerd emojivoto √ linkerd-prometheus-68d6897d75-ghmgm vote-bot-6cb9cb9569-wl6w5 linkerd emojivoto √ linkerd-prometheus-68d6897d75-ghmgm voting-bdf4f778c-pjkjg linkerd emojivoto √ linkerd-prometheus-68d6897d75-ghmgm web-5d69bcfdb7-mxf8f linkerd emojivoto √ linkerd-controller-7d965cf78d-qw6xj linkerd-prometheus-68d6897d75-ghmgm linkerd linkerd √ linkerd-prometheus-68d6897d75-ghmgm linkerd-controller-7d965cf78d-qw6xj linkerd linkerd √ linkerd-prometheus-68d6897d75-ghmgm linkerd-destination-74dbb9c46b-nkxgh linkerd linkerd √ linkerd-prometheus-68d6897d75-ghmgm linkerd-grafana-5d9fb67dc6-sn2l8 linkerd linkerd √ linkerd-prometheus-68d6897d75-ghmgm linkerd-identity-c875b5d58-b756v linkerd linkerd √ linkerd-prometheus-68d6897d75-ghmgm linkerd-proxy-injector-767b55988d-n9r6f linkerd linkerd √ linkerd-prometheus-68d6897d75-ghmgm linkerd-sp-validator-6c8df84fb9-4w8kc linkerd linkerd √ linkerd-prometheus-68d6897d75-ghmgm linkerd-tap-777fbf7656-p87dm linkerd linkerd √ linkerd-prometheus-68d6897d75-ghmgm linkerd-web-546c9444b5-68xpx linkerd linkerd √ ``` `linkerd edges -A -n linkerd pods` results in all edges as well (the result above). The behavior of `linkerd edges pods` does not change and shows edges in the `default` namespace. ``` ❯ linkerd edges pods No edges found. ``` Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
This commit is contained in:
parent
4f16a234aa
commit
eff50936bf
|
@ -256,9 +256,12 @@ func BuildStatSummaryRequest(p StatsSummaryRequestParams) (*pb.StatSummaryReques
|
|||
// EdgesRequestParams.
|
||||
func BuildEdgesRequest(p EdgesRequestParams) (*pb.EdgesRequest, error) {
|
||||
namespace := p.Namespace
|
||||
if namespace == "" && !p.AllNamespaces {
|
||||
namespace = corev1.NamespaceDefault
|
||||
|
||||
// If all namespaces was specified, ignore namespace value.
|
||||
if p.AllNamespaces {
|
||||
namespace = ""
|
||||
}
|
||||
|
||||
resourceType, err := k8s.CanonicalResourceNameFromFriendlyName(p.ResourceType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue