1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00

update crd clusterReportRequest

This commit is contained in:
Shuting Zhao 2020-10-23 18:28:06 -07:00
parent 0aae6a5276
commit 954d12c119
10 changed files with 55 additions and 80 deletions

View file

@ -26,6 +26,7 @@ import (
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +genclient:nonNamespaced
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Kind",type=string,JSONPath=`.scope.kind`,priority=1
// +kubebuilder:printcolumn:name="Name",type=string,JSONPath=`.scope.name`,priority=1

View file

@ -1,11 +1,27 @@
// +build !ignore_autogenerated
// Code generated by controller-gen. DO NOT EDIT.
/*
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 deepcopy-gen. DO NOT EDIT.
package v1alpha1
import (
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@ -37,6 +53,7 @@ func (in *ClusterPolicyReport) DeepCopyInto(out *ClusterPolicyReport) {
}
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterPolicyReport.
@ -69,6 +86,7 @@ func (in *ClusterPolicyReportList) DeepCopyInto(out *ClusterPolicyReportList) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterPolicyReportList.
@ -116,6 +134,7 @@ func (in *ClusterReportRequest) DeepCopyInto(out *ClusterReportRequest) {
}
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterReportRequest.
@ -148,6 +167,7 @@ func (in *ClusterReportRequestList) DeepCopyInto(out *ClusterReportRequestList)
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterReportRequestList.
@ -195,6 +215,7 @@ func (in *PolicyReport) DeepCopyInto(out *PolicyReport) {
}
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyReport.
@ -227,6 +248,7 @@ func (in *PolicyReportList) DeepCopyInto(out *PolicyReportList) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyReportList.
@ -273,6 +295,7 @@ func (in *PolicyReportResult) DeepCopyInto(out *PolicyReportResult) {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyReportResult.
@ -288,6 +311,7 @@ func (in *PolicyReportResult) DeepCopy() *PolicyReportResult {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PolicyReportSummary) DeepCopyInto(out *PolicyReportSummary) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyReportSummary.
@ -327,6 +351,7 @@ func (in *ReportRequest) DeepCopyInto(out *ReportRequest) {
}
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReportRequest.
@ -359,6 +384,7 @@ func (in *ReportRequestList) DeepCopyInto(out *ReportRequestList) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReportRequestList.

View file

@ -33,7 +33,7 @@ import (
// ClusterReportRequestsGetter has a method to return a ClusterReportRequestInterface.
// A group's client should implement this interface.
type ClusterReportRequestsGetter interface {
ClusterReportRequests(namespace string) ClusterReportRequestInterface
ClusterReportRequests() ClusterReportRequestInterface
}
// ClusterReportRequestInterface has methods to work with ClusterReportRequest resources.
@ -52,14 +52,12 @@ type ClusterReportRequestInterface interface {
// clusterReportRequests implements ClusterReportRequestInterface
type clusterReportRequests struct {
client rest.Interface
ns string
}
// newClusterReportRequests returns a ClusterReportRequests
func newClusterReportRequests(c *PolicyV1alpha1Client, namespace string) *clusterReportRequests {
func newClusterReportRequests(c *PolicyV1alpha1Client) *clusterReportRequests {
return &clusterReportRequests{
client: c.RESTClient(),
ns: namespace,
}
}
@ -67,7 +65,6 @@ func newClusterReportRequests(c *PolicyV1alpha1Client, namespace string) *cluste
func (c *clusterReportRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterReportRequest, err error) {
result = &v1alpha1.ClusterReportRequest{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusterreportrequests").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
@ -84,7 +81,6 @@ func (c *clusterReportRequests) List(ctx context.Context, opts v1.ListOptions) (
}
result = &v1alpha1.ClusterReportRequestList{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusterreportrequests").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
@ -101,7 +97,6 @@ func (c *clusterReportRequests) Watch(ctx context.Context, opts v1.ListOptions)
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("clusterreportrequests").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
@ -112,7 +107,6 @@ func (c *clusterReportRequests) Watch(ctx context.Context, opts v1.ListOptions)
func (c *clusterReportRequests) Create(ctx context.Context, clusterReportRequest *v1alpha1.ClusterReportRequest, opts v1.CreateOptions) (result *v1alpha1.ClusterReportRequest, err error) {
result = &v1alpha1.ClusterReportRequest{}
err = c.client.Post().
Namespace(c.ns).
Resource("clusterreportrequests").
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterReportRequest).
@ -125,7 +119,6 @@ func (c *clusterReportRequests) Create(ctx context.Context, clusterReportRequest
func (c *clusterReportRequests) Update(ctx context.Context, clusterReportRequest *v1alpha1.ClusterReportRequest, opts v1.UpdateOptions) (result *v1alpha1.ClusterReportRequest, err error) {
result = &v1alpha1.ClusterReportRequest{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusterreportrequests").
Name(clusterReportRequest.Name).
VersionedParams(&opts, scheme.ParameterCodec).
@ -138,7 +131,6 @@ func (c *clusterReportRequests) Update(ctx context.Context, clusterReportRequest
// Delete takes name of the clusterReportRequest and deletes it. Returns an error if one occurs.
func (c *clusterReportRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusterreportrequests").
Name(name).
Body(&opts).
@ -153,7 +145,6 @@ func (c *clusterReportRequests) DeleteCollection(ctx context.Context, opts v1.De
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("clusterreportrequests").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
@ -166,7 +157,6 @@ func (c *clusterReportRequests) DeleteCollection(ctx context.Context, opts v1.De
func (c *clusterReportRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterReportRequest, err error) {
result = &v1alpha1.ClusterReportRequest{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("clusterreportrequests").
Name(name).
SubResource(subresources...).

View file

@ -33,7 +33,6 @@ import (
// FakeClusterReportRequests implements ClusterReportRequestInterface
type FakeClusterReportRequests struct {
Fake *FakePolicyV1alpha1
ns string
}
var clusterreportrequestsResource = schema.GroupVersionResource{Group: "policy.kubernetes.io", Version: "v1alpha1", Resource: "clusterreportrequests"}
@ -43,8 +42,7 @@ var clusterreportrequestsKind = schema.GroupVersionKind{Group: "policy.kubernete
// Get takes name of the clusterReportRequest, and returns the corresponding clusterReportRequest object, and an error if there is any.
func (c *FakeClusterReportRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterReportRequest, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(clusterreportrequestsResource, c.ns, name), &v1alpha1.ClusterReportRequest{})
Invokes(testing.NewRootGetAction(clusterreportrequestsResource, name), &v1alpha1.ClusterReportRequest{})
if obj == nil {
return nil, err
}
@ -54,8 +52,7 @@ func (c *FakeClusterReportRequests) Get(ctx context.Context, name string, option
// List takes label and field selectors, and returns the list of ClusterReportRequests that match those selectors.
func (c *FakeClusterReportRequests) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterReportRequestList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(clusterreportrequestsResource, clusterreportrequestsKind, c.ns, opts), &v1alpha1.ClusterReportRequestList{})
Invokes(testing.NewRootListAction(clusterreportrequestsResource, clusterreportrequestsKind, opts), &v1alpha1.ClusterReportRequestList{})
if obj == nil {
return nil, err
}
@ -76,15 +73,13 @@ func (c *FakeClusterReportRequests) List(ctx context.Context, opts v1.ListOption
// Watch returns a watch.Interface that watches the requested clusterReportRequests.
func (c *FakeClusterReportRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(clusterreportrequestsResource, c.ns, opts))
InvokesWatch(testing.NewRootWatchAction(clusterreportrequestsResource, opts))
}
// Create takes the representation of a clusterReportRequest and creates it. Returns the server's representation of the clusterReportRequest, and an error, if there is any.
func (c *FakeClusterReportRequests) Create(ctx context.Context, clusterReportRequest *v1alpha1.ClusterReportRequest, opts v1.CreateOptions) (result *v1alpha1.ClusterReportRequest, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(clusterreportrequestsResource, c.ns, clusterReportRequest), &v1alpha1.ClusterReportRequest{})
Invokes(testing.NewRootCreateAction(clusterreportrequestsResource, clusterReportRequest), &v1alpha1.ClusterReportRequest{})
if obj == nil {
return nil, err
}
@ -94,8 +89,7 @@ func (c *FakeClusterReportRequests) Create(ctx context.Context, clusterReportReq
// Update takes the representation of a clusterReportRequest and updates it. Returns the server's representation of the clusterReportRequest, and an error, if there is any.
func (c *FakeClusterReportRequests) Update(ctx context.Context, clusterReportRequest *v1alpha1.ClusterReportRequest, opts v1.UpdateOptions) (result *v1alpha1.ClusterReportRequest, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(clusterreportrequestsResource, c.ns, clusterReportRequest), &v1alpha1.ClusterReportRequest{})
Invokes(testing.NewRootUpdateAction(clusterreportrequestsResource, clusterReportRequest), &v1alpha1.ClusterReportRequest{})
if obj == nil {
return nil, err
}
@ -105,14 +99,13 @@ func (c *FakeClusterReportRequests) Update(ctx context.Context, clusterReportReq
// Delete takes name of the clusterReportRequest and deletes it. Returns an error if one occurs.
func (c *FakeClusterReportRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clusterreportrequestsResource, c.ns, name), &v1alpha1.ClusterReportRequest{})
Invokes(testing.NewRootDeleteAction(clusterreportrequestsResource, name), &v1alpha1.ClusterReportRequest{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeClusterReportRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(clusterreportrequestsResource, c.ns, listOpts)
action := testing.NewRootDeleteCollectionAction(clusterreportrequestsResource, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterReportRequestList{})
return err
@ -121,8 +114,7 @@ func (c *FakeClusterReportRequests) DeleteCollection(ctx context.Context, opts v
// Patch applies the patch and returns the patched clusterReportRequest.
func (c *FakeClusterReportRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterReportRequest, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(clusterreportrequestsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterReportRequest{})
Invokes(testing.NewRootPatchSubresourceAction(clusterreportrequestsResource, name, pt, data, subresources...), &v1alpha1.ClusterReportRequest{})
if obj == nil {
return nil, err
}

View file

@ -32,8 +32,8 @@ func (c *FakePolicyV1alpha1) ClusterPolicyReports() v1alpha1.ClusterPolicyReport
return &FakeClusterPolicyReports{c}
}
func (c *FakePolicyV1alpha1) ClusterReportRequests(namespace string) v1alpha1.ClusterReportRequestInterface {
return &FakeClusterReportRequests{c, namespace}
func (c *FakePolicyV1alpha1) ClusterReportRequests() v1alpha1.ClusterReportRequestInterface {
return &FakeClusterReportRequests{c}
}
func (c *FakePolicyV1alpha1) PolicyReports(namespace string) v1alpha1.PolicyReportInterface {

View file

@ -41,8 +41,8 @@ func (c *PolicyV1alpha1Client) ClusterPolicyReports() ClusterPolicyReportInterfa
return newClusterPolicyReports(c)
}
func (c *PolicyV1alpha1Client) ClusterReportRequests(namespace string) ClusterReportRequestInterface {
return newClusterReportRequests(c, namespace)
func (c *PolicyV1alpha1Client) ClusterReportRequests() ClusterReportRequestInterface {
return newClusterReportRequests(c)
}
func (c *PolicyV1alpha1Client) PolicyReports(namespace string) PolicyReportInterface {

View file

@ -42,33 +42,32 @@ type ClusterReportRequestInformer interface {
type clusterReportRequestInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewClusterReportRequestInformer constructs a new informer for ClusterReportRequest 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 NewClusterReportRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredClusterReportRequestInformer(client, namespace, resyncPeriod, indexers, nil)
func NewClusterReportRequestInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredClusterReportRequestInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredClusterReportRequestInformer constructs a new informer for ClusterReportRequest 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 NewFilteredClusterReportRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
func NewFilteredClusterReportRequestInformer(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.PolicyV1alpha1().ClusterReportRequests(namespace).List(context.TODO(), options)
return client.PolicyV1alpha1().ClusterReportRequests().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.PolicyV1alpha1().ClusterReportRequests(namespace).Watch(context.TODO(), options)
return client.PolicyV1alpha1().ClusterReportRequests().Watch(context.TODO(), options)
},
},
&policyreportv1alpha1.ClusterReportRequest{},
@ -78,7 +77,7 @@ func NewFilteredClusterReportRequestInformer(client versioned.Interface, namespa
}
func (f *clusterReportRequestInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredClusterReportRequestInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
return NewFilteredClusterReportRequestInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *clusterReportRequestInformer) Informer() cache.SharedIndexInformer {

View file

@ -52,7 +52,7 @@ func (v *version) ClusterPolicyReports() ClusterPolicyReportInformer {
// ClusterReportRequests returns a ClusterReportRequestInformer.
func (v *version) ClusterReportRequests() ClusterReportRequestInformer {
return &clusterReportRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
return &clusterReportRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// PolicyReports returns a PolicyReportInformer.

View file

@ -29,8 +29,8 @@ import (
type ClusterReportRequestLister interface {
// List lists all ClusterReportRequests in the indexer.
List(selector labels.Selector) (ret []*v1alpha1.ClusterReportRequest, err error)
// ClusterReportRequests returns an object that can list and get ClusterReportRequests.
ClusterReportRequests(namespace string) ClusterReportRequestNamespaceLister
// Get retrieves the ClusterReportRequest from the index for a given name.
Get(name string) (*v1alpha1.ClusterReportRequest, error)
ClusterReportRequestListerExpansion
}
@ -52,38 +52,9 @@ func (s *clusterReportRequestLister) List(selector labels.Selector) (ret []*v1al
return ret, err
}
// ClusterReportRequests returns an object that can list and get ClusterReportRequests.
func (s *clusterReportRequestLister) ClusterReportRequests(namespace string) ClusterReportRequestNamespaceLister {
return clusterReportRequestNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ClusterReportRequestNamespaceLister helps list and get ClusterReportRequests.
type ClusterReportRequestNamespaceLister interface {
// List lists all ClusterReportRequests in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1alpha1.ClusterReportRequest, err error)
// Get retrieves the ClusterReportRequest from the indexer for a given namespace and name.
Get(name string) (*v1alpha1.ClusterReportRequest, error)
ClusterReportRequestNamespaceListerExpansion
}
// clusterReportRequestNamespaceLister implements the ClusterReportRequestNamespaceLister
// interface.
type clusterReportRequestNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ClusterReportRequests in the indexer for a given namespace.
func (s clusterReportRequestNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterReportRequest, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.ClusterReportRequest))
})
return ret, err
}
// Get retrieves the ClusterReportRequest from the indexer for a given namespace and name.
func (s clusterReportRequestNamespaceLister) Get(name string) (*v1alpha1.ClusterReportRequest, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
// Get retrieves the ClusterReportRequest from the index for a given name.
func (s *clusterReportRequestLister) Get(name string) (*v1alpha1.ClusterReportRequest, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}

View file

@ -26,10 +26,6 @@ type ClusterPolicyReportListerExpansion interface{}
// ClusterReportRequestLister.
type ClusterReportRequestListerExpansion interface{}
// ClusterReportRequestNamespaceListerExpansion allows custom methods to be added to
// ClusterReportRequestNamespaceLister.
type ClusterReportRequestNamespaceListerExpansion interface{}
// PolicyReportListerExpansion allows custom methods to be added to
// PolicyReportLister.
type PolicyReportListerExpansion interface{}