Skip to content

Commit

Permalink
Use k8s hostname, fix #60
Browse files Browse the repository at this point in the history
  • Loading branch information
halfcrazy committed Jul 11, 2019
1 parent 0b0cce4 commit 1e5c9f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/election.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func setupLeaderElection(config *leaderElectionConfig) *leaderelection.LeaderEle
}

broadcaster := record.NewBroadcaster()
hostname, _ := os.Hostname()
hostname := os.Getenv("KUBE_NODE_NAME")

recorder := broadcaster.NewRecorder(scheme.Scheme, apiv1.EventSource{
Component: ovnLeaderElector,
Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ LOOP:

func (c *Controller) getLocalPodIPsNeedNAT() ([]string, error) {
var localPodIPs []string
hostname, _ := os.Hostname()
hostname := os.Getenv("KUBE_NODE_NAME")
allPods, err := c.podsLister.List(labels.Everything())
if err != nil {
klog.Errorf("list pods failed, %+v", err)
Expand Down
4 changes: 4 additions & 0 deletions yamls/kube-ovn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
readinessProbe:
exec:
command:
Expand Down

0 comments on commit 1e5c9f6

Please sign in to comment.