wilfred-s commented on a change in pull request #324:
URL: 
https://github.com/apache/incubator-yunikorn-k8shim/pull/324#discussion_r737921596



##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -229,6 +239,8 @@ func (c *admissionController) validateConf(ar 
*v1beta1.AdmissionReview) *v1beta1
                                },
                        }
                }
+       } else {

Review comment:
       can we turn this around:
   ```
   if requestKind != "ConfigMap" {
   log <not a configmap>
   return <allowed response>
   }
   <check config map>
   ```

##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -72,16 +74,20 @@ func (c *admissionController) mutate(ar 
*v1beta1.AdmissionReview) *v1beta1.Admis
        namespace := ar.Request.Namespace
        var patch []patchOperation
 
-       if req.Kind.Kind == "Pod" {
+       var requestKind = req.Kind.Kind
+       var uid = string(req.UID)
+
+       if requestKind == "Pod" {
                log.Logger().Info("AdmissionReview",
                        zap.Any("Kind", req.Kind),

Review comment:
       This value is always "AdmissionReview" see 
https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#request
 details, lets remove this as we already have it 

##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -101,10 +107,16 @@ func (c *admissionController) mutate(ar 
*v1beta1.AdmissionReview) *v1beta1.Admis
 
                patch = updateSchedulerName(patch)
                patch = updateLabels(namespace, &pod, patch)
+               log.Logger().Info(fmt.Sprintf("generated patch for pod %s\n", 
pod.Name),
+                       zap.Any("patch", patch))
+       } else {

Review comment:
       can we turn this around:
   ```
   if requestKind != "Pod" {
   log <not a pod>
   return <allowed response>
   }
   <mutate pod>
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to