Skip to content

Commit

Permalink
Add exception to golint check
Browse files Browse the repository at this point in the history
(*) Fix cleanup of NodePort resources. (*) Fix the logic to select existing policies

Fix review comment

Fix Bazel

Update GoDep License

Fix NodePort forwarding to target port

Fix Darwin Build break. +1

Implement IsCompatible to validate kernel support for kernel mode
  • Loading branch information
madhanrm authored and Dinesh Govindasamy committed Sep 18, 2017
1 parent 63020d5 commit a8d797a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 46 deletions.
31 changes: 1 addition & 30 deletions Godeps/LICENSES

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions cmd/kube-proxy/app/BUILD
Expand Up @@ -11,10 +11,8 @@ go_library(
srcs = [
"conntrack.go",
"server.go",
"server_others.go",
] + select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"server_linux.go",
],
"@io_bazel_rules_go//go/platform:windows_amd64": [
"server_windows.go",
],
Expand All @@ -37,6 +35,7 @@ go_library(
"//pkg/proxy/ipvs:go_default_library",
"//pkg/proxy/userspace:go_default_library",
"//pkg/util/configz:go_default_library",
"//pkg/util/dbus:go_default_library",
"//pkg/util/iptables:go_default_library",
"//pkg/util/ipvs:go_default_library",
"//pkg/util/mount:go_default_library",
Expand All @@ -55,6 +54,8 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer/json:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//vendor/k8s.io/apiserver/pkg/server/healthz:go_default_library",
Expand All @@ -64,20 +65,12 @@ go_library(
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
"//vendor/k8s.io/client-go/tools/clientcmd/api:go_default_library",
"//vendor/k8s.io/client-go/tools/record:go_default_library",
"//vendor/k8s.io/utils/exec:go_default_library",
] + select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"//pkg/util/dbus:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//vendor/k8s.io/utils/exec:go_default_library",
],
"@io_bazel_rules_go//go/platform:windows_amd64": [
"//pkg/proxy/winkernel:go_default_library",
"//pkg/proxy/winuserspace:go_default_library",
"//pkg/util/netsh:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//vendor/k8s.io/utils/exec:go_default_library",
],
"//conditions:default": [],
}),
Expand Down
Expand Up @@ -51,6 +51,7 @@ import (
"github.com/golang/glog"
)

// NewProxyServer returns a new ProxyServer.
func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndExit bool, scheme *runtime.Scheme, master string) (*ProxyServer, error) {
if config == nil {
return nil, errors.New("config is required")
Expand Down
1 change: 1 addition & 0 deletions hack/.golint_failures
Expand Up @@ -301,6 +301,7 @@ pkg/proxy
pkg/proxy/iptables
pkg/proxy/userspace
pkg/proxy/util
pkg/proxy/winkernel
pkg/proxy/winuserspace
pkg/quota/evaluator/core
pkg/quota/generic
Expand Down
16 changes: 12 additions & 4 deletions pkg/proxy/winkernel/proxier.go
Expand Up @@ -65,8 +65,12 @@ func CanUseWinKernelProxier(kcompat KernelCompatTester) (bool, error) {

type WindowsKernelCompatTester struct{}

// Todo : Fix the below API to query the OS version
// IsCompatible returns true if winkernel can support this mode of proxy
func (lkct WindowsKernelCompatTester) IsCompatible() error {
_, err := hcsshim.HNSListPolicyListRequest()
if err != nil {
return fmt.Errorf("Windows kernel is not compatible for Kernel mode")
}
return nil
}

Expand Down Expand Up @@ -531,6 +535,10 @@ func (svcInfo *serviceInfo) deleteAllHnsLoadBalancerPolicy() {
// Remove the Hns Policy corresponding to this service
deleteHnsLoadBalancerPolicy(svcInfo.hnsID)
svcInfo.hnsID = ""

deleteHnsLoadBalancerPolicy(svcInfo.nodePorthnsID)
svcInfo.nodePorthnsID = ""

for _, externalIp := range svcInfo.externalIPs {
deleteHnsLoadBalancerPolicy(externalIp.hnsID)
externalIp.hnsID = ""
Expand Down Expand Up @@ -576,7 +584,7 @@ func getHnsLoadBalancer(endpoints []hcsshim.HNSEndpoint, isILB bool, vip string,
}
if elbPolicy.Protocol == protocol && elbPolicy.InternalPort == internalPort && elbPolicy.ExternalPort == externalPort && elbPolicy.ILB == isILB {
if len(vip) > 0 {
if len(elbPolicy.VIPs) > 0 && elbPolicy.VIPs[0] != vip {
if len(elbPolicy.VIPs) == 0 || elbPolicy.VIPs[0] != vip {
continue
}
}
Expand Down Expand Up @@ -1049,7 +1057,7 @@ func (proxier *Proxier) syncProxyRules() {
false,
"", // VIP has to be empty to automatically select the nodeIP
Enum(svcInfo.protocol),
uint16(svcInfo.port),
uint16(svcInfo.targetPort),
uint16(svcInfo.nodePort),
)
if err != nil {
Expand All @@ -1058,7 +1066,7 @@ func (proxier *Proxier) syncProxyRules() {
}

svcInfo.nodePorthnsID = hnsLoadBalancer.ID
glog.V(3).Infof("Hns LoadBalancer resource created for cluster ip resources %v, Id [%s]", svcInfo.clusterIP, hnsLoadBalancer.ID)
glog.V(3).Infof("Hns LoadBalancer resource created for nodePort resources %v, Id [%s]", svcInfo.clusterIP, hnsLoadBalancer.ID)
}

// Create a Load Balancer Policy for each external IP
Expand Down

0 comments on commit a8d797a

Please sign in to comment.