k8s.io/kubernetes@v1.31.0-alpha.0.0.20240520171757-56147500dadc/cmd/kube-controller-manager/app/networking.go (about) 1 /* 2 Copyright 2023 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 // Package app implements a server that runs a set of active 18 // components. This includes replication controllers, service endpoints and 19 // nodes. 20 package app 21 22 import ( 23 "context" 24 25 "k8s.io/component-base/featuregate" 26 "k8s.io/controller-manager/controller" 27 "k8s.io/kubernetes/cmd/kube-controller-manager/names" 28 "k8s.io/kubernetes/pkg/controller/servicecidrs" 29 "k8s.io/kubernetes/pkg/features" 30 ) 31 32 func newServiceCIDRsControllerDescriptor() *ControllerDescriptor { 33 return &ControllerDescriptor{ 34 name: names.ServiceCIDRController, 35 initFunc: startServiceCIDRsController, 36 requiredFeatureGates: []featuregate.Feature{ 37 features.MultiCIDRServiceAllocator, 38 }} 39 } 40 func startServiceCIDRsController(ctx context.Context, controllerContext ControllerContext, controllerName string) (controller.Interface, bool, error) { 41 go servicecidrs.NewController( 42 ctx, 43 controllerContext.InformerFactory.Networking().V1alpha1().ServiceCIDRs(), 44 controllerContext.InformerFactory.Networking().V1alpha1().IPAddresses(), 45 controllerContext.ClientBuilder.ClientOrDie("service-cidrs-controller"), 46 ).Run(ctx, 5) 47 // TODO use component config 48 return nil, true, nil 49 50 }