1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

423 policy store (#471)

* fix log format

* update test
This commit is contained in:
Shivkumar Dudhani 2019-11-13 13:21:00 -08:00 committed by GitHub
parent 7a12e12cb5
commit 765a17df03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 7 deletions

View file

@ -57,11 +57,8 @@ func (ws *WebhookServer) HandleMutation(request *v1beta1.AdmissionRequest, polic
return true, nil, ""
}
//TODO: check if resource gvk is available in raw resource,
//TODO: check if the name and namespace is also passed right in the resource?
// if not then set it from the api request
resource.SetGroupVersionKind(schema.GroupVersionKind{Group: request.Kind.Group, Version: request.Kind.Version, Kind: request.Kind.Kind})
var engineResponses []engine.EngineResponse
policyContext := engine.PolicyContext{
NewResource: *resource,

View file

@ -66,12 +66,10 @@ func (ws *WebhookServer) HandleValidation(request *v1beta1.AdmissionRequest, pol
ClusterRoles: clusterRoles,
AdmissionUserInfo: request.UserInfo},
}
var engineResponses []engine.EngineResponse
for _, policy := range policies {
glog.V(2).Infof("Handling validation for Kind=%s, Namespace=%s Name=%s UID=%s patchOperation=%s",
newR.GetKind(), newR.GetNamespace(), newR.GetName(), request.UID, request.Operation)
policyContext.Policy = policy
engineResponse := engine.Validate(policyContext)
if reflect.DeepEqual(engineResponse, engine.EngineResponse{}) {
@ -87,7 +85,7 @@ func (ws *WebhookServer) HandleValidation(request *v1beta1.AdmissionRequest, pol
continue
}
}
glog.V(4).Infof("eval: %v %s/%s/%s %v", time.Since(evalTime), request.Kind, request.Namespace, request.Name, toBlockResource(engineResponses))
glog.V(4).Infof("eval: %v %s/%s/%s ", time.Since(evalTime), request.Kind, request.Namespace, request.Name)
// report time
reportTime := time.Now()
// ADD EVENTS
@ -114,6 +112,6 @@ func (ws *WebhookServer) HandleValidation(request *v1beta1.AdmissionRequest, pol
ws.pvGenerator.Add(pvInfos...)
sendStat(false)
// report time end
glog.V(4).Infof("report: %v %s/%s/%s %v", time.Since(reportTime), request.Kind, request.Namespace, request.Name, toBlockResource(engineResponses))
glog.V(4).Infof("report: %v %s/%s/%s", time.Since(reportTime), request.Kind, request.Namespace, request.Name)
return true, ""
}