1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +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:
Charles-Edouard Brétéché 2022-04-28 08:05:13 +02:00 committed by GitHub
parent cf86887d55
commit 75e300799a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 61 deletions

View file

@ -225,7 +225,7 @@ type Mutation struct {
// Targets defines the target resources to be mutated.
// +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.
// 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"`
}
type TargetMutation struct {
// ResourceSpec specifies the target resource information.
// +optional
ResourceSpec `json:",omitempty" yaml:",omitempty"`
}
func (m *Mutation) GetPatchStrategicMerge() apiextensions.JSON {
return FromJSON(m.RawPatchStrategicMerge)
}

View file

@ -742,7 +742,7 @@ func (in *Mutation) DeepCopyInto(out *Mutation) {
*out = *in
if in.Targets != nil {
in, out := &in.Targets, &out.Targets
*out = make([]TargetMutation, len(*in))
*out = make([]ResourceSpec, len(*in))
copy(*out, *in)
}
if in.RawPatchStrategicMerge != nil {
@ -1106,22 +1106,6 @@ func (in *StaticKeyAttestor) DeepCopy() *StaticKeyAttestor {
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.
func (in *UserInfo) DeepCopyInto(out *UserInfo) {
*out = *in

View file

@ -1094,6 +1094,7 @@ spec:
targets:
description: Targets defines the target resources to be mutated.
items:
description: ResourceSpec contains information to identify a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.
@ -2630,6 +2631,7 @@ spec:
targets:
description: Targets defines the target resources to be mutated.
items:
description: ResourceSpec contains information to identify a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.
@ -4877,6 +4879,7 @@ spec:
targets:
description: Targets defines the target resources to be mutated.
items:
description: ResourceSpec contains information to identify a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.
@ -6413,6 +6416,7 @@ spec:
targets:
description: Targets defines the target resources to be mutated.
items:
description: ResourceSpec contains information to identify a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.

View file

@ -1751,6 +1751,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.
@ -4226,6 +4228,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.

View file

@ -1752,6 +1752,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.
@ -4228,6 +4230,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.

View file

@ -1768,6 +1768,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.
@ -4243,6 +4245,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.
@ -7608,6 +7612,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.
@ -10084,6 +10090,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.

View file

@ -1757,6 +1757,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.
@ -4232,6 +4234,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.
@ -7573,6 +7577,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.
@ -10049,6 +10055,8 @@ spec:
description: Targets defines the target resources to be
mutated.
items:
description: ResourceSpec contains information to identify
a resource.
properties:
apiVersion:
description: APIVersion specifies resource apiVersion.

View file

@ -1879,8 +1879,8 @@ Optional. Defaults to &ldquo;false&rdquo; if not specified.</p>
<td>
<code>targets</code></br>
<em>
<a href="#kyverno.io/v1.TargetMutation">
[]TargetMutation
<a href="#kyverno.io/v1.ResourceSpec">
[]ResourceSpec
</a>
</em>
</td>
@ -2418,7 +2418,7 @@ ResourceDescription
<a href="#kyverno.io/v1.GenerateRequestSpec">GenerateRequestSpec</a>,
<a href="#kyverno.io/v1.GenerateRequestStatus">GenerateRequestStatus</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>ResourceSpec contains information to identify a resource.</p>
@ -2826,39 +2826,6 @@ If not provided, the system roots are used.</p>
</tbody>
</table>
<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>
<p>

View file

@ -10,7 +10,7 @@ import (
"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))
var errors []error