MCPcopy
hub / github.com/kubewall/kubewall / NewJobsHandler

Function NewJobsHandler

backend/handlers/workloads/jobs/jobs.go:41–62  ·  view source on GitHub ↗
(ctx context.Context, config, cluster string, container container.Container)

Source from the content-addressed store, hash-verified

39}
40
41func NewJobsHandler(ctx context.Context, config, cluster string, container container.Container) *JobsHandler {
42 informer := container.SharedInformerFactory(config, cluster).Batch().V1().Jobs().Informer()
43 informer.SetTransform(helpers.StripUnusedFields)
44
45 handler := &JobsHandler{
46 BaseHandler: base.BaseHandler{
47 Kind: "Job",
48 Container: container,
49 RestClient: container.ClientSet(config, cluster).BatchV1().RESTClient(),
50 Informer: informer,
51 QueryConfig: config,
52 QueryCluster: cluster,
53 InformerCacheKey: fmt.Sprintf("%s-%s-jobsInformer", config, cluster),
54 TransformFunc: transformItems,
55 },
56 }
57
58 cache := base.ResourceEventHandler[*batchV1.Job](&handler.BaseHandler)
59 handler.BaseHandler.StartInformer(cache)
60 handler.BaseHandler.WaitForSync(ctx)
61 return handler
62}
63
64func transformItems(items []any, b *base.BaseHandler) ([]byte, error) {
65 var jobList []batchV1.Job

Callers 1

NewJobsRouteHandlerFunction · 0.85

Calls 4

StartInformerMethod · 0.80
WaitForSyncMethod · 0.80
SharedInformerFactoryMethod · 0.65
ClientSetMethod · 0.65

Tested by

no test coverage detected