Start NEG controller in main
@@ -50,6 +50,9 @@ import (
"k8s.io/ingress-gce/pkg/loadbalancers"
"k8s.io/ingress-gce/pkg/storage"
"k8s.io/ingress-gce/pkg/utils"
+
+ neg "k8s.io/ingress-gce/networkendpointgroup"
+
"k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/cloudprovider/providers/gce"
)
@@ -288,11 +291,10 @@ func main() {
// Create fake cluster manager
clusterManager = controller.NewFakeClusterManager(*clusterName, controller.DefaultFirewallName).ClusterManager
}
-
- ctx := context.NewControllerContext(kubeClient, *watchNamespace, *resyncPeriod, false)
-
+ enableNEG := cloud.AlphaFeatureGate.Enabled(gce.AlphaFeatureNetworkEndpointGroup)
+ ctx := context.NewControllerContext(kubeClient, *watchNamespace, *resyncPeriod, enableNEG)
// Start loadbalancer controller
- lbc, err := controller.NewLoadBalancerController(kubeClient, ctx, clusterManager)
+ lbc, err := controller.NewLoadBalancerController(kubeClient, ctx, clusterManager, enableNEG)
if err != nil {
glog.Fatalf("%v", err)
}
@@ -301,6 +303,13 @@ func main() {
glog.V(3).Infof("Cluster name %+v", clusterManager.ClusterNamer.GetClusterName())
}
clusterManager.Init(&controller.GCETranslator{LoadBalancerController: lbc})
+
+ // Start NEG controller
+ if enableNEG {
+ negController, _ := neg.NewController(kubeClient, cloud, ctx, lbc.Translator, namer, *resyncPeriod)
+ go negController.Run(ctx.StopCh)
+ }
+
go registerHandlers(lbc)
go handleSigterm(lbc, *deleteAllOnQuit)
