Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Improve fluxctl connection error
Browse files Browse the repository at this point in the history
It now looks like:

```
$ fluxctl
Error: No pod found in namespace "default" using the following selectors:
  app=flux
  name in (flux,fluxd,weave-flux-agent)

Make sure Flux is running in namespace "default".
If Flux is running in another namespace, please supply it to --k8s-fwd-ns=<namespace>
Run 'fluxctl identity --help' for usage.
```
  • Loading branch information
2opremio committed Apr 30, 2019
1 parent b437ebe commit 32e9df5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/fluxctl/portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
// Attempt to create PortForwards to fluxes that match the label selectors until a Flux
// is found or an error is returned.
func tryPortforwards(ns string, selectors ...metav1.LabelSelector) (p *portforward.PortForward, err error) {
message := fmt.Sprintf("Flux pod not found for labels in namespace %s:", ns)
message := fmt.Sprintf("No pod found in namespace %q using the following selectors:", ns)

for _, selector := range selectors {
p, err = tryPortforward(ns, selector)
Expand All @@ -27,7 +27,8 @@ func tryPortforwards(ns string, selectors ...metav1.LabelSelector) (p *portforwa
message = fmt.Sprintf("%s\n %s", message, metav1.FormatLabelSelector(&selector))
}
}

message = fmt.Sprintf("%s\n\nMake sure Flux is running in namespace %q.\n"+
"If Flux is running in another different namespace, please supply it to --k8s-fwd-ns.", message, ns)
if err != nil {
err = errors.New(message)
}
Expand Down

0 comments on commit 32e9df5

Please sign in to comment.