mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
feat: remove kyverno client v2beta1 (#10543)
* feat: remove kyverno client v2beta1 Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * codegen Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix tests 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
ff88c4c39a
commit
e900abf3a0
53 changed files with 84 additions and 4653 deletions
2
Makefile
2
Makefile
|
@ -403,7 +403,7 @@ GOPATH_SHIM := ${PWD}/.gopath
|
|||
PACKAGE_SHIM := $(GOPATH_SHIM)/src/$(PACKAGE)
|
||||
OUT_PACKAGE := $(PACKAGE)/pkg/client
|
||||
INPUT_DIRS := $(PACKAGE)/api/kyverno/v1,$(PACKAGE)/api/kyverno/v1beta1,$(PACKAGE)/api/kyverno/v2,$(PACKAGE)/api/kyverno/v2beta1,$(PACKAGE)/api/kyverno/v2alpha1,$(PACKAGE)/api/reports/v1,$(PACKAGE)/api/policyreport/v1alpha2
|
||||
CLIENT_INPUT_DIRS := $(PACKAGE)/api/kyverno/v1,$(PACKAGE)/api/kyverno/v2,$(PACKAGE)/api/kyverno/v2beta1,$(PACKAGE)/api/kyverno/v2alpha1,$(PACKAGE)/api/reports/v1,$(PACKAGE)/api/policyreport/v1alpha2
|
||||
CLIENT_INPUT_DIRS := $(PACKAGE)/api/kyverno/v1,$(PACKAGE)/api/kyverno/v2,$(PACKAGE)/api/kyverno/v2alpha1,$(PACKAGE)/api/reports/v1,$(PACKAGE)/api/policyreport/v1alpha2
|
||||
CLIENTSET_PACKAGE := $(OUT_PACKAGE)/clientset
|
||||
LISTERS_PACKAGE := $(OUT_PACKAGE)/listers
|
||||
INFORMERS_PACKAGE := $(OUT_PACKAGE)/informers
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package v2beta1
|
||||
package v2
|
||||
|
||||
import (
|
||||
"time"
|
|
@ -53,7 +53,7 @@ func Test_MatchResources(t *testing.T) {
|
|||
}},
|
||||
},
|
||||
errors: []string{
|
||||
`dummy: Invalid value: v2.MatchResources{Any:v1.ResourceFilters{v1.ResourceFilter{UserInfo:v1.UserInfo{Roles:[]string(nil), ClusterRoles:[]string(nil), Subjects:[]v1.Subject{v1.Subject{Kind:"ServiceAccount", APIGroup:"", Name:"sa-1", Namespace:"ns"}}}, ResourceDescription:v1.ResourceDescription{Kinds:[]string(nil), Name:"", Names:[]string(nil), Namespaces:[]string(nil), Annotations:map[string]string(nil), Selector:(*v1.LabelSelector)(nil), NamespaceSelector:(*v1.LabelSelector)(nil), Operations:[]v1.AdmissionOperation(nil)}}}, All:v1.ResourceFilters{v1.ResourceFilter{UserInfo:v1.UserInfo{Roles:[]string(nil), ClusterRoles:[]string(nil), Subjects:[]v1.Subject{v1.Subject{Kind:"ServiceAccount", APIGroup:"", Name:"sa-1", Namespace:"ns"}}}, ResourceDescription:v1.ResourceDescription{Kinds:[]string(nil), Name:"", Names:[]string(nil), Namespaces:[]string(nil), Annotations:map[string]string(nil), Selector:(*v1.LabelSelector)(nil), NamespaceSelector:(*v1.LabelSelector)(nil), Operations:[]v1.AdmissionOperation(nil)}}}}: Can't specify any and all together`,
|
||||
`dummy: Invalid value: v2beta1.MatchResources{Any:v1.ResourceFilters{v1.ResourceFilter{UserInfo:v1.UserInfo{Roles:[]string(nil), ClusterRoles:[]string(nil), Subjects:[]v1.Subject{v1.Subject{Kind:"ServiceAccount", APIGroup:"", Name:"sa-1", Namespace:"ns"}}}, ResourceDescription:v1.ResourceDescription{Kinds:[]string(nil), Name:"", Names:[]string(nil), Namespaces:[]string(nil), Annotations:map[string]string(nil), Selector:(*v1.LabelSelector)(nil), NamespaceSelector:(*v1.LabelSelector)(nil), Operations:[]v1.AdmissionOperation(nil)}}}, All:v1.ResourceFilters{v1.ResourceFilter{UserInfo:v1.UserInfo{Roles:[]string(nil), ClusterRoles:[]string(nil), Subjects:[]v1.Subject{v1.Subject{Kind:"ServiceAccount", APIGroup:"", Name:"sa-1", Namespace:"ns"}}}, ResourceDescription:v1.ResourceDescription{Kinds:[]string(nil), Name:"", Names:[]string(nil), Namespaces:[]string(nil), Annotations:map[string]string(nil), Selector:(*v1.LabelSelector)(nil), NamespaceSelector:(*v1.LabelSelector)(nil), Operations:[]v1.AdmissionOperation(nil)}}}}: Can't specify any and all together`,
|
||||
},
|
||||
}}
|
||||
|
||||
|
|
|
@ -1,80 +1,7 @@
|
|||
package v2
|
||||
|
||||
import (
|
||||
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
)
|
||||
|
||||
// MatchResources is used to specify resource and admission review request data for
|
||||
// which a policy rule is applicable.
|
||||
type MatchResources struct {
|
||||
// Any allows specifying resources which will be ORed
|
||||
// +optional
|
||||
Any kyvernov1.ResourceFilters `json:"any,omitempty" yaml:"any,omitempty"`
|
||||
|
||||
// All allows specifying resources which will be ANDed
|
||||
// +optional
|
||||
All kyvernov1.ResourceFilters `json:"all,omitempty" yaml:"all,omitempty"`
|
||||
}
|
||||
|
||||
// GetKinds returns all kinds
|
||||
func (m *MatchResources) GetKinds() []string {
|
||||
var kinds []string
|
||||
for _, value := range m.All {
|
||||
kinds = append(kinds, value.ResourceDescription.Kinds...)
|
||||
}
|
||||
for _, value := range m.Any {
|
||||
kinds = append(kinds, value.ResourceDescription.Kinds...)
|
||||
}
|
||||
return kinds
|
||||
}
|
||||
|
||||
// ValidateNoUserInfo verifies that no user info is used
|
||||
func (m *MatchResources) ValidateNoUserInfo(path *field.Path) (errs field.ErrorList) {
|
||||
anyPath := path.Child("any")
|
||||
for i, filter := range m.Any {
|
||||
errs = append(errs, filter.UserInfo.ValidateNoUserInfo(anyPath.Index(i))...)
|
||||
}
|
||||
allPath := path.Child("all")
|
||||
for i, filter := range m.All {
|
||||
errs = append(errs, filter.UserInfo.ValidateNoUserInfo(allPath.Index(i))...)
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
||||
// ValidateResourceWithNoUserInfo implements programmatic validation and verifies that no user info is used
|
||||
func (m *MatchResources) ValidateResourceWithNoUserInfo(path *field.Path, namespaced bool, clusterResources sets.Set[string]) (errs field.ErrorList) {
|
||||
if len(m.Any) > 0 && len(m.All) > 0 {
|
||||
errs = append(errs, field.Invalid(path, m, "Can't specify any and all together"))
|
||||
}
|
||||
anyPath := path.Child("any")
|
||||
for i, filter := range m.Any {
|
||||
errs = append(errs, filter.UserInfo.ValidateNoUserInfo(anyPath.Index(i))...)
|
||||
errs = append(errs, filter.ResourceDescription.Validate(anyPath.Index(i), namespaced, clusterResources)...)
|
||||
}
|
||||
allPath := path.Child("all")
|
||||
for i, filter := range m.All {
|
||||
errs = append(errs, filter.UserInfo.ValidateNoUserInfo(allPath.Index(i))...)
|
||||
errs = append(errs, filter.ResourceDescription.Validate(allPath.Index(i), namespaced, clusterResources)...)
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
||||
// Validate implements programmatic validation
|
||||
func (m *MatchResources) Validate(path *field.Path, namespaced bool, clusterResources sets.Set[string]) (errs field.ErrorList) {
|
||||
if len(m.Any) > 0 && len(m.All) > 0 {
|
||||
errs = append(errs, field.Invalid(path, m, "Can't specify any and all together"))
|
||||
}
|
||||
anyPath := path.Child("any")
|
||||
for i, filter := range m.Any {
|
||||
errs = append(errs, filter.UserInfo.Validate(anyPath.Index(i))...)
|
||||
errs = append(errs, filter.ResourceDescription.Validate(anyPath.Index(i), namespaced, clusterResources)...)
|
||||
}
|
||||
allPath := path.Child("all")
|
||||
for i, filter := range m.All {
|
||||
errs = append(errs, filter.UserInfo.Validate(allPath.Index(i))...)
|
||||
errs = append(errs, filter.ResourceDescription.Validate(allPath.Index(i), namespaced, clusterResources)...)
|
||||
}
|
||||
return errs
|
||||
}
|
||||
type MatchResources = kyvernov2beta1.MatchResources
|
||||
|
|
|
@ -71,7 +71,7 @@ type PolicyExceptionSpec struct {
|
|||
// Conditions are used to determine if a resource applies to the exception by evaluating a
|
||||
// set of conditions. The declaration can contain nested `any` or `all` statements.
|
||||
// +optional
|
||||
Conditions *kyvernov2beta1.AnyAllConditions `json:"conditions,omitempty"`
|
||||
Conditions *AnyAllConditions `json:"conditions,omitempty"`
|
||||
|
||||
// Exceptions is a list policy/rules to be excluded
|
||||
Exceptions []Exception `json:"exceptions" yaml:"exceptions"`
|
||||
|
|
|
@ -155,7 +155,7 @@ func (in *CleanupPolicySpec) DeepCopyInto(out *CleanupPolicySpec) {
|
|||
in.MatchResources.DeepCopyInto(&out.MatchResources)
|
||||
if in.ExcludeResources != nil {
|
||||
in, out := &in.ExcludeResources, &out.ExcludeResources
|
||||
*out = new(MatchResources)
|
||||
*out = new(v2beta1.MatchResources)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Conditions != nil {
|
||||
|
@ -308,36 +308,6 @@ func (in *Exception) DeepCopy() *Exception {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MatchResources) DeepCopyInto(out *MatchResources) {
|
||||
*out = *in
|
||||
if in.Any != nil {
|
||||
in, out := &in.Any, &out.Any
|
||||
*out = make(kyvernov1.ResourceFilters, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.All != nil {
|
||||
in, out := &in.All, &out.All
|
||||
*out = make(kyvernov1.ResourceFilters, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchResources.
|
||||
func (in *MatchResources) DeepCopy() *MatchResources {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MatchResources)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PolicyException) DeepCopyInto(out *PolicyException) {
|
||||
*out = *in
|
||||
|
@ -409,7 +379,7 @@ func (in *PolicyExceptionSpec) DeepCopyInto(out *PolicyExceptionSpec) {
|
|||
in.Match.DeepCopyInto(&out.Match)
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = new(v2beta1.AnyAllConditions)
|
||||
*out = new(AnyAllConditions)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Exceptions != nil {
|
||||
|
|
|
@ -143,13 +143,13 @@ func main() {
|
|||
genericloggingcontroller.NewController(
|
||||
setup.Logger.WithName("cleanup-policy"),
|
||||
"CleanupPolicy",
|
||||
kyvernoInformer.Kyverno().V2beta1().CleanupPolicies(),
|
||||
kyvernoInformer.Kyverno().V2().CleanupPolicies(),
|
||||
genericloggingcontroller.CheckGeneration,
|
||||
)
|
||||
genericloggingcontroller.NewController(
|
||||
setup.Logger.WithName("cluster-cleanup-policy"),
|
||||
"ClusterCleanupPolicy",
|
||||
kyvernoInformer.Kyverno().V2beta1().ClusterCleanupPolicies(),
|
||||
kyvernoInformer.Kyverno().V2().ClusterCleanupPolicies(),
|
||||
genericloggingcontroller.CheckGeneration,
|
||||
)
|
||||
eventGenerator := event.NewEventGenerator(
|
||||
|
@ -303,8 +303,8 @@ func main() {
|
|||
cleanup.NewController(
|
||||
setup.KyvernoDynamicClient,
|
||||
setup.KyvernoClient,
|
||||
kyvernoInformer.Kyverno().V2beta1().ClusterCleanupPolicies(),
|
||||
kyvernoInformer.Kyverno().V2beta1().CleanupPolicies(),
|
||||
kyvernoInformer.Kyverno().V2().ClusterCleanupPolicies(),
|
||||
kyvernoInformer.Kyverno().V2().CleanupPolicies(),
|
||||
nsLister,
|
||||
setup.Configuration,
|
||||
cmResolver,
|
||||
|
|
|
@ -3430,7 +3430,6 @@ ResourceDescription
|
|||
<p>
|
||||
(<em>Appears on:</em>
|
||||
<a href="#kyverno.io/v1.MatchResources">MatchResources</a>,
|
||||
<a href="#kyverno.io/v2.MatchResources">MatchResources</a>,
|
||||
<a href="#kyverno.io/v2beta1.MatchResources">MatchResources</a>)
|
||||
</p>
|
||||
<p>
|
||||
|
@ -5313,7 +5312,7 @@ CleanupPolicySpec
|
|||
<td>
|
||||
<code>match</code><br/>
|
||||
<em>
|
||||
<a href="#kyverno.io/v2.MatchResources">
|
||||
<a href="#kyverno.io/v2beta1.MatchResources">
|
||||
MatchResources
|
||||
</a>
|
||||
</em>
|
||||
|
@ -5329,7 +5328,7 @@ At least one kind is required.</p>
|
|||
<td>
|
||||
<code>exclude</code><br/>
|
||||
<em>
|
||||
<a href="#kyverno.io/v2.MatchResources">
|
||||
<a href="#kyverno.io/v2beta1.MatchResources">
|
||||
MatchResources
|
||||
</a>
|
||||
</em>
|
||||
|
@ -5462,7 +5461,7 @@ CleanupPolicySpec
|
|||
<td>
|
||||
<code>match</code><br/>
|
||||
<em>
|
||||
<a href="#kyverno.io/v2.MatchResources">
|
||||
<a href="#kyverno.io/v2beta1.MatchResources">
|
||||
MatchResources
|
||||
</a>
|
||||
</em>
|
||||
|
@ -5478,7 +5477,7 @@ At least one kind is required.</p>
|
|||
<td>
|
||||
<code>exclude</code><br/>
|
||||
<em>
|
||||
<a href="#kyverno.io/v2.MatchResources">
|
||||
<a href="#kyverno.io/v2beta1.MatchResources">
|
||||
MatchResources
|
||||
</a>
|
||||
</em>
|
||||
|
@ -5623,7 +5622,7 @@ MatchResources
|
|||
<td>
|
||||
<code>conditions</code><br/>
|
||||
<em>
|
||||
<a href="#kyverno.io/v2beta1.AnyAllConditions">
|
||||
<a href="#kyverno.io/v2.AnyAllConditions">
|
||||
AnyAllConditions
|
||||
</a>
|
||||
</em>
|
||||
|
@ -5880,7 +5879,8 @@ Kubernetes admission/v1.Operation
|
|||
</h3>
|
||||
<p>
|
||||
(<em>Appears on:</em>
|
||||
<a href="#kyverno.io/v2.CleanupPolicySpec">CleanupPolicySpec</a>)
|
||||
<a href="#kyverno.io/v2.CleanupPolicySpec">CleanupPolicySpec</a>,
|
||||
<a href="#kyverno.io/v2.PolicyExceptionSpec">PolicyExceptionSpec</a>)
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
|
@ -5929,6 +5929,11 @@ Here, all of the conditions need to pass.</p>
|
|||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<h3 id="kyverno.io/v2.CleanupPolicyInterface">CleanupPolicyInterface
|
||||
</h3>
|
||||
<p>
|
||||
<p>CleanupPolicyInterface abstracts the concrete policy type (CleanupPolicy vs ClusterCleanupPolicy)</p>
|
||||
</p>
|
||||
<h3 id="kyverno.io/v2.CleanupPolicySpec">CleanupPolicySpec
|
||||
</h3>
|
||||
<p>
|
||||
|
@ -5966,7 +5971,7 @@ and schedule when the matching resources needs deleted.</p>
|
|||
<td>
|
||||
<code>match</code><br/>
|
||||
<em>
|
||||
<a href="#kyverno.io/v2.MatchResources">
|
||||
<a href="#kyverno.io/v2beta1.MatchResources">
|
||||
MatchResources
|
||||
</a>
|
||||
</em>
|
||||
|
@ -5982,7 +5987,7 @@ At least one kind is required.</p>
|
|||
<td>
|
||||
<code>exclude</code><br/>
|
||||
<em>
|
||||
<a href="#kyverno.io/v2.MatchResources">
|
||||
<a href="#kyverno.io/v2beta1.MatchResources">
|
||||
MatchResources
|
||||
</a>
|
||||
</em>
|
||||
|
@ -6194,55 +6199,6 @@ references a ClusterPolicy.</p>
|
|||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<h3 id="kyverno.io/v2.MatchResources">MatchResources
|
||||
</h3>
|
||||
<p>
|
||||
(<em>Appears on:</em>
|
||||
<a href="#kyverno.io/v2.CleanupPolicySpec">CleanupPolicySpec</a>)
|
||||
</p>
|
||||
<p>
|
||||
<p>MatchResources is used to specify resource and admission review request data for
|
||||
which a policy rule is applicable.</p>
|
||||
</p>
|
||||
<table class="table table-striped">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>any</code><br/>
|
||||
<em>
|
||||
<a href="#kyverno.io/v1.ResourceFilters">
|
||||
ResourceFilters
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>Any allows specifying resources which will be ORed</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>all</code><br/>
|
||||
<em>
|
||||
<a href="#kyverno.io/v1.ResourceFilters">
|
||||
ResourceFilters
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>All allows specifying resources which will be ANDed</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<h3 id="kyverno.io/v2.PolicyExceptionSpec">PolicyExceptionSpec
|
||||
</h3>
|
||||
<p>
|
||||
|
@ -6290,7 +6246,7 @@ MatchResources
|
|||
<td>
|
||||
<code>conditions</code><br/>
|
||||
<em>
|
||||
<a href="#kyverno.io/v2beta1.AnyAllConditions">
|
||||
<a href="#kyverno.io/v2.AnyAllConditions">
|
||||
AnyAllConditions
|
||||
</a>
|
||||
</em>
|
||||
|
@ -7939,7 +7895,6 @@ Applicable only to policies that have validate.podSecurity subrule.</p>
|
|||
</h3>
|
||||
<p>
|
||||
(<em>Appears on:</em>
|
||||
<a href="#kyverno.io/v2.PolicyExceptionSpec">PolicyExceptionSpec</a>,
|
||||
<a href="#kyverno.io/v2beta1.CleanupPolicySpec">CleanupPolicySpec</a>,
|
||||
<a href="#kyverno.io/v2beta1.Deny">Deny</a>,
|
||||
<a href="#kyverno.io/v2beta1.PolicyExceptionSpec">PolicyExceptionSpec</a>,
|
||||
|
@ -7992,11 +7947,6 @@ Here, all of the conditions need to pass.</p>
|
|||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<h3 id="kyverno.io/v2beta1.CleanupPolicyInterface">CleanupPolicyInterface
|
||||
</h3>
|
||||
<p>
|
||||
<p>CleanupPolicyInterface abstracts the concrete policy type (CleanupPolicy vs ClusterCleanupPolicy)</p>
|
||||
</p>
|
||||
<h3 id="kyverno.io/v2beta1.CleanupPolicySpec">CleanupPolicySpec
|
||||
</h3>
|
||||
<p>
|
||||
|
@ -8463,6 +8413,7 @@ bool
|
|||
</h3>
|
||||
<p>
|
||||
(<em>Appears on:</em>
|
||||
<a href="#kyverno.io/v2.CleanupPolicySpec">CleanupPolicySpec</a>,
|
||||
<a href="#kyverno.io/v2.PolicyExceptionSpec">PolicyExceptionSpec</a>,
|
||||
<a href="#kyverno.io/v2beta1.CleanupPolicySpec">CleanupPolicySpec</a>,
|
||||
<a href="#kyverno.io/v2beta1.PolicyExceptionSpec">PolicyExceptionSpec</a>,
|
||||
|
|
|
@ -20,16 +20,17 @@ package v2
|
|||
|
||||
import (
|
||||
v1 "github.com/kyverno/kyverno/pkg/client/applyconfigurations/kyverno/v1"
|
||||
v2beta1 "github.com/kyverno/kyverno/pkg/client/applyconfigurations/kyverno/v2beta1"
|
||||
)
|
||||
|
||||
// CleanupPolicySpecApplyConfiguration represents an declarative configuration of the CleanupPolicySpec type for use
|
||||
// with apply.
|
||||
type CleanupPolicySpecApplyConfiguration struct {
|
||||
Context []v1.ContextEntryApplyConfiguration `json:"context,omitempty"`
|
||||
MatchResources *MatchResourcesApplyConfiguration `json:"match,omitempty"`
|
||||
ExcludeResources *MatchResourcesApplyConfiguration `json:"exclude,omitempty"`
|
||||
Schedule *string `json:"schedule,omitempty"`
|
||||
Conditions *AnyAllConditionsApplyConfiguration `json:"conditions,omitempty"`
|
||||
Context []v1.ContextEntryApplyConfiguration `json:"context,omitempty"`
|
||||
MatchResources *v2beta1.MatchResourcesApplyConfiguration `json:"match,omitempty"`
|
||||
ExcludeResources *v2beta1.MatchResourcesApplyConfiguration `json:"exclude,omitempty"`
|
||||
Schedule *string `json:"schedule,omitempty"`
|
||||
Conditions *AnyAllConditionsApplyConfiguration `json:"conditions,omitempty"`
|
||||
}
|
||||
|
||||
// CleanupPolicySpecApplyConfiguration constructs an declarative configuration of the CleanupPolicySpec type for use with
|
||||
|
@ -54,7 +55,7 @@ func (b *CleanupPolicySpecApplyConfiguration) WithContext(values ...*v1.ContextE
|
|||
// WithMatchResources sets the MatchResources 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 MatchResources field is set to the value of the last call.
|
||||
func (b *CleanupPolicySpecApplyConfiguration) WithMatchResources(value *MatchResourcesApplyConfiguration) *CleanupPolicySpecApplyConfiguration {
|
||||
func (b *CleanupPolicySpecApplyConfiguration) WithMatchResources(value *v2beta1.MatchResourcesApplyConfiguration) *CleanupPolicySpecApplyConfiguration {
|
||||
b.MatchResources = value
|
||||
return b
|
||||
}
|
||||
|
@ -62,7 +63,7 @@ func (b *CleanupPolicySpecApplyConfiguration) WithMatchResources(value *MatchRes
|
|||
// WithExcludeResources sets the ExcludeResources 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 ExcludeResources field is set to the value of the last call.
|
||||
func (b *CleanupPolicySpecApplyConfiguration) WithExcludeResources(value *MatchResourcesApplyConfiguration) *CleanupPolicySpecApplyConfiguration {
|
||||
func (b *CleanupPolicySpecApplyConfiguration) WithExcludeResources(value *v2beta1.MatchResourcesApplyConfiguration) *CleanupPolicySpecApplyConfiguration {
|
||||
b.ExcludeResources = value
|
||||
return b
|
||||
}
|
||||
|
|
|
@ -26,11 +26,11 @@ import (
|
|||
// PolicyExceptionSpecApplyConfiguration represents an declarative configuration of the PolicyExceptionSpec type for use
|
||||
// with apply.
|
||||
type PolicyExceptionSpecApplyConfiguration struct {
|
||||
Background *bool `json:"background,omitempty"`
|
||||
Match *v2beta1.MatchResourcesApplyConfiguration `json:"match,omitempty"`
|
||||
Conditions *v2beta1.AnyAllConditionsApplyConfiguration `json:"conditions,omitempty"`
|
||||
Exceptions []ExceptionApplyConfiguration `json:"exceptions,omitempty"`
|
||||
PodSecurity []v1.PodSecurityStandardApplyConfiguration `json:"podSecurity,omitempty"`
|
||||
Background *bool `json:"background,omitempty"`
|
||||
Match *v2beta1.MatchResourcesApplyConfiguration `json:"match,omitempty"`
|
||||
Conditions *AnyAllConditionsApplyConfiguration `json:"conditions,omitempty"`
|
||||
Exceptions []ExceptionApplyConfiguration `json:"exceptions,omitempty"`
|
||||
PodSecurity []v1.PodSecurityStandardApplyConfiguration `json:"podSecurity,omitempty"`
|
||||
}
|
||||
|
||||
// PolicyExceptionSpecApplyConfiguration constructs an declarative configuration of the PolicyExceptionSpec type for use with
|
||||
|
@ -58,7 +58,7 @@ func (b *PolicyExceptionSpecApplyConfiguration) WithMatch(value *v2beta1.MatchRe
|
|||
// WithConditions sets the Conditions 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 Conditions field is set to the value of the last call.
|
||||
func (b *PolicyExceptionSpecApplyConfiguration) WithConditions(value *v2beta1.AnyAllConditionsApplyConfiguration) *PolicyExceptionSpecApplyConfiguration {
|
||||
func (b *PolicyExceptionSpecApplyConfiguration) WithConditions(value *AnyAllConditionsApplyConfiguration) *PolicyExceptionSpecApplyConfiguration {
|
||||
b.Conditions = value
|
||||
return b
|
||||
}
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/admissionregistration/v1"
|
||||
)
|
||||
|
||||
// WebhookConfigurationApplyConfiguration represents an declarative configuration of the WebhookConfiguration type for use
|
||||
// with apply.
|
||||
type WebhookConfigurationApplyConfiguration struct {
|
||||
MatchConditions []v1.MatchCondition `json:"matchConditions,omitempty"`
|
||||
}
|
||||
|
||||
// WebhookConfigurationApplyConfiguration constructs an declarative configuration of the WebhookConfiguration type for use with
|
||||
// apply.
|
||||
func WebhookConfiguration() *WebhookConfigurationApplyConfiguration {
|
||||
return &WebhookConfigurationApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithMatchConditions adds the given value to the MatchConditions field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the MatchConditions field.
|
||||
func (b *WebhookConfigurationApplyConfiguration) WithMatchConditions(values ...v1.MatchCondition) *WebhookConfigurationApplyConfiguration {
|
||||
for i := range values {
|
||||
b.MatchConditions = append(b.MatchConditions, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
|
@ -179,8 +179,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
|||
return &kyvernov2.ConditionApplyConfiguration{}
|
||||
case v2.SchemeGroupVersion.WithKind("Exception"):
|
||||
return &kyvernov2.ExceptionApplyConfiguration{}
|
||||
case v2.SchemeGroupVersion.WithKind("MatchResources"):
|
||||
return &kyvernov2.MatchResourcesApplyConfiguration{}
|
||||
case v2.SchemeGroupVersion.WithKind("PolicyException"):
|
||||
return &kyvernov2.PolicyExceptionApplyConfiguration{}
|
||||
case v2.SchemeGroupVersion.WithKind("PolicyExceptionSpec"):
|
||||
|
|
|
@ -25,7 +25,6 @@ import (
|
|||
kyvernov1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1"
|
||||
kyvernov2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2"
|
||||
kyvernov2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1"
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2"
|
||||
reportsv1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/reports/v1"
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
|
@ -37,7 +36,6 @@ type Interface interface {
|
|||
Discovery() discovery.DiscoveryInterface
|
||||
KyvernoV1() kyvernov1.KyvernoV1Interface
|
||||
KyvernoV2() kyvernov2.KyvernoV2Interface
|
||||
KyvernoV2beta1() kyvernov2beta1.KyvernoV2beta1Interface
|
||||
KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface
|
||||
Wgpolicyk8sV1alpha2() wgpolicyk8sv1alpha2.Wgpolicyk8sV1alpha2Interface
|
||||
ReportsV1() reportsv1.ReportsV1Interface
|
||||
|
@ -48,7 +46,6 @@ type Clientset struct {
|
|||
*discovery.DiscoveryClient
|
||||
kyvernoV1 *kyvernov1.KyvernoV1Client
|
||||
kyvernoV2 *kyvernov2.KyvernoV2Client
|
||||
kyvernoV2beta1 *kyvernov2beta1.KyvernoV2beta1Client
|
||||
kyvernoV2alpha1 *kyvernov2alpha1.KyvernoV2alpha1Client
|
||||
wgpolicyk8sV1alpha2 *wgpolicyk8sv1alpha2.Wgpolicyk8sV1alpha2Client
|
||||
reportsV1 *reportsv1.ReportsV1Client
|
||||
|
@ -64,11 +61,6 @@ func (c *Clientset) KyvernoV2() kyvernov2.KyvernoV2Interface {
|
|||
return c.kyvernoV2
|
||||
}
|
||||
|
||||
// KyvernoV2beta1 retrieves the KyvernoV2beta1Client
|
||||
func (c *Clientset) KyvernoV2beta1() kyvernov2beta1.KyvernoV2beta1Interface {
|
||||
return c.kyvernoV2beta1
|
||||
}
|
||||
|
||||
// KyvernoV2alpha1 retrieves the KyvernoV2alpha1Client
|
||||
func (c *Clientset) KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface {
|
||||
return c.kyvernoV2alpha1
|
||||
|
@ -136,10 +128,6 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset,
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.kyvernoV2beta1, err = kyvernov2beta1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.kyvernoV2alpha1, err = kyvernov2alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -175,7 +163,6 @@ func New(c rest.Interface) *Clientset {
|
|||
var cs Clientset
|
||||
cs.kyvernoV1 = kyvernov1.New(c)
|
||||
cs.kyvernoV2 = kyvernov2.New(c)
|
||||
cs.kyvernoV2beta1 = kyvernov2beta1.New(c)
|
||||
cs.kyvernoV2alpha1 = kyvernov2alpha1.New(c)
|
||||
cs.wgpolicyk8sV1alpha2 = wgpolicyk8sv1alpha2.New(c)
|
||||
cs.reportsV1 = reportsv1.New(c)
|
||||
|
|
|
@ -26,8 +26,6 @@ import (
|
|||
fakekyvernov2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2/fake"
|
||||
kyvernov2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1"
|
||||
fakekyvernov2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1/fake"
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||
fakekyvernov2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1/fake"
|
||||
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2"
|
||||
fakewgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/fake"
|
||||
reportsv1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/reports/v1"
|
||||
|
@ -99,11 +97,6 @@ func (c *Clientset) KyvernoV2() kyvernov2.KyvernoV2Interface {
|
|||
return &fakekyvernov2.FakeKyvernoV2{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// KyvernoV2beta1 retrieves the KyvernoV2beta1Client
|
||||
func (c *Clientset) KyvernoV2beta1() kyvernov2beta1.KyvernoV2beta1Interface {
|
||||
return &fakekyvernov2beta1.FakeKyvernoV2beta1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// KyvernoV2alpha1 retrieves the KyvernoV2alpha1Client
|
||||
func (c *Clientset) KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface {
|
||||
return &fakekyvernov2alpha1.FakeKyvernoV2alpha1{Fake: &c.Fake}
|
||||
|
|
|
@ -22,7 +22,6 @@ import (
|
|||
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
||||
kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2"
|
||||
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
||||
reportsv1 "github.com/kyverno/kyverno/api/reports/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -38,7 +37,6 @@ var codecs = serializer.NewCodecFactory(scheme)
|
|||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
kyvernov1.AddToScheme,
|
||||
kyvernov2.AddToScheme,
|
||||
kyvernov2beta1.AddToScheme,
|
||||
kyvernov2alpha1.AddToScheme,
|
||||
wgpolicyk8sv1alpha2.AddToScheme,
|
||||
reportsv1.AddToScheme,
|
||||
|
|
|
@ -22,7 +22,6 @@ import (
|
|||
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
||||
kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2"
|
||||
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
||||
reportsv1 "github.com/kyverno/kyverno/api/reports/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -38,7 +37,6 @@ var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
|||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
kyvernov1.AddToScheme,
|
||||
kyvernov2.AddToScheme,
|
||||
kyvernov2beta1.AddToScheme,
|
||||
kyvernov2alpha1.AddToScheme,
|
||||
wgpolicyk8sv1alpha2.AddToScheme,
|
||||
reportsv1.AddToScheme,
|
||||
|
|
|
@ -1,195 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// CleanupPoliciesGetter has a method to return a CleanupPolicyInterface.
|
||||
// A group's client should implement this interface.
|
||||
type CleanupPoliciesGetter interface {
|
||||
CleanupPolicies(namespace string) CleanupPolicyInterface
|
||||
}
|
||||
|
||||
// CleanupPolicyInterface has methods to work with CleanupPolicy resources.
|
||||
type CleanupPolicyInterface interface {
|
||||
Create(ctx context.Context, cleanupPolicy *v2beta1.CleanupPolicy, opts v1.CreateOptions) (*v2beta1.CleanupPolicy, error)
|
||||
Update(ctx context.Context, cleanupPolicy *v2beta1.CleanupPolicy, opts v1.UpdateOptions) (*v2beta1.CleanupPolicy, error)
|
||||
UpdateStatus(ctx context.Context, cleanupPolicy *v2beta1.CleanupPolicy, opts v1.UpdateOptions) (*v2beta1.CleanupPolicy, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v2beta1.CleanupPolicy, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v2beta1.CleanupPolicyList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.CleanupPolicy, err error)
|
||||
CleanupPolicyExpansion
|
||||
}
|
||||
|
||||
// cleanupPolicies implements CleanupPolicyInterface
|
||||
type cleanupPolicies struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newCleanupPolicies returns a CleanupPolicies
|
||||
func newCleanupPolicies(c *KyvernoV2beta1Client, namespace string) *cleanupPolicies {
|
||||
return &cleanupPolicies{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the cleanupPolicy, and returns the corresponding cleanupPolicy object, and an error if there is any.
|
||||
func (c *cleanupPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.CleanupPolicy, err error) {
|
||||
result = &v2beta1.CleanupPolicy{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("cleanuppolicies").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of CleanupPolicies that match those selectors.
|
||||
func (c *cleanupPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.CleanupPolicyList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v2beta1.CleanupPolicyList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("cleanuppolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested cleanupPolicies.
|
||||
func (c *cleanupPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("cleanuppolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a cleanupPolicy and creates it. Returns the server's representation of the cleanupPolicy, and an error, if there is any.
|
||||
func (c *cleanupPolicies) Create(ctx context.Context, cleanupPolicy *v2beta1.CleanupPolicy, opts v1.CreateOptions) (result *v2beta1.CleanupPolicy, err error) {
|
||||
result = &v2beta1.CleanupPolicy{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("cleanuppolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(cleanupPolicy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a cleanupPolicy and updates it. Returns the server's representation of the cleanupPolicy, and an error, if there is any.
|
||||
func (c *cleanupPolicies) Update(ctx context.Context, cleanupPolicy *v2beta1.CleanupPolicy, opts v1.UpdateOptions) (result *v2beta1.CleanupPolicy, err error) {
|
||||
result = &v2beta1.CleanupPolicy{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("cleanuppolicies").
|
||||
Name(cleanupPolicy.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(cleanupPolicy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *cleanupPolicies) UpdateStatus(ctx context.Context, cleanupPolicy *v2beta1.CleanupPolicy, opts v1.UpdateOptions) (result *v2beta1.CleanupPolicy, err error) {
|
||||
result = &v2beta1.CleanupPolicy{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("cleanuppolicies").
|
||||
Name(cleanupPolicy.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(cleanupPolicy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the cleanupPolicy and deletes it. Returns an error if one occurs.
|
||||
func (c *cleanupPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("cleanuppolicies").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *cleanupPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("cleanuppolicies").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched cleanupPolicy.
|
||||
func (c *cleanupPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.CleanupPolicy, err error) {
|
||||
result = &v2beta1.CleanupPolicy{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("cleanuppolicies").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -1,184 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ClusterCleanupPoliciesGetter has a method to return a ClusterCleanupPolicyInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ClusterCleanupPoliciesGetter interface {
|
||||
ClusterCleanupPolicies() ClusterCleanupPolicyInterface
|
||||
}
|
||||
|
||||
// ClusterCleanupPolicyInterface has methods to work with ClusterCleanupPolicy resources.
|
||||
type ClusterCleanupPolicyInterface interface {
|
||||
Create(ctx context.Context, clusterCleanupPolicy *v2beta1.ClusterCleanupPolicy, opts v1.CreateOptions) (*v2beta1.ClusterCleanupPolicy, error)
|
||||
Update(ctx context.Context, clusterCleanupPolicy *v2beta1.ClusterCleanupPolicy, opts v1.UpdateOptions) (*v2beta1.ClusterCleanupPolicy, error)
|
||||
UpdateStatus(ctx context.Context, clusterCleanupPolicy *v2beta1.ClusterCleanupPolicy, opts v1.UpdateOptions) (*v2beta1.ClusterCleanupPolicy, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v2beta1.ClusterCleanupPolicy, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v2beta1.ClusterCleanupPolicyList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.ClusterCleanupPolicy, err error)
|
||||
ClusterCleanupPolicyExpansion
|
||||
}
|
||||
|
||||
// clusterCleanupPolicies implements ClusterCleanupPolicyInterface
|
||||
type clusterCleanupPolicies struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newClusterCleanupPolicies returns a ClusterCleanupPolicies
|
||||
func newClusterCleanupPolicies(c *KyvernoV2beta1Client) *clusterCleanupPolicies {
|
||||
return &clusterCleanupPolicies{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the clusterCleanupPolicy, and returns the corresponding clusterCleanupPolicy object, and an error if there is any.
|
||||
func (c *clusterCleanupPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.ClusterCleanupPolicy, err error) {
|
||||
result = &v2beta1.ClusterCleanupPolicy{}
|
||||
err = c.client.Get().
|
||||
Resource("clustercleanuppolicies").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterCleanupPolicies that match those selectors.
|
||||
func (c *clusterCleanupPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ClusterCleanupPolicyList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v2beta1.ClusterCleanupPolicyList{}
|
||||
err = c.client.Get().
|
||||
Resource("clustercleanuppolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterCleanupPolicies.
|
||||
func (c *clusterCleanupPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("clustercleanuppolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterCleanupPolicy and creates it. Returns the server's representation of the clusterCleanupPolicy, and an error, if there is any.
|
||||
func (c *clusterCleanupPolicies) Create(ctx context.Context, clusterCleanupPolicy *v2beta1.ClusterCleanupPolicy, opts v1.CreateOptions) (result *v2beta1.ClusterCleanupPolicy, err error) {
|
||||
result = &v2beta1.ClusterCleanupPolicy{}
|
||||
err = c.client.Post().
|
||||
Resource("clustercleanuppolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterCleanupPolicy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterCleanupPolicy and updates it. Returns the server's representation of the clusterCleanupPolicy, and an error, if there is any.
|
||||
func (c *clusterCleanupPolicies) Update(ctx context.Context, clusterCleanupPolicy *v2beta1.ClusterCleanupPolicy, opts v1.UpdateOptions) (result *v2beta1.ClusterCleanupPolicy, err error) {
|
||||
result = &v2beta1.ClusterCleanupPolicy{}
|
||||
err = c.client.Put().
|
||||
Resource("clustercleanuppolicies").
|
||||
Name(clusterCleanupPolicy.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterCleanupPolicy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *clusterCleanupPolicies) UpdateStatus(ctx context.Context, clusterCleanupPolicy *v2beta1.ClusterCleanupPolicy, opts v1.UpdateOptions) (result *v2beta1.ClusterCleanupPolicy, err error) {
|
||||
result = &v2beta1.ClusterCleanupPolicy{}
|
||||
err = c.client.Put().
|
||||
Resource("clustercleanuppolicies").
|
||||
Name(clusterCleanupPolicy.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterCleanupPolicy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterCleanupPolicy and deletes it. Returns an error if one occurs.
|
||||
func (c *clusterCleanupPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("clustercleanuppolicies").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *clusterCleanupPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("clustercleanuppolicies").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterCleanupPolicy.
|
||||
func (c *clusterCleanupPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.ClusterCleanupPolicy, err error) {
|
||||
result = &v2beta1.ClusterCleanupPolicy{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("clustercleanuppolicies").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -1,184 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ClusterPoliciesGetter has a method to return a ClusterPolicyInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ClusterPoliciesGetter interface {
|
||||
ClusterPolicies() ClusterPolicyInterface
|
||||
}
|
||||
|
||||
// ClusterPolicyInterface has methods to work with ClusterPolicy resources.
|
||||
type ClusterPolicyInterface interface {
|
||||
Create(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.CreateOptions) (*v2beta1.ClusterPolicy, error)
|
||||
Update(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (*v2beta1.ClusterPolicy, error)
|
||||
UpdateStatus(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (*v2beta1.ClusterPolicy, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v2beta1.ClusterPolicy, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v2beta1.ClusterPolicyList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.ClusterPolicy, err error)
|
||||
ClusterPolicyExpansion
|
||||
}
|
||||
|
||||
// clusterPolicies implements ClusterPolicyInterface
|
||||
type clusterPolicies struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newClusterPolicies returns a ClusterPolicies
|
||||
func newClusterPolicies(c *KyvernoV2beta1Client) *clusterPolicies {
|
||||
return &clusterPolicies{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the clusterPolicy, and returns the corresponding clusterPolicy object, and an error if there is any.
|
||||
func (c *clusterPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||
result = &v2beta1.ClusterPolicy{}
|
||||
err = c.client.Get().
|
||||
Resource("clusterpolicies").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterPolicies that match those selectors.
|
||||
func (c *clusterPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ClusterPolicyList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v2beta1.ClusterPolicyList{}
|
||||
err = c.client.Get().
|
||||
Resource("clusterpolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterPolicies.
|
||||
func (c *clusterPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("clusterpolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterPolicy and creates it. Returns the server's representation of the clusterPolicy, and an error, if there is any.
|
||||
func (c *clusterPolicies) Create(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.CreateOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||
result = &v2beta1.ClusterPolicy{}
|
||||
err = c.client.Post().
|
||||
Resource("clusterpolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterPolicy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterPolicy and updates it. Returns the server's representation of the clusterPolicy, and an error, if there is any.
|
||||
func (c *clusterPolicies) Update(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||
result = &v2beta1.ClusterPolicy{}
|
||||
err = c.client.Put().
|
||||
Resource("clusterpolicies").
|
||||
Name(clusterPolicy.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterPolicy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *clusterPolicies) UpdateStatus(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||
result = &v2beta1.ClusterPolicy{}
|
||||
err = c.client.Put().
|
||||
Resource("clusterpolicies").
|
||||
Name(clusterPolicy.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterPolicy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterPolicy and deletes it. Returns an error if one occurs.
|
||||
func (c *clusterPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("clusterpolicies").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *clusterPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("clusterpolicies").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterPolicy.
|
||||
func (c *clusterPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.ClusterPolicy, err error) {
|
||||
result = &v2beta1.ClusterPolicy{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("clusterpolicies").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v2beta1
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeCleanupPolicies implements CleanupPolicyInterface
|
||||
type FakeCleanupPolicies struct {
|
||||
Fake *FakeKyvernoV2beta1
|
||||
ns string
|
||||
}
|
||||
|
||||
var cleanuppoliciesResource = v2beta1.SchemeGroupVersion.WithResource("cleanuppolicies")
|
||||
|
||||
var cleanuppoliciesKind = v2beta1.SchemeGroupVersion.WithKind("CleanupPolicy")
|
||||
|
||||
// Get takes name of the cleanupPolicy, and returns the corresponding cleanupPolicy object, and an error if there is any.
|
||||
func (c *FakeCleanupPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.CleanupPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(cleanuppoliciesResource, c.ns, name), &v2beta1.CleanupPolicy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.CleanupPolicy), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of CleanupPolicies that match those selectors.
|
||||
func (c *FakeCleanupPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.CleanupPolicyList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(cleanuppoliciesResource, cleanuppoliciesKind, c.ns, opts), &v2beta1.CleanupPolicyList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v2beta1.CleanupPolicyList{ListMeta: obj.(*v2beta1.CleanupPolicyList).ListMeta}
|
||||
for _, item := range obj.(*v2beta1.CleanupPolicyList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested cleanupPolicies.
|
||||
func (c *FakeCleanupPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(cleanuppoliciesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a cleanupPolicy and creates it. Returns the server's representation of the cleanupPolicy, and an error, if there is any.
|
||||
func (c *FakeCleanupPolicies) Create(ctx context.Context, cleanupPolicy *v2beta1.CleanupPolicy, opts v1.CreateOptions) (result *v2beta1.CleanupPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(cleanuppoliciesResource, c.ns, cleanupPolicy), &v2beta1.CleanupPolicy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.CleanupPolicy), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a cleanupPolicy and updates it. Returns the server's representation of the cleanupPolicy, and an error, if there is any.
|
||||
func (c *FakeCleanupPolicies) Update(ctx context.Context, cleanupPolicy *v2beta1.CleanupPolicy, opts v1.UpdateOptions) (result *v2beta1.CleanupPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(cleanuppoliciesResource, c.ns, cleanupPolicy), &v2beta1.CleanupPolicy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.CleanupPolicy), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeCleanupPolicies) UpdateStatus(ctx context.Context, cleanupPolicy *v2beta1.CleanupPolicy, opts v1.UpdateOptions) (*v2beta1.CleanupPolicy, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(cleanuppoliciesResource, "status", c.ns, cleanupPolicy), &v2beta1.CleanupPolicy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.CleanupPolicy), err
|
||||
}
|
||||
|
||||
// Delete takes name of the cleanupPolicy and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeCleanupPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteActionWithOptions(cleanuppoliciesResource, c.ns, name, opts), &v2beta1.CleanupPolicy{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeCleanupPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(cleanuppoliciesResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v2beta1.CleanupPolicyList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched cleanupPolicy.
|
||||
func (c *FakeCleanupPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.CleanupPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(cleanuppoliciesResource, c.ns, name, pt, data, subresources...), &v2beta1.CleanupPolicy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.CleanupPolicy), err
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeClusterCleanupPolicies implements ClusterCleanupPolicyInterface
|
||||
type FakeClusterCleanupPolicies struct {
|
||||
Fake *FakeKyvernoV2beta1
|
||||
}
|
||||
|
||||
var clustercleanuppoliciesResource = v2beta1.SchemeGroupVersion.WithResource("clustercleanuppolicies")
|
||||
|
||||
var clustercleanuppoliciesKind = v2beta1.SchemeGroupVersion.WithKind("ClusterCleanupPolicy")
|
||||
|
||||
// Get takes name of the clusterCleanupPolicy, and returns the corresponding clusterCleanupPolicy object, and an error if there is any.
|
||||
func (c *FakeClusterCleanupPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.ClusterCleanupPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(clustercleanuppoliciesResource, name), &v2beta1.ClusterCleanupPolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.ClusterCleanupPolicy), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterCleanupPolicies that match those selectors.
|
||||
func (c *FakeClusterCleanupPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ClusterCleanupPolicyList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(clustercleanuppoliciesResource, clustercleanuppoliciesKind, opts), &v2beta1.ClusterCleanupPolicyList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v2beta1.ClusterCleanupPolicyList{ListMeta: obj.(*v2beta1.ClusterCleanupPolicyList).ListMeta}
|
||||
for _, item := range obj.(*v2beta1.ClusterCleanupPolicyList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterCleanupPolicies.
|
||||
func (c *FakeClusterCleanupPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(clustercleanuppoliciesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterCleanupPolicy and creates it. Returns the server's representation of the clusterCleanupPolicy, and an error, if there is any.
|
||||
func (c *FakeClusterCleanupPolicies) Create(ctx context.Context, clusterCleanupPolicy *v2beta1.ClusterCleanupPolicy, opts v1.CreateOptions) (result *v2beta1.ClusterCleanupPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(clustercleanuppoliciesResource, clusterCleanupPolicy), &v2beta1.ClusterCleanupPolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.ClusterCleanupPolicy), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterCleanupPolicy and updates it. Returns the server's representation of the clusterCleanupPolicy, and an error, if there is any.
|
||||
func (c *FakeClusterCleanupPolicies) Update(ctx context.Context, clusterCleanupPolicy *v2beta1.ClusterCleanupPolicy, opts v1.UpdateOptions) (result *v2beta1.ClusterCleanupPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(clustercleanuppoliciesResource, clusterCleanupPolicy), &v2beta1.ClusterCleanupPolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.ClusterCleanupPolicy), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeClusterCleanupPolicies) UpdateStatus(ctx context.Context, clusterCleanupPolicy *v2beta1.ClusterCleanupPolicy, opts v1.UpdateOptions) (*v2beta1.ClusterCleanupPolicy, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(clustercleanuppoliciesResource, "status", clusterCleanupPolicy), &v2beta1.ClusterCleanupPolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.ClusterCleanupPolicy), err
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterCleanupPolicy and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeClusterCleanupPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteActionWithOptions(clustercleanuppoliciesResource, name, opts), &v2beta1.ClusterCleanupPolicy{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusterCleanupPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(clustercleanuppoliciesResource, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v2beta1.ClusterCleanupPolicyList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterCleanupPolicy.
|
||||
func (c *FakeClusterCleanupPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.ClusterCleanupPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(clustercleanuppoliciesResource, name, pt, data, subresources...), &v2beta1.ClusterCleanupPolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.ClusterCleanupPolicy), err
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeClusterPolicies implements ClusterPolicyInterface
|
||||
type FakeClusterPolicies struct {
|
||||
Fake *FakeKyvernoV2beta1
|
||||
}
|
||||
|
||||
var clusterpoliciesResource = v2beta1.SchemeGroupVersion.WithResource("clusterpolicies")
|
||||
|
||||
var clusterpoliciesKind = v2beta1.SchemeGroupVersion.WithKind("ClusterPolicy")
|
||||
|
||||
// Get takes name of the clusterPolicy, and returns the corresponding clusterPolicy object, and an error if there is any.
|
||||
func (c *FakeClusterPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(clusterpoliciesResource, name), &v2beta1.ClusterPolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.ClusterPolicy), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterPolicies that match those selectors.
|
||||
func (c *FakeClusterPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ClusterPolicyList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(clusterpoliciesResource, clusterpoliciesKind, opts), &v2beta1.ClusterPolicyList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v2beta1.ClusterPolicyList{ListMeta: obj.(*v2beta1.ClusterPolicyList).ListMeta}
|
||||
for _, item := range obj.(*v2beta1.ClusterPolicyList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterPolicies.
|
||||
func (c *FakeClusterPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(clusterpoliciesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterPolicy and creates it. Returns the server's representation of the clusterPolicy, and an error, if there is any.
|
||||
func (c *FakeClusterPolicies) Create(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.CreateOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(clusterpoliciesResource, clusterPolicy), &v2beta1.ClusterPolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.ClusterPolicy), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterPolicy and updates it. Returns the server's representation of the clusterPolicy, and an error, if there is any.
|
||||
func (c *FakeClusterPolicies) Update(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(clusterpoliciesResource, clusterPolicy), &v2beta1.ClusterPolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.ClusterPolicy), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeClusterPolicies) UpdateStatus(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (*v2beta1.ClusterPolicy, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(clusterpoliciesResource, "status", clusterPolicy), &v2beta1.ClusterPolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.ClusterPolicy), err
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterPolicy and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeClusterPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteActionWithOptions(clusterpoliciesResource, name, opts), &v2beta1.ClusterPolicy{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusterPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(clusterpoliciesResource, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v2beta1.ClusterPolicyList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterPolicy.
|
||||
func (c *FakeClusterPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.ClusterPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(clusterpoliciesResource, name, pt, data, subresources...), &v2beta1.ClusterPolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.ClusterPolicy), err
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
type FakeKyvernoV2beta1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeKyvernoV2beta1) CleanupPolicies(namespace string) v2beta1.CleanupPolicyInterface {
|
||||
return &FakeCleanupPolicies{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeKyvernoV2beta1) ClusterCleanupPolicies() v2beta1.ClusterCleanupPolicyInterface {
|
||||
return &FakeClusterCleanupPolicies{c}
|
||||
}
|
||||
|
||||
func (c *FakeKyvernoV2beta1) ClusterPolicies() v2beta1.ClusterPolicyInterface {
|
||||
return &FakeClusterPolicies{c}
|
||||
}
|
||||
|
||||
func (c *FakeKyvernoV2beta1) Policies(namespace string) v2beta1.PolicyInterface {
|
||||
return &FakePolicies{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeKyvernoV2beta1) PolicyExceptions(namespace string) v2beta1.PolicyExceptionInterface {
|
||||
return &FakePolicyExceptions{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeKyvernoV2beta1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakePolicies implements PolicyInterface
|
||||
type FakePolicies struct {
|
||||
Fake *FakeKyvernoV2beta1
|
||||
ns string
|
||||
}
|
||||
|
||||
var policiesResource = v2beta1.SchemeGroupVersion.WithResource("policies")
|
||||
|
||||
var policiesKind = v2beta1.SchemeGroupVersion.WithKind("Policy")
|
||||
|
||||
// Get takes name of the policy, and returns the corresponding policy object, and an error if there is any.
|
||||
func (c *FakePolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.Policy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(policiesResource, c.ns, name), &v2beta1.Policy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.Policy), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Policies that match those selectors.
|
||||
func (c *FakePolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.PolicyList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(policiesResource, policiesKind, c.ns, opts), &v2beta1.PolicyList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v2beta1.PolicyList{ListMeta: obj.(*v2beta1.PolicyList).ListMeta}
|
||||
for _, item := range obj.(*v2beta1.PolicyList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested policies.
|
||||
func (c *FakePolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(policiesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a policy and creates it. Returns the server's representation of the policy, and an error, if there is any.
|
||||
func (c *FakePolicies) Create(ctx context.Context, policy *v2beta1.Policy, opts v1.CreateOptions) (result *v2beta1.Policy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(policiesResource, c.ns, policy), &v2beta1.Policy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.Policy), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a policy and updates it. Returns the server's representation of the policy, and an error, if there is any.
|
||||
func (c *FakePolicies) Update(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (result *v2beta1.Policy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(policiesResource, c.ns, policy), &v2beta1.Policy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.Policy), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakePolicies) UpdateStatus(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (*v2beta1.Policy, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(policiesResource, "status", c.ns, policy), &v2beta1.Policy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.Policy), err
|
||||
}
|
||||
|
||||
// Delete takes name of the policy and deletes it. Returns an error if one occurs.
|
||||
func (c *FakePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteActionWithOptions(policiesResource, c.ns, name, opts), &v2beta1.Policy{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakePolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(policiesResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v2beta1.PolicyList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched policy.
|
||||
func (c *FakePolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Policy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(policiesResource, c.ns, name, pt, data, subresources...), &v2beta1.Policy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.Policy), err
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakePolicyExceptions implements PolicyExceptionInterface
|
||||
type FakePolicyExceptions struct {
|
||||
Fake *FakeKyvernoV2beta1
|
||||
ns string
|
||||
}
|
||||
|
||||
var policyexceptionsResource = v2beta1.SchemeGroupVersion.WithResource("policyexceptions")
|
||||
|
||||
var policyexceptionsKind = v2beta1.SchemeGroupVersion.WithKind("PolicyException")
|
||||
|
||||
// Get takes name of the policyException, and returns the corresponding policyException object, and an error if there is any.
|
||||
func (c *FakePolicyExceptions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.PolicyException, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(policyexceptionsResource, c.ns, name), &v2beta1.PolicyException{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.PolicyException), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of PolicyExceptions that match those selectors.
|
||||
func (c *FakePolicyExceptions) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.PolicyExceptionList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(policyexceptionsResource, policyexceptionsKind, c.ns, opts), &v2beta1.PolicyExceptionList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v2beta1.PolicyExceptionList{ListMeta: obj.(*v2beta1.PolicyExceptionList).ListMeta}
|
||||
for _, item := range obj.(*v2beta1.PolicyExceptionList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested policyExceptions.
|
||||
func (c *FakePolicyExceptions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(policyexceptionsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a policyException and creates it. Returns the server's representation of the policyException, and an error, if there is any.
|
||||
func (c *FakePolicyExceptions) Create(ctx context.Context, policyException *v2beta1.PolicyException, opts v1.CreateOptions) (result *v2beta1.PolicyException, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(policyexceptionsResource, c.ns, policyException), &v2beta1.PolicyException{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.PolicyException), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a policyException and updates it. Returns the server's representation of the policyException, and an error, if there is any.
|
||||
func (c *FakePolicyExceptions) Update(ctx context.Context, policyException *v2beta1.PolicyException, opts v1.UpdateOptions) (result *v2beta1.PolicyException, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(policyexceptionsResource, c.ns, policyException), &v2beta1.PolicyException{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.PolicyException), err
|
||||
}
|
||||
|
||||
// Delete takes name of the policyException and deletes it. Returns an error if one occurs.
|
||||
func (c *FakePolicyExceptions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteActionWithOptions(policyexceptionsResource, c.ns, name, opts), &v2beta1.PolicyException{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakePolicyExceptions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(policyexceptionsResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v2beta1.PolicyExceptionList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched policyException.
|
||||
func (c *FakePolicyExceptions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.PolicyException, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(policyexceptionsResource, c.ns, name, pt, data, subresources...), &v2beta1.PolicyException{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2beta1.PolicyException), err
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
type CleanupPolicyExpansion interface{}
|
||||
|
||||
type ClusterCleanupPolicyExpansion interface{}
|
||||
|
||||
type ClusterPolicyExpansion interface{}
|
||||
|
||||
type PolicyExpansion interface{}
|
||||
|
||||
type PolicyExceptionExpansion interface{}
|
|
@ -1,127 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type KyvernoV2beta1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
CleanupPoliciesGetter
|
||||
ClusterCleanupPoliciesGetter
|
||||
ClusterPoliciesGetter
|
||||
PoliciesGetter
|
||||
PolicyExceptionsGetter
|
||||
}
|
||||
|
||||
// KyvernoV2beta1Client is used to interact with features provided by the kyverno.io group.
|
||||
type KyvernoV2beta1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *KyvernoV2beta1Client) CleanupPolicies(namespace string) CleanupPolicyInterface {
|
||||
return newCleanupPolicies(c, namespace)
|
||||
}
|
||||
|
||||
func (c *KyvernoV2beta1Client) ClusterCleanupPolicies() ClusterCleanupPolicyInterface {
|
||||
return newClusterCleanupPolicies(c)
|
||||
}
|
||||
|
||||
func (c *KyvernoV2beta1Client) ClusterPolicies() ClusterPolicyInterface {
|
||||
return newClusterPolicies(c)
|
||||
}
|
||||
|
||||
func (c *KyvernoV2beta1Client) Policies(namespace string) PolicyInterface {
|
||||
return newPolicies(c, namespace)
|
||||
}
|
||||
|
||||
func (c *KyvernoV2beta1Client) PolicyExceptions(namespace string) PolicyExceptionInterface {
|
||||
return newPolicyExceptions(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new KyvernoV2beta1Client for the given config.
|
||||
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||
func NewForConfig(c *rest.Config) (*KyvernoV2beta1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpClient, err := rest.HTTPClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewForConfigAndClient(&config, httpClient)
|
||||
}
|
||||
|
||||
// NewForConfigAndClient creates a new KyvernoV2beta1Client for the given config and http client.
|
||||
// Note the http client provided takes precedence over the configured transport values.
|
||||
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KyvernoV2beta1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &KyvernoV2beta1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new KyvernoV2beta1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *KyvernoV2beta1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new KyvernoV2beta1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *KyvernoV2beta1Client {
|
||||
return &KyvernoV2beta1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v2beta1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *KyvernoV2beta1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// PoliciesGetter has a method to return a PolicyInterface.
|
||||
// A group's client should implement this interface.
|
||||
type PoliciesGetter interface {
|
||||
Policies(namespace string) PolicyInterface
|
||||
}
|
||||
|
||||
// PolicyInterface has methods to work with Policy resources.
|
||||
type PolicyInterface interface {
|
||||
Create(ctx context.Context, policy *v2beta1.Policy, opts v1.CreateOptions) (*v2beta1.Policy, error)
|
||||
Update(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (*v2beta1.Policy, error)
|
||||
UpdateStatus(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (*v2beta1.Policy, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v2beta1.Policy, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v2beta1.PolicyList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Policy, err error)
|
||||
PolicyExpansion
|
||||
}
|
||||
|
||||
// policies implements PolicyInterface
|
||||
type policies struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newPolicies returns a Policies
|
||||
func newPolicies(c *KyvernoV2beta1Client, namespace string) *policies {
|
||||
return &policies{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the policy, and returns the corresponding policy object, and an error if there is any.
|
||||
func (c *policies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.Policy, err error) {
|
||||
result = &v2beta1.Policy{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("policies").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Policies that match those selectors.
|
||||
func (c *policies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.PolicyList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v2beta1.PolicyList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("policies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested policies.
|
||||
func (c *policies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("policies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a policy and creates it. Returns the server's representation of the policy, and an error, if there is any.
|
||||
func (c *policies) Create(ctx context.Context, policy *v2beta1.Policy, opts v1.CreateOptions) (result *v2beta1.Policy, err error) {
|
||||
result = &v2beta1.Policy{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("policies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(policy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a policy and updates it. Returns the server's representation of the policy, and an error, if there is any.
|
||||
func (c *policies) Update(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (result *v2beta1.Policy, err error) {
|
||||
result = &v2beta1.Policy{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("policies").
|
||||
Name(policy.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(policy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *policies) UpdateStatus(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (result *v2beta1.Policy, err error) {
|
||||
result = &v2beta1.Policy{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("policies").
|
||||
Name(policy.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(policy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the policy and deletes it. Returns an error if one occurs.
|
||||
func (c *policies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("policies").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *policies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("policies").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched policy.
|
||||
func (c *policies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Policy, err error) {
|
||||
result = &v2beta1.Policy{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("policies").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -1,178 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// PolicyExceptionsGetter has a method to return a PolicyExceptionInterface.
|
||||
// A group's client should implement this interface.
|
||||
type PolicyExceptionsGetter interface {
|
||||
PolicyExceptions(namespace string) PolicyExceptionInterface
|
||||
}
|
||||
|
||||
// PolicyExceptionInterface has methods to work with PolicyException resources.
|
||||
type PolicyExceptionInterface interface {
|
||||
Create(ctx context.Context, policyException *v2beta1.PolicyException, opts v1.CreateOptions) (*v2beta1.PolicyException, error)
|
||||
Update(ctx context.Context, policyException *v2beta1.PolicyException, opts v1.UpdateOptions) (*v2beta1.PolicyException, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v2beta1.PolicyException, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v2beta1.PolicyExceptionList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.PolicyException, err error)
|
||||
PolicyExceptionExpansion
|
||||
}
|
||||
|
||||
// policyExceptions implements PolicyExceptionInterface
|
||||
type policyExceptions struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newPolicyExceptions returns a PolicyExceptions
|
||||
func newPolicyExceptions(c *KyvernoV2beta1Client, namespace string) *policyExceptions {
|
||||
return &policyExceptions{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the policyException, and returns the corresponding policyException object, and an error if there is any.
|
||||
func (c *policyExceptions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.PolicyException, err error) {
|
||||
result = &v2beta1.PolicyException{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("policyexceptions").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of PolicyExceptions that match those selectors.
|
||||
func (c *policyExceptions) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.PolicyExceptionList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v2beta1.PolicyExceptionList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("policyexceptions").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested policyExceptions.
|
||||
func (c *policyExceptions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("policyexceptions").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a policyException and creates it. Returns the server's representation of the policyException, and an error, if there is any.
|
||||
func (c *policyExceptions) Create(ctx context.Context, policyException *v2beta1.PolicyException, opts v1.CreateOptions) (result *v2beta1.PolicyException, err error) {
|
||||
result = &v2beta1.PolicyException{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("policyexceptions").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(policyException).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a policyException and updates it. Returns the server's representation of the policyException, and an error, if there is any.
|
||||
func (c *policyExceptions) Update(ctx context.Context, policyException *v2beta1.PolicyException, opts v1.UpdateOptions) (result *v2beta1.PolicyException, err error) {
|
||||
result = &v2beta1.PolicyException{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("policyexceptions").
|
||||
Name(policyException.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(policyException).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the policyException and deletes it. Returns an error if one occurs.
|
||||
func (c *policyExceptions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("policyexceptions").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *policyExceptions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("policyexceptions").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched policyException.
|
||||
func (c *policyExceptions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.PolicyException, err error) {
|
||||
result = &v2beta1.PolicyException{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("policyexceptions").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -24,7 +24,6 @@ import (
|
|||
v1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
||||
v2 "github.com/kyverno/kyverno/api/kyverno/v2"
|
||||
v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
|
||||
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
v1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
||||
reportsv1 "github.com/kyverno/kyverno/api/reports/v1"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
@ -77,18 +76,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
|||
case v2alpha1.SchemeGroupVersion.WithResource("globalcontextentries"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2alpha1().GlobalContextEntries().Informer()}, nil
|
||||
|
||||
// Group=kyverno.io, Version=v2beta1
|
||||
case v2beta1.SchemeGroupVersion.WithResource("cleanuppolicies"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2beta1().CleanupPolicies().Informer()}, nil
|
||||
case v2beta1.SchemeGroupVersion.WithResource("clustercleanuppolicies"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2beta1().ClusterCleanupPolicies().Informer()}, nil
|
||||
case v2beta1.SchemeGroupVersion.WithResource("clusterpolicies"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2beta1().ClusterPolicies().Informer()}, nil
|
||||
case v2beta1.SchemeGroupVersion.WithResource("policies"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2beta1().Policies().Informer()}, nil
|
||||
case v2beta1.SchemeGroupVersion.WithResource("policyexceptions"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2beta1().PolicyExceptions().Informer()}, nil
|
||||
|
||||
// Group=reports.kyverno.io, Version=v1
|
||||
case reportsv1.SchemeGroupVersion.WithResource("clusterephemeralreports"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Reports().V1().ClusterEphemeralReports().Informer()}, nil
|
||||
|
|
|
@ -23,7 +23,6 @@ import (
|
|||
v1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1"
|
||||
v2 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v2"
|
||||
v2alpha1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v2alpha1"
|
||||
v2beta1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v2beta1"
|
||||
)
|
||||
|
||||
// Interface provides access to each of this group's versions.
|
||||
|
@ -32,8 +31,6 @@ type Interface interface {
|
|||
V1() v1.Interface
|
||||
// V2 provides access to shared informers for resources in V2.
|
||||
V2() v2.Interface
|
||||
// V2beta1 provides access to shared informers for resources in V2beta1.
|
||||
V2beta1() v2beta1.Interface
|
||||
// V2alpha1 provides access to shared informers for resources in V2alpha1.
|
||||
V2alpha1() v2alpha1.Interface
|
||||
}
|
||||
|
@ -59,11 +56,6 @@ func (g *group) V2() v2.Interface {
|
|||
return v2.New(g.factory, g.namespace, g.tweakListOptions)
|
||||
}
|
||||
|
||||
// V2beta1 returns a new v2beta1.Interface.
|
||||
func (g *group) V2beta1() v2beta1.Interface {
|
||||
return v2beta1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||
}
|
||||
|
||||
// V2alpha1 returns a new v2alpha1.Interface.
|
||||
func (g *group) V2alpha1() v2alpha1.Interface {
|
||||
return v2alpha1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v2beta1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// CleanupPolicyInformer provides access to a shared informer and lister for
|
||||
// CleanupPolicies.
|
||||
type CleanupPolicyInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v2beta1.CleanupPolicyLister
|
||||
}
|
||||
|
||||
type cleanupPolicyInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewCleanupPolicyInformer constructs a new informer for CleanupPolicy type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewCleanupPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredCleanupPolicyInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredCleanupPolicyInformer constructs a new informer for CleanupPolicy type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredCleanupPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.KyvernoV2beta1().CleanupPolicies(namespace).List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.KyvernoV2beta1().CleanupPolicies(namespace).Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&kyvernov2beta1.CleanupPolicy{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *cleanupPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredCleanupPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *cleanupPolicyInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&kyvernov2beta1.CleanupPolicy{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *cleanupPolicyInformer) Lister() v2beta1.CleanupPolicyLister {
|
||||
return v2beta1.NewCleanupPolicyLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v2beta1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ClusterCleanupPolicyInformer provides access to a shared informer and lister for
|
||||
// ClusterCleanupPolicies.
|
||||
type ClusterCleanupPolicyInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v2beta1.ClusterCleanupPolicyLister
|
||||
}
|
||||
|
||||
type clusterCleanupPolicyInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewClusterCleanupPolicyInformer constructs a new informer for ClusterCleanupPolicy type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewClusterCleanupPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredClusterCleanupPolicyInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredClusterCleanupPolicyInformer constructs a new informer for ClusterCleanupPolicy type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredClusterCleanupPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.KyvernoV2beta1().ClusterCleanupPolicies().List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.KyvernoV2beta1().ClusterCleanupPolicies().Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&kyvernov2beta1.ClusterCleanupPolicy{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *clusterCleanupPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredClusterCleanupPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *clusterCleanupPolicyInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&kyvernov2beta1.ClusterCleanupPolicy{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *clusterCleanupPolicyInformer) Lister() v2beta1.ClusterCleanupPolicyLister {
|
||||
return v2beta1.NewClusterCleanupPolicyLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v2beta1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ClusterPolicyInformer provides access to a shared informer and lister for
|
||||
// ClusterPolicies.
|
||||
type ClusterPolicyInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v2beta1.ClusterPolicyLister
|
||||
}
|
||||
|
||||
type clusterPolicyInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewClusterPolicyInformer constructs a new informer for ClusterPolicy type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewClusterPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredClusterPolicyInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredClusterPolicyInformer constructs a new informer for ClusterPolicy type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredClusterPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.KyvernoV2beta1().ClusterPolicies().List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.KyvernoV2beta1().ClusterPolicies().Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&kyvernov2beta1.ClusterPolicy{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *clusterPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredClusterPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *clusterPolicyInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&kyvernov2beta1.ClusterPolicy{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *clusterPolicyInformer) Lister() v2beta1.ClusterPolicyLister {
|
||||
return v2beta1.NewClusterPolicyLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// CleanupPolicies returns a CleanupPolicyInformer.
|
||||
CleanupPolicies() CleanupPolicyInformer
|
||||
// ClusterCleanupPolicies returns a ClusterCleanupPolicyInformer.
|
||||
ClusterCleanupPolicies() ClusterCleanupPolicyInformer
|
||||
// ClusterPolicies returns a ClusterPolicyInformer.
|
||||
ClusterPolicies() ClusterPolicyInformer
|
||||
// Policies returns a PolicyInformer.
|
||||
Policies() PolicyInformer
|
||||
// PolicyExceptions returns a PolicyExceptionInformer.
|
||||
PolicyExceptions() PolicyExceptionInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
namespace string
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// CleanupPolicies returns a CleanupPolicyInformer.
|
||||
func (v *version) CleanupPolicies() CleanupPolicyInformer {
|
||||
return &cleanupPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// ClusterCleanupPolicies returns a ClusterCleanupPolicyInformer.
|
||||
func (v *version) ClusterCleanupPolicies() ClusterCleanupPolicyInformer {
|
||||
return &clusterCleanupPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// ClusterPolicies returns a ClusterPolicyInformer.
|
||||
func (v *version) ClusterPolicies() ClusterPolicyInformer {
|
||||
return &clusterPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// Policies returns a PolicyInformer.
|
||||
func (v *version) Policies() PolicyInformer {
|
||||
return &policyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// PolicyExceptions returns a PolicyExceptionInformer.
|
||||
func (v *version) PolicyExceptions() PolicyExceptionInformer {
|
||||
return &policyExceptionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v2beta1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// PolicyInformer provides access to a shared informer and lister for
|
||||
// Policies.
|
||||
type PolicyInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v2beta1.PolicyLister
|
||||
}
|
||||
|
||||
type policyInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewPolicyInformer constructs a new informer for Policy type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredPolicyInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredPolicyInformer constructs a new informer for Policy type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.KyvernoV2beta1().Policies(namespace).List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.KyvernoV2beta1().Policies(namespace).Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&kyvernov2beta1.Policy{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *policyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *policyInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&kyvernov2beta1.Policy{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *policyInformer) Lister() v2beta1.PolicyLister {
|
||||
return v2beta1.NewPolicyLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v2beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v2beta1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// PolicyExceptionInformer provides access to a shared informer and lister for
|
||||
// PolicyExceptions.
|
||||
type PolicyExceptionInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v2beta1.PolicyExceptionLister
|
||||
}
|
||||
|
||||
type policyExceptionInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewPolicyExceptionInformer constructs a new informer for PolicyException type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewPolicyExceptionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredPolicyExceptionInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredPolicyExceptionInformer constructs a new informer for PolicyException type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredPolicyExceptionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.KyvernoV2beta1().PolicyExceptions(namespace).List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.KyvernoV2beta1().PolicyExceptions(namespace).Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&kyvernov2beta1.PolicyException{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *policyExceptionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredPolicyExceptionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *policyExceptionInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&kyvernov2beta1.PolicyException{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *policyExceptionInformer) Lister() v2beta1.PolicyExceptionLister {
|
||||
return v2beta1.NewPolicyExceptionLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -6,14 +6,12 @@ import (
|
|||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1"
|
||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2"
|
||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1"
|
||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2"
|
||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_reports_v1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/reports/v1"
|
||||
discovery "github.com/kyverno/kyverno/pkg/clients/kyverno/discovery"
|
||||
kyvernov1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1"
|
||||
kyvernov2 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2"
|
||||
kyvernov2alpha1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2alpha1"
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2beta1"
|
||||
reportsv1 "github.com/kyverno/kyverno/pkg/clients/kyverno/reportsv1"
|
||||
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/clients/kyverno/wgpolicyk8sv1alpha2"
|
||||
"github.com/kyverno/kyverno/pkg/metrics"
|
||||
|
@ -25,7 +23,6 @@ type clientset struct {
|
|||
kyvernov1 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1.KyvernoV1Interface
|
||||
kyvernov2 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2.KyvernoV2Interface
|
||||
kyvernov2alpha1 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface
|
||||
kyvernov2beta1 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface
|
||||
reportsv1 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_reports_v1.ReportsV1Interface
|
||||
wgpolicyk8sv1alpha2 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2.Wgpolicyk8sV1alpha2Interface
|
||||
}
|
||||
|
@ -42,9 +39,6 @@ func (c *clientset) KyvernoV2() github_com_kyverno_kyverno_pkg_client_clientset_
|
|||
func (c *clientset) KyvernoV2alpha1() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface {
|
||||
return c.kyvernov2alpha1
|
||||
}
|
||||
func (c *clientset) KyvernoV2beta1() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface {
|
||||
return c.kyvernov2beta1
|
||||
}
|
||||
func (c *clientset) ReportsV1() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_reports_v1.ReportsV1Interface {
|
||||
return c.reportsv1
|
||||
}
|
||||
|
@ -58,7 +52,6 @@ func WrapWithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versi
|
|||
kyvernov1: kyvernov1.WithMetrics(inner.KyvernoV1(), m, clientType),
|
||||
kyvernov2: kyvernov2.WithMetrics(inner.KyvernoV2(), m, clientType),
|
||||
kyvernov2alpha1: kyvernov2alpha1.WithMetrics(inner.KyvernoV2alpha1(), m, clientType),
|
||||
kyvernov2beta1: kyvernov2beta1.WithMetrics(inner.KyvernoV2beta1(), m, clientType),
|
||||
reportsv1: reportsv1.WithMetrics(inner.ReportsV1(), m, clientType),
|
||||
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithMetrics(inner.Wgpolicyk8sV1alpha2(), m, clientType),
|
||||
}
|
||||
|
@ -70,7 +63,6 @@ func WrapWithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versi
|
|||
kyvernov1: kyvernov1.WithTracing(inner.KyvernoV1(), "KyvernoV1"),
|
||||
kyvernov2: kyvernov2.WithTracing(inner.KyvernoV2(), "KyvernoV2"),
|
||||
kyvernov2alpha1: kyvernov2alpha1.WithTracing(inner.KyvernoV2alpha1(), "KyvernoV2alpha1"),
|
||||
kyvernov2beta1: kyvernov2beta1.WithTracing(inner.KyvernoV2beta1(), "KyvernoV2beta1"),
|
||||
reportsv1: reportsv1.WithTracing(inner.ReportsV1(), "ReportsV1"),
|
||||
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithTracing(inner.Wgpolicyk8sV1alpha2(), "Wgpolicyk8sV1alpha2"),
|
||||
}
|
||||
|
@ -82,7 +74,6 @@ func WrapWithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versi
|
|||
kyvernov1: kyvernov1.WithLogging(inner.KyvernoV1(), logger.WithValues("group", "KyvernoV1")),
|
||||
kyvernov2: kyvernov2.WithLogging(inner.KyvernoV2(), logger.WithValues("group", "KyvernoV2")),
|
||||
kyvernov2alpha1: kyvernov2alpha1.WithLogging(inner.KyvernoV2alpha1(), logger.WithValues("group", "KyvernoV2alpha1")),
|
||||
kyvernov2beta1: kyvernov2beta1.WithLogging(inner.KyvernoV2beta1(), logger.WithValues("group", "KyvernoV2beta1")),
|
||||
reportsv1: reportsv1.WithLogging(inner.ReportsV1(), logger.WithValues("group", "ReportsV1")),
|
||||
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithLogging(inner.Wgpolicyk8sV1alpha2(), logger.WithValues("group", "Wgpolicyk8sV1alpha2")),
|
||||
}
|
||||
|
|
|
@ -1,373 +0,0 @@
|
|||
package resource
|
||||
|
||||
import (
|
||||
context "context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
github_com_kyverno_kyverno_api_kyverno_v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||
"github.com/kyverno/kyverno/pkg/metrics"
|
||||
"github.com/kyverno/kyverno/pkg/tracing"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.uber.org/multierr"
|
||||
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||
)
|
||||
|
||||
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface {
|
||||
return &withLogging{inner, logger}
|
||||
}
|
||||
|
||||
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface, recorder metrics.Recorder) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface {
|
||||
return &withMetrics{inner, recorder}
|
||||
}
|
||||
|
||||
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface, client, kind string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface {
|
||||
return &withTracing{inner, client, kind}
|
||||
}
|
||||
|
||||
type withLogging struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface
|
||||
logger logr.Logger
|
||||
}
|
||||
|
||||
func (c *withLogging) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Create")
|
||||
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Create done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Delete")
|
||||
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret0); err != nil {
|
||||
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Delete done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret0); err != nil {
|
||||
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Get")
|
||||
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Get done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicyList, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "List")
|
||||
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("List done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Patch")
|
||||
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Patch done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Update")
|
||||
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Update done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "UpdateStatus")
|
||||
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "UpdateStatus failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("UpdateStatus done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Watch")
|
||||
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Watch done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
type withMetrics struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface
|
||||
recorder metrics.Recorder
|
||||
}
|
||||
|
||||
func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "create")
|
||||
return c.inner.Create(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||
return c.inner.Delete(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "get")
|
||||
return c.inner.Get(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicyList, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "list")
|
||||
return c.inner.List(arg0, arg1)
|
||||
}
|
||||
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
}
|
||||
func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "update")
|
||||
return c.inner.Update(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "update_status")
|
||||
return c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||
return c.inner.Watch(arg0, arg1)
|
||||
}
|
||||
|
||||
type withTracing struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface
|
||||
client string
|
||||
kind string
|
||||
}
|
||||
|
||||
func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Create"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Delete"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret0)
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret0)
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Get"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicyList, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("List"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Patch"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Update"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.CleanupPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("UpdateStatus"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Watch"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"github.com/go-logr/logr"
|
||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||
cleanuppolicies "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2beta1/cleanuppolicies"
|
||||
clustercleanuppolicies "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2beta1/clustercleanuppolicies"
|
||||
clusterpolicies "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2beta1/clusterpolicies"
|
||||
policies "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2beta1/policies"
|
||||
policyexceptions "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2beta1/policyexceptions"
|
||||
"github.com/kyverno/kyverno/pkg/metrics"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface, metrics metrics.MetricsConfigManager, clientType metrics.ClientType) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface {
|
||||
return &withMetrics{inner, metrics, clientType}
|
||||
}
|
||||
|
||||
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface, client string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface {
|
||||
return &withTracing{inner, client}
|
||||
}
|
||||
|
||||
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface {
|
||||
return &withLogging{inner, logger}
|
||||
}
|
||||
|
||||
type withMetrics struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface
|
||||
metrics metrics.MetricsConfigManager
|
||||
clientType metrics.ClientType
|
||||
}
|
||||
|
||||
func (c *withMetrics) RESTClient() rest.Interface {
|
||||
return c.inner.RESTClient()
|
||||
}
|
||||
func (c *withMetrics) CleanupPolicies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface {
|
||||
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "CleanupPolicy", c.clientType)
|
||||
return cleanuppolicies.WithMetrics(c.inner.CleanupPolicies(namespace), recorder)
|
||||
}
|
||||
func (c *withMetrics) ClusterCleanupPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface {
|
||||
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "ClusterCleanupPolicy", c.clientType)
|
||||
return clustercleanuppolicies.WithMetrics(c.inner.ClusterCleanupPolicies(), recorder)
|
||||
}
|
||||
func (c *withMetrics) ClusterPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "ClusterPolicy", c.clientType)
|
||||
return clusterpolicies.WithMetrics(c.inner.ClusterPolicies(), recorder)
|
||||
}
|
||||
func (c *withMetrics) Policies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "Policy", c.clientType)
|
||||
return policies.WithMetrics(c.inner.Policies(namespace), recorder)
|
||||
}
|
||||
func (c *withMetrics) PolicyExceptions(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface {
|
||||
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "PolicyException", c.clientType)
|
||||
return policyexceptions.WithMetrics(c.inner.PolicyExceptions(namespace), recorder)
|
||||
}
|
||||
|
||||
type withTracing struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface
|
||||
client string
|
||||
}
|
||||
|
||||
func (c *withTracing) RESTClient() rest.Interface {
|
||||
return c.inner.RESTClient()
|
||||
}
|
||||
func (c *withTracing) CleanupPolicies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface {
|
||||
return cleanuppolicies.WithTracing(c.inner.CleanupPolicies(namespace), c.client, "CleanupPolicy")
|
||||
}
|
||||
func (c *withTracing) ClusterCleanupPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface {
|
||||
return clustercleanuppolicies.WithTracing(c.inner.ClusterCleanupPolicies(), c.client, "ClusterCleanupPolicy")
|
||||
}
|
||||
func (c *withTracing) ClusterPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||
return clusterpolicies.WithTracing(c.inner.ClusterPolicies(), c.client, "ClusterPolicy")
|
||||
}
|
||||
func (c *withTracing) Policies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||
return policies.WithTracing(c.inner.Policies(namespace), c.client, "Policy")
|
||||
}
|
||||
func (c *withTracing) PolicyExceptions(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface {
|
||||
return policyexceptions.WithTracing(c.inner.PolicyExceptions(namespace), c.client, "PolicyException")
|
||||
}
|
||||
|
||||
type withLogging struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface
|
||||
logger logr.Logger
|
||||
}
|
||||
|
||||
func (c *withLogging) RESTClient() rest.Interface {
|
||||
return c.inner.RESTClient()
|
||||
}
|
||||
func (c *withLogging) CleanupPolicies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.CleanupPolicyInterface {
|
||||
return cleanuppolicies.WithLogging(c.inner.CleanupPolicies(namespace), c.logger.WithValues("resource", "CleanupPolicies").WithValues("namespace", namespace))
|
||||
}
|
||||
func (c *withLogging) ClusterCleanupPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface {
|
||||
return clustercleanuppolicies.WithLogging(c.inner.ClusterCleanupPolicies(), c.logger.WithValues("resource", "ClusterCleanupPolicies"))
|
||||
}
|
||||
func (c *withLogging) ClusterPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||
return clusterpolicies.WithLogging(c.inner.ClusterPolicies(), c.logger.WithValues("resource", "ClusterPolicies"))
|
||||
}
|
||||
func (c *withLogging) Policies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||
return policies.WithLogging(c.inner.Policies(namespace), c.logger.WithValues("resource", "Policies").WithValues("namespace", namespace))
|
||||
}
|
||||
func (c *withLogging) PolicyExceptions(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface {
|
||||
return policyexceptions.WithLogging(c.inner.PolicyExceptions(namespace), c.logger.WithValues("resource", "PolicyExceptions").WithValues("namespace", namespace))
|
||||
}
|
|
@ -1,373 +0,0 @@
|
|||
package resource
|
||||
|
||||
import (
|
||||
context "context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
github_com_kyverno_kyverno_api_kyverno_v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||
"github.com/kyverno/kyverno/pkg/metrics"
|
||||
"github.com/kyverno/kyverno/pkg/tracing"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.uber.org/multierr"
|
||||
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||
)
|
||||
|
||||
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface {
|
||||
return &withLogging{inner, logger}
|
||||
}
|
||||
|
||||
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface, recorder metrics.Recorder) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface {
|
||||
return &withMetrics{inner, recorder}
|
||||
}
|
||||
|
||||
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface, client, kind string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface {
|
||||
return &withTracing{inner, client, kind}
|
||||
}
|
||||
|
||||
type withLogging struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface
|
||||
logger logr.Logger
|
||||
}
|
||||
|
||||
func (c *withLogging) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Create")
|
||||
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Create done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Delete")
|
||||
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret0); err != nil {
|
||||
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Delete done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret0); err != nil {
|
||||
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Get")
|
||||
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Get done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicyList, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "List")
|
||||
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("List done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Patch")
|
||||
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Patch done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Update")
|
||||
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Update done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "UpdateStatus")
|
||||
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "UpdateStatus failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("UpdateStatus done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Watch")
|
||||
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Watch done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
type withMetrics struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface
|
||||
recorder metrics.Recorder
|
||||
}
|
||||
|
||||
func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "create")
|
||||
return c.inner.Create(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||
return c.inner.Delete(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "get")
|
||||
return c.inner.Get(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicyList, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "list")
|
||||
return c.inner.List(arg0, arg1)
|
||||
}
|
||||
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
}
|
||||
func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "update")
|
||||
return c.inner.Update(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "update_status")
|
||||
return c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||
return c.inner.Watch(arg0, arg1)
|
||||
}
|
||||
|
||||
type withTracing struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterCleanupPolicyInterface
|
||||
client string
|
||||
kind string
|
||||
}
|
||||
|
||||
func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Create"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Delete"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret0)
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret0)
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Get"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicyList, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("List"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Patch"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Update"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterCleanupPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("UpdateStatus"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Watch"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
|
@ -1,373 +0,0 @@
|
|||
package resource
|
||||
|
||||
import (
|
||||
context "context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
github_com_kyverno_kyverno_api_kyverno_v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||
"github.com/kyverno/kyverno/pkg/metrics"
|
||||
"github.com/kyverno/kyverno/pkg/tracing"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.uber.org/multierr"
|
||||
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||
)
|
||||
|
||||
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||
return &withLogging{inner, logger}
|
||||
}
|
||||
|
||||
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface, recorder metrics.Recorder) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||
return &withMetrics{inner, recorder}
|
||||
}
|
||||
|
||||
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface, client, kind string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||
return &withTracing{inner, client, kind}
|
||||
}
|
||||
|
||||
type withLogging struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface
|
||||
logger logr.Logger
|
||||
}
|
||||
|
||||
func (c *withLogging) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Create")
|
||||
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Create done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Delete")
|
||||
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret0); err != nil {
|
||||
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Delete done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret0); err != nil {
|
||||
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Get")
|
||||
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Get done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicyList, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "List")
|
||||
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("List done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Patch")
|
||||
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Patch done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Update")
|
||||
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Update done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "UpdateStatus")
|
||||
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "UpdateStatus failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("UpdateStatus done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Watch")
|
||||
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Watch done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
type withMetrics struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface
|
||||
recorder metrics.Recorder
|
||||
}
|
||||
|
||||
func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "create")
|
||||
return c.inner.Create(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||
return c.inner.Delete(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "get")
|
||||
return c.inner.Get(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicyList, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "list")
|
||||
return c.inner.List(arg0, arg1)
|
||||
}
|
||||
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
}
|
||||
func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "update")
|
||||
return c.inner.Update(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "update_status")
|
||||
return c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||
return c.inner.Watch(arg0, arg1)
|
||||
}
|
||||
|
||||
type withTracing struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface
|
||||
client string
|
||||
kind string
|
||||
}
|
||||
|
||||
func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Create"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Delete"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret0)
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret0)
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Get"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicyList, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("List"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Patch"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Update"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("UpdateStatus"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Watch"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
|
@ -1,373 +0,0 @@
|
|||
package resource
|
||||
|
||||
import (
|
||||
context "context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
github_com_kyverno_kyverno_api_kyverno_v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||
"github.com/kyverno/kyverno/pkg/metrics"
|
||||
"github.com/kyverno/kyverno/pkg/tracing"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.uber.org/multierr"
|
||||
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||
)
|
||||
|
||||
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||
return &withLogging{inner, logger}
|
||||
}
|
||||
|
||||
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface, recorder metrics.Recorder) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||
return &withMetrics{inner, recorder}
|
||||
}
|
||||
|
||||
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface, client, kind string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||
return &withTracing{inner, client, kind}
|
||||
}
|
||||
|
||||
type withLogging struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface
|
||||
logger logr.Logger
|
||||
}
|
||||
|
||||
func (c *withLogging) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Create")
|
||||
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Create done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Delete")
|
||||
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret0); err != nil {
|
||||
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Delete done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret0); err != nil {
|
||||
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Get")
|
||||
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Get done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyList, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "List")
|
||||
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("List done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Patch")
|
||||
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Patch done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Update")
|
||||
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Update done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "UpdateStatus")
|
||||
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "UpdateStatus failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("UpdateStatus done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Watch")
|
||||
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Watch done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
type withMetrics struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface
|
||||
recorder metrics.Recorder
|
||||
}
|
||||
|
||||
func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "create")
|
||||
return c.inner.Create(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||
return c.inner.Delete(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "get")
|
||||
return c.inner.Get(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyList, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "list")
|
||||
return c.inner.List(arg0, arg1)
|
||||
}
|
||||
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
}
|
||||
func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "update")
|
||||
return c.inner.Update(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "update_status")
|
||||
return c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||
return c.inner.Watch(arg0, arg1)
|
||||
}
|
||||
|
||||
type withTracing struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface
|
||||
client string
|
||||
kind string
|
||||
}
|
||||
|
||||
func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Create"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Delete"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret0)
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret0)
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Get"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyList, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("List"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Patch"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Update"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("UpdateStatus"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Watch"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
|
@ -1,337 +0,0 @@
|
|||
package resource
|
||||
|
||||
import (
|
||||
context "context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
github_com_kyverno_kyverno_api_kyverno_v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||
"github.com/kyverno/kyverno/pkg/metrics"
|
||||
"github.com/kyverno/kyverno/pkg/tracing"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.uber.org/multierr"
|
||||
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||
)
|
||||
|
||||
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface {
|
||||
return &withLogging{inner, logger}
|
||||
}
|
||||
|
||||
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface, recorder metrics.Recorder) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface {
|
||||
return &withMetrics{inner, recorder}
|
||||
}
|
||||
|
||||
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface, client, kind string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface {
|
||||
return &withTracing{inner, client, kind}
|
||||
}
|
||||
|
||||
type withLogging struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface
|
||||
logger logr.Logger
|
||||
}
|
||||
|
||||
func (c *withLogging) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Create")
|
||||
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Create done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Delete")
|
||||
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret0); err != nil {
|
||||
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Delete done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret0); err != nil {
|
||||
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Get")
|
||||
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Get done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyExceptionList, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "List")
|
||||
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("List done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Patch")
|
||||
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Patch done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Update")
|
||||
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Update done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
start := time.Now()
|
||||
logger := c.logger.WithValues("operation", "Watch")
|
||||
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||
if err := multierr.Combine(ret1); err != nil {
|
||||
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||
} else {
|
||||
logger.Info("Watch done", "duration", time.Since(start))
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
type withMetrics struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface
|
||||
recorder metrics.Recorder
|
||||
}
|
||||
|
||||
func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "create")
|
||||
return c.inner.Create(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||
return c.inner.Delete(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "get")
|
||||
return c.inner.Get(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyExceptionList, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "list")
|
||||
return c.inner.List(arg0, arg1)
|
||||
}
|
||||
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
}
|
||||
func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "update")
|
||||
return c.inner.Update(arg0, arg1, arg2)
|
||||
}
|
||||
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||
return c.inner.Watch(arg0, arg1)
|
||||
}
|
||||
|
||||
type withTracing struct {
|
||||
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyExceptionInterface
|
||||
client string
|
||||
kind string
|
||||
}
|
||||
|
||||
func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Create"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Delete"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret0)
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret0)
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Get"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyExceptionList, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("List"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Patch"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyException, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Update"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
||||
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||
var span trace.Span
|
||||
if tracing.IsInSpan(arg0) {
|
||||
arg0, span = tracing.StartChildSpan(
|
||||
arg0,
|
||||
"",
|
||||
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||
trace.WithAttributes(
|
||||
tracing.KubeClientGroupKey.String(c.client),
|
||||
tracing.KubeClientKindKey.String(c.kind),
|
||||
tracing.KubeClientOperationKey.String("Watch"),
|
||||
),
|
||||
)
|
||||
defer span.End()
|
||||
}
|
||||
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||
if span != nil {
|
||||
tracing.SetSpanStatus(span, ret1)
|
||||
}
|
||||
return ret0, ret1
|
||||
}
|
|
@ -7,10 +7,9 @@ import (
|
|||
"github.com/go-logr/logr"
|
||||
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
||||
kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2"
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
"github.com/kyverno/kyverno/pkg/client/clientset/versioned"
|
||||
kyvernov2beta1informers "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v2beta1"
|
||||
kyvernov2beta1listers "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2beta1"
|
||||
kyvernov2informers "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v2"
|
||||
kyvernov2listers "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2"
|
||||
"github.com/kyverno/kyverno/pkg/clients/dclient"
|
||||
"github.com/kyverno/kyverno/pkg/config"
|
||||
"github.com/kyverno/kyverno/pkg/controllers"
|
||||
|
@ -43,13 +42,13 @@ type controller struct {
|
|||
kyvernoClient versioned.Interface
|
||||
|
||||
// listers
|
||||
cpolLister kyvernov2beta1listers.ClusterCleanupPolicyLister
|
||||
polLister kyvernov2beta1listers.CleanupPolicyLister
|
||||
cpolLister kyvernov2listers.ClusterCleanupPolicyLister
|
||||
polLister kyvernov2listers.CleanupPolicyLister
|
||||
nsLister corev1listers.NamespaceLister
|
||||
|
||||
// queue
|
||||
queue workqueue.RateLimitingInterface
|
||||
enqueue controllerutils.EnqueueFuncT[kyvernov2beta1.CleanupPolicyInterface]
|
||||
enqueue controllerutils.EnqueueFuncT[kyvernov2.CleanupPolicyInterface]
|
||||
|
||||
// config
|
||||
configuration config.Configuration
|
||||
|
@ -74,8 +73,8 @@ const (
|
|||
func NewController(
|
||||
client dclient.Interface,
|
||||
kyvernoClient versioned.Interface,
|
||||
cpolInformer kyvernov2beta1informers.ClusterCleanupPolicyInformer,
|
||||
polInformer kyvernov2beta1informers.CleanupPolicyInformer,
|
||||
cpolInformer kyvernov2informers.ClusterCleanupPolicyInformer,
|
||||
polInformer kyvernov2informers.CleanupPolicyInformer,
|
||||
nsLister corev1listers.NamespaceLister,
|
||||
configuration config.Configuration,
|
||||
cmResolver engineapi.ConfigmapResolver,
|
||||
|
@ -84,11 +83,11 @@ func NewController(
|
|||
gctxStore loaders.Store,
|
||||
) controllers.Controller {
|
||||
queue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), ControllerName)
|
||||
keyFunc := controllerutils.MetaNamespaceKeyT[kyvernov2beta1.CleanupPolicyInterface]
|
||||
keyFunc := controllerutils.MetaNamespaceKeyT[kyvernov2.CleanupPolicyInterface]
|
||||
baseEnqueueFunc := controllerutils.LogError(logger, controllerutils.Parse(keyFunc, controllerutils.Queue(queue)))
|
||||
enqueueFunc := func(logger logr.Logger, operation, kind string) controllerutils.EnqueueFuncT[kyvernov2beta1.CleanupPolicyInterface] {
|
||||
enqueueFunc := func(logger logr.Logger, operation, kind string) controllerutils.EnqueueFuncT[kyvernov2.CleanupPolicyInterface] {
|
||||
logger = logger.WithValues("kind", kind, "operation", operation)
|
||||
return func(obj kyvernov2beta1.CleanupPolicyInterface) error {
|
||||
return func(obj kyvernov2.CleanupPolicyInterface) error {
|
||||
logger = logger.WithValues("name", obj.GetName())
|
||||
if obj.GetNamespace() != "" {
|
||||
logger = logger.WithValues("namespace", obj.GetNamespace())
|
||||
|
@ -161,7 +160,7 @@ func (c *controller) Run(ctx context.Context, workers int) {
|
|||
controllerutils.Run(ctx, logger.V(3), ControllerName, time.Second, c.queue, workers, maxRetries, c.reconcile)
|
||||
}
|
||||
|
||||
func (c *controller) getPolicy(namespace, name string) (kyvernov2beta1.CleanupPolicyInterface, error) {
|
||||
func (c *controller) getPolicy(namespace, name string) (kyvernov2.CleanupPolicyInterface, error) {
|
||||
if namespace == "" {
|
||||
cpolicy, err := c.cpolLister.Get(name)
|
||||
if err != nil {
|
||||
|
@ -177,7 +176,7 @@ func (c *controller) getPolicy(namespace, name string) (kyvernov2beta1.CleanupPo
|
|||
}
|
||||
}
|
||||
|
||||
func (c *controller) cleanup(ctx context.Context, logger logr.Logger, policy kyvernov2beta1.CleanupPolicyInterface) error {
|
||||
func (c *controller) cleanup(ctx context.Context, logger logr.Logger, policy kyvernov2.CleanupPolicyInterface) error {
|
||||
spec := policy.GetSpec()
|
||||
kinds := sets.New(spec.MatchResources.GetKinds()...)
|
||||
debug := logger.V(4)
|
||||
|
@ -422,22 +421,22 @@ func (c *controller) reconcile(ctx context.Context, logger logr.Logger, key, nam
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *controller) updateCleanupPolicyStatus(ctx context.Context, policy kyvernov2beta1.CleanupPolicyInterface, namespace string, time time.Time) error {
|
||||
func (c *controller) updateCleanupPolicyStatus(ctx context.Context, policy kyvernov2.CleanupPolicyInterface, namespace string, time time.Time) error {
|
||||
switch obj := policy.(type) {
|
||||
case *kyvernov2beta1.ClusterCleanupPolicy:
|
||||
case *kyvernov2.ClusterCleanupPolicy:
|
||||
latest := obj.DeepCopy()
|
||||
latest.Status.LastExecutionTime = metav1.NewTime(time)
|
||||
|
||||
new, err := c.kyvernoClient.KyvernoV2beta1().ClusterCleanupPolicies().UpdateStatus(ctx, latest, metav1.UpdateOptions{})
|
||||
new, err := c.kyvernoClient.KyvernoV2().ClusterCleanupPolicies().UpdateStatus(ctx, latest, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
logging.V(3).Info("updated cluster cleanup policy status", "name", policy.GetName(), "status", new.Status)
|
||||
case *kyvernov2beta1.CleanupPolicy:
|
||||
case *kyvernov2.CleanupPolicy:
|
||||
latest := obj.DeepCopy()
|
||||
latest.Status.LastExecutionTime = metav1.NewTime(time)
|
||||
|
||||
new, err := c.kyvernoClient.KyvernoV2beta1().CleanupPolicies(namespace).UpdateStatus(ctx, latest, metav1.UpdateOptions{})
|
||||
new, err := c.kyvernoClient.KyvernoV2().CleanupPolicies(namespace).UpdateStatus(ctx, latest, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"strings"
|
||||
|
||||
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2"
|
||||
engineapi "github.com/kyverno/kyverno/pkg/engine/api"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
@ -285,7 +285,7 @@ func NewPolicyExceptionEvents(engineResponse engineapi.EngineResponse, ruleResp
|
|||
return []Info{policyEvent, exceptionEvent}
|
||||
}
|
||||
|
||||
func NewCleanupPolicyEvent(policy kyvernov2beta1.CleanupPolicyInterface, resource unstructured.Unstructured, err error) Info {
|
||||
func NewCleanupPolicyEvent(policy kyvernov2.CleanupPolicyInterface, resource unstructured.Unstructured, err error) Info {
|
||||
regarding := corev1.ObjectReference{
|
||||
// TODO: iirc it's not safe to assume api version is set
|
||||
APIVersion: "kyverno.io/v2",
|
||||
|
|
|
@ -3,20 +3,20 @@ package admission
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2"
|
||||
admissionv1 "k8s.io/api/admission/v1"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
)
|
||||
|
||||
func UnmarshalCleanupPolicy(kind string, raw []byte) (kyvernov2beta1.CleanupPolicyInterface, error) {
|
||||
func UnmarshalCleanupPolicy(kind string, raw []byte) (kyvernov2.CleanupPolicyInterface, error) {
|
||||
if kind == "CleanupPolicy" {
|
||||
var policy *kyvernov2beta1.CleanupPolicy
|
||||
var policy *kyvernov2.CleanupPolicy
|
||||
if err := json.Unmarshal(raw, &policy); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return policy, nil
|
||||
} else if kind == "ClusterCleanupPolicy" {
|
||||
var policy *kyvernov2beta1.ClusterCleanupPolicy
|
||||
var policy *kyvernov2.ClusterCleanupPolicy
|
||||
if err := json.Unmarshal(raw, &policy); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ func UnmarshalCleanupPolicy(kind string, raw []byte) (kyvernov2beta1.CleanupPoli
|
|||
return nil, fmt.Errorf("admission request does not contain a cleanuppolicy")
|
||||
}
|
||||
|
||||
func GetCleanupPolicies(request admissionv1.AdmissionRequest) (kyvernov2beta1.CleanupPolicyInterface, kyvernov2beta1.CleanupPolicyInterface, error) {
|
||||
var emptypolicy kyvernov2beta1.CleanupPolicyInterface
|
||||
func GetCleanupPolicies(request admissionv1.AdmissionRequest) (kyvernov2.CleanupPolicyInterface, kyvernov2.CleanupPolicyInterface, error) {
|
||||
var emptypolicy kyvernov2.CleanupPolicyInterface
|
||||
policy, err := UnmarshalCleanupPolicy(request.Kind.Kind, request.Object.Raw)
|
||||
if err != nil {
|
||||
return policy, emptypolicy, err
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2"
|
||||
admissionv1 "k8s.io/api/admission/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
@ -36,10 +36,10 @@ func TestUnmarshalCleanupPolicy(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
policy, err := UnmarshalCleanupPolicy(test.kind, test.raw)
|
||||
var expectedPolicy kyvernov2beta1.CleanupPolicyInterface
|
||||
var expectedPolicy kyvernov2.CleanupPolicyInterface
|
||||
switch test.kind {
|
||||
case "CleanupPolicy":
|
||||
var tempPolicy kyvernov2beta1.CleanupPolicy
|
||||
var tempPolicy kyvernov2.CleanupPolicy
|
||||
expectedPolicy = &tempPolicy
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
|
@ -51,7 +51,7 @@ func TestUnmarshalCleanupPolicy(t *testing.T) {
|
|||
t.Errorf("Expected policy %+v, got %+v", expectedPolicy, policy)
|
||||
}
|
||||
case "ClusterCleanupPolicy":
|
||||
var tempPolicy kyvernov2beta1.ClusterCleanupPolicy
|
||||
var tempPolicy kyvernov2.ClusterCleanupPolicy
|
||||
expectedPolicy = &tempPolicy
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
|
@ -147,7 +147,7 @@ func TestGetCleanupPolicies(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
p1, p2, _ := GetCleanupPolicies(test.args.request)
|
||||
var emptypolicy kyvernov2beta1.CleanupPolicyInterface
|
||||
var emptypolicy kyvernov2.CleanupPolicyInterface
|
||||
expectedP1, err := UnmarshalCleanupPolicy(test.args.request.Kind.Kind, test.args.request.Object.Raw)
|
||||
if err != nil {
|
||||
expectedP2 := emptypolicy
|
||||
|
|
|
@ -5,13 +5,13 @@ import (
|
|||
|
||||
"github.com/go-logr/logr"
|
||||
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2"
|
||||
enginecontext "github.com/kyverno/kyverno/pkg/engine/context"
|
||||
"github.com/kyverno/kyverno/pkg/engine/variables"
|
||||
"github.com/kyverno/kyverno/pkg/engine/variables/operator"
|
||||
)
|
||||
|
||||
func CheckAnyAllConditions(logger logr.Logger, ctx enginecontext.Interface, condition kyvernov2beta1.AnyAllConditions) (bool, error) {
|
||||
func CheckAnyAllConditions(logger logr.Logger, ctx enginecontext.Interface, condition kyvernov2.AnyAllConditions) (bool, error) {
|
||||
for _, condition := range condition.AllConditions {
|
||||
if passed, err := checkCondition(logger, ctx, condition); err != nil {
|
||||
return false, err
|
||||
|
@ -29,7 +29,7 @@ func CheckAnyAllConditions(logger logr.Logger, ctx enginecontext.Interface, cond
|
|||
return len(condition.AnyConditions) == 0, nil
|
||||
}
|
||||
|
||||
func checkCondition(logger logr.Logger, ctx enginecontext.Interface, condition kyvernov2beta1.Condition) (bool, error) {
|
||||
func checkCondition(logger logr.Logger, ctx enginecontext.Interface, condition kyvernov2.Condition) (bool, error) {
|
||||
key, err := variables.SubstituteAllInPreconditions(logger, ctx, condition.GetKey())
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to substitute variables in condition key: %w", err)
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2"
|
||||
"github.com/kyverno/kyverno/pkg/config"
|
||||
enginecontext "github.com/kyverno/kyverno/pkg/engine/context"
|
||||
"github.com/kyverno/kyverno/pkg/engine/jmespath"
|
||||
|
@ -22,7 +22,7 @@ func Test_checkCondition(t *testing.T) {
|
|||
type args struct {
|
||||
logger logr.Logger
|
||||
ctx enginecontext.Interface
|
||||
condition kyvernov2beta1.Condition
|
||||
condition kyvernov2.Condition
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
|
@ -34,11 +34,11 @@ func Test_checkCondition(t *testing.T) {
|
|||
args: args{
|
||||
logger: logging.GlobalLogger(),
|
||||
ctx: ctx,
|
||||
condition: kyvernov2beta1.Condition{
|
||||
condition: kyvernov2.Condition{
|
||||
RawKey: &v1.JSON{
|
||||
Raw: []byte(`"{{ request.object.name }}"`),
|
||||
},
|
||||
Operator: kyvernov2beta1.ConditionOperators["Equals"],
|
||||
Operator: kyvernov2.ConditionOperators["Equals"],
|
||||
RawValue: &v1.JSON{
|
||||
Raw: []byte(`"dummy"`),
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"regexp"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||
kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2"
|
||||
"github.com/kyverno/kyverno/pkg/auth"
|
||||
"github.com/kyverno/kyverno/pkg/clients/dclient"
|
||||
"github.com/kyverno/kyverno/pkg/config"
|
||||
|
@ -42,7 +42,7 @@ func FetchClusteredResources(logger logr.Logger, client dclient.Interface) (sets
|
|||
}
|
||||
|
||||
// Validate checks policy is valid
|
||||
func Validate(ctx context.Context, logger logr.Logger, client dclient.Interface, policy kyvernov2beta1.CleanupPolicyInterface) error {
|
||||
func Validate(ctx context.Context, logger logr.Logger, client dclient.Interface, policy kyvernov2.CleanupPolicyInterface) error {
|
||||
clusteredResources, err := FetchClusteredResources(logger, client)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -61,13 +61,13 @@ func Validate(ctx context.Context, logger logr.Logger, client dclient.Interface,
|
|||
}
|
||||
|
||||
// validatePolicy checks the policy and rules declarations for required configurations
|
||||
func validatePolicy(clusterResources sets.Set[string], policy kyvernov2beta1.CleanupPolicyInterface) error {
|
||||
func validatePolicy(clusterResources sets.Set[string], policy kyvernov2.CleanupPolicyInterface) error {
|
||||
errs := policy.Validate(clusterResources)
|
||||
return errs.ToAggregate()
|
||||
}
|
||||
|
||||
// validateAuth checks the the delete action is allowed
|
||||
func validateAuth(ctx context.Context, client dclient.Interface, policy kyvernov2beta1.CleanupPolicyInterface) error {
|
||||
func validateAuth(ctx context.Context, client dclient.Interface, policy kyvernov2.CleanupPolicyInterface) error {
|
||||
namespace := policy.GetNamespace()
|
||||
spec := policy.GetSpec()
|
||||
kinds := sets.New(spec.MatchResources.GetKinds()...)
|
||||
|
@ -93,7 +93,7 @@ func validateAuth(ctx context.Context, client dclient.Interface, policy kyvernov
|
|||
return nil
|
||||
}
|
||||
|
||||
func validateVariables(logger logr.Logger, policy kyvernov2beta1.CleanupPolicyInterface) error {
|
||||
func validateVariables(logger logr.Logger, policy kyvernov2.CleanupPolicyInterface) error {
|
||||
ctx := enginecontext.NewMockContext(allowedVariables)
|
||||
|
||||
c := policy.GetSpec().Conditions
|
||||
|
|
Loading…
Reference in a new issue