Skip to content

Commit

Permalink
Continue if we cannot list namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
c-bata committed Dec 2, 2019
1 parent ddf0b3e commit f0c1671
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kube/completer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/c-bata/go-prompt"
"github.com/c-bata/go-prompt/completer"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
Expand Down Expand Up @@ -36,7 +37,11 @@ func NewCompleter() (*Completer, error) {

namespaces, err := client.CoreV1().Namespaces().List(metav1.ListOptions{})
if err != nil {
return nil, err
if err.(*errors.StatusError).Status().Code == 403 {
namespaces = nil
} else {
return nil, err
}
}

return &Completer{
Expand Down

0 comments on commit f0c1671

Please sign in to comment.