Skip to content

Commit

Permalink
fix: lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Feb 24, 2021
1 parent d0d3e89 commit a537985
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (c *Controller) handleAddNode(key string) error {
}

// There is only one nodeAddr temp
nodeAddr := util.GetNodeInternalIP(node)
nodeAddr := util.GetNodeInternalIP(*node)
for _, ip := range strings.Split(ipStr, ",") {
if util.CheckProtocol(nodeAddr) == util.CheckProtocol(ip) {
err = c.ovnClient.AddStaticRoute("", nodeAddr, ip, c.config.ClusterRouter)
Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func NewController(config *Configuration, podInformerFactory informers.SharedInf
return nil, err
}
controller.protocol = util.CheckProtocol(node.Annotations[util.IpAddressAnnotation])
controller.internalIP = util.GetNodeInternalIP(node)
controller.internalIP = util.GetNodeInternalIP(*node)

controller.iptable = make(map[string]*iptables.IPTables)
controller.ipset = make(map[string]*ipsets.IPSets)
Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (c *Controller) setIptables() error {
return err
}

hostIP := util.GetNodeInternalIP(node)
hostIP := util.GetNodeInternalIP(*node)

var (
v4Rules = []util.IPTableRule{
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package util

import v1 "k8s.io/api/core/v1"

func GetNodeInternalIP(node *v1.Node) string {
func GetNodeInternalIP(node v1.Node) string {
var nodeAddr string
for _, addr := range node.Status.Addresses {
if addr.Type == v1.NodeInternalIP {
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var _ = Describe("[Service]", func() {
nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred())
for _, node := range nodes.Items {
nodeIP := util.GetNodeInternalIP(&node)
nodeIP := util.GetNodeInternalIP(node)
output, err := exec.Command(
"kubectl", "exec", "-n", "kube-system", pod.Name, "--",
"curl", "-s", "-w", "%{http_code}", fmt.Sprintf("%s:%d/metrics", nodeIP, hostService.Spec.Ports[0].NodePort), "-o", "/dev/null",
Expand All @@ -77,7 +77,7 @@ var _ = Describe("[Service]", func() {
nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred())
for _, node := range nodes.Items {
nodeIP := util.GetNodeInternalIP(&node)
nodeIP := util.GetNodeInternalIP(node)
output, err := exec.Command(
"kubectl", "exec", "-n", "kube-system", pod.Name, "--",
"curl", "-s", "-w", "%{http_code}", fmt.Sprintf("%s:%d/metrics", nodeIP, containerService.Spec.Ports[0].NodePort), "-o", "/dev/null",
Expand All @@ -104,7 +104,7 @@ var _ = Describe("[Service]", func() {
nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred())
for _, node := range nodes.Items {
nodeIP := util.GetNodeInternalIP(&node)
nodeIP := util.GetNodeInternalIP(node)
output, err := exec.Command(
"kubectl", "exec", "-n", "kube-system", pod.Name, "--",
"curl", "-s", "-w", "%{http_code}", fmt.Sprintf("%s:%d/metrics", nodeIP, containerService.Spec.Ports[0].NodePort), "-o", "/dev/null",
Expand All @@ -131,7 +131,7 @@ var _ = Describe("[Service]", func() {
nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred())
for _, node := range nodes.Items {
nodeIP := util.GetNodeInternalIP(&node)
nodeIP := util.GetNodeInternalIP(node)
output, err := exec.Command(
"kubectl", "exec", "-n", "kube-system", pod.Name, "--",
"curl", "-s", "-w", "%{http_code}", fmt.Sprintf("%s:%d/metrics", nodeIP, hostService.Spec.Ports[0].NodePort), "-o", "/dev/null",
Expand Down

0 comments on commit a537985

Please sign in to comment.