forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sdn_linux.go
38 lines (33 loc) · 1.51 KB
/
sdn_linux.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package node
import (
"k8s.io/kubernetes/pkg/apis/componentconfig"
kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
kinternalinformers "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion"
osclient "github.com/openshift/origin/pkg/client"
configapi "github.com/openshift/origin/pkg/cmd/server/api"
"github.com/openshift/origin/pkg/network"
sdnnode "github.com/openshift/origin/pkg/network/node"
sdnproxy "github.com/openshift/origin/pkg/network/proxy"
)
func NewSDNInterfaces(options configapi.NodeConfig, originClient *osclient.Client, kubeClient kclientset.Interface, internalKubeInformers kinternalinformers.SharedInformerFactory, proxyconfig *componentconfig.KubeProxyConfiguration) (network.NodeInterface, network.ProxyInterface, error) {
node, err := sdnnode.New(&sdnnode.OsdnNodeConfig{
PluginName: options.NetworkConfig.NetworkPluginName,
Hostname: options.NodeName,
SelfIP: options.NodeIP,
RuntimeEndpoint: options.DockerConfig.DockerShimSocket,
MTU: options.NetworkConfig.MTU,
OSClient: originClient,
KClient: kubeClient,
KubeInformers: internalKubeInformers,
IPTablesSyncPeriod: proxyconfig.IPTables.SyncPeriod.Duration,
ProxyMode: proxyconfig.Mode,
})
if err != nil {
return nil, nil, err
}
proxy, err := sdnproxy.New(options.NetworkConfig.NetworkPluginName, originClient, kubeClient)
if err != nil {
return nil, nil, err
}
return node, proxy, nil
}