Skip to content

Commit

Permalink
Merge pull request #89 from calmkart/NotFoundError
Browse files Browse the repository at this point in the history
MOD:ListPods isNotFound error add
  • Loading branch information
cjimti authored Nov 7, 2019
2 parents df22a90 + e810263 commit 68259d2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cmd/kubefwd/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth"
restclient "k8s.io/client-go/rest"
"k8s.io/apimachinery/pkg/api/errors"
)

var namespaces []string
Expand Down Expand Up @@ -281,7 +282,11 @@ func fwdServices(opts FwdServiceOpts) error {
pods, err := opts.ClientSet.CoreV1().Pods(svc.Namespace).List(listOpts)

if err != nil {
log.Warnf("WARNING: No Running Pods found for %s: %s\n", selector, err.Error())
if errors.IsNotFound(err) {
log.Warnf("WARNING: No Running Pods found for %s: %s\n", selector, err.Error())
} else {
log.Warnf("WARNING: Error in List pods for %s: %s\n", selector, err.Error())
}

// TODO: try again after a time

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5
github.com/txn2/txeh v1.2.1
gopkg.in/yaml.v2 v2.2.4
k8s.io/api v0.0.0-20191031065753-b19d8caf39be
k8s.io/apimachinery v0.0.0-20191102025618-50aa20a7b23f
k8s.io/cli-runtime v0.0.0-20191102031428-d1199d98239f
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEg
github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZtyZRg470CqAXTZaGM=
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0 h1:Ww5g4zThfD/6cLb4z6xxgeyDa7QDkizMkJKe0ysZXp0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
Expand Down

0 comments on commit 68259d2

Please sign in to comment.