mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-15 20:20:22 +00:00
chore: use register-gen to register k8s types (#7761)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
parent
03702476fa
commit
93ba283563
38 changed files with 2507 additions and 246 deletions
16
Makefile
16
Makefile
|
@ -40,6 +40,7 @@ CLIENT_GEN := $(TOOLS_DIR)/client-gen
|
||||||
LISTER_GEN := $(TOOLS_DIR)/lister-gen
|
LISTER_GEN := $(TOOLS_DIR)/lister-gen
|
||||||
INFORMER_GEN := $(TOOLS_DIR)/informer-gen
|
INFORMER_GEN := $(TOOLS_DIR)/informer-gen
|
||||||
OPENAPI_GEN := $(TOOLS_DIR)/openapi-gen
|
OPENAPI_GEN := $(TOOLS_DIR)/openapi-gen
|
||||||
|
REGISTER_GEN := $(TOOLS_DIR)/register-gen
|
||||||
CODE_GEN_VERSION := v0.26.3
|
CODE_GEN_VERSION := v0.26.3
|
||||||
GEN_CRD_API_REFERENCE_DOCS := $(TOOLS_DIR)/gen-crd-api-reference-docs
|
GEN_CRD_API_REFERENCE_DOCS := $(TOOLS_DIR)/gen-crd-api-reference-docs
|
||||||
GEN_CRD_API_REFERENCE_DOCS_VERSION := latest
|
GEN_CRD_API_REFERENCE_DOCS_VERSION := latest
|
||||||
|
@ -55,7 +56,7 @@ KO := $(TOOLS_DIR)/ko
|
||||||
KO_VERSION := v0.14.1
|
KO_VERSION := v0.14.1
|
||||||
KUTTL := $(TOOLS_DIR)/kubectl-kuttl
|
KUTTL := $(TOOLS_DIR)/kubectl-kuttl
|
||||||
KUTTL_VERSION := v0.0.0-20230126200340-834a4dac1ec7
|
KUTTL_VERSION := v0.0.0-20230126200340-834a4dac1ec7
|
||||||
TOOLS := $(KIND) $(CONTROLLER_GEN) $(CLIENT_GEN) $(LISTER_GEN) $(INFORMER_GEN) $(OPENAPI_GEN) $(GEN_CRD_API_REFERENCE_DOCS) $(GO_ACC) $(GOIMPORTS) $(HELM) $(HELM_DOCS) $(KO) $(KUTTL)
|
TOOLS := $(KIND) $(CONTROLLER_GEN) $(CLIENT_GEN) $(LISTER_GEN) $(INFORMER_GEN) $(OPENAPI_GEN) $(REGISTER_GEN) $(GEN_CRD_API_REFERENCE_DOCS) $(GO_ACC) $(GOIMPORTS) $(HELM) $(HELM_DOCS) $(KO) $(KUTTL)
|
||||||
ifeq ($(GOOS), darwin)
|
ifeq ($(GOOS), darwin)
|
||||||
SED := gsed
|
SED := gsed
|
||||||
else
|
else
|
||||||
|
@ -87,6 +88,10 @@ $(OPENAPI_GEN):
|
||||||
@echo Install openapi-gen... >&2
|
@echo Install openapi-gen... >&2
|
||||||
@GOBIN=$(TOOLS_DIR) go install k8s.io/code-generator/cmd/openapi-gen@$(CODE_GEN_VERSION)
|
@GOBIN=$(TOOLS_DIR) go install k8s.io/code-generator/cmd/openapi-gen@$(CODE_GEN_VERSION)
|
||||||
|
|
||||||
|
$(REGISTER_GEN):
|
||||||
|
@echo Install register-gen... >&2
|
||||||
|
@GOBIN=$(TOOLS_DIR) go install k8s.io/code-generator/cmd/register-gen@$(CODE_GEN_VERSION)
|
||||||
|
|
||||||
$(GEN_CRD_API_REFERENCE_DOCS):
|
$(GEN_CRD_API_REFERENCE_DOCS):
|
||||||
@echo Install gen-crd-api-reference-docs... >&2
|
@echo Install gen-crd-api-reference-docs... >&2
|
||||||
@GOBIN=$(TOOLS_DIR) go install github.com/ahmetb/gen-crd-api-reference-docs@$(GEN_CRD_API_REFERENCE_DOCS_VERSION)
|
@GOBIN=$(TOOLS_DIR) go install github.com/ahmetb/gen-crd-api-reference-docs@$(GEN_CRD_API_REFERENCE_DOCS_VERSION)
|
||||||
|
@ -380,7 +385,7 @@ image-build-all: $(BUILD_WITH)-build-all
|
||||||
GOPATH_SHIM := ${PWD}/.gopath
|
GOPATH_SHIM := ${PWD}/.gopath
|
||||||
PACKAGE_SHIM := $(GOPATH_SHIM)/src/$(PACKAGE)
|
PACKAGE_SHIM := $(GOPATH_SHIM)/src/$(PACKAGE)
|
||||||
OUT_PACKAGE := $(PACKAGE)/pkg/client
|
OUT_PACKAGE := $(PACKAGE)/pkg/client
|
||||||
INPUT_DIRS := $(PACKAGE)/api/kyverno/v1,$(PACKAGE)/api/kyverno/v1alpha2,$(PACKAGE)/api/kyverno/v1beta1,$(PACKAGE)/api/kyverno/v2alpha1,$(PACKAGE)/api/policyreport/v1alpha2
|
INPUT_DIRS := $(PACKAGE)/api/kyverno/v1,$(PACKAGE)/api/kyverno/v1alpha2,$(PACKAGE)/api/kyverno/v1beta1,$(PACKAGE)/api/kyverno/v2beta1,$(PACKAGE)/api/kyverno/v2alpha1,$(PACKAGE)/api/policyreport/v1alpha2
|
||||||
CLIENTSET_PACKAGE := $(OUT_PACKAGE)/clientset
|
CLIENTSET_PACKAGE := $(OUT_PACKAGE)/clientset
|
||||||
LISTERS_PACKAGE := $(OUT_PACKAGE)/listers
|
LISTERS_PACKAGE := $(OUT_PACKAGE)/listers
|
||||||
INFORMERS_PACKAGE := $(OUT_PACKAGE)/informers
|
INFORMERS_PACKAGE := $(OUT_PACKAGE)/informers
|
||||||
|
@ -418,8 +423,13 @@ codegen-client-wrappers: codegen-client-clientset $(GOIMPORTS) ## Generate clien
|
||||||
@$(GOIMPORTS) -w ./pkg/clients
|
@$(GOIMPORTS) -w ./pkg/clients
|
||||||
@go fmt ./pkg/clients/...
|
@go fmt ./pkg/clients/...
|
||||||
|
|
||||||
|
.PHONY: codegen-register
|
||||||
|
codegen-register: $(PACKAGE_SHIM) $(REGISTER_GEN) ## Generate types registrations
|
||||||
|
@echo Generate registration... >&2
|
||||||
|
@GOPATH=$(GOPATH_SHIM) $(REGISTER_GEN) --go-header-file=./scripts/boilerplate.go.txt --input-dirs=$(INPUT_DIRS)
|
||||||
|
|
||||||
.PHONY: codegen-client-all
|
.PHONY: codegen-client-all
|
||||||
codegen-client-all: codegen-client-clientset codegen-client-listers codegen-client-informers codegen-client-wrappers ## Generate clientset, listers and informers
|
codegen-client-all: codegen-register codegen-client-clientset codegen-client-listers codegen-client-informers codegen-client-wrappers ## Generate clientset, listers and informers
|
||||||
|
|
||||||
.PHONY: codegen-crds-kyverno
|
.PHONY: codegen-crds-kyverno
|
||||||
codegen-crds-kyverno: $(CONTROLLER_GEN) ## Generate kyverno CRDs
|
codegen-crds-kyverno: $(CONTROLLER_GEN) ## Generate kyverno CRDs
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
package kyverno
|
|
||||||
|
|
||||||
const (
|
|
||||||
// GroupName must be the same as specified in Policy CRD
|
|
||||||
GroupName = "kyverno.io"
|
|
||||||
)
|
|
|
@ -1,41 +0,0 @@
|
||||||
package v1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/kyverno/kyverno/api/kyverno"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SchemeGroupVersion is group version used to register these objects
|
|
||||||
var SchemeGroupVersion = schema.GroupVersion{Group: kyverno.GroupName, Version: "v1"}
|
|
||||||
|
|
||||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
|
||||||
func Kind(kind string) schema.GroupKind {
|
|
||||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
|
||||||
func Resource(resource string) schema.GroupResource {
|
|
||||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
// SchemeBuilder builds the scheme
|
|
||||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
|
||||||
|
|
||||||
// AddToScheme adds all types of this clientset into the given scheme
|
|
||||||
AddToScheme = SchemeBuilder.AddToScheme
|
|
||||||
)
|
|
||||||
|
|
||||||
// Adds the list of known types to Scheme.
|
|
||||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
|
||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
|
||||||
&ClusterPolicy{},
|
|
||||||
&ClusterPolicyList{},
|
|
||||||
&Policy{},
|
|
||||||
&PolicyList{},
|
|
||||||
)
|
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
|
||||||
return nil
|
|
||||||
}
|
|
69
api/kyverno/v1/zz_generated.register.go
Normal file
69
api/kyverno/v1/zz_generated.register.go
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by register-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GroupName specifies the group name used to register the objects.
|
||||||
|
const GroupName = "kyverno.io"
|
||||||
|
|
||||||
|
// GroupVersion specifies the group and the version used to register the objects.
|
||||||
|
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1"}
|
||||||
|
|
||||||
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
// Deprecated: use GroupVersion instead.
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
|
SchemeBuilder runtime.SchemeBuilder
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
|
// Depreciated: use Install instead
|
||||||
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
Install = localSchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// We only register manually written functions here. The registration of the
|
||||||
|
// generated functions takes place in the generated files. The separation
|
||||||
|
// makes the code compile even when the generated files are missing.
|
||||||
|
localSchemeBuilder.Register(addKnownTypes)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds the list of known types to Scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&ClusterPolicy{},
|
||||||
|
&ClusterPolicyList{},
|
||||||
|
&Policy{},
|
||||||
|
&PolicyList{},
|
||||||
|
)
|
||||||
|
// AddToGroupVersion allows the serialization of client types like ListOptions.
|
||||||
|
v1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
45
api/kyverno/v1alpha2/register.go → api/kyverno/v1alpha2/zz_generated.register.go
Executable file → Normal file
45
api/kyverno/v1alpha2/register.go → api/kyverno/v1alpha2/zz_generated.register.go
Executable file → Normal file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2020 The Kubernetes authors.
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -14,25 +14,25 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Package v1alpha2 contains API Schema definitions for the policy v1alpha2 API group
|
// Code generated by register-gen. DO NOT EDIT.
|
||||||
// +kubebuilder:object:generate=true
|
|
||||||
// +groupName=kyverno.io
|
|
||||||
package v1alpha2
|
package v1alpha2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/kyverno/kyverno/api/kyverno"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SchemeGroupVersion is group version used to register these objects
|
// GroupName specifies the group name used to register the objects.
|
||||||
var SchemeGroupVersion = schema.GroupVersion{Group: kyverno.GroupName, Version: "v1alpha2"}
|
const GroupName = "kyverno.io"
|
||||||
|
|
||||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
// GroupVersion specifies the group and the version used to register the objects.
|
||||||
func Kind(kind string) schema.GroupKind {
|
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha2"}
|
||||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
|
||||||
}
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
// Deprecated: use GroupVersion instead.
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"}
|
||||||
|
|
||||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
func Resource(resource string) schema.GroupResource {
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
@ -40,13 +40,21 @@ func Resource(resource string) schema.GroupResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// SchemeBuilder builds the scheme
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
SchemeBuilder runtime.SchemeBuilder
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
// AddToScheme adds all types of this clientset into the given scheme
|
// Depreciated: use Install instead
|
||||||
AddToScheme = SchemeBuilder.AddToScheme
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
Install = localSchemeBuilder.AddToScheme
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// We only register manually written functions here. The registration of the
|
||||||
|
// generated functions takes place in the generated files. The separation
|
||||||
|
// makes the code compile even when the generated files are missing.
|
||||||
|
localSchemeBuilder.Register(addKnownTypes)
|
||||||
|
}
|
||||||
|
|
||||||
// Adds the list of known types to Scheme.
|
// Adds the list of known types to Scheme.
|
||||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
@ -59,6 +67,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
&ClusterBackgroundScanReport{},
|
&ClusterBackgroundScanReport{},
|
||||||
&ClusterBackgroundScanReportList{},
|
&ClusterBackgroundScanReportList{},
|
||||||
)
|
)
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
// AddToGroupVersion allows the serialization of client types like ListOptions.
|
||||||
|
v1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2022.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Package v1beta1 contains API Schema definitions for the kyverno.io v1beta1 API group
|
|
||||||
// +kubebuilder:object:generate=true
|
|
||||||
// +groupName=kyverno.io
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/kyverno/kyverno/api/kyverno"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SchemeGroupVersion is group version used to register these objects
|
|
||||||
var SchemeGroupVersion = schema.GroupVersion{Group: kyverno.GroupName, Version: "v1beta1"}
|
|
||||||
|
|
||||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
|
||||||
func Kind(kind string) schema.GroupKind {
|
|
||||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
|
||||||
func Resource(resource string) schema.GroupResource {
|
|
||||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
// SchemeBuilder builds the scheme
|
|
||||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
|
||||||
|
|
||||||
// AddToScheme adds all types of this clientset into the given scheme
|
|
||||||
AddToScheme = SchemeBuilder.AddToScheme
|
|
||||||
)
|
|
||||||
|
|
||||||
// Adds the list of known types to Scheme.
|
|
||||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
|
||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
|
||||||
&UpdateRequest{},
|
|
||||||
&UpdateRequestList{},
|
|
||||||
)
|
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
|
||||||
return nil
|
|
||||||
}
|
|
67
api/kyverno/v1beta1/zz_generated.register.go
Normal file
67
api/kyverno/v1beta1/zz_generated.register.go
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by register-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GroupName specifies the group name used to register the objects.
|
||||||
|
const GroupName = "kyverno.io"
|
||||||
|
|
||||||
|
// GroupVersion specifies the group and the version used to register the objects.
|
||||||
|
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1beta1"}
|
||||||
|
|
||||||
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
// Deprecated: use GroupVersion instead.
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
|
SchemeBuilder runtime.SchemeBuilder
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
|
// Depreciated: use Install instead
|
||||||
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
Install = localSchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// We only register manually written functions here. The registration of the
|
||||||
|
// generated functions takes place in the generated files. The separation
|
||||||
|
// makes the code compile even when the generated files are missing.
|
||||||
|
localSchemeBuilder.Register(addKnownTypes)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds the list of known types to Scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&UpdateRequest{},
|
||||||
|
&UpdateRequestList{},
|
||||||
|
)
|
||||||
|
// AddToGroupVersion allows the serialization of client types like ListOptions.
|
||||||
|
v1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
44
api/kyverno/v2alpha1/register.go → api/kyverno/v2alpha1/zz_generated.register.go
Executable file → Normal file
44
api/kyverno/v2alpha1/register.go → api/kyverno/v2alpha1/zz_generated.register.go
Executable file → Normal file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2020 The Kubernetes authors.
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -14,24 +14,25 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// +kubebuilder:object:generate=true
|
// Code generated by register-gen. DO NOT EDIT.
|
||||||
// +groupName=kyverno.io
|
|
||||||
package v2alpha1
|
package v2alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/kyverno/kyverno/api/kyverno"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SchemeGroupVersion is group version used to register these objects
|
// GroupName specifies the group name used to register the objects.
|
||||||
var SchemeGroupVersion = schema.GroupVersion{Group: kyverno.GroupName, Version: "v2alpha1"}
|
const GroupName = "kyverno.io"
|
||||||
|
|
||||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
// GroupVersion specifies the group and the version used to register the objects.
|
||||||
func Kind(kind string) schema.GroupKind {
|
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v2alpha1"}
|
||||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
|
||||||
}
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
// Deprecated: use GroupVersion instead.
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v2alpha1"}
|
||||||
|
|
||||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
func Resource(resource string) schema.GroupResource {
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
@ -39,13 +40,21 @@ func Resource(resource string) schema.GroupResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// SchemeBuilder builds the scheme
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
SchemeBuilder runtime.SchemeBuilder
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
// AddToScheme adds all types of this clientset into the given scheme
|
// Depreciated: use Install instead
|
||||||
AddToScheme = SchemeBuilder.AddToScheme
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
Install = localSchemeBuilder.AddToScheme
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// We only register manually written functions here. The registration of the
|
||||||
|
// generated functions takes place in the generated files. The separation
|
||||||
|
// makes the code compile even when the generated files are missing.
|
||||||
|
localSchemeBuilder.Register(addKnownTypes)
|
||||||
|
}
|
||||||
|
|
||||||
// Adds the list of known types to Scheme.
|
// Adds the list of known types to Scheme.
|
||||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
@ -56,6 +65,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
&PolicyException{},
|
&PolicyException{},
|
||||||
&PolicyExceptionList{},
|
&PolicyExceptionList{},
|
||||||
)
|
)
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
// AddToGroupVersion allows the serialization of client types like ListOptions.
|
||||||
|
v1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
|
@ -1,41 +0,0 @@
|
||||||
package v2beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/kyverno/kyverno/api/kyverno"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SchemeGroupVersion is group version used to register these objects
|
|
||||||
var SchemeGroupVersion = schema.GroupVersion{Group: kyverno.GroupName, Version: "v2beta1"}
|
|
||||||
|
|
||||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
|
||||||
func Kind(kind string) schema.GroupKind {
|
|
||||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
|
||||||
func Resource(resource string) schema.GroupResource {
|
|
||||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
// SchemeBuilder builds the scheme
|
|
||||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
|
||||||
|
|
||||||
// AddToScheme adds all types of this clientset into the given scheme
|
|
||||||
AddToScheme = SchemeBuilder.AddToScheme
|
|
||||||
)
|
|
||||||
|
|
||||||
// Adds the list of known types to Scheme.
|
|
||||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
|
||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
|
||||||
&ClusterPolicy{},
|
|
||||||
&ClusterPolicyList{},
|
|
||||||
&Policy{},
|
|
||||||
&PolicyList{},
|
|
||||||
)
|
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
|
||||||
return nil
|
|
||||||
}
|
|
69
api/kyverno/v2beta1/zz_generated.register.go
Normal file
69
api/kyverno/v2beta1/zz_generated.register.go
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by register-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v2beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GroupName specifies the group name used to register the objects.
|
||||||
|
const GroupName = "kyverno.io"
|
||||||
|
|
||||||
|
// GroupVersion specifies the group and the version used to register the objects.
|
||||||
|
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v2beta1"}
|
||||||
|
|
||||||
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
// Deprecated: use GroupVersion instead.
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v2beta1"}
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
|
SchemeBuilder runtime.SchemeBuilder
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
|
// Depreciated: use Install instead
|
||||||
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
Install = localSchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// We only register manually written functions here. The registration of the
|
||||||
|
// generated functions takes place in the generated files. The separation
|
||||||
|
// makes the code compile even when the generated files are missing.
|
||||||
|
localSchemeBuilder.Register(addKnownTypes)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds the list of known types to Scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&ClusterPolicy{},
|
||||||
|
&ClusterPolicyList{},
|
||||||
|
&Policy{},
|
||||||
|
&PolicyList{},
|
||||||
|
)
|
||||||
|
// AddToGroupVersion allows the serialization of client types like ListOptions.
|
||||||
|
v1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
package policyreport
|
|
||||||
|
|
||||||
const (
|
|
||||||
GroupName = "wgpolicyk8s.io"
|
|
||||||
)
|
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2020 The Kubernetes authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1alpha2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/kyverno/kyverno/api/policyreport"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SchemeGroupVersion is group version used to register these objects
|
|
||||||
var SchemeGroupVersion = schema.GroupVersion{Group: policyreport.GroupName, Version: "v1alpha2"}
|
|
||||||
|
|
||||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
|
||||||
func Kind(kind string) schema.GroupKind {
|
|
||||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
|
||||||
func Resource(resource string) schema.GroupResource {
|
|
||||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
// SchemeBuilder builds the scheme
|
|
||||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
|
||||||
|
|
||||||
// AddToScheme adds all types of this clientset into the given scheme
|
|
||||||
AddToScheme = SchemeBuilder.AddToScheme
|
|
||||||
)
|
|
||||||
|
|
||||||
// Adds the list of known types to Scheme.
|
|
||||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
|
||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
|
||||||
&ClusterPolicyReport{},
|
|
||||||
&ClusterPolicyReportList{},
|
|
||||||
&PolicyReport{},
|
|
||||||
&PolicyReportList{},
|
|
||||||
)
|
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
|
||||||
return nil
|
|
||||||
}
|
|
69
api/policyreport/v1alpha2/zz_generated.register.go
Normal file
69
api/policyreport/v1alpha2/zz_generated.register.go
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by register-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GroupName specifies the group name used to register the objects.
|
||||||
|
const GroupName = "wgpolicyk8s.io"
|
||||||
|
|
||||||
|
// GroupVersion specifies the group and the version used to register the objects.
|
||||||
|
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha2"}
|
||||||
|
|
||||||
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
// Deprecated: use GroupVersion instead.
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"}
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
|
SchemeBuilder runtime.SchemeBuilder
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
|
// Depreciated: use Install instead
|
||||||
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
Install = localSchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// We only register manually written functions here. The registration of the
|
||||||
|
// generated functions takes place in the generated files. The separation
|
||||||
|
// makes the code compile even when the generated files are missing.
|
||||||
|
localSchemeBuilder.Register(addKnownTypes)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds the list of known types to Scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&ClusterPolicyReport{},
|
||||||
|
&ClusterPolicyReportList{},
|
||||||
|
&PolicyReport{},
|
||||||
|
&PolicyReportList{},
|
||||||
|
)
|
||||||
|
// AddToGroupVersion allows the serialization of client types like ListOptions.
|
||||||
|
v1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -26,6 +26,7 @@ import (
|
||||||
kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2"
|
kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2"
|
||||||
kyvernov1beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1beta1"
|
kyvernov1beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1beta1"
|
||||||
kyvernov2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1"
|
kyvernov2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1"
|
||||||
|
kyvernov2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||||
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2"
|
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2"
|
||||||
discovery "k8s.io/client-go/discovery"
|
discovery "k8s.io/client-go/discovery"
|
||||||
rest "k8s.io/client-go/rest"
|
rest "k8s.io/client-go/rest"
|
||||||
|
@ -37,6 +38,7 @@ type Interface interface {
|
||||||
KyvernoV1() kyvernov1.KyvernoV1Interface
|
KyvernoV1() kyvernov1.KyvernoV1Interface
|
||||||
KyvernoV1alpha2() kyvernov1alpha2.KyvernoV1alpha2Interface
|
KyvernoV1alpha2() kyvernov1alpha2.KyvernoV1alpha2Interface
|
||||||
KyvernoV1beta1() kyvernov1beta1.KyvernoV1beta1Interface
|
KyvernoV1beta1() kyvernov1beta1.KyvernoV1beta1Interface
|
||||||
|
KyvernoV2beta1() kyvernov2beta1.KyvernoV2beta1Interface
|
||||||
KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface
|
KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface
|
||||||
Wgpolicyk8sV1alpha2() wgpolicyk8sv1alpha2.Wgpolicyk8sV1alpha2Interface
|
Wgpolicyk8sV1alpha2() wgpolicyk8sv1alpha2.Wgpolicyk8sV1alpha2Interface
|
||||||
}
|
}
|
||||||
|
@ -47,6 +49,7 @@ type Clientset struct {
|
||||||
kyvernoV1 *kyvernov1.KyvernoV1Client
|
kyvernoV1 *kyvernov1.KyvernoV1Client
|
||||||
kyvernoV1alpha2 *kyvernov1alpha2.KyvernoV1alpha2Client
|
kyvernoV1alpha2 *kyvernov1alpha2.KyvernoV1alpha2Client
|
||||||
kyvernoV1beta1 *kyvernov1beta1.KyvernoV1beta1Client
|
kyvernoV1beta1 *kyvernov1beta1.KyvernoV1beta1Client
|
||||||
|
kyvernoV2beta1 *kyvernov2beta1.KyvernoV2beta1Client
|
||||||
kyvernoV2alpha1 *kyvernov2alpha1.KyvernoV2alpha1Client
|
kyvernoV2alpha1 *kyvernov2alpha1.KyvernoV2alpha1Client
|
||||||
wgpolicyk8sV1alpha2 *wgpolicyk8sv1alpha2.Wgpolicyk8sV1alpha2Client
|
wgpolicyk8sV1alpha2 *wgpolicyk8sv1alpha2.Wgpolicyk8sV1alpha2Client
|
||||||
}
|
}
|
||||||
|
@ -66,6 +69,11 @@ func (c *Clientset) KyvernoV1beta1() kyvernov1beta1.KyvernoV1beta1Interface {
|
||||||
return c.kyvernoV1beta1
|
return c.kyvernoV1beta1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// KyvernoV2beta1 retrieves the KyvernoV2beta1Client
|
||||||
|
func (c *Clientset) KyvernoV2beta1() kyvernov2beta1.KyvernoV2beta1Interface {
|
||||||
|
return c.kyvernoV2beta1
|
||||||
|
}
|
||||||
|
|
||||||
// KyvernoV2alpha1 retrieves the KyvernoV2alpha1Client
|
// KyvernoV2alpha1 retrieves the KyvernoV2alpha1Client
|
||||||
func (c *Clientset) KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface {
|
func (c *Clientset) KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface {
|
||||||
return c.kyvernoV2alpha1
|
return c.kyvernoV2alpha1
|
||||||
|
@ -132,6 +140,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
cs.kyvernoV2beta1, err = kyvernov2beta1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
cs.kyvernoV2alpha1, err = kyvernov2alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
cs.kyvernoV2alpha1, err = kyvernov2alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -164,6 +176,7 @@ func New(c rest.Interface) *Clientset {
|
||||||
cs.kyvernoV1 = kyvernov1.New(c)
|
cs.kyvernoV1 = kyvernov1.New(c)
|
||||||
cs.kyvernoV1alpha2 = kyvernov1alpha2.New(c)
|
cs.kyvernoV1alpha2 = kyvernov1alpha2.New(c)
|
||||||
cs.kyvernoV1beta1 = kyvernov1beta1.New(c)
|
cs.kyvernoV1beta1 = kyvernov1beta1.New(c)
|
||||||
|
cs.kyvernoV2beta1 = kyvernov2beta1.New(c)
|
||||||
cs.kyvernoV2alpha1 = kyvernov2alpha1.New(c)
|
cs.kyvernoV2alpha1 = kyvernov2alpha1.New(c)
|
||||||
cs.wgpolicyk8sV1alpha2 = wgpolicyk8sv1alpha2.New(c)
|
cs.wgpolicyk8sV1alpha2 = wgpolicyk8sv1alpha2.New(c)
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ import (
|
||||||
fakekyvernov1beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1beta1/fake"
|
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"
|
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"
|
fakekyvernov2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1/fake"
|
||||||
|
kyvernov2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||||
|
fakekyvernov2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1/fake"
|
||||||
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2"
|
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"
|
fakewgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/fake"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
@ -102,6 +104,11 @@ func (c *Clientset) KyvernoV1beta1() kyvernov1beta1.KyvernoV1beta1Interface {
|
||||||
return &fakekyvernov1beta1.FakeKyvernoV1beta1{Fake: &c.Fake}
|
return &fakekyvernov1beta1.FakeKyvernoV1beta1{Fake: &c.Fake}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// KyvernoV2beta1 retrieves the KyvernoV2beta1Client
|
||||||
|
func (c *Clientset) KyvernoV2beta1() kyvernov2beta1.KyvernoV2beta1Interface {
|
||||||
|
return &fakekyvernov2beta1.FakeKyvernoV2beta1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
// KyvernoV2alpha1 retrieves the KyvernoV2alpha1Client
|
// KyvernoV2alpha1 retrieves the KyvernoV2alpha1Client
|
||||||
func (c *Clientset) KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface {
|
func (c *Clientset) KyvernoV2alpha1() kyvernov2alpha1.KyvernoV2alpha1Interface {
|
||||||
return &fakekyvernov2alpha1.FakeKyvernoV2alpha1{Fake: &c.Fake}
|
return &fakekyvernov2alpha1.FakeKyvernoV2alpha1{Fake: &c.Fake}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import (
|
||||||
kyvernov1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2"
|
kyvernov1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2"
|
||||||
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
|
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
|
||||||
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
|
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
|
||||||
|
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
@ -38,6 +39,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
|
||||||
kyvernov1.AddToScheme,
|
kyvernov1.AddToScheme,
|
||||||
kyvernov1alpha2.AddToScheme,
|
kyvernov1alpha2.AddToScheme,
|
||||||
kyvernov1beta1.AddToScheme,
|
kyvernov1beta1.AddToScheme,
|
||||||
|
kyvernov2beta1.AddToScheme,
|
||||||
kyvernov2alpha1.AddToScheme,
|
kyvernov2alpha1.AddToScheme,
|
||||||
wgpolicyk8sv1alpha2.AddToScheme,
|
wgpolicyk8sv1alpha2.AddToScheme,
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import (
|
||||||
kyvernov1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2"
|
kyvernov1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2"
|
||||||
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
|
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
|
||||||
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
|
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
|
||||||
|
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
@ -38,6 +39,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
|
||||||
kyvernov1.AddToScheme,
|
kyvernov1.AddToScheme,
|
||||||
kyvernov1alpha2.AddToScheme,
|
kyvernov1alpha2.AddToScheme,
|
||||||
kyvernov1beta1.AddToScheme,
|
kyvernov1beta1.AddToScheme,
|
||||||
|
kyvernov2beta1.AddToScheme,
|
||||||
kyvernov2alpha1.AddToScheme,
|
kyvernov2alpha1.AddToScheme,
|
||||||
wgpolicyk8sv1alpha2.AddToScheme,
|
wgpolicyk8sv1alpha2.AddToScheme,
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,184 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v2beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
|
scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClusterPoliciesGetter has a method to return a ClusterPolicyInterface.
|
||||||
|
// A group's client should implement this interface.
|
||||||
|
type ClusterPoliciesGetter interface {
|
||||||
|
ClusterPolicies() ClusterPolicyInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterPolicyInterface has methods to work with ClusterPolicy resources.
|
||||||
|
type ClusterPolicyInterface interface {
|
||||||
|
Create(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.CreateOptions) (*v2beta1.ClusterPolicy, error)
|
||||||
|
Update(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (*v2beta1.ClusterPolicy, error)
|
||||||
|
UpdateStatus(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (*v2beta1.ClusterPolicy, error)
|
||||||
|
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||||
|
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||||
|
Get(ctx context.Context, name string, opts v1.GetOptions) (*v2beta1.ClusterPolicy, error)
|
||||||
|
List(ctx context.Context, opts v1.ListOptions) (*v2beta1.ClusterPolicyList, error)
|
||||||
|
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||||
|
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.ClusterPolicy, err error)
|
||||||
|
ClusterPolicyExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// clusterPolicies implements ClusterPolicyInterface
|
||||||
|
type clusterPolicies struct {
|
||||||
|
client rest.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
// newClusterPolicies returns a ClusterPolicies
|
||||||
|
func newClusterPolicies(c *KyvernoV2beta1Client) *clusterPolicies {
|
||||||
|
return &clusterPolicies{
|
||||||
|
client: c.RESTClient(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get takes name of the clusterPolicy, and returns the corresponding clusterPolicy object, and an error if there is any.
|
||||||
|
func (c *clusterPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||||
|
result = &v2beta1.ClusterPolicy{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Resource("clusterpolicies").
|
||||||
|
Name(name).
|
||||||
|
VersionedParams(&options, scheme.ParameterCodec).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of ClusterPolicies that match those selectors.
|
||||||
|
func (c *clusterPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ClusterPolicyList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
result = &v2beta1.ClusterPolicyList{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Resource("clusterpolicies").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested clusterPolicies.
|
||||||
|
func (c *clusterPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
opts.Watch = true
|
||||||
|
return c.client.Get().
|
||||||
|
Resource("clusterpolicies").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Watch(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a clusterPolicy and creates it. Returns the server's representation of the clusterPolicy, and an error, if there is any.
|
||||||
|
func (c *clusterPolicies) Create(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.CreateOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||||
|
result = &v2beta1.ClusterPolicy{}
|
||||||
|
err = c.client.Post().
|
||||||
|
Resource("clusterpolicies").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(clusterPolicy).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a clusterPolicy and updates it. Returns the server's representation of the clusterPolicy, and an error, if there is any.
|
||||||
|
func (c *clusterPolicies) Update(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||||
|
result = &v2beta1.ClusterPolicy{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Resource("clusterpolicies").
|
||||||
|
Name(clusterPolicy.Name).
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(clusterPolicy).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
func (c *clusterPolicies) UpdateStatus(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||||
|
result = &v2beta1.ClusterPolicy{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Resource("clusterpolicies").
|
||||||
|
Name(clusterPolicy.Name).
|
||||||
|
SubResource("status").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(clusterPolicy).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the clusterPolicy and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *clusterPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
|
return c.client.Delete().
|
||||||
|
Resource("clusterpolicies").
|
||||||
|
Name(name).
|
||||||
|
Body(&opts).
|
||||||
|
Do(ctx).
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *clusterPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOpts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
return c.client.Delete().
|
||||||
|
Resource("clusterpolicies").
|
||||||
|
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Body(&opts).
|
||||||
|
Do(ctx).
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched clusterPolicy.
|
||||||
|
func (c *clusterPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.ClusterPolicy, err error) {
|
||||||
|
result = &v2beta1.ClusterPolicy{}
|
||||||
|
err = c.client.Patch(pt).
|
||||||
|
Resource("clusterpolicies").
|
||||||
|
Name(name).
|
||||||
|
SubResource(subresources...).
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(data).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
20
pkg/client/clientset/versioned/typed/kyverno/v2beta1/doc.go
Normal file
20
pkg/client/clientset/versioned/typed/kyverno/v2beta1/doc.go
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
// This package has the automatically generated typed clients.
|
||||||
|
package v2beta1
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
// Package fake has the automatically generated clients.
|
||||||
|
package fake
|
|
@ -0,0 +1,133 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeClusterPolicies implements ClusterPolicyInterface
|
||||||
|
type FakeClusterPolicies struct {
|
||||||
|
Fake *FakeKyvernoV2beta1
|
||||||
|
}
|
||||||
|
|
||||||
|
var clusterpoliciesResource = schema.GroupVersionResource{Group: "kyverno.io", Version: "v2beta1", Resource: "clusterpolicies"}
|
||||||
|
|
||||||
|
var clusterpoliciesKind = schema.GroupVersionKind{Group: "kyverno.io", Version: "v2beta1", Kind: "ClusterPolicy"}
|
||||||
|
|
||||||
|
// Get takes name of the clusterPolicy, and returns the corresponding clusterPolicy object, and an error if there is any.
|
||||||
|
func (c *FakeClusterPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootGetAction(clusterpoliciesResource, name), &v2beta1.ClusterPolicy{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.ClusterPolicy), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of ClusterPolicies that match those selectors.
|
||||||
|
func (c *FakeClusterPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ClusterPolicyList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootListAction(clusterpoliciesResource, clusterpoliciesKind, opts), &v2beta1.ClusterPolicyList{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v2beta1.ClusterPolicyList{ListMeta: obj.(*v2beta1.ClusterPolicyList).ListMeta}
|
||||||
|
for _, item := range obj.(*v2beta1.ClusterPolicyList).Items {
|
||||||
|
if label.Matches(labels.Set(item.Labels)) {
|
||||||
|
list.Items = append(list.Items, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested clusterPolicies.
|
||||||
|
func (c *FakeClusterPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewRootWatchAction(clusterpoliciesResource, opts))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a clusterPolicy and creates it. Returns the server's representation of the clusterPolicy, and an error, if there is any.
|
||||||
|
func (c *FakeClusterPolicies) Create(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.CreateOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootCreateAction(clusterpoliciesResource, clusterPolicy), &v2beta1.ClusterPolicy{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.ClusterPolicy), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a clusterPolicy and updates it. Returns the server's representation of the clusterPolicy, and an error, if there is any.
|
||||||
|
func (c *FakeClusterPolicies) Update(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (result *v2beta1.ClusterPolicy, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootUpdateAction(clusterpoliciesResource, clusterPolicy), &v2beta1.ClusterPolicy{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.ClusterPolicy), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
func (c *FakeClusterPolicies) UpdateStatus(ctx context.Context, clusterPolicy *v2beta1.ClusterPolicy, opts v1.UpdateOptions) (*v2beta1.ClusterPolicy, error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootUpdateSubresourceAction(clusterpoliciesResource, "status", clusterPolicy), &v2beta1.ClusterPolicy{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.ClusterPolicy), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the clusterPolicy and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *FakeClusterPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootDeleteActionWithOptions(clusterpoliciesResource, name, opts), &v2beta1.ClusterPolicy{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *FakeClusterPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||||
|
action := testing.NewRootDeleteCollectionAction(clusterpoliciesResource, listOpts)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v2beta1.ClusterPolicyList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched clusterPolicy.
|
||||||
|
func (c *FakeClusterPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.ClusterPolicy, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootPatchSubresourceAction(clusterpoliciesResource, name, pt, data, subresources...), &v2beta1.ClusterPolicy{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.ClusterPolicy), err
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakeKyvernoV2beta1 struct {
|
||||||
|
*testing.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeKyvernoV2beta1) ClusterPolicies() v2beta1.ClusterPolicyInterface {
|
||||||
|
return &FakeClusterPolicies{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeKyvernoV2beta1) Policies(namespace string) v2beta1.PolicyInterface {
|
||||||
|
return &FakePolicies{c, namespace}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *FakeKyvernoV2beta1) RESTClient() rest.Interface {
|
||||||
|
var ret *rest.RESTClient
|
||||||
|
return ret
|
||||||
|
}
|
|
@ -0,0 +1,142 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakePolicies implements PolicyInterface
|
||||||
|
type FakePolicies struct {
|
||||||
|
Fake *FakeKyvernoV2beta1
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
var policiesResource = schema.GroupVersionResource{Group: "kyverno.io", Version: "v2beta1", Resource: "policies"}
|
||||||
|
|
||||||
|
var policiesKind = schema.GroupVersionKind{Group: "kyverno.io", Version: "v2beta1", Kind: "Policy"}
|
||||||
|
|
||||||
|
// Get takes name of the policy, and returns the corresponding policy object, and an error if there is any.
|
||||||
|
func (c *FakePolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.Policy, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewGetAction(policiesResource, c.ns, name), &v2beta1.Policy{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.Policy), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of Policies that match those selectors.
|
||||||
|
func (c *FakePolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.PolicyList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewListAction(policiesResource, policiesKind, c.ns, opts), &v2beta1.PolicyList{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v2beta1.PolicyList{ListMeta: obj.(*v2beta1.PolicyList).ListMeta}
|
||||||
|
for _, item := range obj.(*v2beta1.PolicyList).Items {
|
||||||
|
if label.Matches(labels.Set(item.Labels)) {
|
||||||
|
list.Items = append(list.Items, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested policies.
|
||||||
|
func (c *FakePolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewWatchAction(policiesResource, c.ns, opts))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a policy and creates it. Returns the server's representation of the policy, and an error, if there is any.
|
||||||
|
func (c *FakePolicies) Create(ctx context.Context, policy *v2beta1.Policy, opts v1.CreateOptions) (result *v2beta1.Policy, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewCreateAction(policiesResource, c.ns, policy), &v2beta1.Policy{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.Policy), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a policy and updates it. Returns the server's representation of the policy, and an error, if there is any.
|
||||||
|
func (c *FakePolicies) Update(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (result *v2beta1.Policy, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateAction(policiesResource, c.ns, policy), &v2beta1.Policy{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.Policy), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
func (c *FakePolicies) UpdateStatus(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (*v2beta1.Policy, error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateSubresourceAction(policiesResource, "status", c.ns, policy), &v2beta1.Policy{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.Policy), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the policy and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *FakePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewDeleteActionWithOptions(policiesResource, c.ns, name, opts), &v2beta1.Policy{})
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *FakePolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||||
|
action := testing.NewDeleteCollectionAction(policiesResource, c.ns, listOpts)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v2beta1.PolicyList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched policy.
|
||||||
|
func (c *FakePolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Policy, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewPatchSubresourceAction(policiesResource, c.ns, name, pt, data, subresources...), &v2beta1.Policy{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.Policy), err
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v2beta1
|
||||||
|
|
||||||
|
type ClusterPolicyExpansion interface{}
|
||||||
|
|
||||||
|
type PolicyExpansion interface{}
|
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v2beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
|
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
)
|
||||||
|
|
||||||
|
type KyvernoV2beta1Interface interface {
|
||||||
|
RESTClient() rest.Interface
|
||||||
|
ClusterPoliciesGetter
|
||||||
|
PoliciesGetter
|
||||||
|
}
|
||||||
|
|
||||||
|
// KyvernoV2beta1Client is used to interact with features provided by the kyverno.io group.
|
||||||
|
type KyvernoV2beta1Client struct {
|
||||||
|
restClient rest.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *KyvernoV2beta1Client) ClusterPolicies() ClusterPolicyInterface {
|
||||||
|
return newClusterPolicies(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *KyvernoV2beta1Client) Policies(namespace string) PolicyInterface {
|
||||||
|
return newPolicies(c, namespace)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfig creates a new KyvernoV2beta1Client for the given config.
|
||||||
|
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||||
|
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||||
|
func NewForConfig(c *rest.Config) (*KyvernoV2beta1Client, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
httpClient, err := rest.HTTPClientFor(&config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return NewForConfigAndClient(&config, httpClient)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigAndClient creates a new KyvernoV2beta1Client for the given config and http client.
|
||||||
|
// Note the http client provided takes precedence over the configured transport values.
|
||||||
|
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KyvernoV2beta1Client, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &KyvernoV2beta1Client{client}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigOrDie creates a new KyvernoV2beta1Client for the given config and
|
||||||
|
// panics if there is an error in the config.
|
||||||
|
func NewForConfigOrDie(c *rest.Config) *KyvernoV2beta1Client {
|
||||||
|
client, err := NewForConfig(c)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return client
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new KyvernoV2beta1Client for the given RESTClient.
|
||||||
|
func New(c rest.Interface) *KyvernoV2beta1Client {
|
||||||
|
return &KyvernoV2beta1Client{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
func setConfigDefaults(config *rest.Config) error {
|
||||||
|
gv := v2beta1.SchemeGroupVersion
|
||||||
|
config.GroupVersion = &gv
|
||||||
|
config.APIPath = "/apis"
|
||||||
|
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||||
|
|
||||||
|
if config.UserAgent == "" {
|
||||||
|
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *KyvernoV2beta1Client) RESTClient() rest.Interface {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.restClient
|
||||||
|
}
|
195
pkg/client/clientset/versioned/typed/kyverno/v2beta1/policy.go
Normal file
195
pkg/client/clientset/versioned/typed/kyverno/v2beta1/policy.go
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v2beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
|
scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PoliciesGetter has a method to return a PolicyInterface.
|
||||||
|
// A group's client should implement this interface.
|
||||||
|
type PoliciesGetter interface {
|
||||||
|
Policies(namespace string) PolicyInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// PolicyInterface has methods to work with Policy resources.
|
||||||
|
type PolicyInterface interface {
|
||||||
|
Create(ctx context.Context, policy *v2beta1.Policy, opts v1.CreateOptions) (*v2beta1.Policy, error)
|
||||||
|
Update(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (*v2beta1.Policy, error)
|
||||||
|
UpdateStatus(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (*v2beta1.Policy, error)
|
||||||
|
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||||
|
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||||
|
Get(ctx context.Context, name string, opts v1.GetOptions) (*v2beta1.Policy, error)
|
||||||
|
List(ctx context.Context, opts v1.ListOptions) (*v2beta1.PolicyList, error)
|
||||||
|
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||||
|
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Policy, err error)
|
||||||
|
PolicyExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// policies implements PolicyInterface
|
||||||
|
type policies struct {
|
||||||
|
client rest.Interface
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
// newPolicies returns a Policies
|
||||||
|
func newPolicies(c *KyvernoV2beta1Client, namespace string) *policies {
|
||||||
|
return &policies{
|
||||||
|
client: c.RESTClient(),
|
||||||
|
ns: namespace,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get takes name of the policy, and returns the corresponding policy object, and an error if there is any.
|
||||||
|
func (c *policies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.Policy, err error) {
|
||||||
|
result = &v2beta1.Policy{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("policies").
|
||||||
|
Name(name).
|
||||||
|
VersionedParams(&options, scheme.ParameterCodec).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of Policies that match those selectors.
|
||||||
|
func (c *policies) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.PolicyList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
result = &v2beta1.PolicyList{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("policies").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested policies.
|
||||||
|
func (c *policies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
opts.Watch = true
|
||||||
|
return c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("policies").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Watch(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a policy and creates it. Returns the server's representation of the policy, and an error, if there is any.
|
||||||
|
func (c *policies) Create(ctx context.Context, policy *v2beta1.Policy, opts v1.CreateOptions) (result *v2beta1.Policy, err error) {
|
||||||
|
result = &v2beta1.Policy{}
|
||||||
|
err = c.client.Post().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("policies").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(policy).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a policy and updates it. Returns the server's representation of the policy, and an error, if there is any.
|
||||||
|
func (c *policies) Update(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (result *v2beta1.Policy, err error) {
|
||||||
|
result = &v2beta1.Policy{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("policies").
|
||||||
|
Name(policy.Name).
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(policy).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
func (c *policies) UpdateStatus(ctx context.Context, policy *v2beta1.Policy, opts v1.UpdateOptions) (result *v2beta1.Policy, err error) {
|
||||||
|
result = &v2beta1.Policy{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("policies").
|
||||||
|
Name(policy.Name).
|
||||||
|
SubResource("status").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(policy).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the policy and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *policies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
|
return c.client.Delete().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("policies").
|
||||||
|
Name(name).
|
||||||
|
Body(&opts).
|
||||||
|
Do(ctx).
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *policies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOpts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
return c.client.Delete().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("policies").
|
||||||
|
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Body(&opts).
|
||||||
|
Do(ctx).
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched policy.
|
||||||
|
func (c *policies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Policy, err error) {
|
||||||
|
result = &v2beta1.Policy{}
|
||||||
|
err = c.client.Patch(pt).
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("policies").
|
||||||
|
Name(name).
|
||||||
|
SubResource(subresources...).
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(data).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
|
@ -25,6 +25,7 @@ import (
|
||||||
v1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2"
|
v1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2"
|
||||||
v1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
|
v1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
|
||||||
v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
|
v2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
cache "k8s.io/client-go/tools/cache"
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
@ -84,6 +85,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
||||||
case v2alpha1.SchemeGroupVersion.WithResource("policyexceptions"):
|
case v2alpha1.SchemeGroupVersion.WithResource("policyexceptions"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2alpha1().PolicyExceptions().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2alpha1().PolicyExceptions().Informer()}, nil
|
||||||
|
|
||||||
|
// Group=kyverno.io, Version=v2beta1
|
||||||
|
case v2beta1.SchemeGroupVersion.WithResource("clusterpolicies"):
|
||||||
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2beta1().ClusterPolicies().Informer()}, nil
|
||||||
|
case v2beta1.SchemeGroupVersion.WithResource("policies"):
|
||||||
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V2beta1().Policies().Informer()}, nil
|
||||||
|
|
||||||
// Group=wgpolicyk8s.io, Version=v1alpha2
|
// Group=wgpolicyk8s.io, Version=v1alpha2
|
||||||
case policyreportv1alpha2.SchemeGroupVersion.WithResource("clusterpolicyreports"):
|
case policyreportv1alpha2.SchemeGroupVersion.WithResource("clusterpolicyreports"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Wgpolicyk8s().V1alpha2().ClusterPolicyReports().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Wgpolicyk8s().V1alpha2().ClusterPolicyReports().Informer()}, nil
|
||||||
|
|
|
@ -24,6 +24,7 @@ import (
|
||||||
v1alpha2 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1alpha2"
|
v1alpha2 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1alpha2"
|
||||||
v1beta1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1beta1"
|
v1beta1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1beta1"
|
||||||
v2alpha1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v2alpha1"
|
v2alpha1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v2alpha1"
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v2beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Interface provides access to each of this group's versions.
|
// Interface provides access to each of this group's versions.
|
||||||
|
@ -34,6 +35,8 @@ type Interface interface {
|
||||||
V1alpha2() v1alpha2.Interface
|
V1alpha2() v1alpha2.Interface
|
||||||
// V1beta1 provides access to shared informers for resources in V1beta1.
|
// V1beta1 provides access to shared informers for resources in V1beta1.
|
||||||
V1beta1() v1beta1.Interface
|
V1beta1() v1beta1.Interface
|
||||||
|
// V2beta1 provides access to shared informers for resources in V2beta1.
|
||||||
|
V2beta1() v2beta1.Interface
|
||||||
// V2alpha1 provides access to shared informers for resources in V2alpha1.
|
// V2alpha1 provides access to shared informers for resources in V2alpha1.
|
||||||
V2alpha1() v2alpha1.Interface
|
V2alpha1() v2alpha1.Interface
|
||||||
}
|
}
|
||||||
|
@ -64,6 +67,11 @@ func (g *group) V1beta1() v1beta1.Interface {
|
||||||
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
|
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// V2beta1 returns a new v2beta1.Interface.
|
||||||
|
func (g *group) V2beta1() v2beta1.Interface {
|
||||||
|
return v2beta1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||||
|
}
|
||||||
|
|
||||||
// V2alpha1 returns a new v2alpha1.Interface.
|
// V2alpha1 returns a new v2alpha1.Interface.
|
||||||
func (g *group) V2alpha1() v2alpha1.Interface {
|
func (g *group) V2alpha1() v2alpha1.Interface {
|
||||||
return v2alpha1.New(g.factory, g.namespace, g.tweakListOptions)
|
return v2alpha1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v2beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
time "time"
|
||||||
|
|
||||||
|
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
|
versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
|
||||||
|
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2beta1"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClusterPolicyInformer provides access to a shared informer and lister for
|
||||||
|
// ClusterPolicies.
|
||||||
|
type ClusterPolicyInformer interface {
|
||||||
|
Informer() cache.SharedIndexInformer
|
||||||
|
Lister() v2beta1.ClusterPolicyLister
|
||||||
|
}
|
||||||
|
|
||||||
|
type clusterPolicyInformer struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewClusterPolicyInformer constructs a new informer for ClusterPolicy type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewClusterPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredClusterPolicyInformer(client, resyncPeriod, indexers, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFilteredClusterPolicyInformer constructs a new informer for ClusterPolicy type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewFilteredClusterPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||||
|
return cache.NewSharedIndexInformer(
|
||||||
|
&cache.ListWatch{
|
||||||
|
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.KyvernoV2beta1().ClusterPolicies().List(context.TODO(), options)
|
||||||
|
},
|
||||||
|
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.KyvernoV2beta1().ClusterPolicies().Watch(context.TODO(), options)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
&kyvernov2beta1.ClusterPolicy{},
|
||||||
|
resyncPeriod,
|
||||||
|
indexers,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *clusterPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredClusterPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *clusterPolicyInformer) Informer() cache.SharedIndexInformer {
|
||||||
|
return f.factory.InformerFor(&kyvernov2beta1.ClusterPolicy{}, f.defaultInformer)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *clusterPolicyInformer) Lister() v2beta1.ClusterPolicyLister {
|
||||||
|
return v2beta1.NewClusterPolicyLister(f.Informer().GetIndexer())
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v2beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Interface provides access to all the informers in this group version.
|
||||||
|
type Interface interface {
|
||||||
|
// ClusterPolicies returns a ClusterPolicyInformer.
|
||||||
|
ClusterPolicies() ClusterPolicyInformer
|
||||||
|
// Policies returns a PolicyInformer.
|
||||||
|
Policies() PolicyInformer
|
||||||
|
}
|
||||||
|
|
||||||
|
type version struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
namespace string
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new Interface.
|
||||||
|
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||||
|
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterPolicies returns a ClusterPolicyInformer.
|
||||||
|
func (v *version) ClusterPolicies() ClusterPolicyInformer {
|
||||||
|
return &clusterPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Policies returns a PolicyInformer.
|
||||||
|
func (v *version) Policies() PolicyInformer {
|
||||||
|
return &policyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v2beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
time "time"
|
||||||
|
|
||||||
|
kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
|
versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
|
||||||
|
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v2beta1"
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PolicyInformer provides access to a shared informer and lister for
|
||||||
|
// Policies.
|
||||||
|
type PolicyInformer interface {
|
||||||
|
Informer() cache.SharedIndexInformer
|
||||||
|
Lister() v2beta1.PolicyLister
|
||||||
|
}
|
||||||
|
|
||||||
|
type policyInformer struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
namespace string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPolicyInformer constructs a new informer for Policy type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredPolicyInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFilteredPolicyInformer constructs a new informer for Policy type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewFilteredPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||||
|
return cache.NewSharedIndexInformer(
|
||||||
|
&cache.ListWatch{
|
||||||
|
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.KyvernoV2beta1().Policies(namespace).List(context.TODO(), options)
|
||||||
|
},
|
||||||
|
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.KyvernoV2beta1().Policies(namespace).Watch(context.TODO(), options)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
&kyvernov2beta1.Policy{},
|
||||||
|
resyncPeriod,
|
||||||
|
indexers,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *policyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *policyInformer) Informer() cache.SharedIndexInformer {
|
||||||
|
return f.factory.InformerFor(&kyvernov2beta1.Policy{}, f.defaultInformer)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *policyInformer) Lister() v2beta1.PolicyLister {
|
||||||
|
return v2beta1.NewPolicyLister(f.Informer().GetIndexer())
|
||||||
|
}
|
68
pkg/client/listers/kyverno/v2beta1/clusterpolicy.go
Normal file
68
pkg/client/listers/kyverno/v2beta1/clusterpolicy.go
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by lister-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v2beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/client-go/tools/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClusterPolicyLister helps list ClusterPolicies.
|
||||||
|
// All objects returned here must be treated as read-only.
|
||||||
|
type ClusterPolicyLister interface {
|
||||||
|
// List lists all ClusterPolicies in the indexer.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
List(selector labels.Selector) (ret []*v2beta1.ClusterPolicy, err error)
|
||||||
|
// Get retrieves the ClusterPolicy from the index for a given name.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
Get(name string) (*v2beta1.ClusterPolicy, error)
|
||||||
|
ClusterPolicyListerExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// clusterPolicyLister implements the ClusterPolicyLister interface.
|
||||||
|
type clusterPolicyLister struct {
|
||||||
|
indexer cache.Indexer
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewClusterPolicyLister returns a new ClusterPolicyLister.
|
||||||
|
func NewClusterPolicyLister(indexer cache.Indexer) ClusterPolicyLister {
|
||||||
|
return &clusterPolicyLister{indexer: indexer}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all ClusterPolicies in the indexer.
|
||||||
|
func (s *clusterPolicyLister) List(selector labels.Selector) (ret []*v2beta1.ClusterPolicy, err error) {
|
||||||
|
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||||
|
ret = append(ret, m.(*v2beta1.ClusterPolicy))
|
||||||
|
})
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get retrieves the ClusterPolicy from the index for a given name.
|
||||||
|
func (s *clusterPolicyLister) Get(name string) (*v2beta1.ClusterPolicy, error) {
|
||||||
|
obj, exists, err := s.indexer.GetByKey(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if !exists {
|
||||||
|
return nil, errors.NewNotFound(v2beta1.Resource("clusterpolicy"), name)
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.ClusterPolicy), nil
|
||||||
|
}
|
31
pkg/client/listers/kyverno/v2beta1/expansion_generated.go
Normal file
31
pkg/client/listers/kyverno/v2beta1/expansion_generated.go
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by lister-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v2beta1
|
||||||
|
|
||||||
|
// ClusterPolicyListerExpansion allows custom methods to be added to
|
||||||
|
// ClusterPolicyLister.
|
||||||
|
type ClusterPolicyListerExpansion interface{}
|
||||||
|
|
||||||
|
// PolicyListerExpansion allows custom methods to be added to
|
||||||
|
// PolicyLister.
|
||||||
|
type PolicyListerExpansion interface{}
|
||||||
|
|
||||||
|
// PolicyNamespaceListerExpansion allows custom methods to be added to
|
||||||
|
// PolicyNamespaceLister.
|
||||||
|
type PolicyNamespaceListerExpansion interface{}
|
99
pkg/client/listers/kyverno/v2beta1/policy.go
Normal file
99
pkg/client/listers/kyverno/v2beta1/policy.go
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by lister-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v2beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/client-go/tools/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PolicyLister helps list Policies.
|
||||||
|
// All objects returned here must be treated as read-only.
|
||||||
|
type PolicyLister interface {
|
||||||
|
// List lists all Policies in the indexer.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
List(selector labels.Selector) (ret []*v2beta1.Policy, err error)
|
||||||
|
// Policies returns an object that can list and get Policies.
|
||||||
|
Policies(namespace string) PolicyNamespaceLister
|
||||||
|
PolicyListerExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// policyLister implements the PolicyLister interface.
|
||||||
|
type policyLister struct {
|
||||||
|
indexer cache.Indexer
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPolicyLister returns a new PolicyLister.
|
||||||
|
func NewPolicyLister(indexer cache.Indexer) PolicyLister {
|
||||||
|
return &policyLister{indexer: indexer}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all Policies in the indexer.
|
||||||
|
func (s *policyLister) List(selector labels.Selector) (ret []*v2beta1.Policy, err error) {
|
||||||
|
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||||
|
ret = append(ret, m.(*v2beta1.Policy))
|
||||||
|
})
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Policies returns an object that can list and get Policies.
|
||||||
|
func (s *policyLister) Policies(namespace string) PolicyNamespaceLister {
|
||||||
|
return policyNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PolicyNamespaceLister helps list and get Policies.
|
||||||
|
// All objects returned here must be treated as read-only.
|
||||||
|
type PolicyNamespaceLister interface {
|
||||||
|
// List lists all Policies in the indexer for a given namespace.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
List(selector labels.Selector) (ret []*v2beta1.Policy, err error)
|
||||||
|
// Get retrieves the Policy from the indexer for a given namespace and name.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
Get(name string) (*v2beta1.Policy, error)
|
||||||
|
PolicyNamespaceListerExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// policyNamespaceLister implements the PolicyNamespaceLister
|
||||||
|
// interface.
|
||||||
|
type policyNamespaceLister struct {
|
||||||
|
indexer cache.Indexer
|
||||||
|
namespace string
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all Policies in the indexer for a given namespace.
|
||||||
|
func (s policyNamespaceLister) List(selector labels.Selector) (ret []*v2beta1.Policy, err error) {
|
||||||
|
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||||
|
ret = append(ret, m.(*v2beta1.Policy))
|
||||||
|
})
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get retrieves the Policy from the indexer for a given namespace and name.
|
||||||
|
func (s policyNamespaceLister) Get(name string) (*v2beta1.Policy, error) {
|
||||||
|
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if !exists {
|
||||||
|
return nil, errors.NewNotFound(v2beta1.Resource("policy"), name)
|
||||||
|
}
|
||||||
|
return obj.(*v2beta1.Policy), nil
|
||||||
|
}
|
|
@ -7,12 +7,14 @@ import (
|
||||||
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_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_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_kyverno_v2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1"
|
||||||
|
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||||
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2"
|
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2"
|
||||||
discovery "github.com/kyverno/kyverno/pkg/clients/kyverno/discovery"
|
discovery "github.com/kyverno/kyverno/pkg/clients/kyverno/discovery"
|
||||||
kyvernov1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1"
|
kyvernov1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1"
|
||||||
kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1alpha2"
|
kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1alpha2"
|
||||||
kyvernov1beta1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1beta1"
|
kyvernov1beta1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov1beta1"
|
||||||
kyvernov2alpha1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2alpha1"
|
kyvernov2alpha1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2alpha1"
|
||||||
|
kyvernov2beta1 "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2beta1"
|
||||||
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/clients/kyverno/wgpolicyk8sv1alpha2"
|
wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/clients/kyverno/wgpolicyk8sv1alpha2"
|
||||||
"github.com/kyverno/kyverno/pkg/metrics"
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
k8s_io_client_go_discovery "k8s.io/client-go/discovery"
|
k8s_io_client_go_discovery "k8s.io/client-go/discovery"
|
||||||
|
@ -24,6 +26,7 @@ type clientset struct {
|
||||||
kyvernov1alpha2 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha2.KyvernoV1alpha2Interface
|
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
|
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
|
kyvernov2alpha1 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface
|
||||||
|
kyvernov2beta1 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface
|
||||||
wgpolicyk8sv1alpha2 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2.Wgpolicyk8sV1alpha2Interface
|
wgpolicyk8sv1alpha2 github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2.Wgpolicyk8sV1alpha2Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +45,9 @@ func (c *clientset) KyvernoV1beta1() github_com_kyverno_kyverno_pkg_client_clien
|
||||||
func (c *clientset) KyvernoV2alpha1() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface {
|
func (c *clientset) KyvernoV2alpha1() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1.KyvernoV2alpha1Interface {
|
||||||
return c.kyvernov2alpha1
|
return c.kyvernov2alpha1
|
||||||
}
|
}
|
||||||
|
func (c *clientset) KyvernoV2beta1() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface {
|
||||||
|
return c.kyvernov2beta1
|
||||||
|
}
|
||||||
func (c *clientset) Wgpolicyk8sV1alpha2() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2.Wgpolicyk8sV1alpha2Interface {
|
func (c *clientset) Wgpolicyk8sV1alpha2() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2.Wgpolicyk8sV1alpha2Interface {
|
||||||
return c.wgpolicyk8sv1alpha2
|
return c.wgpolicyk8sv1alpha2
|
||||||
}
|
}
|
||||||
|
@ -53,6 +59,7 @@ func WrapWithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versi
|
||||||
kyvernov1alpha2: kyvernov1alpha2.WithMetrics(inner.KyvernoV1alpha2(), m, clientType),
|
kyvernov1alpha2: kyvernov1alpha2.WithMetrics(inner.KyvernoV1alpha2(), m, clientType),
|
||||||
kyvernov1beta1: kyvernov1beta1.WithMetrics(inner.KyvernoV1beta1(), m, clientType),
|
kyvernov1beta1: kyvernov1beta1.WithMetrics(inner.KyvernoV1beta1(), m, clientType),
|
||||||
kyvernov2alpha1: kyvernov2alpha1.WithMetrics(inner.KyvernoV2alpha1(), m, clientType),
|
kyvernov2alpha1: kyvernov2alpha1.WithMetrics(inner.KyvernoV2alpha1(), m, clientType),
|
||||||
|
kyvernov2beta1: kyvernov2beta1.WithMetrics(inner.KyvernoV2beta1(), m, clientType),
|
||||||
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithMetrics(inner.Wgpolicyk8sV1alpha2(), m, clientType),
|
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithMetrics(inner.Wgpolicyk8sV1alpha2(), m, clientType),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +71,7 @@ func WrapWithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versi
|
||||||
kyvernov1alpha2: kyvernov1alpha2.WithTracing(inner.KyvernoV1alpha2(), "KyvernoV1alpha2"),
|
kyvernov1alpha2: kyvernov1alpha2.WithTracing(inner.KyvernoV1alpha2(), "KyvernoV1alpha2"),
|
||||||
kyvernov1beta1: kyvernov1beta1.WithTracing(inner.KyvernoV1beta1(), "KyvernoV1beta1"),
|
kyvernov1beta1: kyvernov1beta1.WithTracing(inner.KyvernoV1beta1(), "KyvernoV1beta1"),
|
||||||
kyvernov2alpha1: kyvernov2alpha1.WithTracing(inner.KyvernoV2alpha1(), "KyvernoV2alpha1"),
|
kyvernov2alpha1: kyvernov2alpha1.WithTracing(inner.KyvernoV2alpha1(), "KyvernoV2alpha1"),
|
||||||
|
kyvernov2beta1: kyvernov2beta1.WithTracing(inner.KyvernoV2beta1(), "KyvernoV2beta1"),
|
||||||
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithTracing(inner.Wgpolicyk8sV1alpha2(), "Wgpolicyk8sV1alpha2"),
|
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithTracing(inner.Wgpolicyk8sV1alpha2(), "Wgpolicyk8sV1alpha2"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,6 +83,7 @@ func WrapWithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versi
|
||||||
kyvernov1alpha2: kyvernov1alpha2.WithLogging(inner.KyvernoV1alpha2(), logger.WithValues("group", "KyvernoV1alpha2")),
|
kyvernov1alpha2: kyvernov1alpha2.WithLogging(inner.KyvernoV1alpha2(), logger.WithValues("group", "KyvernoV1alpha2")),
|
||||||
kyvernov1beta1: kyvernov1beta1.WithLogging(inner.KyvernoV1beta1(), logger.WithValues("group", "KyvernoV1beta1")),
|
kyvernov1beta1: kyvernov1beta1.WithLogging(inner.KyvernoV1beta1(), logger.WithValues("group", "KyvernoV1beta1")),
|
||||||
kyvernov2alpha1: kyvernov2alpha1.WithLogging(inner.KyvernoV2alpha1(), logger.WithValues("group", "KyvernoV2alpha1")),
|
kyvernov2alpha1: kyvernov2alpha1.WithLogging(inner.KyvernoV2alpha1(), logger.WithValues("group", "KyvernoV2alpha1")),
|
||||||
|
kyvernov2beta1: kyvernov2beta1.WithLogging(inner.KyvernoV2beta1(), logger.WithValues("group", "KyvernoV2beta1")),
|
||||||
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithLogging(inner.Wgpolicyk8sV1alpha2(), logger.WithValues("group", "Wgpolicyk8sV1alpha2")),
|
wgpolicyk8sv1alpha2: wgpolicyk8sv1alpha2.WithLogging(inner.Wgpolicyk8sV1alpha2(), logger.WithValues("group", "Wgpolicyk8sV1alpha2")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
70
pkg/clients/kyverno/kyvernov2beta1/client.generated.go
Normal file
70
pkg/clients/kyverno/kyvernov2beta1/client.generated.go
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-logr/logr"
|
||||||
|
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||||
|
clusterpolicies "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2beta1/clusterpolicies"
|
||||||
|
policies "github.com/kyverno/kyverno/pkg/clients/kyverno/kyvernov2beta1/policies"
|
||||||
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
|
"k8s.io/client-go/rest"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface, metrics metrics.MetricsConfigManager, clientType metrics.ClientType) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface {
|
||||||
|
return &withMetrics{inner, metrics, clientType}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface, client string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface {
|
||||||
|
return &withTracing{inner, client}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface {
|
||||||
|
return &withLogging{inner, logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withMetrics struct {
|
||||||
|
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface
|
||||||
|
metrics metrics.MetricsConfigManager
|
||||||
|
clientType metrics.ClientType
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withMetrics) RESTClient() rest.Interface {
|
||||||
|
return c.inner.RESTClient()
|
||||||
|
}
|
||||||
|
func (c *withMetrics) ClusterPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||||
|
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "ClusterPolicy", c.clientType)
|
||||||
|
return clusterpolicies.WithMetrics(c.inner.ClusterPolicies(), recorder)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Policies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||||
|
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "Policy", c.clientType)
|
||||||
|
return policies.WithMetrics(c.inner.Policies(namespace), recorder)
|
||||||
|
}
|
||||||
|
|
||||||
|
type withTracing struct {
|
||||||
|
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface
|
||||||
|
client string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withTracing) RESTClient() rest.Interface {
|
||||||
|
return c.inner.RESTClient()
|
||||||
|
}
|
||||||
|
func (c *withTracing) ClusterPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||||
|
return clusterpolicies.WithTracing(c.inner.ClusterPolicies(), c.client, "ClusterPolicy")
|
||||||
|
}
|
||||||
|
func (c *withTracing) Policies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||||
|
return policies.WithTracing(c.inner.Policies(namespace), c.client, "Policy")
|
||||||
|
}
|
||||||
|
|
||||||
|
type withLogging struct {
|
||||||
|
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.KyvernoV2beta1Interface
|
||||||
|
logger logr.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withLogging) RESTClient() rest.Interface {
|
||||||
|
return c.inner.RESTClient()
|
||||||
|
}
|
||||||
|
func (c *withLogging) ClusterPolicies() github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||||
|
return clusterpolicies.WithLogging(c.inner.ClusterPolicies(), c.logger.WithValues("resource", "ClusterPolicies"))
|
||||||
|
}
|
||||||
|
func (c *withLogging) Policies(namespace string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||||
|
return policies.WithLogging(c.inner.Policies(namespace), c.logger.WithValues("resource", "Policies").WithValues("namespace", namespace))
|
||||||
|
}
|
|
@ -0,0 +1,373 @@
|
||||||
|
package resource
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-logr/logr"
|
||||||
|
github_com_kyverno_kyverno_api_kyverno_v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
|
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||||
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
|
"github.com/kyverno/kyverno/pkg/tracing"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
"go.uber.org/multierr"
|
||||||
|
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||||
|
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||||
|
return &withLogging{inner, logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface, recorder metrics.Recorder) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||||
|
return &withMetrics{inner, recorder}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface, client, kind string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface {
|
||||||
|
return &withTracing{inner, client, kind}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withLogging struct {
|
||||||
|
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface
|
||||||
|
logger logr.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withLogging) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Create")
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Create done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Delete")
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Delete done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Get")
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Get done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicyList, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "List")
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("List done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Patch")
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Patch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Update")
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Update done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "UpdateStatus")
|
||||||
|
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "UpdateStatus failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("UpdateStatus done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Watch")
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Watch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
type withMetrics struct {
|
||||||
|
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface
|
||||||
|
recorder metrics.Recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "create")
|
||||||
|
return c.inner.Create(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||||
|
return c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||||
|
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "get")
|
||||||
|
return c.inner.Get(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicyList, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "list")
|
||||||
|
return c.inner.List(arg0, arg1)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||||
|
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update")
|
||||||
|
return c.inner.Update(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update_status")
|
||||||
|
return c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||||
|
return c.inner.Watch(arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
type withTracing struct {
|
||||||
|
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.ClusterPolicyInterface
|
||||||
|
client string
|
||||||
|
kind string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Create"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Delete"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Get"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicyList, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("List"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Patch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Update"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.ClusterPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("UpdateStatus"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Watch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
|
@ -0,0 +1,373 @@
|
||||||
|
package resource
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-logr/logr"
|
||||||
|
github_com_kyverno_kyverno_api_kyverno_v2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1"
|
||||||
|
github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2beta1"
|
||||||
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
|
"github.com/kyverno/kyverno/pkg/tracing"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
"go.uber.org/multierr"
|
||||||
|
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||||
|
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WithLogging(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface, logger logr.Logger) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||||
|
return &withLogging{inner, logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithMetrics(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface, recorder metrics.Recorder) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||||
|
return &withMetrics{inner, recorder}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTracing(inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface, client, kind string) github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface {
|
||||||
|
return &withTracing{inner, client, kind}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withLogging struct {
|
||||||
|
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface
|
||||||
|
logger logr.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withLogging) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Create")
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Create done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Delete")
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Delete done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Get")
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Get done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyList, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "List")
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("List done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Patch")
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Patch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Update")
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Update done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "UpdateStatus")
|
||||||
|
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "UpdateStatus failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("UpdateStatus done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Watch")
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Watch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
type withMetrics struct {
|
||||||
|
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface
|
||||||
|
recorder metrics.Recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "create")
|
||||||
|
return c.inner.Create(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||||
|
return c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||||
|
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "get")
|
||||||
|
return c.inner.Get(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyList, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "list")
|
||||||
|
return c.inner.List(arg0, arg1)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||||
|
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update")
|
||||||
|
return c.inner.Update(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update_status")
|
||||||
|
return c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||||
|
return c.inner.Watch(arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
type withTracing struct {
|
||||||
|
inner github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2beta1.PolicyInterface
|
||||||
|
client string
|
||||||
|
kind string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Create"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Delete"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Get"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.PolicyList, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("List"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Patch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Update"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2beta1.Policy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("UpdateStatus"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Watch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue