Skip to content

Commit

Permalink
Start NEG controller in main
Browse files Browse the repository at this point in the history
  • Loading branch information
freehan committed Oct 26, 2017
1 parent e47e18a commit 64c563a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions cmd/glbc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)

Expand Down

0 comments on commit 64c563a

Please sign in to comment.