Skip to content

Commit

Permalink
Merge pull request #114 from cloudnativelabs/113-segment-voilation
Browse files Browse the repository at this point in the history
segmentation violation when kube-router is not able to contact api server
  • Loading branch information
murali-reddy committed Aug 9, 2017
2 parents 1a71a12 + 801b0e9 commit d3f43fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/watchers/network_policy_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"reflect"
"strconv"
"time"
"errors"

"github.com/cloudnativelabs/kube-router/utils"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -78,7 +79,11 @@ func StartNetworkPolicyWatcher(clientset *kubernetes.Clientset, resyncPeriod tim
npw.clientset = clientset

v1NetworkPolicy := true
v, _ := clientset.Discovery().ServerVersion()
v, err := clientset.Discovery().ServerVersion()
if err != nil {
return nil, errors.New("Failed to get API server version due to " + err.Error())
}

minorVer, _ := strconv.Atoi(v.Minor)
if v.Major == "1" && minorVer < 7 {
v1NetworkPolicy = false
Expand Down

0 comments on commit d3f43fc

Please sign in to comment.