Skip to content

Commit

Permalink
network policy should use internal address for contiv client
Browse files Browse the repository at this point in the history
network policy should use internal address instead for interacting
with contiv.
  • Loading branch information
tiewei committed Jan 10, 2018
1 parent a04b4ae commit 92cd7d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion netmaster/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func (d *MasterDaemon) InitServices() {
isLeader := func() bool {
return d.currState == "leader"
}
networkpolicy.InitK8SServiceWatch(d.ListenURL, isLeader)
networkpolicy.InitK8SServiceWatch(d.ControlURL, isLeader)
}
}

Expand Down
9 changes: 3 additions & 6 deletions netmaster/k8snetwork/networkpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,11 @@ func (k8sNet *k8sContext) watchK8sEvents(errChan chan error) {
}

// InitK8SServiceWatch monitor k8s services
func InitK8SServiceWatch(listenURL string, isLeader func() bool) error {
func InitK8SServiceWatch(listenAddr string, isLeader func() bool) error {
npLog = log.WithField("k8s", "netpolicy")

listenAddr := strings.Split(listenURL, ":")
if len(listenAddr[0]) <= 0 {
listenAddr[0] = "localhost"
}
contivClient, err := client.NewContivClient("http://" + listenAddr[0] + ":" + listenAddr[1])
npLog.Infof("Create contiv client at http://%s", listenAddr)
contivClient, err := client.NewContivClient("http://" + listenAddr)
if err != nil {
npLog.Errorf("failed to create contivclient %s", err)
return err
Expand Down

0 comments on commit 92cd7d5

Please sign in to comment.