Skip to content

Commit

Permalink
use constant instead a string
Browse files Browse the repository at this point in the history
  • Loading branch information
pengbinbin1 committed Oct 22, 2021
1 parent ee19ab6 commit b31c4d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/controller/election.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"time"

"github.com/kubeovn/kube-ovn/pkg/util"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clientset "k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -99,7 +100,7 @@ func setupLeaderElection(config *leaderElectionConfig) *leaderelection.LeaderEle
}

broadcaster := record.NewBroadcaster()
hostname := os.Getenv("KUBE_NODE_NAME")
hostname := os.Getenv(util.HostnameEnv)

recorder := broadcaster.NewRecorder(scheme.Scheme, apiv1.EventSource{
Component: ovnLeaderElector,
Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ func (c *Controller) getPolicyRouting(subnet *kubeovnv1.Subnet) ([]netlink.Rule,
return nil, nil, err
}

hostname := os.Getenv("KUBE_NODE_NAME")
hostname := os.Getenv(util.HostnameEnv)
for _, pod := range pods {
if pod.Spec.HostNetwork ||
pod.Status.PodIP == "" ||
Expand Down

0 comments on commit b31c4d1

Please sign in to comment.