MCPcopy Create free account
hub / github.com/cloudtty/cloudtty / StartControllers

Function StartControllers

cmd/app/cloudshell-manager.go:142–170  ·  view source on GitHub ↗
(c *config.Config, stopCh <-chan struct{})

Source from the content-addressed store, hash-verified

140}
141
142func StartControllers(c *config.Config, stopCh <-chan struct{}) error {
143 ownerExist, err := labels.NewRequirement(constants.WorkerOwnerLabelKey, selection.Exists, nil)
144 if err != nil {
145 return err
146 }
147
148 labelsSelector := labels.NewSelector().Add(*ownerExist)
149
150 factory := informers.NewSharedInformerFactoryWithOptions(c.KubeClient, 0,
151 informers.WithTweakListOptions(func(opts *metav1.ListOptions) {
152 opts.LabelSelector = labelsSelector.String()
153 }))
154
155 podInformer := factory.Core().V1().Pods()
156 pool := worerkpool.New(c.Client, c.CoreWorkerLimit, c.MaxWorkerLimit, podInformer)
157
158 informerFactory := externalversions.NewSharedInformerFactory(c.CloudShellClient, 0)
159 informer := informerFactory.Cloudshell().V1alpha1().CloudShells()
160 controller := controllers.New(c.Client, c.KubeClient, c.Kubeconfig, pool, c.CloudShellImage, c.NodeSelector, c.Resources, informer, podInformer)
161
162 factory.Start(stopCh)
163 informerFactory.Start(stopCh)
164
165 go pool.Run(stopCh)
166 go controller.Run(1, stopCh)
167
168 <-stopCh
169 return nil
170}

Callers 1

RunFunction · 0.85

Calls 10

CloudshellMethod · 0.95
StartMethod · 0.95
NewSharedInformerFactoryFunction · 0.92
NewFunction · 0.92
AddMethod · 0.65
CloudShellsMethod · 0.65
V1alpha1Method · 0.65
StartMethod · 0.65
StringMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected