@@ -203,6 +203,40 @@ func JobList() []Job {
203
203
ch <- jobResult
204
204
},
205
205
},
206
+ {
207
+ Name : "roles-list" ,
208
+ Timeout : time .Second * 10 ,
209
+ Execute : func (dc * data_collector.DataCollector , ctx context.Context , ch chan JobResult ) {
210
+ jobResult := JobResult {Files : make (map [string ][]byte ), Error : nil }
211
+ for _ , namespace := range dc .Namespaces {
212
+ result , err := dc .K8sCoreClientSet .RbacV1 ().Roles (namespace ).List (ctx , metav1.ListOptions {})
213
+ if err != nil {
214
+ dc .Logger .Printf ("\t Could not retrieve roles list for namespace %s: %v\n " , namespace , err )
215
+ } else {
216
+ jsonResult , _ := json .MarshalIndent (result , "" , " " )
217
+ jobResult .Files [path .Join (dc .BaseDir , "k8s" , "rbac" , namespace , "roles.json" )] = jsonResult
218
+ }
219
+ }
220
+ ch <- jobResult
221
+ },
222
+ },
223
+ {
224
+ Name : "rolebindings-list" ,
225
+ Timeout : time .Second * 10 ,
226
+ Execute : func (dc * data_collector.DataCollector , ctx context.Context , ch chan JobResult ) {
227
+ jobResult := JobResult {Files : make (map [string ][]byte ), Error : nil }
228
+ for _ , namespace := range dc .Namespaces {
229
+ result , err := dc .K8sCoreClientSet .RbacV1 ().RoleBindings (namespace ).List (ctx , metav1.ListOptions {})
230
+ if err != nil {
231
+ dc .Logger .Printf ("\t Could not retrieve role bindings list for namespace %s: %v\n " , namespace , err )
232
+ } else {
233
+ jsonResult , _ := json .MarshalIndent (result , "" , " " )
234
+ jobResult .Files [path .Join (dc .BaseDir , "k8s" , "rbac" , namespace , "rolebindings.json" )] = jsonResult
235
+ }
236
+ }
237
+ ch <- jobResult
238
+ },
239
+ },
206
240
{
207
241
Name : "k8s-version" ,
208
242
Timeout : time .Second * 10 ,
0 commit comments