Skip to content

Commit

Permalink
fix: add default excludeIps and check kern version
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Aug 19, 2019
1 parent a08d7b9 commit 7e2bdf5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
7 changes: 7 additions & 0 deletions dist/images/start-ovs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/bash
set -euo pipefail

# https://bugs.launchpad.net/neutron/+bug/1776778
if grep -q "3.10.0-862" /proc/version
then
echo "kernel version 3.10.0-862 has a nat related bug that will affect ovs function, please update to a version grate than 3.10.0-898"
exit 1
fi

# wait for ovn-sb ready
function wait_ovn_sb {
if [[ -z "${OVN_SB_SERVICE_HOST}}" ]]; then
Expand Down
22 changes: 19 additions & 3 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package controller

import (
"fmt"
"net"
"reflect"

kubeovnv1 "github.com/alauda/kube-ovn/pkg/apis/kubeovn/v1"
"github.com/alauda/kube-ovn/pkg/ovs"
"github.com/alauda/kube-ovn/pkg/util"
"net"
"reflect"

v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -234,6 +233,23 @@ func formatSubnet(subnet *kubeovnv1.Subnet, c *Controller) error {
changed = true
}

if len(subnet.Spec.ExcludeIps) == 0 {
subnet.Spec.ExcludeIps = []string{subnet.Spec.Gateway}
changed = true
} else {
gwExists := false
for _, ip := range ovs.ExpandExcludeIPs(subnet.Spec.ExcludeIps) {
if ip == subnet.Spec.Gateway {
gwExists = true
break
}
}
if !gwExists {
subnet.Spec.ExcludeIps = append(subnet.Spec.ExcludeIps, subnet.Spec.Gateway)
changed = true
}
}

if changed {
subnet, err = c.config.KubeOvnClient.KubeovnV1().Subnets().Update(subnet)
if err != nil {
Expand Down

0 comments on commit 7e2bdf5

Please sign in to comment.