-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DO NOT MERGE] move openshift-sdn pod network setup to a CNI plugin #9981
Changes from all commits
4bdedd5
af14aa8
7ef5c3a
a8357ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ import ( | |
clientadapter "k8s.io/kubernetes/pkg/client/unversioned/adapters/internalclientset" | ||
"k8s.io/kubernetes/pkg/kubelet" | ||
"k8s.io/kubernetes/pkg/kubelet/dockertools" | ||
kubeletcni "k8s.io/kubernetes/pkg/kubelet/network/cni" | ||
kubeletserver "k8s.io/kubernetes/pkg/kubelet/server" | ||
kubelettypes "k8s.io/kubernetes/pkg/kubelet/types" | ||
kcrypto "k8s.io/kubernetes/pkg/util/crypto" | ||
|
@@ -77,7 +78,7 @@ type NodeConfig struct { | |
DNSServer *dns.Server | ||
|
||
// SDNPlugin is an optional SDN plugin | ||
SDNPlugin sdnpluginapi.OsdnNodePlugin | ||
SDNPlugin *sdnplugin.OsdnNode | ||
// EndpointsFilterer is an optional endpoints filterer | ||
FilteringEndpointsHandler sdnpluginapi.FilteringEndpointsConfigHandler | ||
} | ||
|
@@ -165,12 +166,6 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enable | |
} | ||
server.DockerExecHandlerName = string(options.DockerConfig.ExecHandlerName) | ||
|
||
if sdnplugin.IsOpenShiftNetworkPlugin(server.NetworkPluginName) { | ||
// set defaults for openshift-sdn | ||
server.HairpinMode = componentconfig.HairpinNone | ||
server.ConfigureCBR0 = false | ||
} | ||
|
||
// prevents kube from generating certs | ||
server.TLSCertFile = options.ServingInfo.ServerCert.CertFile | ||
server.TLSPrivateKeyFile = options.ServingInfo.ServerCert.KeyFile | ||
|
@@ -190,6 +185,23 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enable | |
return nil, err | ||
} | ||
|
||
// Initialize SDN before building kubelet config so it can modify options | ||
iptablesSyncPeriod, err := time.ParseDuration(options.IPTablesSyncPeriod) | ||
if err != nil { | ||
return nil, fmt.Errorf("Cannot parse the provided ip-tables sync period (%s) : %v", options.IPTablesSyncPeriod, err) | ||
} | ||
sdnPlugin, err := sdnplugin.NewNodePlugin(options.NetworkConfig.NetworkPluginName, originClient, kubeClient, options.NodeName, options.NodeIP, iptablesSyncPeriod, options.NetworkConfig.MTU, options.MasterKubeConfig) | ||
if err != nil { | ||
return nil, fmt.Errorf("SDN initialization failed: %v", err) | ||
} | ||
if sdnPlugin != nil { | ||
// SDN plugin pod setup/teardown is implemented as a CNI plugin | ||
server.NetworkPluginName = kubeletcni.CNIPluginName | ||
server.NetworkPluginDir = kubeletcni.DefaultNetDir | ||
server.HairpinMode = componentconfig.HairpinNone | ||
server.ConfigureCBR0 = false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. HairpinMode/ConfigureCBR0 aren't handled automatically for CNI? Or even if not for CNI, we should check what the current state of them is; I know there have been some adjustments to when hairping mode gets set upstream. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CNI doesn't do anything with hairpin, because there's no way to know what kind of network setup the CNI plugin is going to do. It might use a Linux bridge (and thus need hairpin mode) or it might not (like openshift-sdn). So for the moment we still need to set that, until we can figure out how to handle it for CNI or turn it off there and require plugins to handle it themselves. |
||
} | ||
|
||
deps, err := kubeletapp.UnsecuredKubeletDeps(server) | ||
if err != nil { | ||
return nil, err | ||
|
@@ -250,18 +262,6 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enable | |
deps.TLSOptions = nil | ||
} | ||
|
||
iptablesSyncPeriod, err := time.ParseDuration(options.IPTablesSyncPeriod) | ||
if err != nil { | ||
return nil, fmt.Errorf("Cannot parse the provided ip-tables sync period (%s) : %v", options.IPTablesSyncPeriod, err) | ||
} | ||
sdnPlugin, err := sdnplugin.NewNodePlugin(options.NetworkConfig.NetworkPluginName, originClient, kubeClient, options.NodeName, options.NodeIP, iptablesSyncPeriod, options.NetworkConfig.MTU) | ||
if err != nil { | ||
return nil, fmt.Errorf("SDN initialization failed: %v", err) | ||
} | ||
if sdnPlugin != nil { | ||
deps.NetworkPlugins = append(deps.NetworkPlugins, sdnPlugin) | ||
} | ||
|
||
endpointFilter, err := sdnplugin.NewProxyPlugin(options.NetworkConfig.NetworkPluginName, originClient, kubeClient) | ||
if err != nil { | ||
return nil, fmt.Errorf("SDN proxy initialization failed: %v", err) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this (and a few other things like deleting
contrib/systemd/docker-sdn-ovs.conf
) should be in the previous commit