1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

feat: introduce v2alpha1 (#5625)

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:
Charles-Edouard Brétéché 2022-12-08 12:45:47 +01:00 committed by GitHub
parent f5adb50f8f
commit 87ce4b85de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 757 additions and 757 deletions

View file

@ -310,7 +310,7 @@ image-build-all: $(BUILD_WITH)-build-all
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/v1alpha2,$(PACKAGE)/api/kyverno/v1alpha1,$(PACKAGE)/api/policyreport/v1alpha2
INPUT_DIRS := $(PACKAGE)/api/kyverno/v1,$(PACKAGE)/api/kyverno/v1alpha2,$(PACKAGE)/api/kyverno/v1beta1,$(PACKAGE)/api/kyverno/v2alpha1,$(PACKAGE)/api/policyreport/v1alpha2
CLIENTSET_PACKAGE := $(OUT_PACKAGE)/clientset
LISTERS_PACKAGE := $(OUT_PACKAGE)/listers
INFORMERS_PACKAGE := $(OUT_PACKAGE)/informers

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package v1beta1 contains API Schema definitions for the policy v1alpha1 API group
// Package v1beta1 contains API Schema definitions for the policy v1beta1 API group
// +k8s:deepcopy-gen=package
// +kubebuilder:object:generate=true
// +groupName=kyverno.io

View file

@ -1,4 +1,4 @@
package v1alpha1
package v2alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View file

@ -1,4 +1,4 @@
package v1alpha1
package v2alpha1
import (
"encoding/json"

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
package v2alpha1
import (
"reflect"

View file

@ -17,4 +17,4 @@ limitations under the License.
// +k8s:deepcopy-gen=package
// +kubebuilder:object:generate=true
// +groupName=kyverno.io
package v1alpha1
package v2alpha1

View file

@ -16,7 +16,7 @@ limitations under the License.
// +kubebuilder:object:generate=true
// +groupName=kyverno.io
package v1alpha1
package v2alpha1
import (
"github.com/kyverno/kyverno/api/kyverno"
@ -26,7 +26,7 @@ import (
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: kyverno.GroupName, Version: "v1alpha1"}
var SchemeGroupVersion = schema.GroupVersion{Group: kyverno.GroupName, Version: "v2alpha1"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {

View file

@ -19,7 +19,7 @@ limitations under the License.
// Code generated by controller-gen. DO NOT EDIT.
package v1alpha1
package v2alpha1
import (
"github.com/kyverno/kyverno/api/kyverno/v2beta1"

View file

@ -49,7 +49,7 @@ webhooks:
- apiGroups:
- kyverno.io
apiVersions:
- v1alpha1
- v2alpha1
operations:
- CREATE
- UPDATE

View file

@ -531,7 +531,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v2alpha1
schema:
openAPIV3Schema:
description: CleanupPolicy defines a rule for resource cleanup.
@ -1728,7 +1728,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v2alpha1
schema:
openAPIV3Schema:
description: ClusterCleanupPolicy defines rule for resource cleanup.

View file

@ -5,8 +5,8 @@ import (
"time"
"github.com/go-logr/logr"
kyvernov1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
kyvernov1alpha1listers "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha1"
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
kyvernov2alpha1listers "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2alpha1"
"github.com/kyverno/kyverno/pkg/clients/dclient"
controllerutils "github.com/kyverno/kyverno/pkg/utils/controller"
"go.uber.org/multierr"
@ -17,15 +17,15 @@ import (
type handlers struct {
client dclient.Interface
cpolLister kyvernov1alpha1listers.ClusterCleanupPolicyLister
polLister kyvernov1alpha1listers.CleanupPolicyLister
cpolLister kyvernov2alpha1listers.ClusterCleanupPolicyLister
polLister kyvernov2alpha1listers.CleanupPolicyLister
nsLister corev1listers.NamespaceLister
}
func New(
client dclient.Interface,
cpolLister kyvernov1alpha1listers.ClusterCleanupPolicyLister,
polLister kyvernov1alpha1listers.CleanupPolicyLister,
cpolLister kyvernov2alpha1listers.ClusterCleanupPolicyLister,
polLister kyvernov2alpha1listers.CleanupPolicyLister,
nsLister corev1listers.NamespaceLister,
) *handlers {
return &handlers{
@ -49,7 +49,7 @@ func (h *handlers) Cleanup(ctx context.Context, logger logr.Logger, name string,
return h.executePolicy(ctx, logger, policy)
}
func (h *handlers) lookupPolicy(namespace, name string) (kyvernov1alpha1.CleanupPolicyInterface, error) {
func (h *handlers) lookupPolicy(namespace, name string) (kyvernov2alpha1.CleanupPolicyInterface, error) {
if namespace == "" {
return h.cpolLister.Get(name)
} else {
@ -57,7 +57,7 @@ func (h *handlers) lookupPolicy(namespace, name string) (kyvernov1alpha1.Cleanup
}
}
func (h *handlers) executePolicy(ctx context.Context, logger logr.Logger, policy kyvernov1alpha1.CleanupPolicyInterface) error {
func (h *handlers) executePolicy(ctx context.Context, logger logr.Logger, policy kyvernov2alpha1.CleanupPolicyInterface) error {
spec := policy.GetSpec()
kinds := sets.NewString(spec.MatchResources.GetKinds()...)
var errs []error

View file

@ -60,16 +60,16 @@ func main() {
cleanup.ControllerName,
cleanup.NewController(
kubeClient,
kyvernoInformer.Kyverno().V1alpha1().ClusterCleanupPolicies(),
kyvernoInformer.Kyverno().V1alpha1().CleanupPolicies(),
kyvernoInformer.Kyverno().V2alpha1().ClusterCleanupPolicies(),
kyvernoInformer.Kyverno().V2alpha1().CleanupPolicies(),
kubeInformer.Batch().V1().CronJobs(),
cleanupService,
),
cleanup.Workers,
)
secretLister := kubeKyvernoInformer.Core().V1().Secrets().Lister()
cpolLister := kyvernoInformer.Kyverno().V1alpha1().ClusterCleanupPolicies().Lister()
polLister := kyvernoInformer.Kyverno().V1alpha1().CleanupPolicies().Lister()
cpolLister := kyvernoInformer.Kyverno().V2alpha1().ClusterCleanupPolicies().Lister()
polLister := kyvernoInformer.Kyverno().V2alpha1().CleanupPolicies().Lister()
nsLister := kubeInformer.Core().V1().Namespaces().Lister()
// start informers and wait for cache sync
if !internal.StartInformersAndWaitForCacheSync(ctx, kubeKyvernoInformer, kubeInformer, kyvernoInformer) {

View file

@ -26,7 +26,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v2alpha1
schema:
openAPIV3Schema:
description: CleanupPolicy defines a rule for resource cleanup.

View file

@ -26,7 +26,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v2alpha1
schema:
openAPIV3Schema:
description: ClusterCleanupPolicy defines rule for resource cleanup.

View file

@ -697,7 +697,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v2alpha1
schema:
openAPIV3Schema:
description: CleanupPolicy defines a rule for resource cleanup.
@ -2402,7 +2402,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v2alpha1
schema:
openAPIV3Schema:
description: ClusterCleanupPolicy defines rule for resource cleanup.

View file

@ -693,7 +693,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v2alpha1
schema:
openAPIV3Schema:
description: CleanupPolicy defines a rule for resource cleanup.
@ -2395,7 +2395,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v2alpha1
schema:
openAPIV3Schema:
description: ClusterCleanupPolicy defines rule for resource cleanup.

View file

@ -21,15 +21,15 @@ background-color: #1589dd;
<a href="#kyverno.io%2fv1"><b style="color: white">kyverno.io/v1</b></a>
</li>
<li>
<a href="#kyverno.io%2fv1alpha1"><b style="color: white">kyverno.io/v1alpha1</b></a>
</li>
<li>
<a href="#kyverno.io%2fv1alpha2"><b style="color: white">kyverno.io/v1alpha2</b></a>
</li>
<li>
<a href="#kyverno.io%2fv1beta1"><b style="color: white">kyverno.io/v1beta1</b></a>
</li>
<li>
<a href="#kyverno.io%2fv2alpha1"><b style="color: white">kyverno.io/v2alpha1</b></a>
</li>
<li>
<a href="#kyverno.io%2fv2beta1"><b style="color: white">kyverno.io/v2beta1</b></a>
</li>
<li>
@ -3979,403 +3979,6 @@ string
</tbody>
</table>
<hr />
<h2 id="kyverno.io/v1alpha1">kyverno.io/v1alpha1</h2>
<p>
</p>
Resource Types:
<ul><li>
<a href="#kyverno.io/v1alpha1.CleanupPolicy">CleanupPolicy</a>
</li><li>
<a href="#kyverno.io/v1alpha1.ClusterCleanupPolicy">ClusterCleanupPolicy</a>
</li></ul>
<hr />
<h3 id="kyverno.io/v1alpha1.CleanupPolicy">CleanupPolicy
</h3>
<p>
<p>CleanupPolicy defines a rule for resource cleanup.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>apiVersion</code><br/>
string</td>
<td>
<code>
kyverno.io/v1alpha1
</code>
</td>
</tr>
<tr>
<td>
<code>kind</code><br/>
string
</td>
<td><code>CleanupPolicy</code></td>
</tr>
<tr>
<td>
<code>metadata</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#objectmeta-v1-meta">
Kubernetes meta/v1.ObjectMeta
</a>
</em>
</td>
<td>
Refer to the Kubernetes API documentation for the fields of the
<code>metadata</code> field.
</td>
</tr>
<tr>
<td>
<code>spec</code><br/>
<em>
<a href="#kyverno.io/v1alpha1.CleanupPolicySpec">
CleanupPolicySpec
</a>
</em>
</td>
<td>
<p>Spec declares policy behaviors.</p>
<br/>
<br/>
<table class="table table-striped">
<tr>
<td>
<code>match</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<p>MatchResources defines when cleanuppolicy should be applied. The match
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the user name or role.
At least one kind is required.</p>
</td>
</tr>
<tr>
<td>
<code>exclude</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ExcludeResources defines when cleanuppolicy should not be applied. The exclude
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the name or role.</p>
</td>
</tr>
<tr>
<td>
<code>schedule</code><br/>
<em>
string
</em>
</td>
<td>
<p>The schedule in Cron format</p>
</td>
</tr>
<tr>
<td>
<code>conditions</code><br/>
<em>
<a href="#kyverno.io/v2beta1.AnyAllConditions">
AnyAllConditions
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Conditions defines conditions used to select resources which user needs to delete</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<code>status</code><br/>
<em>
<a href="#kyverno.io/v1alpha1.CleanupPolicyStatus">
CleanupPolicyStatus
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Status contains policy runtime data.</p>
</td>
</tr>
</tbody>
</table>
<hr />
<h3 id="kyverno.io/v1alpha1.ClusterCleanupPolicy">ClusterCleanupPolicy
</h3>
<p>
<p>ClusterCleanupPolicy defines rule for resource cleanup.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>apiVersion</code><br/>
string</td>
<td>
<code>
kyverno.io/v1alpha1
</code>
</td>
</tr>
<tr>
<td>
<code>kind</code><br/>
string
</td>
<td><code>ClusterCleanupPolicy</code></td>
</tr>
<tr>
<td>
<code>metadata</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#objectmeta-v1-meta">
Kubernetes meta/v1.ObjectMeta
</a>
</em>
</td>
<td>
Refer to the Kubernetes API documentation for the fields of the
<code>metadata</code> field.
</td>
</tr>
<tr>
<td>
<code>spec</code><br/>
<em>
<a href="#kyverno.io/v1alpha1.CleanupPolicySpec">
CleanupPolicySpec
</a>
</em>
</td>
<td>
<p>Spec declares policy behaviors.</p>
<br/>
<br/>
<table class="table table-striped">
<tr>
<td>
<code>match</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<p>MatchResources defines when cleanuppolicy should be applied. The match
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the user name or role.
At least one kind is required.</p>
</td>
</tr>
<tr>
<td>
<code>exclude</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ExcludeResources defines when cleanuppolicy should not be applied. The exclude
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the name or role.</p>
</td>
</tr>
<tr>
<td>
<code>schedule</code><br/>
<em>
string
</em>
</td>
<td>
<p>The schedule in Cron format</p>
</td>
</tr>
<tr>
<td>
<code>conditions</code><br/>
<em>
<a href="#kyverno.io/v2beta1.AnyAllConditions">
AnyAllConditions
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Conditions defines conditions used to select resources which user needs to delete</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<code>status</code><br/>
<em>
<a href="#kyverno.io/v1alpha1.CleanupPolicyStatus">
CleanupPolicyStatus
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Status contains policy runtime data.</p>
</td>
</tr>
</tbody>
</table>
<hr />
<h3 id="kyverno.io/v1alpha1.CleanupPolicyInterface">CleanupPolicyInterface
</h3>
<p>
<p>CleanupPolicyInterface abstracts the concrete policy type (Policy vs ClusterPolicy)</p>
</p>
<h3 id="kyverno.io/v1alpha1.CleanupPolicySpec">CleanupPolicySpec
</h3>
<p>
(<em>Appears on:</em>
<a href="#kyverno.io/v1alpha1.CleanupPolicy">CleanupPolicy</a>,
<a href="#kyverno.io/v1alpha1.ClusterCleanupPolicy">ClusterCleanupPolicy</a>)
</p>
<p>
<p>CleanupPolicySpec stores specifications for selecting resources that the user needs to delete
and schedule when the matching resources needs deleted.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>match</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<p>MatchResources defines when cleanuppolicy should be applied. The match
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the user name or role.
At least one kind is required.</p>
</td>
</tr>
<tr>
<td>
<code>exclude</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ExcludeResources defines when cleanuppolicy should not be applied. The exclude
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the name or role.</p>
</td>
</tr>
<tr>
<td>
<code>schedule</code><br/>
<em>
string
</em>
</td>
<td>
<p>The schedule in Cron format</p>
</td>
</tr>
<tr>
<td>
<code>conditions</code><br/>
<em>
<a href="#kyverno.io/v2beta1.AnyAllConditions">
AnyAllConditions
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Conditions defines conditions used to select resources which user needs to delete</p>
</td>
</tr>
</tbody>
</table>
<hr />
<h3 id="kyverno.io/v1alpha1.CleanupPolicyStatus">CleanupPolicyStatus
</h3>
<p>
(<em>Appears on:</em>
<a href="#kyverno.io/v1alpha1.CleanupPolicy">CleanupPolicy</a>,
<a href="#kyverno.io/v1alpha1.ClusterCleanupPolicy">ClusterCleanupPolicy</a>)
</p>
<p>
<p>CleanupPolicyStatus stores the status of the policy.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>conditions</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#condition-v1-meta">
[]Kubernetes meta/v1.Condition
</a>
</em>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<hr />
<h2 id="kyverno.io/v1alpha2">kyverno.io/v1alpha2</h2>
<p>
<p>Package v1alpha2 contains API Schema definitions for the policy v1alpha2 API group</p>
@ -4897,7 +4500,7 @@ PolicyReportSummary
</p>
<h2 id="kyverno.io/v1beta1">kyverno.io/v1beta1</h2>
<p>
<p>Package v1beta1 contains API Schema definitions for the policy v1alpha1 API group</p>
<p>Package v1beta1 contains API Schema definitions for the policy v1beta1 API group</p>
</p>
Resource Types:
<ul><li>
@ -5339,6 +4942,403 @@ Will be used during clean up resources.</p>
</tbody>
</table>
<hr />
<h2 id="kyverno.io/v2alpha1">kyverno.io/v2alpha1</h2>
<p>
</p>
Resource Types:
<ul><li>
<a href="#kyverno.io/v2alpha1.CleanupPolicy">CleanupPolicy</a>
</li><li>
<a href="#kyverno.io/v2alpha1.ClusterCleanupPolicy">ClusterCleanupPolicy</a>
</li></ul>
<hr />
<h3 id="kyverno.io/v2alpha1.CleanupPolicy">CleanupPolicy
</h3>
<p>
<p>CleanupPolicy defines a rule for resource cleanup.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>apiVersion</code><br/>
string</td>
<td>
<code>
kyverno.io/v2alpha1
</code>
</td>
</tr>
<tr>
<td>
<code>kind</code><br/>
string
</td>
<td><code>CleanupPolicy</code></td>
</tr>
<tr>
<td>
<code>metadata</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#objectmeta-v1-meta">
Kubernetes meta/v1.ObjectMeta
</a>
</em>
</td>
<td>
Refer to the Kubernetes API documentation for the fields of the
<code>metadata</code> field.
</td>
</tr>
<tr>
<td>
<code>spec</code><br/>
<em>
<a href="#kyverno.io/v2alpha1.CleanupPolicySpec">
CleanupPolicySpec
</a>
</em>
</td>
<td>
<p>Spec declares policy behaviors.</p>
<br/>
<br/>
<table class="table table-striped">
<tr>
<td>
<code>match</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<p>MatchResources defines when cleanuppolicy should be applied. The match
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the user name or role.
At least one kind is required.</p>
</td>
</tr>
<tr>
<td>
<code>exclude</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ExcludeResources defines when cleanuppolicy should not be applied. The exclude
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the name or role.</p>
</td>
</tr>
<tr>
<td>
<code>schedule</code><br/>
<em>
string
</em>
</td>
<td>
<p>The schedule in Cron format</p>
</td>
</tr>
<tr>
<td>
<code>conditions</code><br/>
<em>
<a href="#kyverno.io/v2beta1.AnyAllConditions">
AnyAllConditions
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Conditions defines conditions used to select resources which user needs to delete</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<code>status</code><br/>
<em>
<a href="#kyverno.io/v2alpha1.CleanupPolicyStatus">
CleanupPolicyStatus
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Status contains policy runtime data.</p>
</td>
</tr>
</tbody>
</table>
<hr />
<h3 id="kyverno.io/v2alpha1.ClusterCleanupPolicy">ClusterCleanupPolicy
</h3>
<p>
<p>ClusterCleanupPolicy defines rule for resource cleanup.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>apiVersion</code><br/>
string</td>
<td>
<code>
kyverno.io/v2alpha1
</code>
</td>
</tr>
<tr>
<td>
<code>kind</code><br/>
string
</td>
<td><code>ClusterCleanupPolicy</code></td>
</tr>
<tr>
<td>
<code>metadata</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#objectmeta-v1-meta">
Kubernetes meta/v1.ObjectMeta
</a>
</em>
</td>
<td>
Refer to the Kubernetes API documentation for the fields of the
<code>metadata</code> field.
</td>
</tr>
<tr>
<td>
<code>spec</code><br/>
<em>
<a href="#kyverno.io/v2alpha1.CleanupPolicySpec">
CleanupPolicySpec
</a>
</em>
</td>
<td>
<p>Spec declares policy behaviors.</p>
<br/>
<br/>
<table class="table table-striped">
<tr>
<td>
<code>match</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<p>MatchResources defines when cleanuppolicy should be applied. The match
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the user name or role.
At least one kind is required.</p>
</td>
</tr>
<tr>
<td>
<code>exclude</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ExcludeResources defines when cleanuppolicy should not be applied. The exclude
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the name or role.</p>
</td>
</tr>
<tr>
<td>
<code>schedule</code><br/>
<em>
string
</em>
</td>
<td>
<p>The schedule in Cron format</p>
</td>
</tr>
<tr>
<td>
<code>conditions</code><br/>
<em>
<a href="#kyverno.io/v2beta1.AnyAllConditions">
AnyAllConditions
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Conditions defines conditions used to select resources which user needs to delete</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<code>status</code><br/>
<em>
<a href="#kyverno.io/v2alpha1.CleanupPolicyStatus">
CleanupPolicyStatus
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Status contains policy runtime data.</p>
</td>
</tr>
</tbody>
</table>
<hr />
<h3 id="kyverno.io/v2alpha1.CleanupPolicyInterface">CleanupPolicyInterface
</h3>
<p>
<p>CleanupPolicyInterface abstracts the concrete policy type (Policy vs ClusterPolicy)</p>
</p>
<h3 id="kyverno.io/v2alpha1.CleanupPolicySpec">CleanupPolicySpec
</h3>
<p>
(<em>Appears on:</em>
<a href="#kyverno.io/v2alpha1.CleanupPolicy">CleanupPolicy</a>,
<a href="#kyverno.io/v2alpha1.ClusterCleanupPolicy">ClusterCleanupPolicy</a>)
</p>
<p>
<p>CleanupPolicySpec stores specifications for selecting resources that the user needs to delete
and schedule when the matching resources needs deleted.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>match</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<p>MatchResources defines when cleanuppolicy should be applied. The match
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the user name or role.
At least one kind is required.</p>
</td>
</tr>
<tr>
<td>
<code>exclude</code><br/>
<em>
<a href="#kyverno.io/v2beta1.MatchResources">
MatchResources
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ExcludeResources defines when cleanuppolicy should not be applied. The exclude
criteria can include resource information (e.g. kind, name, namespace, labels)
and admission review request information like the name or role.</p>
</td>
</tr>
<tr>
<td>
<code>schedule</code><br/>
<em>
string
</em>
</td>
<td>
<p>The schedule in Cron format</p>
</td>
</tr>
<tr>
<td>
<code>conditions</code><br/>
<em>
<a href="#kyverno.io/v2beta1.AnyAllConditions">
AnyAllConditions
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Conditions defines conditions used to select resources which user needs to delete</p>
</td>
</tr>
</tbody>
</table>
<hr />
<h3 id="kyverno.io/v2alpha1.CleanupPolicyStatus">CleanupPolicyStatus
</h3>
<p>
(<em>Appears on:</em>
<a href="#kyverno.io/v2alpha1.CleanupPolicy">CleanupPolicy</a>,
<a href="#kyverno.io/v2alpha1.ClusterCleanupPolicy">ClusterCleanupPolicy</a>)
</p>
<p>
<p>CleanupPolicyStatus stores the status of the policy.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>conditions</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#condition-v1-meta">
[]Kubernetes meta/v1.Condition
</a>
</em>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<hr />
<h2 id="kyverno.io/v2beta1">kyverno.io/v2beta1</h2>
Resource Types:
<ul><li>
@ -5800,7 +5800,7 @@ PolicyStatus
</h3>
<p>
(<em>Appears on:</em>
<a href="#kyverno.io/v1alpha1.CleanupPolicySpec">CleanupPolicySpec</a>,
<a href="#kyverno.io/v2alpha1.CleanupPolicySpec">CleanupPolicySpec</a>,
<a href="#kyverno.io/v2beta1.Deny">Deny</a>,
<a href="#kyverno.io/v2beta1.Rule">Rule</a>)
</p>
@ -6073,7 +6073,7 @@ bool
</h3>
<p>
(<em>Appears on:</em>
<a href="#kyverno.io/v1alpha1.CleanupPolicySpec">CleanupPolicySpec</a>,
<a href="#kyverno.io/v2alpha1.CleanupPolicySpec">CleanupPolicySpec</a>,
<a href="#kyverno.io/v2beta1.Rule">Rule</a>)
</p>
<p>

View file

@ -23,9 +23,9 @@ import (
"net/http"
kyvernov1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1"
kyvernov1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1"
kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2"
kyvernov1beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1beta1"
kyvernov2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1"
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
@ -35,9 +35,9 @@ import (
type Interface interface {
Discovery() discovery.DiscoveryInterface
KyvernoV1() kyvernov1.KyvernoV1Interface
KyvernoV1beta1() kyvernov1beta1.KyvernoV1beta1Interface
KyvernoV1alpha2() kyvernov1alpha2.KyvernoV1alpha2Interface
KyvernoV1alpha1() kyvernov1alpha1.KyvernoV1alpha1Interface
KyvernoV1beta1() kyvernov1beta1.KyvernoV1beta1Interface
KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface
Wgpolicyk8sV1alpha2() wgpolicyk8sv1alpha2.Wgpolicyk8sV1alpha2Interface
}
@ -46,9 +46,9 @@ type Interface interface {
type Clientset struct {
*discovery.DiscoveryClient
kyvernoV1 *kyvernov1.KyvernoV1Client
kyvernoV1beta1 *kyvernov1beta1.KyvernoV1beta1Client
kyvernoV1alpha2 *kyvernov1alpha2.KyvernoV1alpha2Client
kyvernoV1alpha1 *kyvernov1alpha1.KyvernoV1alpha1Client
kyvernoV1beta1 *kyvernov1beta1.KyvernoV1beta1Client
kyvernoV2alpha1 *kyvernov2alpha1.KyvernoV2alpha1Client
wgpolicyk8sV1alpha2 *wgpolicyk8sv1alpha2.Wgpolicyk8sV1alpha2Client
}
@ -57,19 +57,19 @@ func (c *Clientset) KyvernoV1() kyvernov1.KyvernoV1Interface {
return c.kyvernoV1
}
// KyvernoV1beta1 retrieves the KyvernoV1beta1Client
func (c *Clientset) KyvernoV1beta1() kyvernov1beta1.KyvernoV1beta1Interface {
return c.kyvernoV1beta1
}
// KyvernoV1alpha2 retrieves the KyvernoV1alpha2Client
func (c *Clientset) KyvernoV1alpha2() kyvernov1alpha2.KyvernoV1alpha2Interface {
return c.kyvernoV1alpha2
}
// KyvernoV1alpha1 retrieves the KyvernoV1alpha1Client
func (c *Clientset) KyvernoV1alpha1() kyvernov1alpha1.KyvernoV1alpha1Interface {
return c.kyvernoV1alpha1
// KyvernoV1beta1 retrieves the KyvernoV1beta1Client
func (c *Clientset) KyvernoV1beta1() kyvernov1beta1.KyvernoV1beta1Interface {
return c.kyvernoV1beta1
}
// KyvernoV2alpha1 retrieves the KyvernoV2alpha1Client
func (c *Clientset) KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface {
return c.kyvernoV2alpha1
}
// Wgpolicyk8sV1alpha2 retrieves the Wgpolicyk8sV1alpha2Client
@ -125,15 +125,15 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset,
if err != nil {
return nil, err
}
cs.kyvernoV1beta1, err = kyvernov1beta1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
cs.kyvernoV1alpha2, err = kyvernov1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
cs.kyvernoV1alpha1, err = kyvernov1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
cs.kyvernoV1beta1, err = kyvernov1beta1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
cs.kyvernoV2alpha1, err = kyvernov2alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
@ -163,9 +163,9 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.kyvernoV1 = kyvernov1.New(c)
cs.kyvernoV1beta1 = kyvernov1beta1.New(c)
cs.kyvernoV1alpha2 = kyvernov1alpha2.New(c)
cs.kyvernoV1alpha1 = kyvernov1alpha1.New(c)
cs.kyvernoV1beta1 = kyvernov1beta1.New(c)
cs.kyvernoV2alpha1 = kyvernov2alpha1.New(c)
cs.wgpolicyk8sV1alpha2 = wgpolicyk8sv1alpha2.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)

View file

@ -22,12 +22,12 @@ import (
clientset "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
kyvernov1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1"
fakekyvernov1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1/fake"
kyvernov1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1"
fakekyvernov1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1/fake"
kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2"
fakekyvernov1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/fake"
kyvernov1beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1beta1"
fakekyvernov1beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1beta1/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"
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"
"k8s.io/apimachinery/pkg/runtime"
@ -92,19 +92,19 @@ func (c *Clientset) KyvernoV1() kyvernov1.KyvernoV1Interface {
return &fakekyvernov1.FakeKyvernoV1{Fake: &c.Fake}
}
// KyvernoV1beta1 retrieves the KyvernoV1beta1Client
func (c *Clientset) KyvernoV1beta1() kyvernov1beta1.KyvernoV1beta1Interface {
return &fakekyvernov1beta1.FakeKyvernoV1beta1{Fake: &c.Fake}
}
// KyvernoV1alpha2 retrieves the KyvernoV1alpha2Client
func (c *Clientset) KyvernoV1alpha2() kyvernov1alpha2.KyvernoV1alpha2Interface {
return &fakekyvernov1alpha2.FakeKyvernoV1alpha2{Fake: &c.Fake}
}
// KyvernoV1alpha1 retrieves the KyvernoV1alpha1Client
func (c *Clientset) KyvernoV1alpha1() kyvernov1alpha1.KyvernoV1alpha1Interface {
return &fakekyvernov1alpha1.FakeKyvernoV1alpha1{Fake: &c.Fake}
// KyvernoV1beta1 retrieves the KyvernoV1beta1Client
func (c *Clientset) KyvernoV1beta1() kyvernov1beta1.KyvernoV1beta1Interface {
return &fakekyvernov1beta1.FakeKyvernoV1beta1{Fake: &c.Fake}
}
// KyvernoV2alpha1 retrieves the KyvernoV2alpha1Client
func (c *Clientset) KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface {
return &fakekyvernov2alpha1.FakeKyvernoV2alpha1{Fake: &c.Fake}
}
// Wgpolicyk8sV1alpha2 retrieves the Wgpolicyk8sV1alpha2Client

View file

@ -20,9 +20,9 @@ package fake
import (
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
kyvernov1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
kyvernov1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2"
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
@ -36,9 +36,9 @@ var codecs = serializer.NewCodecFactory(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
kyvernov1.AddToScheme,
kyvernov1beta1.AddToScheme,
kyvernov1alpha2.AddToScheme,
kyvernov1alpha1.AddToScheme,
kyvernov1beta1.AddToScheme,
kyvernov2alpha1.AddToScheme,
wgpolicyk8sv1alpha2.AddToScheme,
}

View file

@ -20,9 +20,9 @@ package scheme
import (
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
kyvernov1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
kyvernov1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2"
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
@ -36,9 +36,9 @@ var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
kyvernov1.AddToScheme,
kyvernov1beta1.AddToScheme,
kyvernov1alpha2.AddToScheme,
kyvernov1alpha1.AddToScheme,
kyvernov1beta1.AddToScheme,
kyvernov2alpha1.AddToScheme,
wgpolicyk8sv1alpha2.AddToScheme,
}

View file

@ -16,13 +16,13 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
package v2alpha1
import (
"context"
"time"
v1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
@ -38,15 +38,15 @@ type CleanupPoliciesGetter interface {
// CleanupPolicyInterface has methods to work with CleanupPolicy resources.
type CleanupPolicyInterface interface {
Create(ctx context.Context, cleanupPolicy *v1alpha1.CleanupPolicy, opts v1.CreateOptions) (*v1alpha1.CleanupPolicy, error)
Update(ctx context.Context, cleanupPolicy *v1alpha1.CleanupPolicy, opts v1.UpdateOptions) (*v1alpha1.CleanupPolicy, error)
UpdateStatus(ctx context.Context, cleanupPolicy *v1alpha1.CleanupPolicy, opts v1.UpdateOptions) (*v1alpha1.CleanupPolicy, error)
Create(ctx context.Context, cleanupPolicy *v2alpha1.CleanupPolicy, opts v1.CreateOptions) (*v2alpha1.CleanupPolicy, error)
Update(ctx context.Context, cleanupPolicy *v2alpha1.CleanupPolicy, opts v1.UpdateOptions) (*v2alpha1.CleanupPolicy, error)
UpdateStatus(ctx context.Context, cleanupPolicy *v2alpha1.CleanupPolicy, opts v1.UpdateOptions) (*v2alpha1.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) (*v1alpha1.CleanupPolicy, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.CleanupPolicyList, error)
Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CleanupPolicy, error)
List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.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 *v1alpha1.CleanupPolicy, err error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CleanupPolicy, err error)
CleanupPolicyExpansion
}
@ -57,7 +57,7 @@ type cleanupPolicies struct {
}
// newCleanupPolicies returns a CleanupPolicies
func newCleanupPolicies(c *KyvernoV1alpha1Client, namespace string) *cleanupPolicies {
func newCleanupPolicies(c *KyvernoV2alpha1Client, namespace string) *cleanupPolicies {
return &cleanupPolicies{
client: c.RESTClient(),
ns: namespace,
@ -65,8 +65,8 @@ func newCleanupPolicies(c *KyvernoV1alpha1Client, namespace string) *cleanupPoli
}
// 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 *v1alpha1.CleanupPolicy, err error) {
result = &v1alpha1.CleanupPolicy{}
func (c *cleanupPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CleanupPolicy, err error) {
result = &v2alpha1.CleanupPolicy{}
err = c.client.Get().
Namespace(c.ns).
Resource("cleanuppolicies").
@ -78,12 +78,12 @@ func (c *cleanupPolicies) Get(ctx context.Context, name string, options v1.GetOp
}
// 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 *v1alpha1.CleanupPolicyList, err error) {
func (c *cleanupPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CleanupPolicyList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.CleanupPolicyList{}
result = &v2alpha1.CleanupPolicyList{}
err = c.client.Get().
Namespace(c.ns).
Resource("cleanuppolicies").
@ -110,8 +110,8 @@ func (c *cleanupPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch
}
// 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 *v1alpha1.CleanupPolicy, opts v1.CreateOptions) (result *v1alpha1.CleanupPolicy, err error) {
result = &v1alpha1.CleanupPolicy{}
func (c *cleanupPolicies) Create(ctx context.Context, cleanupPolicy *v2alpha1.CleanupPolicy, opts v1.CreateOptions) (result *v2alpha1.CleanupPolicy, err error) {
result = &v2alpha1.CleanupPolicy{}
err = c.client.Post().
Namespace(c.ns).
Resource("cleanuppolicies").
@ -123,8 +123,8 @@ func (c *cleanupPolicies) Create(ctx context.Context, cleanupPolicy *v1alpha1.Cl
}
// 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 *v1alpha1.CleanupPolicy, opts v1.UpdateOptions) (result *v1alpha1.CleanupPolicy, err error) {
result = &v1alpha1.CleanupPolicy{}
func (c *cleanupPolicies) Update(ctx context.Context, cleanupPolicy *v2alpha1.CleanupPolicy, opts v1.UpdateOptions) (result *v2alpha1.CleanupPolicy, err error) {
result = &v2alpha1.CleanupPolicy{}
err = c.client.Put().
Namespace(c.ns).
Resource("cleanuppolicies").
@ -138,8 +138,8 @@ func (c *cleanupPolicies) Update(ctx context.Context, cleanupPolicy *v1alpha1.Cl
// 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 *v1alpha1.CleanupPolicy, opts v1.UpdateOptions) (result *v1alpha1.CleanupPolicy, err error) {
result = &v1alpha1.CleanupPolicy{}
func (c *cleanupPolicies) UpdateStatus(ctx context.Context, cleanupPolicy *v2alpha1.CleanupPolicy, opts v1.UpdateOptions) (result *v2alpha1.CleanupPolicy, err error) {
result = &v2alpha1.CleanupPolicy{}
err = c.client.Put().
Namespace(c.ns).
Resource("cleanuppolicies").
@ -180,8 +180,8 @@ func (c *cleanupPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOp
}
// 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 *v1alpha1.CleanupPolicy, err error) {
result = &v1alpha1.CleanupPolicy{}
func (c *cleanupPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CleanupPolicy, err error) {
result = &v2alpha1.CleanupPolicy{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("cleanuppolicies").

View file

@ -16,13 +16,13 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
package v2alpha1
import (
"context"
"time"
v1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
@ -38,15 +38,15 @@ type ClusterCleanupPoliciesGetter interface {
// ClusterCleanupPolicyInterface has methods to work with ClusterCleanupPolicy resources.
type ClusterCleanupPolicyInterface interface {
Create(ctx context.Context, clusterCleanupPolicy *v1alpha1.ClusterCleanupPolicy, opts v1.CreateOptions) (*v1alpha1.ClusterCleanupPolicy, error)
Update(ctx context.Context, clusterCleanupPolicy *v1alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (*v1alpha1.ClusterCleanupPolicy, error)
UpdateStatus(ctx context.Context, clusterCleanupPolicy *v1alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (*v1alpha1.ClusterCleanupPolicy, error)
Create(ctx context.Context, clusterCleanupPolicy *v2alpha1.ClusterCleanupPolicy, opts v1.CreateOptions) (*v2alpha1.ClusterCleanupPolicy, error)
Update(ctx context.Context, clusterCleanupPolicy *v2alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (*v2alpha1.ClusterCleanupPolicy, error)
UpdateStatus(ctx context.Context, clusterCleanupPolicy *v2alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (*v2alpha1.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) (*v1alpha1.ClusterCleanupPolicy, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterCleanupPolicyList, error)
Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.ClusterCleanupPolicy, error)
List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.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 *v1alpha1.ClusterCleanupPolicy, err error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ClusterCleanupPolicy, err error)
ClusterCleanupPolicyExpansion
}
@ -56,15 +56,15 @@ type clusterCleanupPolicies struct {
}
// newClusterCleanupPolicies returns a ClusterCleanupPolicies
func newClusterCleanupPolicies(c *KyvernoV1alpha1Client) *clusterCleanupPolicies {
func newClusterCleanupPolicies(c *KyvernoV2alpha1Client) *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 *v1alpha1.ClusterCleanupPolicy, err error) {
result = &v1alpha1.ClusterCleanupPolicy{}
func (c *clusterCleanupPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ClusterCleanupPolicy, err error) {
result = &v2alpha1.ClusterCleanupPolicy{}
err = c.client.Get().
Resource("clustercleanuppolicies").
Name(name).
@ -75,12 +75,12 @@ func (c *clusterCleanupPolicies) Get(ctx context.Context, name string, options v
}
// 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 *v1alpha1.ClusterCleanupPolicyList, err error) {
func (c *clusterCleanupPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ClusterCleanupPolicyList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.ClusterCleanupPolicyList{}
result = &v2alpha1.ClusterCleanupPolicyList{}
err = c.client.Get().
Resource("clustercleanuppolicies").
VersionedParams(&opts, scheme.ParameterCodec).
@ -105,8 +105,8 @@ func (c *clusterCleanupPolicies) Watch(ctx context.Context, opts v1.ListOptions)
}
// 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 *v1alpha1.ClusterCleanupPolicy, opts v1.CreateOptions) (result *v1alpha1.ClusterCleanupPolicy, err error) {
result = &v1alpha1.ClusterCleanupPolicy{}
func (c *clusterCleanupPolicies) Create(ctx context.Context, clusterCleanupPolicy *v2alpha1.ClusterCleanupPolicy, opts v1.CreateOptions) (result *v2alpha1.ClusterCleanupPolicy, err error) {
result = &v2alpha1.ClusterCleanupPolicy{}
err = c.client.Post().
Resource("clustercleanuppolicies").
VersionedParams(&opts, scheme.ParameterCodec).
@ -117,8 +117,8 @@ func (c *clusterCleanupPolicies) Create(ctx context.Context, clusterCleanupPolic
}
// 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 *v1alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (result *v1alpha1.ClusterCleanupPolicy, err error) {
result = &v1alpha1.ClusterCleanupPolicy{}
func (c *clusterCleanupPolicies) Update(ctx context.Context, clusterCleanupPolicy *v2alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (result *v2alpha1.ClusterCleanupPolicy, err error) {
result = &v2alpha1.ClusterCleanupPolicy{}
err = c.client.Put().
Resource("clustercleanuppolicies").
Name(clusterCleanupPolicy.Name).
@ -131,8 +131,8 @@ func (c *clusterCleanupPolicies) Update(ctx context.Context, clusterCleanupPolic
// 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 *v1alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (result *v1alpha1.ClusterCleanupPolicy, err error) {
result = &v1alpha1.ClusterCleanupPolicy{}
func (c *clusterCleanupPolicies) UpdateStatus(ctx context.Context, clusterCleanupPolicy *v2alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (result *v2alpha1.ClusterCleanupPolicy, err error) {
result = &v2alpha1.ClusterCleanupPolicy{}
err = c.client.Put().
Resource("clustercleanuppolicies").
Name(clusterCleanupPolicy.Name).
@ -170,8 +170,8 @@ func (c *clusterCleanupPolicies) DeleteCollection(ctx context.Context, opts v1.D
}
// 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 *v1alpha1.ClusterCleanupPolicy, err error) {
result = &v1alpha1.ClusterCleanupPolicy{}
func (c *clusterCleanupPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ClusterCleanupPolicy, err error) {
result = &v2alpha1.ClusterCleanupPolicy{}
err = c.client.Patch(pt).
Resource("clustercleanuppolicies").
Name(name).

View file

@ -17,4 +17,4 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1alpha1
package v2alpha1

View file

@ -21,7 +21,7 @@ package fake
import (
"context"
v1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
@ -32,29 +32,29 @@ import (
// FakeCleanupPolicies implements CleanupPolicyInterface
type FakeCleanupPolicies struct {
Fake *FakeKyvernoV1alpha1
Fake *FakeKyvernoV2alpha1
ns string
}
var cleanuppoliciesResource = schema.GroupVersionResource{Group: "kyverno.io", Version: "v1alpha1", Resource: "cleanuppolicies"}
var cleanuppoliciesResource = schema.GroupVersionResource{Group: "kyverno.io", Version: "v2alpha1", Resource: "cleanuppolicies"}
var cleanuppoliciesKind = schema.GroupVersionKind{Group: "kyverno.io", Version: "v1alpha1", Kind: "CleanupPolicy"}
var cleanuppoliciesKind = schema.GroupVersionKind{Group: "kyverno.io", Version: "v2alpha1", Kind: "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 *v1alpha1.CleanupPolicy, err error) {
func (c *FakeCleanupPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CleanupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(cleanuppoliciesResource, c.ns, name), &v1alpha1.CleanupPolicy{})
Invokes(testing.NewGetAction(cleanuppoliciesResource, c.ns, name), &v2alpha1.CleanupPolicy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.CleanupPolicy), err
return obj.(*v2alpha1.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 *v1alpha1.CleanupPolicyList, err error) {
func (c *FakeCleanupPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CleanupPolicyList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(cleanuppoliciesResource, cleanuppoliciesKind, c.ns, opts), &v1alpha1.CleanupPolicyList{})
Invokes(testing.NewListAction(cleanuppoliciesResource, cleanuppoliciesKind, c.ns, opts), &v2alpha1.CleanupPolicyList{})
if obj == nil {
return nil, err
@ -64,8 +64,8 @@ func (c *FakeCleanupPolicies) List(ctx context.Context, opts v1.ListOptions) (re
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.CleanupPolicyList{ListMeta: obj.(*v1alpha1.CleanupPolicyList).ListMeta}
for _, item := range obj.(*v1alpha1.CleanupPolicyList).Items {
list := &v2alpha1.CleanupPolicyList{ListMeta: obj.(*v2alpha1.CleanupPolicyList).ListMeta}
for _, item := range obj.(*v2alpha1.CleanupPolicyList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@ -81,43 +81,43 @@ func (c *FakeCleanupPolicies) Watch(ctx context.Context, opts v1.ListOptions) (w
}
// 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 *v1alpha1.CleanupPolicy, opts v1.CreateOptions) (result *v1alpha1.CleanupPolicy, err error) {
func (c *FakeCleanupPolicies) Create(ctx context.Context, cleanupPolicy *v2alpha1.CleanupPolicy, opts v1.CreateOptions) (result *v2alpha1.CleanupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(cleanuppoliciesResource, c.ns, cleanupPolicy), &v1alpha1.CleanupPolicy{})
Invokes(testing.NewCreateAction(cleanuppoliciesResource, c.ns, cleanupPolicy), &v2alpha1.CleanupPolicy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.CleanupPolicy), err
return obj.(*v2alpha1.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 *v1alpha1.CleanupPolicy, opts v1.UpdateOptions) (result *v1alpha1.CleanupPolicy, err error) {
func (c *FakeCleanupPolicies) Update(ctx context.Context, cleanupPolicy *v2alpha1.CleanupPolicy, opts v1.UpdateOptions) (result *v2alpha1.CleanupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(cleanuppoliciesResource, c.ns, cleanupPolicy), &v1alpha1.CleanupPolicy{})
Invokes(testing.NewUpdateAction(cleanuppoliciesResource, c.ns, cleanupPolicy), &v2alpha1.CleanupPolicy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.CleanupPolicy), err
return obj.(*v2alpha1.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 *v1alpha1.CleanupPolicy, opts v1.UpdateOptions) (*v1alpha1.CleanupPolicy, error) {
func (c *FakeCleanupPolicies) UpdateStatus(ctx context.Context, cleanupPolicy *v2alpha1.CleanupPolicy, opts v1.UpdateOptions) (*v2alpha1.CleanupPolicy, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(cleanuppoliciesResource, "status", c.ns, cleanupPolicy), &v1alpha1.CleanupPolicy{})
Invokes(testing.NewUpdateSubresourceAction(cleanuppoliciesResource, "status", c.ns, cleanupPolicy), &v2alpha1.CleanupPolicy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.CleanupPolicy), err
return obj.(*v2alpha1.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), &v1alpha1.CleanupPolicy{})
Invokes(testing.NewDeleteActionWithOptions(cleanuppoliciesResource, c.ns, name, opts), &v2alpha1.CleanupPolicy{})
return err
}
@ -126,17 +126,17 @@ func (c *FakeCleanupPolicies) Delete(ctx context.Context, name string, opts v1.D
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, &v1alpha1.CleanupPolicyList{})
_, err := c.Fake.Invokes(action, &v2alpha1.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 *v1alpha1.CleanupPolicy, err error) {
func (c *FakeCleanupPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CleanupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(cleanuppoliciesResource, c.ns, name, pt, data, subresources...), &v1alpha1.CleanupPolicy{})
Invokes(testing.NewPatchSubresourceAction(cleanuppoliciesResource, c.ns, name, pt, data, subresources...), &v2alpha1.CleanupPolicy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.CleanupPolicy), err
return obj.(*v2alpha1.CleanupPolicy), err
}

View file

@ -21,7 +21,7 @@ package fake
import (
"context"
v1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
@ -32,27 +32,27 @@ import (
// FakeClusterCleanupPolicies implements ClusterCleanupPolicyInterface
type FakeClusterCleanupPolicies struct {
Fake *FakeKyvernoV1alpha1
Fake *FakeKyvernoV2alpha1
}
var clustercleanuppoliciesResource = schema.GroupVersionResource{Group: "kyverno.io", Version: "v1alpha1", Resource: "clustercleanuppolicies"}
var clustercleanuppoliciesResource = schema.GroupVersionResource{Group: "kyverno.io", Version: "v2alpha1", Resource: "clustercleanuppolicies"}
var clustercleanuppoliciesKind = schema.GroupVersionKind{Group: "kyverno.io", Version: "v1alpha1", Kind: "ClusterCleanupPolicy"}
var clustercleanuppoliciesKind = schema.GroupVersionKind{Group: "kyverno.io", Version: "v2alpha1", Kind: "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 *v1alpha1.ClusterCleanupPolicy, err error) {
func (c *FakeClusterCleanupPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ClusterCleanupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(clustercleanuppoliciesResource, name), &v1alpha1.ClusterCleanupPolicy{})
Invokes(testing.NewRootGetAction(clustercleanuppoliciesResource, name), &v2alpha1.ClusterCleanupPolicy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterCleanupPolicy), err
return obj.(*v2alpha1.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 *v1alpha1.ClusterCleanupPolicyList, err error) {
func (c *FakeClusterCleanupPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ClusterCleanupPolicyList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(clustercleanuppoliciesResource, clustercleanuppoliciesKind, opts), &v1alpha1.ClusterCleanupPolicyList{})
Invokes(testing.NewRootListAction(clustercleanuppoliciesResource, clustercleanuppoliciesKind, opts), &v2alpha1.ClusterCleanupPolicyList{})
if obj == nil {
return nil, err
}
@ -61,8 +61,8 @@ func (c *FakeClusterCleanupPolicies) List(ctx context.Context, opts v1.ListOptio
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ClusterCleanupPolicyList{ListMeta: obj.(*v1alpha1.ClusterCleanupPolicyList).ListMeta}
for _, item := range obj.(*v1alpha1.ClusterCleanupPolicyList).Items {
list := &v2alpha1.ClusterCleanupPolicyList{ListMeta: obj.(*v2alpha1.ClusterCleanupPolicyList).ListMeta}
for _, item := range obj.(*v2alpha1.ClusterCleanupPolicyList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@ -77,40 +77,40 @@ func (c *FakeClusterCleanupPolicies) Watch(ctx context.Context, opts v1.ListOpti
}
// 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 *v1alpha1.ClusterCleanupPolicy, opts v1.CreateOptions) (result *v1alpha1.ClusterCleanupPolicy, err error) {
func (c *FakeClusterCleanupPolicies) Create(ctx context.Context, clusterCleanupPolicy *v2alpha1.ClusterCleanupPolicy, opts v1.CreateOptions) (result *v2alpha1.ClusterCleanupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(clustercleanuppoliciesResource, clusterCleanupPolicy), &v1alpha1.ClusterCleanupPolicy{})
Invokes(testing.NewRootCreateAction(clustercleanuppoliciesResource, clusterCleanupPolicy), &v2alpha1.ClusterCleanupPolicy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterCleanupPolicy), err
return obj.(*v2alpha1.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 *v1alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (result *v1alpha1.ClusterCleanupPolicy, err error) {
func (c *FakeClusterCleanupPolicies) Update(ctx context.Context, clusterCleanupPolicy *v2alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (result *v2alpha1.ClusterCleanupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(clustercleanuppoliciesResource, clusterCleanupPolicy), &v1alpha1.ClusterCleanupPolicy{})
Invokes(testing.NewRootUpdateAction(clustercleanuppoliciesResource, clusterCleanupPolicy), &v2alpha1.ClusterCleanupPolicy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterCleanupPolicy), err
return obj.(*v2alpha1.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 *v1alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (*v1alpha1.ClusterCleanupPolicy, error) {
func (c *FakeClusterCleanupPolicies) UpdateStatus(ctx context.Context, clusterCleanupPolicy *v2alpha1.ClusterCleanupPolicy, opts v1.UpdateOptions) (*v2alpha1.ClusterCleanupPolicy, error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceAction(clustercleanuppoliciesResource, "status", clusterCleanupPolicy), &v1alpha1.ClusterCleanupPolicy{})
Invokes(testing.NewRootUpdateSubresourceAction(clustercleanuppoliciesResource, "status", clusterCleanupPolicy), &v2alpha1.ClusterCleanupPolicy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterCleanupPolicy), err
return obj.(*v2alpha1.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), &v1alpha1.ClusterCleanupPolicy{})
Invokes(testing.NewRootDeleteActionWithOptions(clustercleanuppoliciesResource, name, opts), &v2alpha1.ClusterCleanupPolicy{})
return err
}
@ -118,16 +118,16 @@ func (c *FakeClusterCleanupPolicies) Delete(ctx context.Context, name string, op
func (c *FakeClusterCleanupPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(clustercleanuppoliciesResource, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterCleanupPolicyList{})
_, err := c.Fake.Invokes(action, &v2alpha1.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 *v1alpha1.ClusterCleanupPolicy, err error) {
func (c *FakeClusterCleanupPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ClusterCleanupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(clustercleanuppoliciesResource, name, pt, data, subresources...), &v1alpha1.ClusterCleanupPolicy{})
Invokes(testing.NewRootPatchSubresourceAction(clustercleanuppoliciesResource, name, pt, data, subresources...), &v2alpha1.ClusterCleanupPolicy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterCleanupPolicy), err
return obj.(*v2alpha1.ClusterCleanupPolicy), err
}

View file

@ -19,26 +19,26 @@ limitations under the License.
package fake
import (
v1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1"
v2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeKyvernoV1alpha1 struct {
type FakeKyvernoV2alpha1 struct {
*testing.Fake
}
func (c *FakeKyvernoV1alpha1) CleanupPolicies(namespace string) v1alpha1.CleanupPolicyInterface {
func (c *FakeKyvernoV2alpha1) CleanupPolicies(namespace string) v2alpha1.CleanupPolicyInterface {
return &FakeCleanupPolicies{c, namespace}
}
func (c *FakeKyvernoV1alpha1) ClusterCleanupPolicies() v1alpha1.ClusterCleanupPolicyInterface {
func (c *FakeKyvernoV2alpha1) ClusterCleanupPolicies() v2alpha1.ClusterCleanupPolicyInterface {
return &FakeClusterCleanupPolicies{c}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeKyvernoV1alpha1) RESTClient() rest.Interface {
func (c *FakeKyvernoV2alpha1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View file

@ -16,7 +16,7 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
package v2alpha1
type CleanupPolicyExpansion interface{}

View file

@ -16,39 +16,39 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
package v2alpha1
import (
"net/http"
v1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
rest "k8s.io/client-go/rest"
)
type KyvernoV1alpha1Interface interface {
type KyvernoV2alpha1Interface interface {
RESTClient() rest.Interface
CleanupPoliciesGetter
ClusterCleanupPoliciesGetter
}
// KyvernoV1alpha1Client is used to interact with features provided by the kyverno.io group.
type KyvernoV1alpha1Client struct {
// KyvernoV2alpha1Client is used to interact with features provided by the kyverno.io group.
type KyvernoV2alpha1Client struct {
restClient rest.Interface
}
func (c *KyvernoV1alpha1Client) CleanupPolicies(namespace string) CleanupPolicyInterface {
func (c *KyvernoV2alpha1Client) CleanupPolicies(namespace string) CleanupPolicyInterface {
return newCleanupPolicies(c, namespace)
}
func (c *KyvernoV1alpha1Client) ClusterCleanupPolicies() ClusterCleanupPolicyInterface {
func (c *KyvernoV2alpha1Client) ClusterCleanupPolicies() ClusterCleanupPolicyInterface {
return newClusterCleanupPolicies(c)
}
// NewForConfig creates a new KyvernoV1alpha1Client for the given config.
// NewForConfig creates a new KyvernoV2alpha1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*KyvernoV1alpha1Client, error) {
func NewForConfig(c *rest.Config) (*KyvernoV2alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
@ -60,9 +60,9 @@ func NewForConfig(c *rest.Config) (*KyvernoV1alpha1Client, error) {
return NewForConfigAndClient(&config, httpClient)
}
// NewForConfigAndClient creates a new KyvernoV1alpha1Client for the given config and http client.
// NewForConfigAndClient creates a new KyvernoV2alpha1Client 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) (*KyvernoV1alpha1Client, error) {
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KyvernoV2alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
@ -71,12 +71,12 @@ func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KyvernoV1alpha1Clie
if err != nil {
return nil, err
}
return &KyvernoV1alpha1Client{client}, nil
return &KyvernoV2alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new KyvernoV1alpha1Client for the given config and
// NewForConfigOrDie creates a new KyvernoV2alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *KyvernoV1alpha1Client {
func NewForConfigOrDie(c *rest.Config) *KyvernoV2alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
@ -84,13 +84,13 @@ func NewForConfigOrDie(c *rest.Config) *KyvernoV1alpha1Client {
return client
}
// New creates a new KyvernoV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *KyvernoV1alpha1Client {
return &KyvernoV1alpha1Client{c}
// New creates a new KyvernoV2alpha1Client for the given RESTClient.
func New(c rest.Interface) *KyvernoV2alpha1Client {
return &KyvernoV2alpha1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha1.SchemeGroupVersion
gv := v2alpha1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
@ -104,7 +104,7 @@ func setConfigDefaults(config *rest.Config) error {
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *KyvernoV1alpha1Client) RESTClient() rest.Interface {
func (c *KyvernoV2alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}

View file

@ -22,9 +22,9 @@ import (
"fmt"
v1 "github.com/kyverno/kyverno/api/kyverno/v1"
v1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
v1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2"
v1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
@ -64,12 +64,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case v1.SchemeGroupVersion.WithResource("policies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V1().Policies().Informer()}, nil
// Group=kyverno.io, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("cleanuppolicies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V1alpha1().CleanupPolicies().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("clustercleanuppolicies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V1alpha1().ClusterCleanupPolicies().Informer()}, nil
// Group=kyverno.io, Version=v1alpha2
case v1alpha2.SchemeGroupVersion.WithResource("admissionreports"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V1alpha2().AdmissionReports().Informer()}, nil
@ -84,6 +78,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case v1beta1.SchemeGroupVersion.WithResource("updaterequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V1beta1().UpdateRequests().Informer()}, nil
// Group=kyverno.io, Version=v2alpha1
case v2alpha1.SchemeGroupVersion.WithResource("cleanuppolicies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2alpha1().CleanupPolicies().Informer()}, nil
case v2alpha1.SchemeGroupVersion.WithResource("clustercleanuppolicies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2alpha1().ClusterCleanupPolicies().Informer()}, nil
// Group=wgpolicyk8s.io, Version=v1alpha2
case policyreportv1alpha2.SchemeGroupVersion.WithResource("clusterpolicyreports"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Wgpolicyk8s().V1alpha2().ClusterPolicyReports().Informer()}, nil

View file

@ -21,21 +21,21 @@ package kyverno
import (
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
v1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1"
v1alpha1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1alpha1"
v1alpha2 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1alpha2"
v1beta1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1beta1"
v2alpha1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v2alpha1"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1 provides access to shared informers for resources in V1.
V1() v1.Interface
// V1beta1 provides access to shared informers for resources in V1beta1.
V1beta1() v1beta1.Interface
// V1alpha2 provides access to shared informers for resources in V1alpha2.
V1alpha2() v1alpha2.Interface
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.Interface
// V1beta1 provides access to shared informers for resources in V1beta1.
V1beta1() v1beta1.Interface
// V2alpha1 provides access to shared informers for resources in V2alpha1.
V2alpha1() v2alpha1.Interface
}
type group struct {
@ -54,17 +54,17 @@ func (g *group) V1() v1.Interface {
return v1.New(g.factory, g.namespace, g.tweakListOptions)
}
// V1beta1 returns a new v1beta1.Interface.
func (g *group) V1beta1() v1beta1.Interface {
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
}
// V1alpha2 returns a new v1alpha2.Interface.
func (g *group) V1alpha2() v1alpha2.Interface {
return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions)
}
// V1alpha1 returns a new v1alpha1.Interface.
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
// V1beta1 returns a new v1beta1.Interface.
func (g *group) V1beta1() v1beta1.Interface {
return v1beta1.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)
}

View file

@ -16,16 +16,16 @@ limitations under the License.
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
package v2alpha1
import (
"context"
time "time"
kyvernov1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha1"
v2alpha1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
@ -36,7 +36,7 @@ import (
// CleanupPolicies.
type CleanupPolicyInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.CleanupPolicyLister
Lister() v2alpha1.CleanupPolicyLister
}
type cleanupPolicyInformer struct {
@ -62,16 +62,16 @@ func NewFilteredCleanupPolicyInformer(client versioned.Interface, namespace stri
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.KyvernoV1alpha1().CleanupPolicies(namespace).List(context.TODO(), options)
return client.KyvernoV2alpha1().CleanupPolicies(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.KyvernoV1alpha1().CleanupPolicies(namespace).Watch(context.TODO(), options)
return client.KyvernoV2alpha1().CleanupPolicies(namespace).Watch(context.TODO(), options)
},
},
&kyvernov1alpha1.CleanupPolicy{},
&kyvernov2alpha1.CleanupPolicy{},
resyncPeriod,
indexers,
)
@ -82,9 +82,9 @@ func (f *cleanupPolicyInformer) defaultInformer(client versioned.Interface, resy
}
func (f *cleanupPolicyInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&kyvernov1alpha1.CleanupPolicy{}, f.defaultInformer)
return f.factory.InformerFor(&kyvernov2alpha1.CleanupPolicy{}, f.defaultInformer)
}
func (f *cleanupPolicyInformer) Lister() v1alpha1.CleanupPolicyLister {
return v1alpha1.NewCleanupPolicyLister(f.Informer().GetIndexer())
func (f *cleanupPolicyInformer) Lister() v2alpha1.CleanupPolicyLister {
return v2alpha1.NewCleanupPolicyLister(f.Informer().GetIndexer())
}

View file

@ -16,16 +16,16 @@ limitations under the License.
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
package v2alpha1
import (
"context"
time "time"
kyvernov1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha1"
v2alpha1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
@ -36,7 +36,7 @@ import (
// ClusterCleanupPolicies.
type ClusterCleanupPolicyInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.ClusterCleanupPolicyLister
Lister() v2alpha1.ClusterCleanupPolicyLister
}
type clusterCleanupPolicyInformer struct {
@ -61,16 +61,16 @@ func NewFilteredClusterCleanupPolicyInformer(client versioned.Interface, resyncP
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.KyvernoV1alpha1().ClusterCleanupPolicies().List(context.TODO(), options)
return client.KyvernoV2alpha1().ClusterCleanupPolicies().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.KyvernoV1alpha1().ClusterCleanupPolicies().Watch(context.TODO(), options)
return client.KyvernoV2alpha1().ClusterCleanupPolicies().Watch(context.TODO(), options)
},
},
&kyvernov1alpha1.ClusterCleanupPolicy{},
&kyvernov2alpha1.ClusterCleanupPolicy{},
resyncPeriod,
indexers,
)
@ -81,9 +81,9 @@ func (f *clusterCleanupPolicyInformer) defaultInformer(client versioned.Interfac
}
func (f *clusterCleanupPolicyInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&kyvernov1alpha1.ClusterCleanupPolicy{}, f.defaultInformer)
return f.factory.InformerFor(&kyvernov2alpha1.ClusterCleanupPolicy{}, f.defaultInformer)
}
func (f *clusterCleanupPolicyInformer) Lister() v1alpha1.ClusterCleanupPolicyLister {
return v1alpha1.NewClusterCleanupPolicyLister(f.Informer().GetIndexer())
func (f *clusterCleanupPolicyInformer) Lister() v2alpha1.ClusterCleanupPolicyLister {
return v2alpha1.NewClusterCleanupPolicyLister(f.Informer().GetIndexer())
}

View file

@ -16,7 +16,7 @@ limitations under the License.
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
package v2alpha1
import (
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"

View file

@ -16,10 +16,10 @@ limitations under the License.
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
package v2alpha1
import (
v1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
@ -30,7 +30,7 @@ import (
type CleanupPolicyLister interface {
// List lists all CleanupPolicies in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.CleanupPolicy, err error)
List(selector labels.Selector) (ret []*v2alpha1.CleanupPolicy, err error)
// CleanupPolicies returns an object that can list and get CleanupPolicies.
CleanupPolicies(namespace string) CleanupPolicyNamespaceLister
CleanupPolicyListerExpansion
@ -47,9 +47,9 @@ func NewCleanupPolicyLister(indexer cache.Indexer) CleanupPolicyLister {
}
// List lists all CleanupPolicies in the indexer.
func (s *cleanupPolicyLister) List(selector labels.Selector) (ret []*v1alpha1.CleanupPolicy, err error) {
func (s *cleanupPolicyLister) List(selector labels.Selector) (ret []*v2alpha1.CleanupPolicy, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.CleanupPolicy))
ret = append(ret, m.(*v2alpha1.CleanupPolicy))
})
return ret, err
}
@ -64,10 +64,10 @@ func (s *cleanupPolicyLister) CleanupPolicies(namespace string) CleanupPolicyNam
type CleanupPolicyNamespaceLister interface {
// List lists all CleanupPolicies in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.CleanupPolicy, err error)
List(selector labels.Selector) (ret []*v2alpha1.CleanupPolicy, err error)
// Get retrieves the CleanupPolicy from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha1.CleanupPolicy, error)
Get(name string) (*v2alpha1.CleanupPolicy, error)
CleanupPolicyNamespaceListerExpansion
}
@ -79,21 +79,21 @@ type cleanupPolicyNamespaceLister struct {
}
// List lists all CleanupPolicies in the indexer for a given namespace.
func (s cleanupPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CleanupPolicy, err error) {
func (s cleanupPolicyNamespaceLister) List(selector labels.Selector) (ret []*v2alpha1.CleanupPolicy, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.CleanupPolicy))
ret = append(ret, m.(*v2alpha1.CleanupPolicy))
})
return ret, err
}
// Get retrieves the CleanupPolicy from the indexer for a given namespace and name.
func (s cleanupPolicyNamespaceLister) Get(name string) (*v1alpha1.CleanupPolicy, error) {
func (s cleanupPolicyNamespaceLister) Get(name string) (*v2alpha1.CleanupPolicy, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("cleanuppolicy"), name)
return nil, errors.NewNotFound(v2alpha1.Resource("cleanuppolicy"), name)
}
return obj.(*v1alpha1.CleanupPolicy), nil
return obj.(*v2alpha1.CleanupPolicy), nil
}

View file

@ -16,10 +16,10 @@ limitations under the License.
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
package v2alpha1
import (
v1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
@ -30,10 +30,10 @@ import (
type ClusterCleanupPolicyLister interface {
// List lists all ClusterCleanupPolicies in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.ClusterCleanupPolicy, err error)
List(selector labels.Selector) (ret []*v2alpha1.ClusterCleanupPolicy, err error)
// Get retrieves the ClusterCleanupPolicy from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha1.ClusterCleanupPolicy, error)
Get(name string) (*v2alpha1.ClusterCleanupPolicy, error)
ClusterCleanupPolicyListerExpansion
}
@ -48,21 +48,21 @@ func NewClusterCleanupPolicyLister(indexer cache.Indexer) ClusterCleanupPolicyLi
}
// List lists all ClusterCleanupPolicies in the indexer.
func (s *clusterCleanupPolicyLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterCleanupPolicy, err error) {
func (s *clusterCleanupPolicyLister) List(selector labels.Selector) (ret []*v2alpha1.ClusterCleanupPolicy, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.ClusterCleanupPolicy))
ret = append(ret, m.(*v2alpha1.ClusterCleanupPolicy))
})
return ret, err
}
// Get retrieves the ClusterCleanupPolicy from the index for a given name.
func (s *clusterCleanupPolicyLister) Get(name string) (*v1alpha1.ClusterCleanupPolicy, error) {
func (s *clusterCleanupPolicyLister) Get(name string) (*v2alpha1.ClusterCleanupPolicy, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("clustercleanuppolicy"), name)
return nil, errors.NewNotFound(v2alpha1.Resource("clustercleanuppolicy"), name)
}
return obj.(*v1alpha1.ClusterCleanupPolicy), nil
return obj.(*v2alpha1.ClusterCleanupPolicy), nil
}

View file

@ -16,7 +16,7 @@ limitations under the License.
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
package v2alpha1
// CleanupPolicyListerExpansion allows custom methods to be added to
// CleanupPolicyLister.

View file

@ -4,15 +4,15 @@ import (
"github.com/go-logr/logr"
github_com_kyverno_kyverno_pkg_client_clientset_versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
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_v1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1"
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2"
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1beta1"
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_policyreport_v1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2"
discovery "github.com/kyverno/kyverno/pkg/clients/kyverno/discovery"
kyvernov1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1"
kyvernov1alpha1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1alpha1"
kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1alpha2"
kyvernov1beta1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1beta1"
kyvernov2alpha1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2alpha1"
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/clients/kyverno/wgpolicyk8sv1alpha2"
"github.com/kyverno/kyverno/pkg/metrics"
k8s_io_client_go_discovery "k8s.io/client-go/discovery"
@ -21,9 +21,9 @@ import (
type clientset struct {
discovery k8s_io_client_go_discovery.DiscoveryInterface
kyvernov1 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1.KyvernoV1Interface
kyvernov1alpha1 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.KyvernoV1alpha1Interface
kyvernov1alpha2 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha2.KyvernoV1alpha2Interface
kyvernov1beta1 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1beta1.KyvernoV1beta1Interface
kyvernov2alpha1 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface
wgpolicyk8sv1alpha2 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2.Wgpolicyk8sV1alpha2Interface
}
@ -33,15 +33,15 @@ func (c *clientset) Discovery() k8s_io_client_go_discovery.DiscoveryInterface {
func (c *clientset) KyvernoV1() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1.KyvernoV1Interface {
return c.kyvernov1
}
func (c *clientset) KyvernoV1alpha1() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.KyvernoV1alpha1Interface {
return c.kyvernov1alpha1
}
func (c *clientset) KyvernoV1alpha2() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha2.KyvernoV1alpha2Interface {
return c.kyvernov1alpha2
}
func (c *clientset) KyvernoV1beta1() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1beta1.KyvernoV1beta1Interface {
return c.kyvernov1beta1
}
func (c *clientset) KyvernoV2alpha1() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface {
return c.kyvernov2alpha1
}
func (c *clientset) Wgpolicyk8sV1alpha2() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2.Wgpolicyk8sV1alpha2Interface {
return c.wgpolicyk8sv1alpha2
}
@ -50,9 +50,9 @@ func WrapWithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versi
return &clientset{
discovery: discovery.WithMetrics(inner.Discovery(), metrics.ClusteredClientQueryRecorder(m, "Discovery", clientType)),
kyvernov1: kyvernov1.WithMetrics(inner.KyvernoV1(), m, clientType),
kyvernov1alpha1: kyvernov1alpha1.WithMetrics(inner.KyvernoV1alpha1(), m, clientType),
kyvernov1alpha2: kyvernov1alpha2.WithMetrics(inner.KyvernoV1alpha2(), m, clientType),
kyvernov1beta1: kyvernov1beta1.WithMetrics(inner.KyvernoV1beta1(), m, clientType),
kyvernov2alpha1: kyvernov2alpha1.WithMetrics(inner.KyvernoV2alpha1(), m, clientType),
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithMetrics(inner.Wgpolicyk8sV1alpha2(), m, clientType),
}
}
@ -61,9 +61,9 @@ func WrapWithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versi
return &clientset{
discovery: discovery.WithTracing(inner.Discovery(), "Discovery", ""),
kyvernov1: kyvernov1.WithTracing(inner.KyvernoV1(), "KyvernoV1"),
kyvernov1alpha1: kyvernov1alpha1.WithTracing(inner.KyvernoV1alpha1(), "KyvernoV1alpha1"),
kyvernov1alpha2: kyvernov1alpha2.WithTracing(inner.KyvernoV1alpha2(), "KyvernoV1alpha2"),
kyvernov1beta1: kyvernov1beta1.WithTracing(inner.KyvernoV1beta1(), "KyvernoV1beta1"),
kyvernov2alpha1: kyvernov2alpha1.WithTracing(inner.KyvernoV2alpha1(), "KyvernoV2alpha1"),
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithTracing(inner.Wgpolicyk8sV1alpha2(), "Wgpolicyk8sV1alpha2"),
}
}
@ -72,9 +72,9 @@ func WrapWithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versi
return &clientset{
discovery: discovery.WithLogging(inner.Discovery(), logger.WithValues("group", "Discovery")),
kyvernov1: kyvernov1.WithLogging(inner.KyvernoV1(), logger.WithValues("group", "KyvernoV1")),
kyvernov1alpha1: kyvernov1alpha1.WithLogging(inner.KyvernoV1alpha1(), logger.WithValues("group", "KyvernoV1alpha1")),
kyvernov1alpha2: kyvernov1alpha2.WithLogging(inner.KyvernoV1alpha2(), logger.WithValues("group", "KyvernoV1alpha2")),
kyvernov1beta1: kyvernov1beta1.WithLogging(inner.KyvernoV1beta1(), logger.WithValues("group", "KyvernoV1beta1")),
kyvernov2alpha1: kyvernov2alpha1.WithLogging(inner.KyvernoV2alpha1(), logger.WithValues("group", "KyvernoV2alpha1")),
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithLogging(inner.Wgpolicyk8sV1alpha2(), logger.WithValues("group", "Wgpolicyk8sV1alpha2")),
}
}

View file

@ -6,8 +6,8 @@ import (
"time"
"github.com/go-logr/logr"
github_com_kyverno_kyverno_api_kyverno_v1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1"
github_com_kyverno_kyverno_api_kyverno_v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
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/metrics"
"github.com/kyverno/kyverno/pkg/tracing"
"go.uber.org/multierr"
@ -16,24 +16,24 @@ import (
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
)
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.CleanupPolicyInterface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.CleanupPolicyInterface {
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.CleanupPolicyInterface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.CleanupPolicyInterface {
return &withLogging{inner, logger}
}
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.CleanupPolicyInterface, recorder metrics.Recorder) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.CleanupPolicyInterface {
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.CleanupPolicyInterface, recorder metrics.Recorder) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.CleanupPolicyInterface {
return &withMetrics{inner, recorder}
}
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.CleanupPolicyInterface, client, kind string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.CleanupPolicyInterface {
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.CleanupPolicyInterface, client, kind string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.CleanupPolicyInterface {
return &withTracing{inner, client, kind}
}
type withLogging struct {
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.CleanupPolicyInterface
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.CleanupPolicyInterface
logger logr.Logger
}
func (c *withLogging) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, error) {
func (c *withLogging) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "Create")
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
@ -66,7 +66,7 @@ func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimach
}
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_v1alpha1.CleanupPolicy, error) {
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "Get")
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
@ -77,7 +77,7 @@ func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimach
}
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_v1alpha1.CleanupPolicyList, error) {
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicyList, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "List")
ret0, ret1 := c.inner.List(arg0, arg1)
@ -88,7 +88,7 @@ func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_ap
}
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_v1alpha1.CleanupPolicy, error) {
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_v2alpha1.CleanupPolicy, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "Patch")
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
@ -99,7 +99,7 @@ func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apima
}
return ret0, ret1
}
func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, error) {
func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "Update")
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
@ -110,7 +110,7 @@ func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyve
}
return ret0, ret1
}
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, error) {
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "UpdateStatus")
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
@ -134,11 +134,11 @@ func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_a
}
type withMetrics struct {
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.CleanupPolicyInterface
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.CleanupPolicyInterface
recorder metrics.Recorder
}
func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, error) {
func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
defer c.recorder.Record("create")
return c.inner.Create(arg0, arg1, arg2)
}
@ -150,23 +150,23 @@ func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimach
defer c.recorder.Record("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_v1alpha1.CleanupPolicy, error) {
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
defer c.recorder.Record("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_v1alpha1.CleanupPolicyList, error) {
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicyList, error) {
defer c.recorder.Record("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_v1alpha1.CleanupPolicy, error) {
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_v2alpha1.CleanupPolicy, error) {
defer c.recorder.Record("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_v1alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, error) {
func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
defer c.recorder.Record("update")
return c.inner.Update(arg0, arg1, arg2)
}
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, error) {
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
defer c.recorder.Record("update_status")
return c.inner.UpdateStatus(arg0, arg1, arg2)
}
@ -176,12 +176,12 @@ func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_a
}
type withTracing struct {
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.CleanupPolicyInterface
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.CleanupPolicyInterface
client string
kind string
}
func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, error) {
func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
ctx, span := tracing.StartSpan(
arg0,
"",
@ -226,7 +226,7 @@ func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimach
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_v1alpha1.CleanupPolicy, error) {
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
ctx, span := tracing.StartSpan(
arg0,
"",
@ -241,7 +241,7 @@ func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimach
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_v1alpha1.CleanupPolicyList, error) {
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicyList, error) {
ctx, span := tracing.StartSpan(
arg0,
"",
@ -256,7 +256,7 @@ func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_ap
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_v1alpha1.CleanupPolicy, error) {
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_v2alpha1.CleanupPolicy, error) {
ctx, span := tracing.StartSpan(
arg0,
"",
@ -271,7 +271,7 @@ func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apima
tracing.SetSpanStatus(span, ret1)
return ret0, ret1
}
func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, error) {
func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
ctx, span := tracing.StartSpan(
arg0,
"",
@ -286,7 +286,7 @@ func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyve
tracing.SetSpanStatus(span, ret1)
return ret0, ret1
}
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.CleanupPolicy, error) {
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) {
ctx, span := tracing.StartSpan(
arg0,
"",

View file

@ -2,27 +2,27 @@ package client
import (
"github.com/go-logr/logr"
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1"
cleanuppolicies "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1alpha1/cleanuppolicies"
clustercleanuppolicies "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1alpha1/clustercleanuppolicies"
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1"
cleanuppolicies "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2alpha1/cleanuppolicies"
clustercleanuppolicies "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2alpha1/clustercleanuppolicies"
"github.com/kyverno/kyverno/pkg/metrics"
"k8s.io/client-go/rest"
)
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.KyvernoV1alpha1Interface, metrics metrics.MetricsConfigManager, clientType metrics.ClientType) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.KyvernoV1alpha1Interface {
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface, metrics metrics.MetricsConfigManager, clientType metrics.ClientType) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface {
return &withMetrics{inner, metrics, clientType}
}
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.KyvernoV1alpha1Interface, client string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.KyvernoV1alpha1Interface {
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface, client string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface {
return &withTracing{inner, client}
}
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.KyvernoV1alpha1Interface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.KyvernoV1alpha1Interface {
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface {
return &withLogging{inner, logger}
}
type withMetrics struct {
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.KyvernoV1alpha1Interface
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface
metrics metrics.MetricsConfigManager
clientType metrics.ClientType
}
@ -30,41 +30,41 @@ type withMetrics struct {
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_v1alpha1.CleanupPolicyInterface {
func (c *withMetrics) CleanupPolicies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.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_v1alpha1.ClusterCleanupPolicyInterface {
func (c *withMetrics) ClusterCleanupPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface {
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "ClusterCleanupPolicy", c.clientType)
return clustercleanuppolicies.WithMetrics(c.inner.ClusterCleanupPolicies(), recorder)
}
type withTracing struct {
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.KyvernoV1alpha1Interface
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface
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_v1alpha1.CleanupPolicyInterface {
func (c *withTracing) CleanupPolicies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.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_v1alpha1.ClusterCleanupPolicyInterface {
func (c *withTracing) ClusterCleanupPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface {
return clustercleanuppolicies.WithTracing(c.inner.ClusterCleanupPolicies(), c.client, "ClusterCleanupPolicy")
}
type withLogging struct {
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.KyvernoV1alpha1Interface
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface
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_v1alpha1.CleanupPolicyInterface {
func (c *withLogging) CleanupPolicies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.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_v1alpha1.ClusterCleanupPolicyInterface {
func (c *withLogging) ClusterCleanupPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface {
return clustercleanuppolicies.WithLogging(c.inner.ClusterCleanupPolicies(), c.logger.WithValues("resource", "ClusterCleanupPolicies"))
}

View file

@ -6,8 +6,8 @@ import (
"time"
"github.com/go-logr/logr"
github_com_kyverno_kyverno_api_kyverno_v1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1"
github_com_kyverno_kyverno_api_kyverno_v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
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/metrics"
"github.com/kyverno/kyverno/pkg/tracing"
"go.uber.org/multierr"
@ -16,24 +16,24 @@ import (
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
)
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.ClusterCleanupPolicyInterface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.ClusterCleanupPolicyInterface {
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface {
return &withLogging{inner, logger}
}
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.ClusterCleanupPolicyInterface, recorder metrics.Recorder) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.ClusterCleanupPolicyInterface {
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface, recorder metrics.Recorder) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface {
return &withMetrics{inner, recorder}
}
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.ClusterCleanupPolicyInterface, client, kind string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.ClusterCleanupPolicyInterface {
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface, client, kind string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface {
return &withTracing{inner, client, kind}
}
type withLogging struct {
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.ClusterCleanupPolicyInterface
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface
logger logr.Logger
}
func (c *withLogging) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withLogging) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "Create")
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
@ -66,7 +66,7 @@ func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimach
}
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_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "Get")
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
@ -77,7 +77,7 @@ func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimach
}
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_v1alpha1.ClusterCleanupPolicyList, error) {
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicyList, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "List")
ret0, ret1 := c.inner.List(arg0, arg1)
@ -88,7 +88,7 @@ func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_ap
}
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_v1alpha1.ClusterCleanupPolicy, error) {
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_v2alpha1.ClusterCleanupPolicy, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "Patch")
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
@ -99,7 +99,7 @@ func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apima
}
return ret0, ret1
}
func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "Update")
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
@ -110,7 +110,7 @@ func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyve
}
return ret0, ret1
}
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
start := time.Now()
logger := c.logger.WithValues("operation", "UpdateStatus")
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
@ -134,11 +134,11 @@ func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_a
}
type withMetrics struct {
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.ClusterCleanupPolicyInterface
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface
recorder metrics.Recorder
}
func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
defer c.recorder.Record("create")
return c.inner.Create(arg0, arg1, arg2)
}
@ -150,23 +150,23 @@ func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimach
defer c.recorder.Record("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_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
defer c.recorder.Record("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_v1alpha1.ClusterCleanupPolicyList, error) {
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicyList, error) {
defer c.recorder.Record("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_v1alpha1.ClusterCleanupPolicy, error) {
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_v2alpha1.ClusterCleanupPolicy, error) {
defer c.recorder.Record("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_v1alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
defer c.recorder.Record("update")
return c.inner.Update(arg0, arg1, arg2)
}
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
defer c.recorder.Record("update_status")
return c.inner.UpdateStatus(arg0, arg1, arg2)
}
@ -176,12 +176,12 @@ func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_a
}
type withTracing struct {
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha1.ClusterCleanupPolicyInterface
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.ClusterCleanupPolicyInterface
client string
kind string
}
func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
ctx, span := tracing.StartSpan(
arg0,
"",
@ -226,7 +226,7 @@ func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimach
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_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
ctx, span := tracing.StartSpan(
arg0,
"",
@ -241,7 +241,7 @@ func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimach
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_v1alpha1.ClusterCleanupPolicyList, error) {
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicyList, error) {
ctx, span := tracing.StartSpan(
arg0,
"",
@ -256,7 +256,7 @@ func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_ap
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_v1alpha1.ClusterCleanupPolicy, error) {
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_v2alpha1.ClusterCleanupPolicy, error) {
ctx, span := tracing.StartSpan(
arg0,
"",
@ -271,7 +271,7 @@ func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apima
tracing.SetSpanStatus(span, ret1)
return ret0, ret1
}
func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
ctx, span := tracing.StartSpan(
arg0,
"",
@ -286,7 +286,7 @@ func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyve
tracing.SetSpanStatus(span, ret1)
return ret0, ret1
}
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha1.ClusterCleanupPolicy, error) {
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) {
ctx, span := tracing.StartSpan(
arg0,
"",

View file

@ -6,9 +6,9 @@ import (
"time"
"github.com/go-logr/logr"
kyvernov1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
kyvernov1alpha1informers "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1alpha1"
kyvernov1alpha1listers "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha1"
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
kyvernov2alpha1informers "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v2alpha1"
kyvernov2alpha1listers "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2alpha1"
"github.com/kyverno/kyverno/pkg/config"
"github.com/kyverno/kyverno/pkg/controllers"
controllerutils "github.com/kyverno/kyverno/pkg/utils/controller"
@ -33,14 +33,14 @@ type controller struct {
client kubernetes.Interface
// listers
cpolLister kyvernov1alpha1listers.ClusterCleanupPolicyLister
polLister kyvernov1alpha1listers.CleanupPolicyLister
cpolLister kyvernov2alpha1listers.ClusterCleanupPolicyLister
polLister kyvernov2alpha1listers.CleanupPolicyLister
cjLister batchv1listers.CronJobLister
// queue
queue workqueue.RateLimitingInterface
cpolEnqueue controllerutils.EnqueueFuncT[*kyvernov1alpha1.ClusterCleanupPolicy]
polEnqueue controllerutils.EnqueueFuncT[*kyvernov1alpha1.CleanupPolicy]
cpolEnqueue controllerutils.EnqueueFuncT[*kyvernov2alpha1.ClusterCleanupPolicy]
polEnqueue controllerutils.EnqueueFuncT[*kyvernov2alpha1.CleanupPolicy]
// config
cleanupService string
@ -54,8 +54,8 @@ const (
func NewController(
client kubernetes.Interface,
cpolInformer kyvernov1alpha1informers.ClusterCleanupPolicyInformer,
polInformer kyvernov1alpha1informers.CleanupPolicyInformer,
cpolInformer kyvernov2alpha1informers.ClusterCleanupPolicyInformer,
polInformer kyvernov2alpha1informers.CleanupPolicyInformer,
cjInformer batchv1informers.CronJobInformer,
cleanupService string,
) controllers.Controller {
@ -66,8 +66,8 @@ func NewController(
polLister: polInformer.Lister(),
cjLister: cjInformer.Lister(),
queue: queue,
cpolEnqueue: controllerutils.AddDefaultEventHandlersT[*kyvernov1alpha1.ClusterCleanupPolicy](logger, cpolInformer.Informer(), queue),
polEnqueue: controllerutils.AddDefaultEventHandlersT[*kyvernov1alpha1.CleanupPolicy](logger, polInformer.Informer(), queue),
cpolEnqueue: controllerutils.AddDefaultEventHandlersT[*kyvernov2alpha1.ClusterCleanupPolicy](logger, cpolInformer.Informer(), queue),
polEnqueue: controllerutils.AddDefaultEventHandlersT[*kyvernov2alpha1.CleanupPolicy](logger, polInformer.Informer(), queue),
cleanupService: cleanupService,
}
controllerutils.AddEventHandlersT(
@ -86,7 +86,7 @@ func (c *controller) Run(ctx context.Context, workers int) {
func (c *controller) enqueueCronJob(n *batchv1.CronJob) {
if len(n.OwnerReferences) == 1 {
if n.OwnerReferences[0].Kind == "ClusterCleanupPolicy" {
cpol := &kyvernov1alpha1.ClusterCleanupPolicy{
cpol := &kyvernov2alpha1.ClusterCleanupPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: n.OwnerReferences[0].Name,
},
@ -96,7 +96,7 @@ func (c *controller) enqueueCronJob(n *batchv1.CronJob) {
logger.Error(err, "failed to enqueue ClusterCleanupPolicy object", cpol)
}
} else if n.OwnerReferences[0].Kind == "CleanupPolicy" {
pol := &kyvernov1alpha1.CleanupPolicy{
pol := &kyvernov2alpha1.CleanupPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: n.OwnerReferences[0].Name,
Namespace: n.Namespace,
@ -110,7 +110,7 @@ func (c *controller) enqueueCronJob(n *batchv1.CronJob) {
}
}
func (c *controller) getPolicy(namespace, name string) (kyvernov1alpha1.CleanupPolicyInterface, error) {
func (c *controller) getPolicy(namespace, name string) (kyvernov2alpha1.CleanupPolicyInterface, error) {
if namespace == "" {
cpolicy, err := c.cpolLister.Get(name)
if err != nil {
@ -134,9 +134,9 @@ func (c *controller) getCronjob(namespace, name string) (*batchv1.CronJob, error
return cj, nil
}
func (c *controller) buildCronJob(cronJob *batchv1.CronJob, pol kyvernov1alpha1.CleanupPolicyInterface) error {
func (c *controller) buildCronJob(cronJob *batchv1.CronJob, pol kyvernov2alpha1.CleanupPolicyInterface) error {
// TODO: find a better way to do that, it looks like resources returned by WATCH don't have the GVK
apiVersion := "kyverno.io/v1alpha1"
apiVersion := "kyverno.io/v2alpha1"
kind := "CleanupPolicy"
if pol.GetNamespace() == "" {
kind = "ClusterCleanupPolicy"

View file

@ -4,19 +4,19 @@ import (
"encoding/json"
"fmt"
kyvernov1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
admissionv1 "k8s.io/api/admission/v1"
)
func UnmarshalCleanupPolicy(kind string, raw []byte) (kyvernov1alpha1.CleanupPolicyInterface, error) {
func UnmarshalCleanupPolicy(kind string, raw []byte) (kyvernov2alpha1.CleanupPolicyInterface, error) {
if kind == "CleanupPolicy" {
var policy *kyvernov1alpha1.CleanupPolicy
var policy *kyvernov2alpha1.CleanupPolicy
if err := json.Unmarshal(raw, &policy); err != nil {
return nil, err
}
return policy, nil
} else if kind == "ClusterCleanupPolicy" {
var policy *kyvernov1alpha1.ClusterCleanupPolicy
var policy *kyvernov2alpha1.ClusterCleanupPolicy
if err := json.Unmarshal(raw, &policy); err != nil {
return nil, err
}
@ -25,8 +25,8 @@ func UnmarshalCleanupPolicy(kind string, raw []byte) (kyvernov1alpha1.CleanupPol
return nil, fmt.Errorf("admission request does not contain a cleanuppolicy")
}
func GetCleanupPolicies(request *admissionv1.AdmissionRequest) (kyvernov1alpha1.CleanupPolicyInterface, kyvernov1alpha1.CleanupPolicyInterface, error) {
var emptypolicy kyvernov1alpha1.CleanupPolicyInterface
func GetCleanupPolicies(request *admissionv1.AdmissionRequest) (kyvernov2alpha1.CleanupPolicyInterface, kyvernov2alpha1.CleanupPolicyInterface, error) {
var emptypolicy kyvernov2alpha1.CleanupPolicyInterface
policy, err := UnmarshalCleanupPolicy(request.Kind.Kind, request.Object.Raw)
if err != nil {
return policy, emptypolicy, err

View file

@ -5,7 +5,7 @@ import (
"fmt"
"github.com/go-logr/logr"
kyvernov1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
"github.com/kyverno/kyverno/pkg/auth"
"github.com/kyverno/kyverno/pkg/clients/dclient"
"k8s.io/apimachinery/pkg/util/sets"
@ -37,7 +37,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 kyvernov1alpha1.CleanupPolicyInterface) error {
func Validate(ctx context.Context, logger logr.Logger, client dclient.Interface, policy kyvernov2alpha1.CleanupPolicyInterface) error {
clusteredResources, err := FetchClusteredResources(logger, client)
if err != nil {
return err
@ -52,13 +52,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.String, policy kyvernov1alpha1.CleanupPolicyInterface) error {
func validatePolicy(clusterResources sets.String, policy kyvernov2alpha1.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 kyvernov1alpha1.CleanupPolicyInterface) error {
func validateAuth(ctx context.Context, client dclient.Interface, policy kyvernov2alpha1.CleanupPolicyInterface) error {
namespace := policy.GetNamespace()
spec := policy.GetSpec()
kinds := sets.NewString(spec.MatchResources.GetKinds()...)

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v1alpha1
apiVersion: kyverno.io/v2alpha1
kind: CleanupPolicy
metadata:
name: cleanuppolicy

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v1alpha1
apiVersion: kyverno.io/v2alpha1
kind: CleanupPolicy
metadata:
name: cleanuppolicy

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v1alpha1
apiVersion: kyverno.io/v2alpha1
kind: ClusterCleanupPolicy
metadata:
name: cleanuppolicy

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v1alpha1
apiVersion: kyverno.io/v2alpha1
kind: ClusterCleanupPolicy
metadata:
name: cleanuppolicy

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v1alpha1
apiVersion: kyverno.io/v2alpha1
kind: CleanupPolicy
metadata:
name: cleanuppolicy