Skip to content

Commit fffeb25

Browse files
committed
feat: add job to collect daemonsets
1 parent 3471c99 commit fffeb25

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pkg/jobs/job_list.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,23 @@ func JobList() []Job {
152152
ch <- jobResult
153153
},
154154
},
155+
{
156+
Name: "daemonsets-list",
157+
Timeout: time.Second * 10,
158+
Execute: func(dc *data_collector.DataCollector, ctx context.Context, ch chan JobResult) {
159+
jobResult := JobResult{Files: make(map[string][]byte), Error: nil}
160+
for _, namespace := range dc.Namespaces {
161+
result, err := dc.K8sCoreClientSet.AppsV1().DaemonSets(namespace).List(ctx, metav1.ListOptions{})
162+
if err != nil {
163+
dc.Logger.Printf("\tCould not retrieve daemonsets list for namespace %s: %v\n", namespace, err)
164+
} else {
165+
jsonResult, _ := json.MarshalIndent(result, "", " ")
166+
jobResult.Files[path.Join(dc.BaseDir, "resources", namespace, "daemonsets.json")] = jsonResult
167+
}
168+
}
169+
ch <- jobResult
170+
},
171+
},
155172
{
156173
Name: "replicaset-list",
157174
Timeout: time.Second * 10,

0 commit comments

Comments
 (0)