(c *config.Config, stopCh <-chan struct{})
| 140 | } |
| 141 | |
| 142 | func 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 | } |
no test coverage detected