MCPcopy Index your code
hub / github.com/kubernetes/sample-controller / newController

Method newController

controller_test.go:87–110  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

85}
86
87func (f *fixture) newController(ctx context.Context) (*Controller, informers.SharedInformerFactory, kubeinformers.SharedInformerFactory) {
88 f.client = fake.NewClientset(f.objects...)
89 f.kubeclient = k8sfake.NewClientset(f.kubeobjects...)
90
91 i := informers.NewSharedInformerFactory(f.client, noResyncPeriodFunc())
92 k8sI := kubeinformers.NewSharedInformerFactory(f.kubeclient, noResyncPeriodFunc())
93
94 c := NewController(ctx, f.kubeclient, f.client,
95 k8sI.Apps().V1().Deployments(), i.Samplecontroller().V1alpha1().Foos())
96
97 c.foosSynced = alwaysReady
98 c.deploymentsSynced = alwaysReady
99 c.recorder = &record.FakeRecorder{}
100
101 for _, f := range f.fooLister {
102 i.Samplecontroller().V1alpha1().Foos().Informer().GetIndexer().Add(f)
103 }
104
105 for _, d := range f.deploymentLister {
106 k8sI.Apps().V1().Deployments().Informer().GetIndexer().Add(d)
107 }
108
109 return c, i, k8sI
110}
111
112func (f *fixture) run(ctx context.Context, fooRef cache.ObjectName) {
113 f.runController(ctx, fooRef, true, false)

Callers 1

runControllerMethod · 0.95

Calls 6

SamplecontrollerMethod · 0.95
NewClientsetFunction · 0.92
NewControllerFunction · 0.85
FoosMethod · 0.65
V1alpha1Method · 0.65
InformerMethod · 0.65

Tested by

no test coverage detected