mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 10:28:36 +00:00
feat: use pointer in rule (generate field) (#11076)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
parent
bcf6075fd1
commit
12edb6d405
2 changed files with 7 additions and 3 deletions
|
@ -60,7 +60,7 @@ type Rule struct {
|
|||
|
||||
// Generation is used to create new resources.
|
||||
// +optional
|
||||
Generation kyvernov1.Generation `json:"generate,omitempty"`
|
||||
Generation *kyvernov1.Generation `json:"generate,omitempty"`
|
||||
|
||||
// VerifyImages is used to verify image signatures and mutate them to add a digest
|
||||
// +optional
|
||||
|
@ -134,7 +134,7 @@ func (r *Rule) HasValidate() bool {
|
|||
|
||||
// HasGenerate checks for generate rule
|
||||
func (r *Rule) HasGenerate() bool {
|
||||
return !datautils.DeepEqual(r.Generation, kyvernov1.Generation{})
|
||||
return r.Generation != nil && !datautils.DeepEqual(*r.Generation, kyvernov1.Generation{})
|
||||
}
|
||||
|
||||
// ValidateRuleType checks only one type of rule is defined per rule
|
||||
|
|
|
@ -744,7 +744,11 @@ func (in *Rule) DeepCopyInto(out *Rule) {
|
|||
}
|
||||
in.Mutation.DeepCopyInto(&out.Mutation)
|
||||
in.Validation.DeepCopyInto(&out.Validation)
|
||||
in.Generation.DeepCopyInto(&out.Generation)
|
||||
if in.Generation != nil {
|
||||
in, out := &in.Generation, &out.Generation
|
||||
*out = new(v1.Generation)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.VerifyImages != nil {
|
||||
in, out := &in.VerifyImages, &out.VerifyImages
|
||||
*out = make([]ImageVerification, len(*in))
|
||||
|
|
Loading…
Add table
Reference in a new issue