diff --git a/api/kyverno/v1/clusterpolicy_test.go b/api/kyverno/v1/clusterpolicy_test.go index 11943d9a99..e5d922b3ea 100644 --- a/api/kyverno/v1/clusterpolicy_test.go +++ b/api/kyverno/v1/clusterpolicy_test.go @@ -24,7 +24,7 @@ func Test_ClusterPolicy_Name(t *testing.T) { } func Test_ClusterPolicy_IsNamespaced(t *testing.T) { - namespaced := ClusterPolicy{ + namespaced := Policy{ ObjectMeta: metav1.ObjectMeta{ Name: "this-is-a-way-too-long-policy-name-that-should-trigger-an-error-when-calling-the-policy-validation-method", Namespace: "abcd", diff --git a/api/kyverno/v1/clusterpolicy_types.go b/api/kyverno/v1/clusterpolicy_types.go index c2d2d7fbe2..dc5ac75a7f 100644 --- a/api/kyverno/v1/clusterpolicy_types.go +++ b/api/kyverno/v1/clusterpolicy_types.go @@ -96,7 +96,7 @@ func (p *ClusterPolicy) GetStatus() *PolicyStatus { // IsNamespaced indicates if the policy is namespace scoped func (p *ClusterPolicy) IsNamespaced() bool { - return p.GetNamespace() != "" + return false } // IsReady indicates if the policy is ready to serve the admission request @@ -119,7 +119,7 @@ func (p *ClusterPolicy) Validate(clusterResources sets.Set[string]) (errs field. } func (p *ClusterPolicy) GetKind() string { - return p.Kind + return "ClusterPolicy" } func (p *ClusterPolicy) CreateDeepCopy() PolicyInterface { diff --git a/api/kyverno/v1/policy_interface.go b/api/kyverno/v1/policy_interface.go index aec9b7ef2b..f1c70cc71a 100644 --- a/api/kyverno/v1/policy_interface.go +++ b/api/kyverno/v1/policy_interface.go @@ -11,7 +11,6 @@ import ( type PolicyInterface interface { metav1.Object BackgroundProcessingEnabled() bool - HasAutoGenAnnotation() bool IsNamespaced() bool GetSpec() *Spec GetStatus() *PolicyStatus diff --git a/api/kyverno/v1/policy_types.go b/api/kyverno/v1/policy_types.go index a0a73bcd06..aed1110500 100644 --- a/api/kyverno/v1/policy_types.go +++ b/api/kyverno/v1/policy_types.go @@ -120,7 +120,7 @@ func (p *Policy) Validate(clusterResources sets.Set[string]) (errs field.ErrorLi } func (p *Policy) GetKind() string { - return p.Kind + return "Policy" } func (p *Policy) CreateDeepCopy() PolicyInterface { diff --git a/api/kyverno/v2beta1/clusterpolicy_test.go b/api/kyverno/v2beta1/clusterpolicy_test.go index 7e2fad054d..51e8fbf8f3 100644 --- a/api/kyverno/v2beta1/clusterpolicy_test.go +++ b/api/kyverno/v2beta1/clusterpolicy_test.go @@ -25,7 +25,7 @@ func Test_ClusterPolicy_Name(t *testing.T) { } func Test_ClusterPolicy_IsNamespaced(t *testing.T) { - namespaced := ClusterPolicy{ + namespaced := Policy{ ObjectMeta: metav1.ObjectMeta{ Name: "this-is-a-way-too-long-policy-name-that-should-trigger-an-error-when-calling-the-policy-validation-method", Namespace: "abcd",