mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
fix: remove unused type TargetMutation (#3706)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
This commit is contained in:
parent
cf86887d55
commit
75e300799a
9 changed files with 34 additions and 61 deletions
|
@ -225,7 +225,7 @@ type Mutation struct {
|
||||||
|
|
||||||
// Targets defines the target resources to be mutated.
|
// Targets defines the target resources to be mutated.
|
||||||
// +optional
|
// +optional
|
||||||
Targets []TargetMutation `json:"targets,omitempty" yaml:"targets,omitempty"`
|
Targets []ResourceSpec `json:"targets,omitempty" yaml:"targets,omitempty"`
|
||||||
|
|
||||||
// PatchStrategicMerge is a strategic merge patch used to modify resources.
|
// PatchStrategicMerge is a strategic merge patch used to modify resources.
|
||||||
// See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
|
// See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
|
||||||
|
@ -243,12 +243,6 @@ type Mutation struct {
|
||||||
ForEachMutation []ForEachMutation `json:"foreach,omitempty" yaml:"foreach,omitempty"`
|
ForEachMutation []ForEachMutation `json:"foreach,omitempty" yaml:"foreach,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TargetMutation struct {
|
|
||||||
// ResourceSpec specifies the target resource information.
|
|
||||||
// +optional
|
|
||||||
ResourceSpec `json:",omitempty" yaml:",omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Mutation) GetPatchStrategicMerge() apiextensions.JSON {
|
func (m *Mutation) GetPatchStrategicMerge() apiextensions.JSON {
|
||||||
return FromJSON(m.RawPatchStrategicMerge)
|
return FromJSON(m.RawPatchStrategicMerge)
|
||||||
}
|
}
|
||||||
|
|
|
@ -742,7 +742,7 @@ func (in *Mutation) DeepCopyInto(out *Mutation) {
|
||||||
*out = *in
|
*out = *in
|
||||||
if in.Targets != nil {
|
if in.Targets != nil {
|
||||||
in, out := &in.Targets, &out.Targets
|
in, out := &in.Targets, &out.Targets
|
||||||
*out = make([]TargetMutation, len(*in))
|
*out = make([]ResourceSpec, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
if in.RawPatchStrategicMerge != nil {
|
if in.RawPatchStrategicMerge != nil {
|
||||||
|
@ -1106,22 +1106,6 @@ func (in *StaticKeyAttestor) DeepCopy() *StaticKeyAttestor {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *TargetMutation) DeepCopyInto(out *TargetMutation) {
|
|
||||||
*out = *in
|
|
||||||
out.ResourceSpec = in.ResourceSpec
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetMutation.
|
|
||||||
func (in *TargetMutation) DeepCopy() *TargetMutation {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(TargetMutation)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *UserInfo) DeepCopyInto(out *UserInfo) {
|
func (in *UserInfo) DeepCopyInto(out *UserInfo) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
|
@ -1094,6 +1094,7 @@ spec:
|
||||||
targets:
|
targets:
|
||||||
description: Targets defines the target resources to be mutated.
|
description: Targets defines the target resources to be mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
@ -2630,6 +2631,7 @@ spec:
|
||||||
targets:
|
targets:
|
||||||
description: Targets defines the target resources to be mutated.
|
description: Targets defines the target resources to be mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
@ -4877,6 +4879,7 @@ spec:
|
||||||
targets:
|
targets:
|
||||||
description: Targets defines the target resources to be mutated.
|
description: Targets defines the target resources to be mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
@ -6413,6 +6416,7 @@ spec:
|
||||||
targets:
|
targets:
|
||||||
description: Targets defines the target resources to be mutated.
|
description: Targets defines the target resources to be mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
|
|
@ -1751,6 +1751,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
@ -4226,6 +4228,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
|
|
@ -1752,6 +1752,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
@ -4228,6 +4230,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
|
|
@ -1768,6 +1768,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
@ -4243,6 +4245,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
@ -7608,6 +7612,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
@ -10084,6 +10090,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
|
|
@ -1757,6 +1757,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
@ -4232,6 +4234,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
@ -7573,6 +7577,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
@ -10049,6 +10055,8 @@ spec:
|
||||||
description: Targets defines the target resources to be
|
description: Targets defines the target resources to be
|
||||||
mutated.
|
mutated.
|
||||||
items:
|
items:
|
||||||
|
description: ResourceSpec contains information to identify
|
||||||
|
a resource.
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: APIVersion specifies resource apiVersion.
|
description: APIVersion specifies resource apiVersion.
|
||||||
|
|
|
@ -1879,8 +1879,8 @@ Optional. Defaults to “false” if not specified.</p>
|
||||||
<td>
|
<td>
|
||||||
<code>targets</code></br>
|
<code>targets</code></br>
|
||||||
<em>
|
<em>
|
||||||
<a href="#kyverno.io/v1.TargetMutation">
|
<a href="#kyverno.io/v1.ResourceSpec">
|
||||||
[]TargetMutation
|
[]ResourceSpec
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
</td>
|
</td>
|
||||||
|
@ -2418,7 +2418,7 @@ ResourceDescription
|
||||||
<a href="#kyverno.io/v1.GenerateRequestSpec">GenerateRequestSpec</a>,
|
<a href="#kyverno.io/v1.GenerateRequestSpec">GenerateRequestSpec</a>,
|
||||||
<a href="#kyverno.io/v1.GenerateRequestStatus">GenerateRequestStatus</a>,
|
<a href="#kyverno.io/v1.GenerateRequestStatus">GenerateRequestStatus</a>,
|
||||||
<a href="#kyverno.io/v1.Generation">Generation</a>,
|
<a href="#kyverno.io/v1.Generation">Generation</a>,
|
||||||
<a href="#kyverno.io/v1.TargetMutation">TargetMutation</a>)
|
<a href="#kyverno.io/v1.Mutation">Mutation</a>)
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<p>ResourceSpec contains information to identify a resource.</p>
|
<p>ResourceSpec contains information to identify a resource.</p>
|
||||||
|
@ -2826,39 +2826,6 @@ If not provided, the system roots are used.</p>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<hr />
|
<hr />
|
||||||
<h3 id="kyverno.io/v1.TargetMutation">TargetMutation
|
|
||||||
</h3>
|
|
||||||
<p>
|
|
||||||
(<em>Appears on:</em>
|
|
||||||
<a href="#kyverno.io/v1.Mutation">Mutation</a>)
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
</p>
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead class="thead-dark">
|
|
||||||
<tr>
|
|
||||||
<th>Field</th>
|
|
||||||
<th>Description</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>ResourceSpec</code></br>
|
|
||||||
<em>
|
|
||||||
<a href="#kyverno.io/v1.ResourceSpec">
|
|
||||||
ResourceSpec
|
|
||||||
</a>
|
|
||||||
</em>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<em>(Optional)</em>
|
|
||||||
<p>ResourceSpec specifies the target resource information.</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<hr />
|
|
||||||
<h3 id="kyverno.io/v1.UserInfo">UserInfo
|
<h3 id="kyverno.io/v1.UserInfo">UserInfo
|
||||||
</h3>
|
</h3>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||||
)
|
)
|
||||||
|
|
||||||
func loadTargets(logger logr.Logger, targets []kyverno.TargetMutation, ctx *PolicyContext) ([]unstructured.Unstructured, error) {
|
func loadTargets(logger logr.Logger, targets []kyverno.ResourceSpec, ctx *PolicyContext) ([]unstructured.Unstructured, error) {
|
||||||
targetObjects := make([]unstructured.Unstructured, len(targets))
|
targetObjects := make([]unstructured.Unstructured, len(targets))
|
||||||
var errors []error
|
var errors []error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue