mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
return on delete request
This commit is contained in:
parent
35e0c7ca49
commit
fdfa074954
1 changed files with 6 additions and 7 deletions
|
@ -17,19 +17,18 @@ func (ws *WebhookServer) HandlePolicyValidation(request *v1beta1.AdmissionReques
|
|||
admissionResp := &v1beta1.AdmissionResponse{
|
||||
Allowed: true,
|
||||
}
|
||||
// nothing to do on DELETE
|
||||
if request.Operation == v1beta1.Delete {
|
||||
return admissionResp
|
||||
}
|
||||
|
||||
raw := request.Object.Raw
|
||||
if request.Operation == v1beta1.Delete {
|
||||
raw = request.OldObject.Raw
|
||||
}
|
||||
if err := json.Unmarshal(raw, &policy); err != nil {
|
||||
glog.Errorf("Failed to unmarshal policy admission request, err %v\n", err)
|
||||
return &v1beta1.AdmissionResponse{Allowed: false}
|
||||
}
|
||||
|
||||
if request.Operation != v1beta1.Delete {
|
||||
admissionResp = ws.validateUniqueRuleName(policy)
|
||||
}
|
||||
// check for uniqueness of rule names while CREATE/DELET
|
||||
admissionResp = ws.validateUniqueRuleName(policy)
|
||||
|
||||
if admissionResp.Allowed {
|
||||
ws.manageWebhookConfigurations(*policy, request.Operation)
|
||||
|
|
Loading…
Add table
Reference in a new issue