1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

move reportChangeRequest to kyverno.io/v1alpha1

This commit is contained in:
Shuting Zhao 2020-10-30 19:26:53 -07:00
parent e5c5cb39a0
commit 153516b0d6
46 changed files with 665 additions and 307 deletions

View file

@ -186,6 +186,8 @@ release:
report-crd: controller-gen
$(CONTROLLER_GEN) crd:trivialVersions=true paths="./pkg/api/policyreport/v1alpha1" output:dir=./definitions/crds
$(CONTROLLER_GEN) object paths=./pkg/api/policyreport/v1alpha1
$(CONTROLLER_GEN) crd:trivialVersions=true paths="./pkg/api/kyverno/v1alpha1" output:dir=./definitions/crds
$(CONTROLLER_GEN) object paths=./pkg/api/kyverno/v1alpha1
# find or download controller-gen
# download controller-gen if necessary

View file

@ -684,7 +684,7 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: clusterreportchangerequests.policy.k8s.io
name: clusterreportchangerequests.kyverno.io
spec:
additionalPrinterColumns:
- JSONPath: .scope.kind
@ -713,7 +713,7 @@ spec:
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: policy.k8s.io
group: kyverno.io
names:
kind: ClusterReportChangeRequest
listKind: ClusterReportChangeRequestList
@ -1746,7 +1746,7 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: reportchangerequests.policy.k8s.io
name: reportchangerequests.kyverno.io
spec:
additionalPrinterColumns:
- JSONPath: .scope.kind
@ -1775,7 +1775,7 @@ spec:
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: policy.k8s.io
group: kyverno.io
names:
kind: ReportChangeRequest
listKind: ReportChangeRequestList

View file

