Skip to content

Commit

Permalink
Rebase hybrid proxy onto event-driven proxy code
Browse files Browse the repository at this point in the history
This commit moves the hybrid proxier onto the event-driven model adopted
upstream by the iptables and userspace proxiers.
  • Loading branch information
DirectXMan12 committed Jul 31, 2017
1 parent 7a48deb commit eb2f419
Show file tree
Hide file tree
Showing 3 changed files with 714 additions and 604 deletions.
67 changes: 34 additions & 33 deletions pkg/cmd/server/kubernetes/node/node.go
Expand Up @@ -13,8 +13,8 @@ import (
dockerclient "github.com/fsouza/go-dockerclient"
"github.com/golang/glog"

// "github.com/openshift/origin/pkg/proxy/hybrid"
// "github.com/openshift/origin/pkg/proxy/unidler"
"github.com/openshift/origin/pkg/proxy/hybrid"
"github.com/openshift/origin/pkg/proxy/unidler"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilnet "k8s.io/apimachinery/pkg/util/net"
utilwait "k8s.io/apimachinery/pkg/util/wait"
Expand Down Expand Up @@ -430,37 +430,38 @@ func (c *NodeConfig) RunProxy() {
c.ProxyConfig.ConfigSyncPeriod.Duration,
)

// if c.EnableUnidling {
// unidlingLoadBalancer := userspace.NewLoadBalancerRR()
// signaler := unidler.NewEventSignaler(recorder)
// unidlingUserspaceProxy, err := unidler.NewUnidlerProxier(unidlingLoadBalancer, bindAddr, iptInterface, execer, *portRange, c.ProxyConfig.IPTablesSyncPeriod.Duration, c.ProxyConfig.IPTablesMinSyncPeriod.Duration, c.ProxyConfig.UDPIdleTimeout.Duration, signaler)
// if err != nil {
// if c.Containerized {
// glog.Fatalf("error: Could not initialize Kubernetes Proxy: %v\n When running in a container, you must run the container in the host network namespace with --net=host and with --privileged", err)
// } else {
// glog.Fatalf("error: Could not initialize Kubernetes Proxy. You must run this process as root to use the service proxy: %v", err)
// }
// }
// hybridProxier, err := hybrid.NewHybridProxier(
// unidlingLoadBalancer,
// unidlingUserspaceProxy,
// endpointsHandler,
// proxier,
// servicesHandler,
// c.ProxyConfig.IPTablesSyncPeriod.Duration,
// c.InternalKubeInformers.Core().InternalVersion().Services().Lister(),
// )
// if err != nil {
// if c.Containerized {
// glog.Fatalf("error: Could not initialize Kubernetes Proxy: %v\n When running in a container, you must run the container in the host network namespace with --net=host and with --privileged", err)
// } else {
// glog.Fatalf("error: Could not initialize Kubernetes Proxy. You must run this process as root to use the service proxy: %v", err)
// }
// }
// endpointsHandler = hybridProxier
// servicesHandler = hybridProxier
// proxier = hybridProxier
// }
if c.EnableUnidling {
unidlingLoadBalancer := userspace.NewLoadBalancerRR()
signaler := unidler.NewEventSignaler(recorder)
unidlingUserspaceProxy, err := unidler.NewUnidlerProxier(unidlingLoadBalancer, bindAddr, iptInterface, execer, *portRange, c.ProxyConfig.IPTables.SyncPeriod.Duration, c.ProxyConfig.IPTables.MinSyncPeriod.Duration, c.ProxyConfig.UDPIdleTimeout.Duration, signaler)
if err != nil {
if c.Containerized {
glog.Fatalf("error: Could not initialize Kubernetes Proxy: %v\n When running in a container, you must run the container in the host network namespace with --net=host and with --privileged", err)
} else {
glog.Fatalf("error: Could not initialize Kubernetes Proxy. You must run this process as root to use the service proxy: %v", err)
}
}
hybridProxier, err := hybrid.NewHybridProxier(
unidlingLoadBalancer,
unidlingUserspaceProxy,
endpointsHandler,
servicesHandler,
proxier,
unidlingUserspaceProxy,
c.ProxyConfig.IPTables.SyncPeriod.Duration,
c.InternalKubeInformers.Core().InternalVersion().Services().Lister(),
)
if err != nil {
if c.Containerized {
glog.Fatalf("error: Could not initialize Kubernetes Proxy: %v\n When running in a container, you must run the container in the host network namespace with --net=host and with --privileged", err)
} else {
glog.Fatalf("error: Could not initialize Kubernetes Proxy. You must run this process as root to use the service proxy: %v", err)
}
}
endpointsHandler = hybridProxier
servicesHandler = hybridProxier
proxier = hybridProxier
}

iptInterface.AddReloadFunc(proxier.Sync)
serviceConfig.RegisterEventHandler(servicesHandler)
Expand Down

0 comments on commit eb2f419

Please sign in to comment.