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

fix: couple of issues in policy interface (#6772)

* fix: couple of issues in policy interface

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-06-19 06:30:25 +02:00 committed by GitHub
parent 85705a7fec
commit a3bb168d9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 6 deletions

View file

@ -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",

View file

@ -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 {

View file

@ -11,7 +11,6 @@ import (
type PolicyInterface interface {
metav1.Object
BackgroundProcessingEnabled() bool
HasAutoGenAnnotation() bool
IsNamespaced() bool
GetSpec() *Spec
GetStatus() *PolicyStatus

View file

@ -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 {

View file

@ -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",