@ -198,8 +198,8 @@ func main() {
if os.Getenv("POLICY-TYPE") == common.PolicyReport {
reportReqGen = policyreport.NewReportChangeRequestGenerator(pclient,
client,
pInformer.Policy().V1alpha1().ReportChangeRequests(),
pInformer.Policy().V1alpha1().ClusterReportChangeRequests(),
pInformer.Kyverno().V1alpha1().ReportChangeRequests(),
pInformer.Kyverno().V1alpha1().ClusterReportChangeRequests(),
statusSync.Listener,
log.Log.WithName("ReportChangeRequestGenerator"),
)
@ -207,8 +207,8 @@ func main() {
prgen = policyreport.NewReportGenerator(client,
pInformer.Policy().V1alpha1().ClusterPolicyReports(),
pInformer.Policy().V1alpha1().PolicyReports(),
pInformer.Policy().V1alpha1().ReportChangeRequests(),
pInformer.Policy().V1alpha1().ClusterReportChangeRequests(),
pInformer.Kyverno().V1alpha1().ReportChangeRequests(),
pInformer.Kyverno().V1alpha1().ClusterReportChangeRequests(),
kubeInformer.Core().V1().Namespaces(),
log.Log.WithName("PolicyReportGenerator"),
)

View file

@ -5,5 +5,5 @@ resources:
- ./crds.yaml
- ./policy.k8s.io_clusterpolicyreports.yaml
- ./policy.k8s.io_policyreports.yaml
- ./policy.k8s.io_clusterreportchangerequests.yaml
- ./policy.k8s.io_reportchangerequests.yaml
- ./kyverno.io_reportchangerequests.yaml
- ./kyverno.io_clusterreportchangerequests.yaml

View file

@ -6,7 +6,7 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: clusterreportchangerequests.policy.k8s.io
name: clusterreportchangerequests.kyverno.io
spec:
additionalPrinterColumns:
- JSONPath: .scope.kind
@ -35,7 +35,7 @@ spec:
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: policy.k8s.io
group: kyverno.io
names:
kind: ClusterReportChangeRequest
listKind: ClusterReportChangeRequestList

View file

@ -6,7 +6,7 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: reportchangerequests.policy.k8s.io
name: reportchangerequests.kyverno.io
spec:
additionalPrinterColumns:
- JSONPath: .scope.kind
@ -35,7 +35,7 @@ spec:
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: policy.k8s.io
group: kyverno.io
names:
kind: ReportChangeRequest
listKind: ReportChangeRequestList

View file

@ -689,7 +689,7 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: clusterreportchangerequests.policy.k8s.io
name: clusterreportchangerequests.kyverno.io
spec:
additionalPrinterColumns:
- JSONPath: .scope.kind
@ -718,7 +718,7 @@ spec:
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: policy.k8s.io
group: kyverno.io
names:
kind: ClusterReportChangeRequest
listKind: ClusterReportChangeRequestList
@ -1751,7 +1751,7 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: reportchangerequests.policy.k8s.io
name: reportchangerequests.kyverno.io
spec:
additionalPrinterColumns:
- JSONPath: .scope.kind
@ -1780,7 +1780,7 @@ spec:
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: policy.k8s.io
group: kyverno.io
names:
kind: ReportChangeRequest
listKind: ReportChangeRequestList

View file

@ -689,7 +689,7 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: clusterreportchangerequests.policy.k8s.io
name: clusterreportchangerequests.kyverno.io
spec:
additionalPrinterColumns:
- JSONPath: .scope.kind
@ -718,7 +718,7 @@ spec:
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: policy.k8s.io
group: kyverno.io
names:
kind: ClusterReportChangeRequest
listKind: ClusterReportChangeRequestList
@ -1751,7 +1751,7 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: reportchangerequests.policy.k8s.io
name: reportchangerequests.kyverno.io
spec:
additionalPrinterColumns:
- JSONPath: .scope.kind
@ -1780,7 +1780,7 @@ spec:
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: policy.k8s.io
group: kyverno.io
names:
kind: ReportChangeRequest
listKind: ReportChangeRequestList

View file

@ -1,11 +1,10 @@
package v1
import (
"github.com/kyverno/kyverno/pkg/api/kyverno"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/kyverno/kyverno/pkg/api/kyverno"
)
// SchemeGroupVersion is group version used to register these objects

View file

@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1
import (
report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -53,11 +54,11 @@ type ClusterReportChangeRequest struct {
// PolicyReportSummary provides a summary of results
// +optional
Summary PolicyReportSummary `json:"summary,omitempty"`
Summary report.PolicyReportSummary `json:"summary,omitempty"`
// PolicyReportResult provides result details
// +optional
Results []*PolicyReportResult `json:"results,omitempty"`
Results []*report.PolicyReportResult `json:"results,omitempty"`
}
// +kubebuilder:object:root=true

View file

@ -0,0 +1,21 @@
/*
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 v1alpha1 contains API Schema definitions for the policy v1alpha1 API group
// +k8s:deepcopy-gen=package
// +kubebuilder:object:generate=true
// +groupName=kyverno.io
package v1alpha1

View file

@ -0,0 +1,49 @@
/*
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 v1alpha1 contains API Schema definitions for the policy v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=kyverno.io
package v1alpha1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)
// Package v1alpha1 contains API Schema definitions for the policy v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=kyverno.io
var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "kyverno.io", Version: "v1alpha1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
// 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()
}

View file

@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1
import (
report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -52,11 +53,11 @@ type ReportChangeRequest struct {
// PolicyReportSummary provides a summary of results
// +optional
Summary PolicyReportSummary `json:"summary,omitempty"`
Summary report.PolicyReportSummary `json:"summary,omitempty"`
// PolicyReportResult provides result details
// +optional
Results []*PolicyReportResult `json:"results,omitempty"`
Results []*report.PolicyReportResult `json:"results,omitempty"`
}
// +kubebuilder:object:root=true

View file

@ -0,0 +1,170 @@
// +build !ignore_autogenerated
// Code generated by controller-gen. DO NOT EDIT.
package v1alpha1
import (
policyreportv1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterReportChangeRequest) DeepCopyInto(out *ClusterReportChangeRequest) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
if in.Scope != nil {
in, out := &in.Scope, &out.Scope
*out = new(v1.ObjectReference)
**out = **in
}
if in.ScopeSelector != nil {
in, out := &in.ScopeSelector, &out.ScopeSelector
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
out.Summary = in.Summary
if in.Results != nil {
in, out := &in.Results, &out.Results
*out = make([]*policyreportv1alpha1.PolicyReportResult, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(policyreportv1alpha1.PolicyReportResult)
(*in).DeepCopyInto(*out)
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterReportChangeRequest.
func (in *ClusterReportChangeRequest) DeepCopy() *ClusterReportChangeRequest {
if in == nil {
return nil
}
out := new(ClusterReportChangeRequest)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterReportChangeRequest) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterReportChangeRequestList) DeepCopyInto(out *ClusterReportChangeRequestList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ClusterReportChangeRequest, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterReportChangeRequestList.
func (in *ClusterReportChangeRequestList) DeepCopy() *ClusterReportChangeRequestList {
if in == nil {
return nil
}
out := new(ClusterReportChangeRequestList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterReportChangeRequestList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ReportChangeRequest) DeepCopyInto(out *ReportChangeRequest) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
if in.Scope != nil {
in, out := &in.Scope, &out.Scope
*out = new(v1.ObjectReference)
**out = **in
}
if in.ScopeSelector != nil {
in, out := &in.ScopeSelector, &out.ScopeSelector
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
out.Summary = in.Summary
if in.Results != nil {
in, out := &in.Results, &out.Results
*out = make([]*policyreportv1alpha1.PolicyReportResult, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(policyreportv1alpha1.PolicyReportResult)
(*in).DeepCopyInto(*out)
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReportChangeRequest.
func (in *ReportChangeRequest) DeepCopy() *ReportChangeRequest {
if in == nil {
return nil
}
out := new(ReportChangeRequest)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ReportChangeRequest) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ReportChangeRequestList) DeepCopyInto(out *ReportChangeRequestList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ReportChangeRequest, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReportChangeRequestList.
func (in *ReportChangeRequestList) DeepCopy() *ReportChangeRequestList {
if in == nil {
return nil
}
out := new(ReportChangeRequestList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ReportChangeRequestList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

View file

@ -89,85 +89,6 @@ func (in *ClusterPolicyReportList) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterReportChangeRequest) DeepCopyInto(out *ClusterReportChangeRequest) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
if in.Scope != nil {
in, out := &in.Scope, &out.Scope
*out = new(v1.ObjectReference)
**out = **in
}
if in.ScopeSelector != nil {
in, out := &in.ScopeSelector, &out.ScopeSelector
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
out.Summary = in.Summary
if in.Results != nil {
in, out := &in.Results, &out.Results
*out = make([]*PolicyReportResult, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(PolicyReportResult)
(*in).DeepCopyInto(*out)
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterReportChangeRequest.
func (in *ClusterReportChangeRequest) DeepCopy() *ClusterReportChangeRequest {
if in == nil {
return nil
}
out := new(ClusterReportChangeRequest)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterReportChangeRequest) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterReportChangeRequestList) DeepCopyInto(out *ClusterReportChangeRequestList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ClusterReportChangeRequest, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterReportChangeRequestList.
func (in *ClusterReportChangeRequestList) DeepCopy() *ClusterReportChangeRequestList {
if in == nil {
return nil
}
out := new(ClusterReportChangeRequestList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterReportChangeRequestList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PolicyReport) DeepCopyInto(out *PolicyReport) {
*out = *in
@ -299,82 +220,3 @@ func (in *PolicyReportSummary) DeepCopy() *PolicyReportSummary {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ReportChangeRequest) DeepCopyInto(out *ReportChangeRequest) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
if in.Scope != nil {
in, out := &in.Scope, &out.Scope
*out = new(v1.ObjectReference)
**out = **in
}
if in.ScopeSelector != nil {
in, out := &in.ScopeSelector, &out.ScopeSelector
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
out.Summary = in.Summary
if in.Results != nil {
in, out := &in.Results, &out.Results
*out = make([]*PolicyReportResult, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(PolicyReportResult)
(*in).DeepCopyInto(*out)
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReportChangeRequest.
func (in *ReportChangeRequest) DeepCopy() *ReportChangeRequest {
if in == nil {
return nil
}
out := new(ReportChangeRequest)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ReportChangeRequest) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ReportChangeRequestList) DeepCopyInto(out *ReportChangeRequestList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ReportChangeRequest, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReportChangeRequestList.
func (in *ReportChangeRequestList) DeepCopy() *ReportChangeRequestList {
if in == nil {
return nil
}
out := new(ReportChangeRequestList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ReportChangeRequestList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

View file

@ -22,6 +22,7 @@ import (
"fmt"
kyvernov1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1"
kyvernov1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1"
policyv1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
@ -31,6 +32,7 @@ import (
type Interface interface {
Discovery() discovery.DiscoveryInterface
KyvernoV1() kyvernov1.KyvernoV1Interface
KyvernoV1alpha1() kyvernov1alpha1.KyvernoV1alpha1Interface
PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface
}
@ -38,8 +40,9 @@ type Interface interface {
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
kyvernoV1 *kyvernov1.KyvernoV1Client
policyV1alpha1 *policyv1alpha1.PolicyV1alpha1Client
kyvernoV1 *kyvernov1.KyvernoV1Client
kyvernoV1alpha1 *kyvernov1alpha1.KyvernoV1alpha1Client
policyV1alpha1 *policyv1alpha1.PolicyV1alpha1Client
}
// KyvernoV1 retrieves the KyvernoV1Client
@ -47,6 +50,11 @@ func (c *Clientset) KyvernoV1() kyvernov1.KyvernoV1Interface {
return c.kyvernoV1
}
// KyvernoV1alpha1 retrieves the KyvernoV1alpha1Client
func (c *Clientset) KyvernoV1alpha1() kyvernov1alpha1.KyvernoV1alpha1Interface {
return c.kyvernoV1alpha1
}
// PolicyV1alpha1 retrieves the PolicyV1alpha1Client
func (c *Clientset) PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface {
return c.policyV1alpha1
@ -77,6 +85,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
if err != nil {
return nil, err
}
cs.kyvernoV1alpha1, err = kyvernov1alpha1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.policyV1alpha1, err = policyv1alpha1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
@ -94,6 +106,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.kyvernoV1 = kyvernov1.NewForConfigOrDie(c)
cs.kyvernoV1alpha1 = kyvernov1alpha1.NewForConfigOrDie(c)
cs.policyV1alpha1 = policyv1alpha1.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
@ -104,6 +117,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.kyvernoV1 = kyvernov1.New(c)
cs.kyvernoV1alpha1 = kyvernov1alpha1.New(c)
cs.policyV1alpha1 = policyv1alpha1.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)

View file

@ -22,6 +22,8 @@ import (
clientset "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
kyvernov1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1"
fakekyvernov1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1/fake"
kyvernov1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1"
fakekyvernov1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1/fake"
policyv1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha1"
fakepolicyv1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha1/fake"
"k8s.io/apimachinery/pkg/runtime"
@ -83,6 +85,11 @@ func (c *Clientset) KyvernoV1() kyvernov1.KyvernoV1Interface {
return &fakekyvernov1.FakeKyvernoV1{Fake: &c.Fake}
}
// KyvernoV1alpha1 retrieves the KyvernoV1alpha1Client
func (c *Clientset) KyvernoV1alpha1() kyvernov1alpha1.KyvernoV1alpha1Interface {
return &fakekyvernov1alpha1.FakeKyvernoV1alpha1{Fake: &c.Fake}
}
// PolicyV1alpha1 retrieves the PolicyV1alpha1Client
func (c *Clientset) PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface {
return &fakepolicyv1alpha1.FakePolicyV1alpha1{Fake: &c.Fake}

View file

@ -20,6 +20,7 @@ package fake
import (
kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1"
kyvernov1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
policyv1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
@ -33,6 +34,7 @@ var codecs = serializer.NewCodecFactory(scheme)
var parameterCodec = runtime.NewParameterCodec(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
kyvernov1.AddToScheme,
kyvernov1alpha1.AddToScheme,
policyv1alpha1.AddToScheme,
}

View file

@ -20,6 +20,7 @@ package scheme
import (
kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1"
kyvernov1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
policyv1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
@ -33,6 +34,7 @@ var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
kyvernov1.AddToScheme,
kyvernov1alpha1.AddToScheme,
policyv1alpha1.AddToScheme,
}

View file

@ -22,7 +22,7 @@ import (
"context"
"time"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
@ -55,7 +55,7 @@ type clusterReportChangeRequests struct {
}
// newClusterReportChangeRequests returns a ClusterReportChangeRequests
func newClusterReportChangeRequests(c *PolicyV1alpha1Client) *clusterReportChangeRequests {
func newClusterReportChangeRequests(c *KyvernoV1alpha1Client) *clusterReportChangeRequests {
return &clusterReportChangeRequests{
client: c.RESTClient(),
}

View 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 v1alpha1

View 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.
// Package fake has the automatically generated clients.
package fake

View file

@ -21,7 +21,7 @@ package fake
import (
"context"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
@ -32,12 +32,12 @@ import (
// FakeClusterReportChangeRequests implements ClusterReportChangeRequestInterface
type FakeClusterReportChangeRequests struct {
Fake *FakePolicyV1alpha1
Fake *FakeKyvernoV1alpha1
}
var clusterreportchangerequestsResource = schema.GroupVersionResource{Group: "policy.k8s.io", Version: "v1alpha1", Resource: "clusterreportchangerequests"}
var clusterreportchangerequestsResource = schema.GroupVersionResource{Group: "kyverno.io", Version: "v1alpha1", Resource: "clusterreportchangerequests"}
var clusterreportchangerequestsKind = schema.GroupVersionKind{Group: "policy.k8s.io", Version: "v1alpha1", Kind: "ClusterReportChangeRequest"}
var clusterreportchangerequestsKind = schema.GroupVersionKind{Group: "kyverno.io", Version: "v1alpha1", Kind: "ClusterReportChangeRequest"}
// Get takes name of the clusterReportChangeRequest, and returns the corresponding clusterReportChangeRequest object, and an error if there is any.
func (c *FakeClusterReportChangeRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterReportChangeRequest, err error) {

View file

@ -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 (
v1alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeKyvernoV1alpha1 struct {
*testing.Fake
}
func (c *FakeKyvernoV1alpha1) ClusterReportChangeRequests() v1alpha1.ClusterReportChangeRequestInterface {
return &FakeClusterReportChangeRequests{c}
}
func (c *FakeKyvernoV1alpha1) ReportChangeRequests(namespace string) v1alpha1.ReportChangeRequestInterface {
return &FakeReportChangeRequests{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeKyvernoV1alpha1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View file

@ -21,7 +21,7 @@ package fake
import (
"context"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
@ -32,13 +32,13 @@ import (
// FakeReportChangeRequests implements ReportChangeRequestInterface
type FakeReportChangeRequests struct {
Fake *FakePolicyV1alpha1
Fake *FakeKyvernoV1alpha1
ns string
}
var reportchangerequestsResource = schema.GroupVersionResource{Group: "policy.k8s.io", Version: "v1alpha1", Resource: "reportchangerequests"}
var reportchangerequestsResource = schema.GroupVersionResource{Group: "kyverno.io", Version: "v1alpha1", Resource: "reportchangerequests"}
var reportchangerequestsKind = schema.GroupVersionKind{Group: "policy.k8s.io", Version: "v1alpha1", Kind: "ReportChangeRequest"}
var reportchangerequestsKind = schema.GroupVersionKind{Group: "kyverno.io", Version: "v1alpha1", Kind: "ReportChangeRequest"}
// Get takes name of the reportChangeRequest, and returns the corresponding reportChangeRequest object, and an error if there is any.
func (c *FakeReportChangeRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ReportChangeRequest, err error) {

View file

@ -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 v1alpha1
type ClusterReportChangeRequestExpansion interface{}
type ReportChangeRequestExpansion interface{}

View file

@ -0,0 +1,94 @@
/*
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 v1alpha1
import (
v1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
rest "k8s.io/client-go/rest"
)
type KyvernoV1alpha1Interface interface {
RESTClient() rest.Interface
ClusterReportChangeRequestsGetter
ReportChangeRequestsGetter
}
// KyvernoV1alpha1Client is used to interact with features provided by the kyverno.io group.
type KyvernoV1alpha1Client struct {
restClient rest.Interface
}
func (c *KyvernoV1alpha1Client) ClusterReportChangeRequests() ClusterReportChangeRequestInterface {
return newClusterReportChangeRequests(c)
}
func (c *KyvernoV1alpha1Client) ReportChangeRequests(namespace string) ReportChangeRequestInterface {
return newReportChangeRequests(c, namespace)
}
// NewForConfig creates a new KyvernoV1alpha1Client for the given config.
func NewForConfig(c *rest.Config) (*KyvernoV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &KyvernoV1alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new KyvernoV1alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *KyvernoV1alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new KyvernoV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *KyvernoV1alpha1Client {
return &KyvernoV1alpha1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha1.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 *KyvernoV1alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View file

@ -22,7 +22,7 @@ import (
"context"
"time"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
@ -56,7 +56,7 @@ type reportChangeRequests struct {
}
// newReportChangeRequests returns a ReportChangeRequests
func newReportChangeRequests(c *PolicyV1alpha1Client, namespace string) *reportChangeRequests {
func newReportChangeRequests(c *KyvernoV1alpha1Client, namespace string) *reportChangeRequests {
return &reportChangeRequests{
client: c.RESTClient(),
ns: namespace,

View file

@ -32,18 +32,10 @@ func (c *FakePolicyV1alpha1) ClusterPolicyReports() v1alpha1.ClusterPolicyReport
return &FakeClusterPolicyReports{c}
}
func (c *FakePolicyV1alpha1) ClusterReportChangeRequests() v1alpha1.ClusterReportChangeRequestInterface {
return &FakeClusterReportChangeRequests{c}
}
func (c *FakePolicyV1alpha1) PolicyReports(namespace string) v1alpha1.PolicyReportInterface {
return &FakePolicyReports{c, namespace}
}
func (c *FakePolicyV1alpha1) ReportChangeRequests(namespace string) v1alpha1.ReportChangeRequestInterface {
return &FakeReportChangeRequests{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakePolicyV1alpha1) RESTClient() rest.Interface {

View file

@ -20,8 +20,4 @@ package v1alpha1
type ClusterPolicyReportExpansion interface{}
type ClusterReportChangeRequestExpansion interface{}
type PolicyReportExpansion interface{}
type ReportChangeRequestExpansion interface{}

View file

@ -27,9 +27,7 @@ import (
type PolicyV1alpha1Interface interface {
RESTClient() rest.Interface
ClusterPolicyReportsGetter
ClusterReportChangeRequestsGetter
PolicyReportsGetter
ReportChangeRequestsGetter
}
// PolicyV1alpha1Client is used to interact with features provided by the policy.k8s.io group.
@ -41,18 +39,10 @@ func (c *PolicyV1alpha1Client) ClusterPolicyReports() ClusterPolicyReportInterfa
return newClusterPolicyReports(c)
}
func (c *PolicyV1alpha1Client) ClusterReportChangeRequests() ClusterReportChangeRequestInterface {
return newClusterReportChangeRequests(c)
}
func (c *PolicyV1alpha1Client) PolicyReports(namespace string) PolicyReportInterface {
return newPolicyReports(c, namespace)
}
func (c *PolicyV1alpha1Client) ReportChangeRequests(namespace string) ReportChangeRequestInterface {
return newReportChangeRequests(c, namespace)
}
// NewForConfig creates a new PolicyV1alpha1Client for the given config.
func NewForConfig(c *rest.Config) (*PolicyV1alpha1Client, error) {
config := *c

View file

@ -22,7 +22,8 @@ import (
"fmt"
v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
policyreportv1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
)
@ -65,15 +66,17 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case v1.SchemeGroupVersion.WithResource("policyviolations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V1().PolicyViolations().Informer()}, nil
// Group=policy.k8s.io, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("clusterpolicyreports"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1alpha1().ClusterPolicyReports().Informer()}, nil
// Group=kyverno.io, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("clusterreportchangerequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1alpha1().ClusterReportChangeRequests().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("policyreports"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1alpha1().PolicyReports().Informer()}, nil
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V1alpha1().ClusterReportChangeRequests().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("reportchangerequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1alpha1().ReportChangeRequests().Informer()}, nil
return &genericInformer{resource: resource.GroupResource(), informer: f.Kyverno().V1alpha1().ReportChangeRequests().Informer()}, nil
// Group=policy.k8s.io, Version=v1alpha1
case policyreportv1alpha1.SchemeGroupVersion.WithResource("clusterpolicyreports"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1alpha1().ClusterPolicyReports().Informer()}, nil
case policyreportv1alpha1.SchemeGroupVersion.WithResource("policyreports"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1alpha1().PolicyReports().Informer()}, nil
}

View file

@ -21,12 +21,15 @@ package kyverno
import (
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
v1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1"
v1alpha1 "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1alpha1"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1 provides access to shared informers for resources in V1.
V1() v1.Interface
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.Interface
}
type group struct {
@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
func (g *group) V1() v1.Interface {
return v1.New(g.factory, g.namespace, g.tweakListOptions)
}
// V1alpha1 returns a new v1alpha1.Interface.
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
}

View file

@ -22,10 +22,10 @@ import (
"context"
time "time"
policyreportv1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
kyvernov1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/kyverno/kyverno/pkg/client/listers/policyreport/v1alpha1"
v1alpha1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
@ -61,16 +61,16 @@ func NewFilteredClusterReportChangeRequestInformer(client versioned.Interface, r
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.PolicyV1alpha1().ClusterReportChangeRequests().List(context.TODO(), options)
return client.KyvernoV1alpha1().ClusterReportChangeRequests().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.PolicyV1alpha1().ClusterReportChangeRequests().Watch(context.TODO(), options)
return client.KyvernoV1alpha1().ClusterReportChangeRequests().Watch(context.TODO(), options)
},
},
&policyreportv1alpha1.ClusterReportChangeRequest{},
&kyvernov1alpha1.ClusterReportChangeRequest{},
resyncPeriod,
indexers,
)
@ -81,7 +81,7 @@ func (f *clusterReportChangeRequestInformer) defaultInformer(client versioned.In
}
func (f *clusterReportChangeRequestInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&policyreportv1alpha1.ClusterReportChangeRequest{}, f.defaultInformer)
return f.factory.InformerFor(&kyvernov1alpha1.ClusterReportChangeRequest{}, f.defaultInformer)
}
func (f *clusterReportChangeRequestInformer) Lister() v1alpha1.ClusterReportChangeRequestLister {

View file

@ -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 v1alpha1
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 {
// ClusterReportChangeRequests returns a ClusterReportChangeRequestInformer.
ClusterReportChangeRequests() ClusterReportChangeRequestInformer
// ReportChangeRequests returns a ReportChangeRequestInformer.
ReportChangeRequests() ReportChangeRequestInformer
}
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}
}
// ClusterReportChangeRequests returns a ClusterReportChangeRequestInformer.
func (v *version) ClusterReportChangeRequests() ClusterReportChangeRequestInformer {
return &clusterReportChangeRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// ReportChangeRequests returns a ReportChangeRequestInformer.
func (v *version) ReportChangeRequests() ReportChangeRequestInformer {
return &reportChangeRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}

View file

@ -22,10 +22,10 @@ import (
"context"
time "time"
policyreportv1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
kyvernov1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/kyverno/kyverno/pkg/client/listers/policyreport/v1alpha1"
v1alpha1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
@ -62,16 +62,16 @@ func NewFilteredReportChangeRequestInformer(client versioned.Interface, namespac
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.PolicyV1alpha1().ReportChangeRequests(namespace).List(context.TODO(), options)
return client.KyvernoV1alpha1().ReportChangeRequests(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.PolicyV1alpha1().ReportChangeRequests(namespace).Watch(context.TODO(), options)
return client.KyvernoV1alpha1().ReportChangeRequests(namespace).Watch(context.TODO(), options)
},
},
&policyreportv1alpha1.ReportChangeRequest{},
&kyvernov1alpha1.ReportChangeRequest{},
resyncPeriod,
indexers,
)
@ -82,7 +82,7 @@ func (f *reportChangeRequestInformer) defaultInformer(client versioned.Interface
}
func (f *reportChangeRequestInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&policyreportv1alpha1.ReportChangeRequest{}, f.defaultInformer)
return f.factory.InformerFor(&kyvernov1alpha1.ReportChangeRequest{}, f.defaultInformer)
}
func (f *reportChangeRequestInformer) Lister() v1alpha1.ReportChangeRequestLister {

View file

@ -26,12 +26,8 @@ import (
type Interface interface {
// ClusterPolicyReports returns a ClusterPolicyReportInformer.
ClusterPolicyReports() ClusterPolicyReportInformer
// ClusterReportChangeRequests returns a ClusterReportChangeRequestInformer.
ClusterReportChangeRequests() ClusterReportChangeRequestInformer
// PolicyReports returns a PolicyReportInformer.
PolicyReports() PolicyReportInformer
// ReportChangeRequests returns a ReportChangeRequestInformer.
ReportChangeRequests() ReportChangeRequestInformer
}
type version struct {
@ -50,17 +46,7 @@ func (v *version) ClusterPolicyReports() ClusterPolicyReportInformer {
return &clusterPolicyReportInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// ClusterReportChangeRequests returns a ClusterReportChangeRequestInformer.
func (v *version) ClusterReportChangeRequests() ClusterReportChangeRequestInformer {
return &clusterReportChangeRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// PolicyReports returns a PolicyReportInformer.
func (v *version) PolicyReports() PolicyReportInformer {
return &policyReportInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// ReportChangeRequests returns a ReportChangeRequestInformer.
func (v *version) ReportChangeRequests() ReportChangeRequestInformer {
return &reportChangeRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}

View file

@ -19,7 +19,7 @@ limitations under the License.
package v1alpha1
import (
v1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"

View 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 v1alpha1
// ClusterReportChangeRequestListerExpansion allows custom methods to be added to
// ClusterReportChangeRequestLister.
type ClusterReportChangeRequestListerExpansion interface{}
// ReportChangeRequestListerExpansion allows custom methods to be added to
// ReportChangeRequestLister.
type ReportChangeRequestListerExpansion interface{}
// ReportChangeRequestNamespaceListerExpansion allows custom methods to be added to
// ReportChangeRequestNamespaceLister.
type ReportChangeRequestNamespaceListerExpansion interface{}

View file

@ -19,7 +19,7 @@ limitations under the License.
package v1alpha1
import (
v1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
v1alpha1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"

View file

@ -22,10 +22,6 @@ package v1alpha1
// ClusterPolicyReportLister.
type ClusterPolicyReportListerExpansion interface{}
// ClusterReportChangeRequestListerExpansion allows custom methods to be added to
// ClusterReportChangeRequestLister.
type ClusterReportChangeRequestListerExpansion interface{}
// PolicyReportListerExpansion allows custom methods to be added to
// PolicyReportLister.
type PolicyReportListerExpansion interface{}
@ -33,11 +29,3 @@ type PolicyReportListerExpansion interface{}
// PolicyReportNamespaceListerExpansion allows custom methods to be added to
// PolicyReportNamespaceLister.
type PolicyReportNamespaceListerExpansion interface{}
// ReportChangeRequestListerExpansion allows custom methods to be added to
// ReportChangeRequestLister.
type ReportChangeRequestListerExpansion interface{}
// ReportChangeRequestNamespaceListerExpansion allows custom methods to be added to
// ReportChangeRequestNamespaceLister.
type ReportChangeRequestNamespaceListerExpansion interface{}

View file

@ -7,6 +7,7 @@ import (
"github.com/go-logr/logr"
kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1"
request "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
"github.com/kyverno/kyverno/pkg/common"
"github.com/kyverno/kyverno/pkg/config"
@ -88,12 +89,11 @@ func (pvb *requestBuilder) build(info Info) (req *unstructured.Unstructured, err
result.Rule = rule.Name
result.Message = rule.Message
result.Status = report.PolicyStatus(rule.Check)
fmt.Println("======status", result.Status)
results = append(results, result)
}
if info.Resource.GetNamespace() != "" {
rr := &report.ReportChangeRequest{
rr := &request.ReportChangeRequest{
Summary: calculateSummary(results),
Results: results,
}
@ -106,7 +106,7 @@ func (pvb *requestBuilder) build(info Info) (req *unstructured.Unstructured, err
req = &unstructured.Unstructured{Object: obj}
set(req, fmt.Sprintf("reportchangerequest-%s-%s-%s", info.PolicyName, info.Resource.GetNamespace(), info.Resource.GetName()), info)
} else {
rr := &report.ClusterReportChangeRequest{
rr := &request.ClusterReportChangeRequest{
Summary: calculateSummary(results),
Results: results,
}
@ -157,7 +157,7 @@ func set(obj *unstructured.Unstructured, name string, info Info) {
resource := info.Resource
obj.SetName(name)
obj.SetNamespace(config.KubePolicyNamespace)
obj.SetAPIVersion("policy.k8s.io/v1alpha1")
obj.SetAPIVersion(request.SchemeGroupVersion.Group + "/" + request.SchemeGroupVersion.Version)
if resource.GetNamespace() == "" {
obj.SetKind("ClusterReportChangeRequest")
} else {

View file

@ -6,6 +6,7 @@ import (
"strings"
"github.com/cornelk/hashmap"
changerequest "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
@ -15,7 +16,7 @@ type deletedResource struct {
}
func getDeletedResources(aggregatedRequests interface{}) (resources []deletedResource) {
if requests, ok := aggregatedRequests.([]*report.ClusterReportChangeRequest); ok {
if requests, ok := aggregatedRequests.([]*changerequest.ClusterReportChangeRequest); ok {
for _, request := range requests {
labels := request.GetLabels()
dr := deletedResource{
@ -26,7 +27,7 @@ func getDeletedResources(aggregatedRequests interface{}) (resources []deletedRes
resources = append(resources, dr)
}
} else if requests, ok := aggregatedRequests.([]*report.ReportChangeRequest); ok {
} else if requests, ok := aggregatedRequests.([]*changerequest.ReportChangeRequest); ok {
for _, request := range requests {
labels := request.GetLabels()
dr := deletedResource{

View file

@ -6,8 +6,11 @@ import (
"strings"
"github.com/go-logr/logr"
changerequest "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
requestinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1alpha1"
policyreportinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/policyreport/v1alpha1"
requestlister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha1"
policyreport "github.com/kyverno/kyverno/pkg/client/listers/policyreport/v1alpha1"
"github.com/kyverno/kyverno/pkg/config"
"github.com/kyverno/kyverno/pkg/constant"
@ -42,10 +45,10 @@ type ReportGenerator struct {
clusterReportLister policyreport.ClusterPolicyReportLister
clusterReportSynced cache.InformerSynced
reportChangeRequestLister policyreport.ReportChangeRequestLister
reportChangeRequestLister requestlister.ReportChangeRequestLister
reportReqSynced cache.InformerSynced
clusterReportChangeRequestLister policyreport.ClusterReportChangeRequestLister
clusterReportChangeRequestLister requestlister.ClusterReportChangeRequestLister
clusterReportReqSynced cache.InformerSynced
nsLister listerv1.NamespaceLister
@ -61,8 +64,8 @@ func NewReportGenerator(
dclient *dclient.Client,
clusterReportInformer policyreportinformer.ClusterPolicyReportInformer,
reportInformer policyreportinformer.PolicyReportInformer,
reportReqInformer policyreportinformer.ReportChangeRequestInformer,
clusterReportReqInformer policyreportinformer.ClusterReportChangeRequestInformer,
reportReqInformer requestinformer.ReportChangeRequestInformer,
clusterReportReqInformer requestinformer.ClusterReportChangeRequestInformer,
namespace informers.NamespaceInformer,
log logr.Logger) *ReportGenerator {
@ -105,7 +108,7 @@ const deletedPolicyKey string = "deletedpolicy"
// - "" for cluster wide resource
// - "deletedpolicy/policyName/ruleName(optional)" for a deleted policy or rule
func generateCacheKey(changeRequest interface{}) string {
if request, ok := changeRequest.(*report.ReportChangeRequest); ok {
if request, ok := changeRequest.(*changerequest.ReportChangeRequest); ok {
label := request.GetLabels()
policy := label[deletedLabelPolicy]
rule := label[deletedLabelRule]
@ -118,7 +121,7 @@ func generateCacheKey(changeRequest interface{}) string {
ns = "default"
}
return ns
} else if request, ok := changeRequest.(*report.ClusterReportChangeRequest); ok {
} else if request, ok := changeRequest.(*changerequest.ClusterReportChangeRequest); ok {
label := request.GetLabels()
policy := label[deletedLabelPolicy]
rule := label[deletedLabelRule]
@ -137,8 +140,8 @@ func (g *ReportGenerator) addReportChangeRequest(obj interface{}) {
}
func (g *ReportGenerator) updateReportChangeRequest(old interface{}, cur interface{}) {
oldReq := old.(*report.ReportChangeRequest)
curReq := cur.(*report.ReportChangeRequest)
oldReq := old.(*changerequest.ReportChangeRequest)
curReq := cur.(*changerequest.ReportChangeRequest)
if reflect.DeepEqual(oldReq.Results, curReq.Results) {
return
}
@ -153,8 +156,8 @@ func (g *ReportGenerator) addClusterReportChangeRequest(obj interface{}) {
}
func (g *ReportGenerator) updateClusterReportChangeRequest(old interface{}, cur interface{}) {
oldReq := old.(*report.ClusterReportChangeRequest)
curReq := cur.(*report.ClusterReportChangeRequest)
oldReq := old.(*changerequest.ClusterReportChangeRequest)
curReq := cur.(*changerequest.ClusterReportChangeRequest)
if reflect.DeepEqual(oldReq.Results, curReq.Results) {
return
@ -217,7 +220,7 @@ func (g *ReportGenerator) handleErr(err error, key interface{}) {
// retires requests if there is error
if g.queue.NumRequeues(key) < workQueueRetryLimit {
logger.Error(err, "failed to sync report request", "key", key)
logger.Error(err, "failed to sync policy report", "key", key)
// Re-enqueue the key rate limited. Based on the rate limiter on the
// queue and the re-enqueue history, the key will be processed later again.
g.queue.AddRateLimited(key)
@ -402,8 +405,8 @@ func (g *ReportGenerator) aggregateReports(namespace string) (
func mergeRequests(ns *v1.Namespace, requestsGeneral interface{}) (*unstructured.Unstructured, interface{}, error) {
results := []*report.PolicyReportResult{}
if requests, ok := requestsGeneral.([]*report.ClusterReportChangeRequest); ok {
aggregatedRequests := []*report.ClusterReportChangeRequest{}
if requests, ok := requestsGeneral.([]*changerequest.ClusterReportChangeRequest); ok {
aggregatedRequests := []*changerequest.ClusterReportChangeRequest{}
for _, request := range requests {
if request.GetDeletionTimestamp() != nil {
continue
@ -429,8 +432,8 @@ func mergeRequests(ns *v1.Namespace, requestsGeneral interface{}) (*unstructured
return req, aggregatedRequests, nil
}
if requests, ok := requestsGeneral.([]*report.ReportChangeRequest); ok {
aggregatedRequests := []*report.ReportChangeRequest{}
if requests, ok := requestsGeneral.([]*changerequest.ReportChangeRequest); ok {
aggregatedRequests := []*changerequest.ReportChangeRequest{}
for _, request := range requests {
if request.GetDeletionTimestamp() != nil {
continue
@ -539,7 +542,7 @@ func (g *ReportGenerator) updateReport(old interface{}, new *unstructured.Unstru
func (g *ReportGenerator) cleanupReportRequets(requestsGeneral interface{}) {
defer g.log.V(5).Info("successfully cleaned up report requests")
if requests, ok := requestsGeneral.([]*report.ReportChangeRequest); ok {
if requests, ok := requestsGeneral.([]*changerequest.ReportChangeRequest); ok {
for _, request := range requests {
if err := g.dclient.DeleteResource(request.APIVersion, "ReportChangeRequest", config.KubePolicyNamespace, request.Name, false); err != nil {
if !apierrors.IsNotFound(err) {
@ -549,7 +552,7 @@ func (g *ReportGenerator) cleanupReportRequets(requestsGeneral interface{}) {
}
}
if requests, ok := requestsGeneral.([]*report.ClusterReportChangeRequest); ok {
if requests, ok := requestsGeneral.([]*changerequest.ClusterReportChangeRequest); ok {
for _, request := range requests {
if err := g.dclient.DeleteResource(request.APIVersion, "ClusterReportChangeRequest", "", request.Name, false); err != nil {
if !apierrors.IsNotFound(err) {

View file

@ -9,11 +9,10 @@ import (
"github.com/go-logr/logr"
kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1"
report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
changerequest "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha1"
policyreportclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned"
reportchangerequest "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha1"
policyreportinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/policyreport/v1alpha1"
policyreport "github.com/kyverno/kyverno/pkg/client/listers/policyreport/v1alpha1"
requestinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1alpha1"
requestlister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha1"
"github.com/kyverno/kyverno/pkg/config"
"github.com/kyverno/kyverno/pkg/constant"
client "github.com/kyverno/kyverno/pkg/dclient"
@ -34,11 +33,10 @@ const workQueueRetryLimit = 3
// Generator creates report request
type Generator struct {
dclient *dclient.Client
reportChangeRequestInterface reportchangerequest.PolicyV1alpha1Interface
dclient *dclient.Client
reportChangeRequestLister policyreport.ReportChangeRequestLister
clusterReportChangeRequestLister policyreport.ClusterReportChangeRequestLister
reportChangeRequestLister requestlister.ReportChangeRequestLister
clusterReportChangeRequestLister requestlister.ClusterReportChangeRequestLister
// returns true if the cluster report request store has been synced at least once
reportReqSynced cache.InformerSynced
@ -57,12 +55,11 @@ type Generator struct {
// NewReportChangeRequestGenerator returns a new instance of report request generator
func NewReportChangeRequestGenerator(client *policyreportclient.Clientset,
dclient *dclient.Client,
reportReqInformer policyreportinformer.ReportChangeRequestInformer,
clusterReportReqInformer policyreportinformer.ClusterReportChangeRequestInformer,
reportReqInformer requestinformer.ReportChangeRequestInformer,
clusterReportReqInformer requestinformer.ClusterReportChangeRequestInformer,
policyStatus policystatus.Listener,
log logr.Logger) *Generator {
gen := Generator{
reportChangeRequestInterface: client.PolicyV1alpha1(),
dclient: dclient,
clusterReportChangeRequestLister: clusterReportReqInformer.Lister(),
clusterReportReqSynced: clusterReportReqInformer.Informer().HasSynced,
@ -291,14 +288,14 @@ func (gen *Generator) sync(reportReq *unstructured.Unstructured, info Info) erro
func updateReportChangeRequest(dClient *client.Client, old interface{}, new *unstructured.Unstructured, log logr.Logger) (err error) {
oldUnstructed := make(map[string]interface{})
if oldTyped, ok := old.(*report.ReportChangeRequest); ok {
if oldTyped, ok := old.(*changerequest.ReportChangeRequest); ok {
if oldUnstructed, err = runtime.DefaultUnstructuredConverter.ToUnstructured(oldTyped); err != nil {
return fmt.Errorf("unable to convert reportChangeRequest: %v", err)
}
new.SetResourceVersion(oldTyped.GetResourceVersion())
new.SetUID(oldTyped.GetUID())
} else {
oldTyped := old.(*report.ClusterReportChangeRequest)
oldTyped := old.(*changerequest.ClusterReportChangeRequest)
if oldUnstructed, err = runtime.DefaultUnstructuredConverter.ToUnstructured(oldTyped); err != nil {
return fmt.Errorf("unable to convert clusterReportChangeRequest: %v", err)
}

View file

@ -26,4 +26,4 @@ ${CODEGEN_PKG}/generate-groups.sh \
"deepcopy,client,informer,lister" \
${NIRMATA_PKG}/pkg/client \
${NIRMATA_PKG}/pkg/api \
"kyverno:v1 policyreport:v1alpha1"
"kyverno:v1 policyreport:v1alpha1 kyverno:v1alpha1"