@@ -56,10 +56,10 @@ func (m *PodMutator) BackfillPermissions(ctx context.Context) {
5656 for i := 0 ; i < 5 ; i ++ {
5757 // fetch all pods with the "openfeature.dev/enabled" annotation set to "true"
5858 podList := & corev1.PodList {}
59- err := m .Client .List (context . Background () , podList , client.MatchingFields {"metadata.annotations.openfeature.dev/enabled" : "true" })
59+ err := m .Client .List (ctx , podList , client.MatchingFields {"metadata.annotations.openfeature.dev/enabled" : "true" })
6060 if err != nil {
6161 if ! goErr .Is (err , & cache.ErrCacheNotStarted {}) {
62- m .Log .Error (err , err . Error () )
62+ m .Log .Error (err , "unable to list annotated pods" , "webhook" , "metadata.annotations.openfeature.dev/enabled" )
6363 return
6464 }
6565 time .Sleep (1 * time .Second )
@@ -70,13 +70,22 @@ func (m *PodMutator) BackfillPermissions(ctx context.Context) {
7070 for _ , pod := range podList .Items {
7171 m .Log .V (1 ).Info (fmt .Sprintf ("backfilling permissions for pod %s/%s" , pod .Namespace , pod .Name ))
7272 if err := m .enableClusterRoleBinding (ctx , & pod ); err != nil {
73- m .Log .Error (err , err .Error ())
73+ m .Log .Error (
74+ err ,
75+ fmt .Sprintf ("unable backfill permissions for pod %s/%s" , pod .Namespace , pod .Name ),
76+ "webhook" ,
77+ "metadata.annotations.openfeature.dev/enabled" ,
78+ )
7479 }
7580 }
7681 return
7782 }
7883 err := goErr .New ("unable to backfill permissions for the flagd-kubernetes-sync role binding: timeout" )
79- m .Log .Error (err , err .Error ())
84+ m .Log .Error (
85+ err ,
86+ "webhook" ,
87+ "metadata.annotations.openfeature.dev/enabled" ,
88+ )
8089}
8190
8291// Handle injects the flagd sidecar (if the prerequisites are all met)
0 commit comments