mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
feat: add generateExisting field under the generate rule (#10441)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
This commit is contained in:
parent
19b71d746c
commit
846439b13e
15 changed files with 310 additions and 114 deletions
|
@ -656,6 +656,11 @@ func (v *ForEachValidation) SetAnyPattern(in apiextensions.JSON) {
|
|||
|
||||
// Generation defines how new resources should be created and managed.
|
||||
type Generation struct {
|
||||
// GenerateExisting controls whether to trigger the rule in existing resources
|
||||
// If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
// +optional
|
||||
GenerateExisting *bool `json:"generateExisting,omitempty" yaml:"generateExisting,omitempty"`
|
||||
|
||||
// ResourceSpec contains information to select the resource.
|
||||
ResourceSpec `json:",omitempty" yaml:",omitempty"`
|
||||
|
||||
|
@ -690,6 +695,10 @@ type Generation struct {
|
|||
CloneList CloneList `json:"cloneList,omitempty" yaml:"cloneList,omitempty"`
|
||||
}
|
||||
|
||||
func (g *Generation) IsGenerateExisting() *bool {
|
||||
return g.GenerateExisting
|
||||
}
|
||||
|
||||
type CloneList struct {
|
||||
// Namespace specifies source resource namespace.
|
||||
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||
|
|
|
@ -111,9 +111,7 @@ type Spec struct {
|
|||
// +optional
|
||||
GenerateExistingOnPolicyUpdate *bool `json:"generateExistingOnPolicyUpdate,omitempty" yaml:"generateExistingOnPolicyUpdate,omitempty"`
|
||||
|
||||
// GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
// If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
// Defaults to "false" if not specified.
|
||||
// Deprecated, use generateExisting under the generate rule instead
|
||||
// +optional
|
||||
GenerateExisting bool `json:"generateExisting,omitempty" yaml:"generateExisting,omitempty"`
|
||||
|
||||
|
@ -251,6 +249,14 @@ func (s *Spec) GetMutateExistingOnPolicyUpdate() bool {
|
|||
|
||||
// IsGenerateExisting return GenerateExisting set value
|
||||
func (s *Spec) IsGenerateExisting() bool {
|
||||
for _, rule := range s.Rules {
|
||||
if rule.HasGenerate() {
|
||||
isGenerateExisting := rule.Generation.IsGenerateExisting()
|
||||
if isGenerateExisting != nil && *isGenerateExisting {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
if s.GenerateExistingOnPolicyUpdate != nil && *s.GenerateExistingOnPolicyUpdate {
|
||||
return true
|
||||
}
|
||||
|
@ -307,8 +313,15 @@ func (s *Spec) ValidateRules(path *field.Path, namespaced bool, policyNamespace
|
|||
}
|
||||
|
||||
func (s *Spec) validateDeprecatedFields(path *field.Path) (errs field.ErrorList) {
|
||||
if s.GenerateExistingOnPolicyUpdate != nil && s.GenerateExisting {
|
||||
errs = append(errs, field.Forbidden(path.Child("generateExistingOnPolicyUpdate"), "remove the deprecated field and use generateExisting instead"))
|
||||
for _, rule := range s.Rules {
|
||||
if rule.HasGenerate() && rule.Generation.IsGenerateExisting() != nil {
|
||||
if s.GenerateExistingOnPolicyUpdate != nil {
|
||||
errs = append(errs, field.Forbidden(path.Child("generateExistingOnPolicyUpdate"), "remove the deprecated field and use spec.generate[*].generateExisting instead"))
|
||||
}
|
||||
if s.GenerateExisting {
|
||||
errs = append(errs, field.Forbidden(path.Child("generateExisting"), "remove the deprecated field and use spec.generate[*].generateExisting instead"))
|
||||
}
|
||||
}
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
|
|
@ -637,6 +637,11 @@ func (in *ForEachValidation) DeepCopy() *ForEachValidation {
|
|||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Generation) DeepCopyInto(out *Generation) {
|
||||
*out = *in
|
||||
if in.GenerateExisting != nil {
|
||||
in, out := &in.GenerateExisting, &out.GenerateExisting
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
out.ResourceSpec = in.ResourceSpec
|
||||
if in.RawData != nil {
|
||||
in, out := &in.RawData, &out.RawData
|
||||
|
|
|
@ -71,10 +71,7 @@ type Spec struct {
|
|||
// +optional
|
||||
GenerateExistingOnPolicyUpdate *bool `json:"generateExistingOnPolicyUpdate,omitempty" yaml:"generateExistingOnPolicyUpdate,omitempty"`
|
||||
|
||||
// GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
// If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
// Defaults to "false" if not specified.
|
||||
// +optional
|
||||
// Deprecated, use generateExisting under the generate rule instead
|
||||
GenerateExisting bool `json:"generateExisting,omitempty" yaml:"generateExisting,omitempty"`
|
||||
|
||||
// UseServerSideApply controls whether to use server-side apply for generate rules
|
||||
|
@ -218,6 +215,14 @@ func (s *Spec) GetMutateExistingOnPolicyUpdate() bool {
|
|||
|
||||
// IsGenerateExisting return GenerateExisting set value
|
||||
func (s *Spec) IsGenerateExisting() bool {
|
||||
for _, rule := range s.Rules {
|
||||
if rule.HasGenerate() {
|
||||
isGenerateExisting := rule.Generation.IsGenerateExisting()
|
||||
if isGenerateExisting != nil && *isGenerateExisting {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
if s.GenerateExistingOnPolicyUpdate != nil && *s.GenerateExistingOnPolicyUpdate {
|
||||
return true
|
||||
}
|
||||
|
@ -263,8 +268,15 @@ func (s *Spec) ValidateRules(path *field.Path, namespaced bool, policyNamespace
|
|||
}
|
||||
|
||||
func (s *Spec) ValidateDeprecatedFields(path *field.Path) (errs field.ErrorList) {
|
||||
if s.GenerateExistingOnPolicyUpdate != nil && s.GenerateExisting {
|
||||
errs = append(errs, field.Forbidden(path.Child("generateExistingOnPolicyUpdate"), "remove the deprecated field and use generateExisting instead"))
|
||||
for _, rule := range s.Rules {
|
||||
if rule.HasGenerate() && rule.Generation.IsGenerateExisting() != nil {
|
||||
if s.GenerateExistingOnPolicyUpdate != nil {
|
||||
errs = append(errs, field.Forbidden(path.Child("generateExistingOnPolicyUpdate"), "remove the deprecated field and use spec.generate[*].generateExisting instead"))
|
||||
}
|
||||
if s.GenerateExisting {
|
||||
errs = append(errs, field.Forbidden(path.Child("generateExisting"), "remove the deprecated field and use spec.generate[*].generateExisting instead"))
|
||||
}
|
||||
}
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
|
|
@ -123,10 +123,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -1086,6 +1084,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -5304,6 +5307,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -8679,10 +8687,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -9440,6 +9446,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -13606,6 +13617,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
|
|
@ -124,10 +124,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -1087,6 +1085,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -5306,6 +5309,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -8682,10 +8690,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -9443,6 +9449,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -13609,6 +13620,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
|
|
@ -117,10 +117,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -1080,6 +1078,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -5298,6 +5301,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -8673,10 +8681,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -9434,6 +9440,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -13600,6 +13611,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
|
|
@ -118,10 +118,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -1081,6 +1079,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -5300,6 +5303,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -8676,10 +8684,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -9437,6 +9443,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -13603,6 +13614,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
|
|
@ -117,10 +117,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -1080,6 +1078,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -5298,6 +5301,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -8673,10 +8681,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -9434,6 +9440,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -13600,6 +13611,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
|
|
@ -118,10 +118,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -1081,6 +1079,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -5300,6 +5303,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -8676,10 +8684,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -9437,6 +9443,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -13603,6 +13614,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
|
|
@ -10324,10 +10324,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -11287,6 +11285,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -15505,6 +15508,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -18880,10 +18888,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -19641,6 +19647,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -23807,6 +23818,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -27465,10 +27481,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -28428,6 +28442,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -32647,6 +32666,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -36023,10 +36047,8 @@ spec:
|
|||
- Fail
|
||||
type: string
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.
|
||||
description: Deprecated, use generateExisting under the generate rule
|
||||
instead
|
||||
type: boolean
|
||||
generateExistingOnPolicyUpdate:
|
||||
description: Deprecated, use generateExisting instead
|
||||
|
@ -36784,6 +36806,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
@ -40950,6 +40977,11 @@ spec:
|
|||
At most one of Data or Clone must be specified. If neither are provided, the generated
|
||||
resource will be created with default data only.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
generateExisting:
|
||||
description: |-
|
||||
GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.
|
||||
type: boolean
|
||||
kind:
|
||||
description: Kind specifies resource kind.
|
||||
type: string
|
||||
|
|
|
@ -274,9 +274,7 @@ bool
|
|||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to “true” generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to “false” if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -552,9 +550,7 @@ bool
|
|||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to “true” generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to “false” if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1932,6 +1928,19 @@ Kubernetes apiextensions/v1.JSON
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>generateExisting</code><br/>
|
||||
<em>
|
||||
bool
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to “true” the rule will be triggered and applied to existing matched resources.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>ResourceSpec</code><br/>
|
||||
<em>
|
||||
<a href="#kyverno.io/v1.ResourceSpec">
|
||||
|
@ -4046,9 +4055,7 @@ bool
|
|||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to “true” generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to “false” if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -8809,10 +8816,7 @@ bool
|
|||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to “true” generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to “false” if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -9086,10 +9090,7 @@ bool
|
|||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to “true” generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to “false” if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -10483,10 +10484,7 @@ bool
|
|||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to “true” generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to “false” if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -482,9 +482,7 @@ Default value is "false".</p>
|
|||
<td>
|
||||
|
||||
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
|
||||
|
||||
|
||||
|
@ -1046,9 +1044,7 @@ Default value is "false".</p>
|
|||
<td>
|
||||
|
||||
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
|
||||
|
||||
|
||||
|
@ -3878,6 +3874,34 @@ must be satisfied for the validation rule to succeed.</p>
|
|||
|
||||
|
||||
|
||||
<tr>
|
||||
<td><code>generateExisting</code>
|
||||
|
||||
</br>
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-family: monospace">bool</span>
|
||||
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
|
||||
<p>GenerateExisting controls whether to trigger the rule in existing resources
|
||||
If is set to "true" the rule will be triggered and applied to existing matched resources.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td><code>ResourceSpec</code>
|
||||
|
||||
|
@ -8004,9 +8028,7 @@ Default value is "false".</p>
|
|||
<td>
|
||||
|
||||
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1069,6 +1069,8 @@ Default value is "false".</p>
|
|||
<tr>
|
||||
<td><code>generateExisting</code>
|
||||
|
||||
<span style="color:blue;"> *</span>
|
||||
|
||||
</br>
|
||||
|
||||
|
||||
|
@ -1081,9 +1083,7 @@ Default value is "false".</p>
|
|||
<td>
|
||||
|
||||
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
|
||||
|
||||
|
||||
|
@ -1632,6 +1632,8 @@ Default value is "false".</p>
|
|||
<tr>
|
||||
<td><code>generateExisting</code>
|
||||
|
||||
<span style="color:blue;"> *</span>
|
||||
|
||||
</br>
|
||||
|
||||
|
||||
|
@ -1644,9 +1646,7 @@ Default value is "false".</p>
|
|||
<td>
|
||||
|
||||
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
|
||||
|
||||
|
||||
|
@ -4412,6 +4412,8 @@ Default value is "false".</p>
|
|||
<tr>
|
||||
<td><code>generateExisting</code>
|
||||
|
||||
<span style="color:blue;"> *</span>
|
||||
|
||||
</br>
|
||||
|
||||
|
||||
|
@ -4424,9 +4426,7 @@ Default value is "false".</p>
|
|||
<td>
|
||||
|
||||
|
||||
<p>GenerateExisting controls whether to trigger generate rule in existing resources
|
||||
If is set to "true" generate rule will be triggered and applied to existing matched resources.
|
||||
Defaults to "false" if not specified.</p>
|
||||
<p>Deprecated, use generateExisting under the generate rule instead</p>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import (
|
|||
// GenerationApplyConfiguration represents an declarative configuration of the Generation type for use
|
||||
// with apply.
|
||||
type GenerationApplyConfiguration struct {
|
||||
GenerateExisting *bool `json:"generateExisting,omitempty"`
|
||||
*ResourceSpecApplyConfiguration `json:"ResourceSpec,omitempty"`
|
||||
Synchronize *bool `json:"synchronize,omitempty"`
|
||||
OrphanDownstreamOnPolicyDelete *bool `json:"orphanDownstreamOnPolicyDelete,omitempty"`
|
||||
|
@ -40,6 +41,14 @@ func Generation() *GenerationApplyConfiguration {
|
|||
return &GenerationApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithGenerateExisting sets the GenerateExisting field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the GenerateExisting field is set to the value of the last call.
|
||||
func (b *GenerationApplyConfiguration) WithGenerateExisting(value bool) *GenerationApplyConfiguration {
|
||||
b.GenerateExisting = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||
|
|
Loading…
Reference in a new issue