From f3ca1d78f116114b7e24e0cf947274aad4b374bd Mon Sep 17 00:00:00 2001 From: shuting <shutting06@gmail.com> Date: Thu, 8 Apr 2021 12:10:30 -0700 Subject: [PATCH] Fix log message (#1779) * update log message Signed-off-by: Shuting Zhao <shutting06@gmail.com> * update printer column - validation failure action Signed-off-by: Shuting Zhao <shutting06@gmail.com> --- charts/kyverno/crds/crds.yaml | 2 +- definitions/crds/kyverno.io_policies.yaml | 2 +- definitions/install.yaml | 2 +- definitions/install_debug.yaml | 2 +- pkg/api/kyverno/v1/policy_types.go | 2 +- pkg/policy/validate.go | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/charts/kyverno/crds/crds.yaml b/charts/kyverno/crds/crds.yaml index a23d37a7f3..8ba0095d19 100644 --- a/charts/kyverno/crds/crds.yaml +++ b/charts/kyverno/crds/crds.yaml @@ -1165,7 +1165,7 @@ spec: name: Background type: string - jsonPath: .spec.validationFailureAction - name: Validation Failure Action + name: Action type: string name: v1 schema: diff --git a/definitions/crds/kyverno.io_policies.yaml b/definitions/crds/kyverno.io_policies.yaml index 82bdcd892c..0744cf7459 100644 --- a/definitions/crds/kyverno.io_policies.yaml +++ b/definitions/crds/kyverno.io_policies.yaml @@ -23,7 +23,7 @@ spec: name: Background type: string - jsonPath: .spec.validationFailureAction - name: Validation Failure Action + name: Action type: string name: v1 schema: diff --git a/definitions/install.yaml b/definitions/install.yaml index f9a07e7185..be1c18a243 100644 --- a/definitions/install.yaml +++ b/definitions/install.yaml @@ -1170,7 +1170,7 @@ spec: name: Background type: string - jsonPath: .spec.validationFailureAction - name: Validation Failure Action + name: Action type: string name: v1 schema: diff --git a/definitions/install_debug.yaml b/definitions/install_debug.yaml index c6f74b27b3..a279164987 100755 --- a/definitions/install_debug.yaml +++ b/definitions/install_debug.yaml @@ -1170,7 +1170,7 @@ spec: name: Background type: string - jsonPath: .spec.validationFailureAction - name: Validation Failure Action + name: Action type: string name: v1 schema: diff --git a/pkg/api/kyverno/v1/policy_types.go b/pkg/api/kyverno/v1/policy_types.go index 80ba6eb926..460018cb55 100755 --- a/pkg/api/kyverno/v1/policy_types.go +++ b/pkg/api/kyverno/v1/policy_types.go @@ -21,7 +21,7 @@ type PolicyList struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="Background",type="string",JSONPath=".spec.background" -// +kubebuilder:printcolumn:name="Validation Failure Action",type="string",JSONPath=".spec.validationFailureAction" +// +kubebuilder:printcolumn:name="Action",type="string",JSONPath=".spec.validationFailureAction" // +kubebuilder:resource:shortName=pol type Policy struct { metav1.TypeMeta `json:",inline,omitempty" yaml:",inline,omitempty"` diff --git a/pkg/policy/validate.go b/pkg/policy/validate.go index 344cac673f..fee82629d9 100644 --- a/pkg/policy/validate.go +++ b/pkg/policy/validate.go @@ -153,10 +153,10 @@ func Validate(policy *kyverno.ClusterPolicy, client *dclient.Client, mock bool, obj.SetLabels(label) _, err = client.UpdateResource(obj.GetAPIVersion(), rule.Generation.Kind, rule.Generation.Clone.Namespace, obj, false) if err != nil { - log.Log.Error(err, "failed to update source name:%v namespace:%v kind:%v", obj.GetName(), obj.GetNamespace(), obj.GetKind()) + log.Log.Error(err, "failed to update source", "kind", obj.GetKind(), "name", obj.GetName(), "namespace", obj.GetNamespace()) continue } - log.Log.V(4).Info("updated source name:%v namespace:%v kind:%v", obj.GetName(), obj.GetNamespace(), obj.GetKind()) + log.Log.V(4).Info("updated source", "kind", obj.GetKind(), "name", obj.GetName(), "namespace", obj.GetNamespace()) } } }