Skip to content

Commit edddaaf

Browse files
Merge pull request #20556 from deads2k/controller-03-networking
switch networking to external types
2 parents 684d27b + e1285a5 commit edddaaf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+313
-323
lines changed

api/protobuf-spec/github_com_openshift_api_webconsole_v1.proto

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glide.lock

+10-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cmd/openshift-controller-manager/controller/interfaces.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313

1414
appsclient "github.com/openshift/client-go/apps/clientset/versioned"
1515
appsinformer "github.com/openshift/client-go/apps/informers/externalversions"
16+
networkclientinternal "github.com/openshift/client-go/network/clientset/versioned"
17+
networkinformer "github.com/openshift/client-go/network/informers/externalversions"
1618
routeinformer "github.com/openshift/client-go/route/informers/externalversions"
1719
securityv1client "github.com/openshift/client-go/security/clientset/versioned"
1820
authorizationinformer "github.com/openshift/origin/pkg/authorization/generated/informers/internalversion"
@@ -21,8 +23,6 @@ import (
2123
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config"
2224
imageinformer "github.com/openshift/origin/pkg/image/generated/informers/internalversion"
2325
imageclientinternal "github.com/openshift/origin/pkg/image/generated/internalclientset"
24-
networkinformer "github.com/openshift/origin/pkg/network/generated/informers/internalversion"
25-
networkclientinternal "github.com/openshift/origin/pkg/network/generated/internalclientset"
2626
quotainformer "github.com/openshift/origin/pkg/quota/generated/informers/internalversion"
2727
quotaclient "github.com/openshift/origin/pkg/quota/generated/internalclientset"
2828
securityinformer "github.com/openshift/origin/pkg/security/generated/informers/internalversion"
@@ -41,7 +41,7 @@ type ControllerContext struct {
4141

4242
InternalBuildInformers buildinformer.SharedInformerFactory
4343
InternalImageInformers imageinformer.SharedInformerFactory
44-
InternalNetworkInformers networkinformer.SharedInformerFactory
44+
NetworkInformers networkinformer.SharedInformerFactory
4545
InternalTemplateInformers templateinformer.SharedInformerFactory
4646
InternalQuotaInformers quotainformer.SharedInformerFactory
4747
InternalAuthorizationInformers authorizationinformer.SharedInformerFactory
@@ -90,8 +90,8 @@ type ControllerClientBuilder interface {
9090
OpenshiftInternalQuotaClient(name string) (quotaclient.Interface, error)
9191
OpenshiftInternalQuotaClientOrDie(name string) quotaclient.Interface
9292

93-
OpenshiftInternalNetworkClient(name string) (networkclientinternal.Interface, error)
94-
OpenshiftInternalNetworkClientOrDie(name string) networkclientinternal.Interface
93+
OpenshiftNetworkClient(name string) (networkclientinternal.Interface, error)
94+
OpenshiftNetworkClientOrDie(name string) networkclientinternal.Interface
9595

9696
OpenshiftInternalSecurityClient(name string) (securityclient.Interface, error)
9797
OpenshiftInternalSecurityClientOrDie(name string) securityclient.Interface
@@ -232,22 +232,22 @@ func (b OpenshiftControllerClientBuilder) OpenshiftInternalQuotaClientOrDie(name
232232
return client
233233
}
234234

235-
// OpenshiftInternalNetworkClient provides a REST client for the network API.
235+
// OpenshiftNetworkClient provides a REST client for the network API.
236236
// If the client cannot be created because of configuration error, this function
237237
// will error.
238-
func (b OpenshiftControllerClientBuilder) OpenshiftInternalNetworkClient(name string) (networkclientinternal.Interface, error) {
238+
func (b OpenshiftControllerClientBuilder) OpenshiftNetworkClient(name string) (networkclientinternal.Interface, error) {
239239
clientConfig, err := b.Config(name)
240240
if err != nil {
241241
return nil, err
242242
}
243243
return networkclientinternal.NewForConfig(clientConfig)
244244
}
245245

246-
// OpenshiftInternalNetworkClientOrDie provides a REST client for the network API.
246+
// OpenshiftNetworkClientOrDie provides a REST client for the network API.
247247
// If the client cannot be created because of configuration error, this function
248248
// will panic.
249-
func (b OpenshiftControllerClientBuilder) OpenshiftInternalNetworkClientOrDie(name string) networkclientinternal.Interface {
250-
client, err := b.OpenshiftInternalNetworkClient(name)
249+
func (b OpenshiftControllerClientBuilder) OpenshiftNetworkClientOrDie(name string) networkclientinternal.Interface {
250+
client, err := b.OpenshiftNetworkClient(name)
251251
if err != nil {
252252
glog.Fatal(err)
253253
}

pkg/cmd/openshift-controller-manager/controller/network_sdn.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ func RunSDNController(ctx ControllerContext) (bool, error) {
1515

1616
if err := sdnmaster.Start(
1717
ctx.OpenshiftControllerConfig.Network,
18-
ctx.ClientBuilder.OpenshiftInternalNetworkClientOrDie(bootstrappolicy.InfraSDNControllerServiceAccountName),
18+
ctx.ClientBuilder.OpenshiftNetworkClientOrDie(bootstrappolicy.InfraSDNControllerServiceAccountName),
1919
ctx.ClientBuilder.ClientOrDie(bootstrappolicy.InfraSDNControllerServiceAccountName),
2020
ctx.KubernetesInformers,
21-
ctx.InternalNetworkInformers,
21+
ctx.NetworkInformers,
2222
); err != nil {
2323
return false, fmt.Errorf("failed to start SDN plugin controller: %v", err)
2424
}

pkg/cmd/openshift-controller-manager/controller_manager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func newControllerContext(
143143
InternalAuthorizationInformers: originInformers.GetInternalOpenshiftAuthorizationInformers(),
144144
InternalBuildInformers: originInformers.GetInternalOpenshiftBuildInformers(),
145145
InternalImageInformers: originInformers.GetInternalOpenshiftImageInformers(),
146-
InternalNetworkInformers: originInformers.GetInternalOpenshiftNetworkInformers(),
146+
NetworkInformers: originInformers.GetOpenshiftNetworkInformers(),
147147
InternalQuotaInformers: originInformers.GetInternalOpenshiftQuotaInformers(),
148148
InternalSecurityInformers: originInformers.GetInternalOpenshiftSecurityInformers(),
149149
InternalRouteInformers: originInformers.GetOpenshiftRouteInformers(),

pkg/cmd/server/kubernetes/network/network_config.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ import (
1818
"k8s.io/kubernetes/pkg/proxy/apis/kubeproxyconfig"
1919
proxyconfig "k8s.io/kubernetes/pkg/proxy/config"
2020

21+
networkclient "github.com/openshift/client-go/network/clientset/versioned"
22+
networkinformers "github.com/openshift/client-go/network/informers/externalversions"
2123
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config"
2224
"github.com/openshift/origin/pkg/cmd/server/kubernetes/network/transport"
2325
"github.com/openshift/origin/pkg/dns"
2426
"github.com/openshift/origin/pkg/network"
25-
networkinformers "github.com/openshift/origin/pkg/network/generated/informers/internalversion"
26-
networkclient "github.com/openshift/origin/pkg/network/generated/internalclientset"
2727
)
2828

2929
// NetworkConfig represents the required parameters to start OpenShift networking
@@ -35,8 +35,8 @@ type NetworkConfig struct {
3535
ExternalKubeClientset kclientsetexternal.Interface
3636
// Internal kubernetes shared informer factory.
3737
InternalKubeInformers kinternalinformers.SharedInformerFactory
38-
// Internal network shared informer factory.
39-
InternalNetworkInformers networkinformers.SharedInformerFactory
38+
// Network shared informer factory.
39+
NetworkInformers networkinformers.SharedInformerFactory
4040

4141
// ProxyConfig is the configuration for the kube-proxy, fully initialized
4242
ProxyConfig *kubeproxyconfig.KubeProxyConfiguration
@@ -118,9 +118,9 @@ func New(options configapi.NodeConfig, clusterDomain string, proxyConfig *kubepr
118118
}
119119

120120
if network.IsOpenShiftNetworkPlugin(options.NetworkConfig.NetworkPluginName) {
121-
config.InternalNetworkInformers = networkinformers.NewSharedInformerFactory(networkClient, network.DefaultInformerResyncPeriod)
121+
config.NetworkInformers = networkinformers.NewSharedInformerFactory(networkClient, network.DefaultInformerResyncPeriod)
122122

123-
config.SDNNode, config.SDNProxy, err = NewSDNInterfaces(options, networkClient, kubeClient, internalKubeClient, internalKubeInformers, config.InternalNetworkInformers, proxyConfig)
123+
config.SDNNode, config.SDNProxy, err = NewSDNInterfaces(options, networkClient, kubeClient, internalKubeClient, internalKubeInformers, config.NetworkInformers, proxyConfig)
124124
if err != nil {
125125
return nil, fmt.Errorf("SDN initialization failed: %v", err)
126126
}

pkg/cmd/server/kubernetes/network/sdn_linux.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
kinternalinformers "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion"
1313
"k8s.io/kubernetes/pkg/proxy/apis/kubeproxyconfig"
1414

15+
networkclient "github.com/openshift/client-go/network/clientset/versioned"
16+
networkinformers "github.com/openshift/client-go/network/informers/externalversions"
1517
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config"
16-
networkinformers "github.com/openshift/origin/pkg/network/generated/informers/internalversion"
17-
networkclient "github.com/openshift/origin/pkg/network/generated/internalclientset"
1818
sdnnode "github.com/openshift/origin/pkg/network/node"
1919
sdnproxy "github.com/openshift/origin/pkg/network/proxy"
2020
)

pkg/cmd/server/kubernetes/network/sdn_unsupported.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
kinternalinformers "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion"
1111
"k8s.io/kubernetes/pkg/proxy/apis/kubeproxyconfig"
1212

13+
networkclient "github.com/openshift/client-go/network/clientset/versioned"
14+
networkinformers "github.com/openshift/client-go/network/informers/externalversions"
1315
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config"
14-
networkinformers "github.com/openshift/origin/pkg/network/generated/informers/internalversion"
15-
networkclient "github.com/openshift/origin/pkg/network/generated/internalclientset"
1616
)
1717

1818
func NewSDNInterfaces(options configapi.NodeConfig, networkClient networkclient.Interface,

pkg/cmd/server/origin/informers.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"github.com/golang/glog"
1515
appsclient "github.com/openshift/client-go/apps/clientset/versioned"
1616
appsinformer "github.com/openshift/client-go/apps/informers/externalversions"
17+
networkclient "github.com/openshift/client-go/network/clientset/versioned"
18+
networkinformer "github.com/openshift/client-go/network/informers/externalversions"
1719
oauthclient "github.com/openshift/client-go/oauth/clientset/versioned"
1820
oauthinformer "github.com/openshift/client-go/oauth/informers/externalversions"
1921
routeclient "github.com/openshift/client-go/route/clientset/versioned"
@@ -26,8 +28,6 @@ import (
2628
buildclient "github.com/openshift/origin/pkg/build/generated/internalclientset"
2729
imageinformer "github.com/openshift/origin/pkg/image/generated/informers/internalversion"
2830
imageclient "github.com/openshift/origin/pkg/image/generated/internalclientset"
29-
networkinformer "github.com/openshift/origin/pkg/network/generated/informers/internalversion"
30-
networkclient "github.com/openshift/origin/pkg/network/generated/internalclientset"
3131
quotainformer "github.com/openshift/origin/pkg/quota/generated/informers/internalversion"
3232
quotaclient "github.com/openshift/origin/pkg/quota/generated/internalclientset"
3333
securityinformer "github.com/openshift/origin/pkg/security/generated/informers/internalversion"
@@ -233,7 +233,7 @@ func (i *informerHolder) GetInternalOpenshiftBuildInformers() buildinformer.Shar
233233
func (i *informerHolder) GetInternalOpenshiftImageInformers() imageinformer.SharedInformerFactory {
234234
return i.imageInformers
235235
}
236-
func (i *informerHolder) GetInternalOpenshiftNetworkInformers() networkinformer.SharedInformerFactory {
236+
func (i *informerHolder) GetOpenshiftNetworkInformers() networkinformer.SharedInformerFactory {
237237
return i.networkInformers
238238
}
239239
func (i *informerHolder) GetOpenshiftOauthInformers() oauthinformer.SharedInformerFactory {
@@ -289,7 +289,7 @@ func (i *informerHolder) ToGenericInformer() GenericResourceInformer {
289289
return i.GetInternalOpenshiftImageInformers().ForResource(resource)
290290
}),
291291
genericResourceInformerFunc(func(resource schema.GroupVersionResource) (kexternalinformers.GenericInformer, error) {
292-
return i.GetInternalOpenshiftNetworkInformers().ForResource(resource)
292+
return i.GetOpenshiftNetworkInformers().ForResource(resource)
293293
}),
294294
genericInternalResourceInformerFunc(func(resource schema.GroupVersionResource) (kexternalinformers.GenericInformer, error) {
295295
return i.GetOpenshiftOauthInformers().ForResource(resource)

pkg/cmd/server/origin/master_config.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
rbacauthorizer "k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac"
3131

3232
appsinformer "github.com/openshift/client-go/apps/informers/externalversions"
33+
networkinformer "github.com/openshift/client-go/network/informers/externalversions"
3334
oauthinformer "github.com/openshift/client-go/oauth/informers/externalversions"
3435
routeinformer "github.com/openshift/client-go/route/informers/externalversions"
3536
userinformer "github.com/openshift/client-go/user/informers/externalversions"
@@ -41,7 +42,6 @@ import (
4142
originrest "github.com/openshift/origin/pkg/cmd/server/origin/rest"
4243
imageadmission "github.com/openshift/origin/pkg/image/apiserver/admission/limitrange"
4344
imageinformer "github.com/openshift/origin/pkg/image/generated/informers/internalversion"
44-
networkinformer "github.com/openshift/origin/pkg/network/generated/informers/internalversion"
4545
_ "github.com/openshift/origin/pkg/printers/internalversion"
4646
projectauth "github.com/openshift/origin/pkg/project/auth"
4747
projectcache "github.com/openshift/origin/pkg/project/cache"
@@ -109,13 +109,13 @@ type InformerAccess interface {
109109

110110
GetOpenshiftAppInformers() appsinformer.SharedInformerFactory
111111
GetOpenshiftOauthInformers() oauthinformer.SharedInformerFactory
112+
GetOpenshiftNetworkInformers() networkinformer.SharedInformerFactory
112113
GetOpenshiftRouteInformers() routeinformer.SharedInformerFactory
113114
GetOpenshiftUserInformers() userinformer.SharedInformerFactory
114115

115116
GetInternalOpenshiftAuthorizationInformers() authorizationinformer.SharedInformerFactory
116117
GetInternalOpenshiftBuildInformers() buildinformer.SharedInformerFactory
117118
GetInternalOpenshiftImageInformers() imageinformer.SharedInformerFactory
118-
GetInternalOpenshiftNetworkInformers() networkinformer.SharedInformerFactory
119119
GetInternalOpenshiftQuotaInformers() quotainformer.SharedInformerFactory
120120
GetInternalOpenshiftSecurityInformers() securityinformer.SharedInformerFactory
121121
GetInternalOpenshiftTemplateInformers() templateinformer.SharedInformerFactory

pkg/cmd/server/start/start_node.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,8 @@ func StartNode(nodeConfig configapi.NodeConfig, components *utilflags.ComponentF
493493
}
494494

495495
networkConfig.InternalKubeInformers.Start(stopCh)
496-
if networkConfig.InternalNetworkInformers != nil {
497-
networkConfig.InternalNetworkInformers.Start(stopCh)
496+
if networkConfig.NetworkInformers != nil {
497+
networkConfig.NetworkInformers.Start(stopCh)
498498
}
499499

500500
return nil

pkg/network/apis/network/annotations.go

-5
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,3 @@ func SetChangePodNetworkAnnotation(netns *NetNamespace, action PodNetworkAction,
5858
}
5959
netns.Annotations[ChangePodNetworkAnnotation] = value
6060
}
61-
62-
// DeleteChangePodNetworkAnnotation removes network change intent from NetNamespace
63-
func DeleteChangePodNetworkAnnotation(netns *NetNamespace) {
64-
delete(netns.Annotations, ChangePodNetworkAnnotation)
65-
}

pkg/network/apis/network/plugin.go

-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
package network
22

33
const (
4-
// Pod annotations
5-
IngressBandwidthAnnotation = "kubernetes.io/ingress-bandwidth"
6-
EgressBandwidthAnnotation = "kubernetes.io/egress-bandwidth"
7-
AssignMacvlanAnnotation = "pod.network.openshift.io/assign-macvlan"
84

95
// HostSubnet annotations. (Note: should be "hostsubnet.network.openshift.io/", but the incorrect name is now part of the API.)
106
AssignHostSubnetAnnotation = "pod.network.openshift.io/assign-subnet"
11-
FixedVNIDHostAnnotation = "pod.network.openshift.io/fixed-vnid-host"
12-
NodeUIDAnnotation = "pod.network.openshift.io/node-uid"
13-
14-
// NetNamespace annotations
15-
MulticastEnabledAnnotation = "netnamespace.network.openshift.io/multicast-enabled"
167
)

0 commit comments

Comments
 (0)