Skip to content

Commit

Permalink
modify review problems
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Oct 30, 2020
1 parent 559e2cd commit 652190c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
14 changes: 12 additions & 2 deletions dist/images/start-ovn-monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@
set -euo pipefail
ENABLE_SSL=${ENABLE_SSL:-false}

function gen_conn_str {
t=$(echo -n "${NODE_IPS}" | sed 's/[[:space:]]//g' | sed 's/,/ /g')
if [[ "$ENABLE_SSL" == "false" ]]; then
x=$(for i in ${t}; do echo -n "tcp:[$i]:$1",; done| sed 's/,$//')
else
x=$(for i in ${t}; do echo -n "ssl:[$i]:$1",; done| sed 's/,$//')
fi
echo "$x"
}

if [[ "$ENABLE_SSL" == "false" ]]; then
export OVN_NB_DAEMON=$(ovn-nbctl --db=tcp:["${OVN_NB_SERVICE_HOST}"]:"${OVN_NB_SERVICE_PORT}" --pidfile --detach --overwrite-pidfile)
export OVN_NB_DAEMON=$(ovn-nbctl --db="$(gen_conn_str 6641)" --pidfile --detach --overwrite-pidfile)
else
export OVN_NB_DAEMON=$(ovn-nbctl -p /var/run/tls/key -c /var/run/tls/cert -C /var/run/tls/cacert --db=ssl:["${OVN_NB_SERVICE_HOST}"]:"${OVN_NB_SERVICE_PORT}" --pidfile --detach --overwrite-pidfile)
export OVN_NB_DAEMON=$(ovn-nbctl -p /var/run/tls/key -c /var/run/tls/cert -C /var/run/tls/cacert --db="$(gen_conn_str 6641)" --pidfile --detach --overwrite-pidfile)
fi

exec ./kube-ovn-monitor $@
7 changes: 4 additions & 3 deletions pkg/ipam/subnet.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package ipam

import (
"github.com/alauda/kube-ovn/pkg/util"
"net"
"sync"

"github.com/alauda/kube-ovn/pkg/util"
)

type Subnet struct {
Expand Down Expand Up @@ -97,13 +98,13 @@ func (subnet *Subnet) GetRandomAddress(podName string) (IP, string, error) {

func (subnet *Subnet) GetStaticAddress(podName string, ip IP, mac string, force bool) (IP, string, error) {
subnet.mutex.Lock()
subnet.mutex.Unlock()
defer subnet.mutex.Unlock()
if !subnet.CIDR.Contains(net.ParseIP(string(ip))) {
return ip, mac, OutOfRangeError
}

if mac == "" {
if m, ok := subnet.PodToMac[mac]; ok {
if m, ok := subnet.PodToMac[podName]; ok {
mac = m
} else {
mac = subnet.GetRandomMac(podName)
Expand Down
2 changes: 0 additions & 2 deletions pkg/ovnmonitor/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ func (e *Exporter) getOvnStatus() (bool, error) {
e.IncrementErrorCounter()
return false, err
}

klog.Infof("%s: getOvnStatus() completed GetProcessInfo(%s)", e.Client.System.ID, component)
}

return true, nil
Expand Down
2 changes: 0 additions & 2 deletions pkg/pinger/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ func (e *Exporter) getOvsStatus() (bool, error) {
e.IncrementErrorCounter()
return false, err
}

klog.Infof("%s: getOvsStatus() completed GetProcessInfo(%s)", e.Client.System.ID, component)
}

return true, nil
Expand Down

0 comments on commit 652190c

Please sign in to comment.