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

remove rule name in failure even info

This commit is contained in:
Shuting Zhao 2019-07-19 17:52:24 -07:00
parent 9f157544c9
commit 9fd59297f8
4 changed files with 6 additions and 6 deletions

View file

@ -29,7 +29,7 @@ func Mutate(policy kubepolicy.Policy, rawResource []byte, gvk metav1.GroupVersio
overlayPatches, err := ProcessOverlay(rule, rawResource, gvk)
if err != nil {
ri.Fail()
ri.Addf("Rule %s: Overlay application has failed, err %s.", rule.Name, err)
ri.Addf("overlay application has failed, err %v.", err)
} else {
// Apply the JSON patches from the rule to the resource
rawResource, err = ApplyPatches(rawResource, overlayPatches)
@ -49,14 +49,14 @@ func Mutate(policy kubepolicy.Policy, rawResource []byte, gvk metav1.GroupVersio
if len(errs) > 0 {
ri.Fail()
for _, err := range errs {
ri.Addf("Rule %s: Patches application has failed, err %s.", rule.Name, err)
ri.Addf("patches application has failed, err %v.", err)
}
} else {
// Apply the JSON patches from the rule to the resource
rawResource, err = ApplyPatches(rawResource, rulePatches)
if err != nil {
ri.Fail()
ri.Addf("Unable to apply JSON patch to resource, err %s.", err)
ri.Addf("Unable to apply JSON patch to resource, err %v.", err)
} else {
ri.Addf("Rule %s: Patches succesfully applied.", rule.Name)
allPatches = append(allPatches, rulePatches...)

View file

@ -41,7 +41,7 @@ func Validate(policy kubepolicy.Policy, rawResource []byte, gvk metav1.GroupVers
err := validateResourceWithPattern(resource, rule.Validation.Pattern)
if err != nil {
ri.Fail()
ri.Addf("Rule %s: Validation has failed, err %s.", rule.Name, err)
ri.Addf("validation has failed, err %v.", err)
} else {
ri.Addf("Rule %s: Validation succesfully.", rule.Name)

View file

@ -59,7 +59,7 @@ func (ws *WebhookServer) HandleMutation(request *v1beta1.AdmissionRequest) *v1be
if !policyInfo.IsSuccessful() {
glog.Infof("Failed to apply policy %s on resource %s/%s", policy.Name, rname, rns)
for _, r := range ruleInfos {
glog.Warning(r.Msgs)
glog.Warningf("%s: %s\n", r.Name, r.Msgs)
}
} else {
// // CleanUp Violations if exists

View file

@ -65,7 +65,7 @@ func (ws *WebhookServer) HandleValidation(request *v1beta1.AdmissionRequest) *v1
if !policyInfo.IsSuccessful() {
glog.Infof("Failed to apply policy %s on resource %s/%s", policy.Name, rname, rns)
for _, r := range ruleInfos {
glog.Warning(r.Msgs)
glog.Warningf("%s: %s\n", r.Name, r.Msgs)
}
} else {
// CleanUp Violations if exists