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:
parent
85705a7fec
commit
a3bb168d9c
5 changed files with 5 additions and 6 deletions
|
@ -24,7 +24,7 @@ func Test_ClusterPolicy_Name(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_ClusterPolicy_IsNamespaced(t *testing.T) {
|
func Test_ClusterPolicy_IsNamespaced(t *testing.T) {
|
||||||
namespaced := ClusterPolicy{
|
namespaced := Policy{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "this-is-a-way-too-long-policy-name-that-should-trigger-an-error-when-calling-the-policy-validation-method",
|
Name: "this-is-a-way-too-long-policy-name-that-should-trigger-an-error-when-calling-the-policy-validation-method",
|
||||||
Namespace: "abcd",
|
Namespace: "abcd",
|
||||||
|
|
|
@ -96,7 +96,7 @@ func (p *ClusterPolicy) GetStatus() *PolicyStatus {
|
||||||
|
|
||||||
// IsNamespaced indicates if the policy is namespace scoped
|
// IsNamespaced indicates if the policy is namespace scoped
|
||||||
func (p *ClusterPolicy) IsNamespaced() bool {
|
func (p *ClusterPolicy) IsNamespaced() bool {
|
||||||
return p.GetNamespace() != ""
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsReady indicates if the policy is ready to serve the admission request
|
// 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 {
|
func (p *ClusterPolicy) GetKind() string {
|
||||||
return p.Kind
|
return "ClusterPolicy"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ClusterPolicy) CreateDeepCopy() PolicyInterface {
|
func (p *ClusterPolicy) CreateDeepCopy() PolicyInterface {
|
||||||
|
|
|
@ -11,7 +11,6 @@ import (
|
||||||
type PolicyInterface interface {
|
type PolicyInterface interface {
|
||||||
metav1.Object
|
metav1.Object
|
||||||
BackgroundProcessingEnabled() bool
|
BackgroundProcessingEnabled() bool
|
||||||
HasAutoGenAnnotation() bool
|
|
||||||
IsNamespaced() bool
|
IsNamespaced() bool
|
||||||
GetSpec() *Spec
|
GetSpec() *Spec
|
||||||
GetStatus() *PolicyStatus
|
GetStatus() *PolicyStatus
|
||||||
|
|
|
@ -120,7 +120,7 @@ func (p *Policy) Validate(clusterResources sets.Set[string]) (errs field.ErrorLi
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Policy) GetKind() string {
|
func (p *Policy) GetKind() string {
|
||||||
return p.Kind
|
return "Policy"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Policy) CreateDeepCopy() PolicyInterface {
|
func (p *Policy) CreateDeepCopy() PolicyInterface {
|
||||||
|
|
|
@ -25,7 +25,7 @@ func Test_ClusterPolicy_Name(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_ClusterPolicy_IsNamespaced(t *testing.T) {
|
func Test_ClusterPolicy_IsNamespaced(t *testing.T) {
|
||||||
namespaced := ClusterPolicy{
|
namespaced := Policy{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "this-is-a-way-too-long-policy-name-that-should-trigger-an-error-when-calling-the-policy-validation-method",
|
Name: "this-is-a-way-too-long-policy-name-that-should-trigger-an-error-when-calling-the-policy-validation-method",
|
||||||
Namespace: "abcd",
|
Namespace: "abcd",
|
||||||
|
|
Loading…
Add table
Reference in a new issue