@@ -99,6 +99,7 @@ func (srv webHookServer) serve(w http.ResponseWriter, r *http.Request) {
9999
100100}
101101
102+ // This handles the admission review sent by k8s and mutates the pod
102103func (srv webHookServer ) mutate (ar * v1beta1.AdmissionReview ) * v1beta1.AdmissionResponse {
103104 req := ar .Request
104105
@@ -121,7 +122,9 @@ func (srv webHookServer) mutate(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionR
121122 log .Infof ("AdmissionReview for Kind=%v, Namespace=%v Name=%v UID=%v patchOperation=%v UserInfo=%v" ,
122123 ownerKind , req .Namespace , ownerName , req .UID , req .Operation , req .UserInfo )
123124
125+ // 'binds' is the list of database credential bindings
124126 binds , err := srv .bindings .List ()
127+ log .Info (" -----> Database bindings: %+v" , binds )
125128 if err != nil {
126129 return & v1beta1.AdmissionResponse {
127130 Result : & metav1.Status {
@@ -138,6 +141,7 @@ func (srv webHookServer) mutate(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionR
138141 }
139142 }
140143
144+ // TODO: This is were we build database bindings for the pod
141145 databases := matchBindings (filteredBindings , pod .Spec .ServiceAccountName )
142146 if len (databases ) == 0 {
143147 log .Infof ("Skipping mutation for %s/%s due to policy check" , req .Namespace , ownerName )
@@ -176,6 +180,7 @@ func filterBindings(bindings []v1alpha1.DatabaseCredentialBinding, namespace str
176180 return filteredBindings
177181}
178182
183+ // TODO: This is were we build database bindings for the pod
179184func matchBindings (bindings []v1alpha1.DatabaseCredentialBinding , serviceAccount string ) []database {
180185 matchedBindings := []database {}
181186 for _ , binding := range bindings {
0 commit comments