Merge pull request #52935 from m1093782566/ipv6

Automatic merge from submit-queue (batch tested with PRs 53454, 53446, 52935, 53443, 52917). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove ipv4 constraint of Node IPs in ipvs proxier

**What this PR does / why we need it**:

We are targeting to IPV6. So, we should remove ipv4 constraint of Node IPs in ipvs proxier.

Besides, adding some log messages.


**Which issue this PR fixes**:

xref #51866 

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue
2017-10-05 05:06:27 -07:00
committed by GitHub
4 changed files with 97 additions and 43 deletions

View File

@@ -35,6 +35,7 @@ import (
clientv1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
utilfeature "k8s.io/apiserver/pkg/util/feature"
@@ -155,17 +156,17 @@ func (r *realIPGetter) NodeIPs() (ips []net.IP, err error) {
}
intf, err := net.InterfaceByName(name)
if err != nil {
utilruntime.HandleError(fmt.Errorf("Failed to get interface by name: %s, error: %v", name, err))
continue
}
addrs, err := intf.Addrs()
if err != nil {
utilruntime.HandleError(fmt.Errorf("Failed to get addresses from interface: %s, error: %v", name, err))
continue
}
for _, a := range addrs {
if ipnet, ok := a.(*net.IPNet); ok {
if ipnet.IP.To4() != nil {
ips = append(ips, ipnet.IP.To4())
}
ips = append(ips, ipnet.IP)
}
}
}