From e882820e0cbb2ce0443d56c34abdf50fb904d427 Mon Sep 17 00:00:00 2001 From: Anna Kapuscinska Date: Thu, 29 Feb 2024 17:27:35 +0000 Subject: [PATCH] watcher: Don't create service and podInfo informers [ upstream commit efbbaa5ef57ff66685e112dd928a6b0d5e103be5 ] They are unused. I also merged NewK8sWatcherWithTetragonClient function into NewK8sWatcher and deleted unused code related to these informers. Signed-off-by: Anna Kapuscinska --- pkg/watcher/watcher.go | 68 +--------- .../versioned/fake/clientset_generated.go | 72 ---------- .../client/clientset/versioned/fake/doc.go | 7 - .../clientset/versioned/fake/register.go | 43 ------ .../typed/cilium.io/v1alpha1/fake/doc.go | 7 - .../v1alpha1/fake/fake_cilium.io_client.go | 35 ----- .../cilium.io/v1alpha1/fake/fake_podinfo.go | 128 ------------------ .../v1alpha1/fake/fake_tracingpolicy.go | 108 --------------- .../fake/fake_tracingpolicynamespaced.go | 116 ---------------- vendor/modules.txt | 2 - 10 files changed, 5 insertions(+), 581 deletions(-) delete mode 100644 vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go delete mode 100644 vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/doc.go delete mode 100644 vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/register.go delete mode 100644 vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/doc.go delete mode 100644 vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_cilium.io_client.go delete mode 100644 vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_podinfo.go delete mode 100644 vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_tracingpolicy.go delete mode 100644 vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_tracingpolicynamespaced.go diff --git a/pkg/watcher/watcher.go b/pkg/watcher/watcher.go index a381da4b670..c16eb6c4d53 100644 --- a/pkg/watcher/watcher.go +++ b/pkg/watcher/watcher.go @@ -11,10 +11,6 @@ import ( "strings" "time" - "github.com/cilium/tetragon/pkg/k8s/apis/cilium.io/v1alpha1" - "github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned" - "github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake" - "github.com/cilium/tetragon/pkg/k8s/client/informers/externalversions" "github.com/cilium/tetragon/pkg/logger" "github.com/cilium/tetragon/pkg/podhooks" corev1 "k8s.io/api/core/v1" @@ -26,20 +22,14 @@ import ( ) const ( - containerIDLen = 15 - containerIdx = "containers-ids" - podIdx = "pod-ids" - serviceIPsIdx = "service-ips" - podInfoIPsIdx = "pod-info-ips" - podInformerName = "pod" - serviceInformerName = "service" - podInfoInformerName = "podInfo" + containerIDLen = 15 + containerIdx = "containers-ids" + podIdx = "pod-ids" + podInformerName = "pod" ) var ( - errNoPod = errors.New("object is not a *corev1.Pod") - errNoService = errors.New("object is not a *corev1.Service") - errNoPodInfo = errors.New("object is not a *PodInfo") + errNoPod = errors.New("object is not a *corev1.Pod") ) // K8sResourceWatcher defines an interface for accessing various resources from Kubernetes API. @@ -127,35 +117,8 @@ func containerIndexFunc(obj interface{}) ([]string, error) { return nil, fmt.Errorf("%w - found %T", errNoPod, obj) } -// serviceIPIndexFunc indexes services by their IP addresses -func serviceIPIndexFunc(obj interface{}) ([]string, error) { - switch t := obj.(type) { - case *corev1.Service: - return t.Spec.ClusterIPs, nil - } - return nil, fmt.Errorf("%w - found %T", errNoService, obj) -} - -// podInfoIPIndexFunc indexes services by their IP addresses -func podInfoIPIndexFunc(obj interface{}) ([]string, error) { - switch t := obj.(type) { - case *v1alpha1.PodInfo: - var ips []string - for _, ip := range t.Status.PodIPs { - ips = append(ips, ip.IP) - } - return ips, nil - } - return nil, fmt.Errorf("%w - found %T", errNoPodInfo, obj) -} - // NewK8sWatcher returns a pointer to an initialized K8sWatcher struct. func NewK8sWatcher(k8sClient kubernetes.Interface, stateSyncIntervalSec time.Duration) *K8sWatcher { - return NewK8sWatcherWithTetragonClient(k8sClient, fake.NewSimpleClientset(), stateSyncIntervalSec) -} - -// NewK8sWatcherWithTetragonClient returns a pointer to an initialized K8sWatcher struct. -func NewK8sWatcherWithTetragonClient(k8sClient kubernetes.Interface, tetragonClient versioned.Interface, stateSyncIntervalSec time.Duration) *K8sWatcher { nodeName := os.Getenv("NODE_NAME") if nodeName == "" { logger.GetLogger().Warn("env var NODE_NAME not specified, K8s watcher will not work as expected") @@ -181,27 +144,6 @@ func NewK8sWatcherWithTetragonClient(k8sClient kubernetes.Interface, tetragonCli }, }) - // can't share the same informer factory as pods because the pod informer filters by spec.nodeName field. - serviceInformerFactory := informers.NewSharedInformerFactory(k8sClient, stateSyncIntervalSec) - serviceInformer := serviceInformerFactory.Core().V1().Services().Informer() - k8sWatcher.AddInformers(serviceInformerFactory, &InternalInformer{ - Name: serviceInformerName, - Informer: serviceInformer, - Indexers: map[string]cache.IndexFunc{ - serviceIPsIdx: serviceIPIndexFunc, - }, - }) - - podInfoInformerFactory := externalversions.NewSharedInformerFactory(tetragonClient, stateSyncIntervalSec) - podInfoInformer := podInfoInformerFactory.Cilium().V1alpha1().PodInfo().Informer() - k8sWatcher.AddInformers(podInfoInformerFactory, &InternalInformer{ - Name: podInfoInformerName, - Informer: podInfoInformer, - Indexers: map[string]cache.IndexFunc{ - podInfoIPsIdx: podInfoIPIndexFunc, - }, - }) - podhooks.InstallHooks(podInformer) k8sWatcher.Start() diff --git a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go b/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go deleted file mode 100644 index 4cb28652cec..00000000000 --- a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Tetragon - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - clientset "github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned" - ciliumv1alpha1 "github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1" - fakeciliumv1alpha1 "github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" -) - -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - cs := &Clientset{tracker: o} - cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} - cs.AddReactor("*", "*", testing.ObjectReaction(o)) - cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) - if err != nil { - return false, nil, err - } - return true, watch, nil - }) - - return cs -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery - tracker testing.ObjectTracker -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -func (c *Clientset) Tracker() testing.ObjectTracker { - return c.tracker -} - -var ( - _ clientset.Interface = &Clientset{} - _ testing.FakeClient = &Clientset{} -) - -// CiliumV1alpha1 retrieves the CiliumV1alpha1Client -func (c *Clientset) CiliumV1alpha1() ciliumv1alpha1.CiliumV1alpha1Interface { - return &fakeciliumv1alpha1.FakeCiliumV1alpha1{Fake: &c.Fake} -} diff --git a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/doc.go b/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/doc.go deleted file mode 100644 index 9b4fecfef2b..00000000000 --- a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Tetragon - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated fake clientset. -package fake diff --git a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/register.go b/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/register.go deleted file mode 100644 index 7c4ea8398e2..00000000000 --- a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake/register.go +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Tetragon - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - ciliumv1alpha1 "github.com/cilium/tetragon/pkg/k8s/apis/cilium.io/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var scheme = runtime.NewScheme() -var codecs = serializer.NewCodecFactory(scheme) - -var localSchemeBuilder = runtime.SchemeBuilder{ - ciliumv1alpha1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(scheme)) -} diff --git a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/doc.go b/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/doc.go deleted file mode 100644 index b26f3ccd0bf..00000000000 --- a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Tetragon - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_cilium.io_client.go b/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_cilium.io_client.go deleted file mode 100644 index d91edfe95e4..00000000000 --- a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_cilium.io_client.go +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Tetragon - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1alpha1 "github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeCiliumV1alpha1 struct { - *testing.Fake -} - -func (c *FakeCiliumV1alpha1) PodInfo(namespace string) v1alpha1.PodInfoInterface { - return &FakePodInfo{c, namespace} -} - -func (c *FakeCiliumV1alpha1) TracingPolicies() v1alpha1.TracingPolicyInterface { - return &FakeTracingPolicies{c} -} - -func (c *FakeCiliumV1alpha1) TracingPoliciesNamespaced(namespace string) v1alpha1.TracingPolicyNamespacedInterface { - return &FakeTracingPoliciesNamespaced{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeCiliumV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_podinfo.go b/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_podinfo.go deleted file mode 100644 index b33229b2114..00000000000 --- a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_podinfo.go +++ /dev/null @@ -1,128 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Tetragon - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1alpha1 "github.com/cilium/tetragon/pkg/k8s/apis/cilium.io/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakePodInfo implements PodInfoInterface -type FakePodInfo struct { - Fake *FakeCiliumV1alpha1 - ns string -} - -var podinfoResource = v1alpha1.SchemeGroupVersion.WithResource("podinfo") - -var podinfoKind = v1alpha1.SchemeGroupVersion.WithKind("PodInfo") - -// Get takes name of the podInfo, and returns the corresponding podInfo object, and an error if there is any. -func (c *FakePodInfo) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PodInfo, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(podinfoResource, c.ns, name), &v1alpha1.PodInfo{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodInfo), err -} - -// List takes label and field selectors, and returns the list of PodInfo that match those selectors. -func (c *FakePodInfo) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PodInfoList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(podinfoResource, podinfoKind, c.ns, opts), &v1alpha1.PodInfoList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.PodInfoList{ListMeta: obj.(*v1alpha1.PodInfoList).ListMeta} - for _, item := range obj.(*v1alpha1.PodInfoList).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 podInfo. -func (c *FakePodInfo) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(podinfoResource, c.ns, opts)) - -} - -// Create takes the representation of a podInfo and creates it. Returns the server's representation of the podInfo, and an error, if there is any. -func (c *FakePodInfo) Create(ctx context.Context, podInfo *v1alpha1.PodInfo, opts v1.CreateOptions) (result *v1alpha1.PodInfo, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(podinfoResource, c.ns, podInfo), &v1alpha1.PodInfo{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodInfo), err -} - -// Update takes the representation of a podInfo and updates it. Returns the server's representation of the podInfo, and an error, if there is any. -func (c *FakePodInfo) Update(ctx context.Context, podInfo *v1alpha1.PodInfo, opts v1.UpdateOptions) (result *v1alpha1.PodInfo, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(podinfoResource, c.ns, podInfo), &v1alpha1.PodInfo{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodInfo), 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 *FakePodInfo) UpdateStatus(ctx context.Context, podInfo *v1alpha1.PodInfo, opts v1.UpdateOptions) (*v1alpha1.PodInfo, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(podinfoResource, "status", c.ns, podInfo), &v1alpha1.PodInfo{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodInfo), err -} - -// Delete takes name of the podInfo and deletes it. Returns an error if one occurs. -func (c *FakePodInfo) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(podinfoResource, c.ns, name, opts), &v1alpha1.PodInfo{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakePodInfo) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(podinfoResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.PodInfoList{}) - return err -} - -// Patch applies the patch and returns the patched podInfo. -func (c *FakePodInfo) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PodInfo, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(podinfoResource, c.ns, name, pt, data, subresources...), &v1alpha1.PodInfo{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PodInfo), err -} diff --git a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_tracingpolicy.go b/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_tracingpolicy.go deleted file mode 100644 index d0d0e206217..00000000000 --- a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_tracingpolicy.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Tetragon - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1alpha1 "github.com/cilium/tetragon/pkg/k8s/apis/cilium.io/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeTracingPolicies implements TracingPolicyInterface -type FakeTracingPolicies struct { - Fake *FakeCiliumV1alpha1 -} - -var tracingpoliciesResource = v1alpha1.SchemeGroupVersion.WithResource("tracingpolicies") - -var tracingpoliciesKind = v1alpha1.SchemeGroupVersion.WithKind("TracingPolicy") - -// Get takes name of the tracingPolicy, and returns the corresponding tracingPolicy object, and an error if there is any. -func (c *FakeTracingPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TracingPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(tracingpoliciesResource, name), &v1alpha1.TracingPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TracingPolicy), err -} - -// List takes label and field selectors, and returns the list of TracingPolicies that match those selectors. -func (c *FakeTracingPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TracingPolicyList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(tracingpoliciesResource, tracingpoliciesKind, opts), &v1alpha1.TracingPolicyList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.TracingPolicyList{ListMeta: obj.(*v1alpha1.TracingPolicyList).ListMeta} - for _, item := range obj.(*v1alpha1.TracingPolicyList).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 tracingPolicies. -func (c *FakeTracingPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(tracingpoliciesResource, opts)) -} - -// Create takes the representation of a tracingPolicy and creates it. Returns the server's representation of the tracingPolicy, and an error, if there is any. -func (c *FakeTracingPolicies) Create(ctx context.Context, tracingPolicy *v1alpha1.TracingPolicy, opts v1.CreateOptions) (result *v1alpha1.TracingPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(tracingpoliciesResource, tracingPolicy), &v1alpha1.TracingPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TracingPolicy), err -} - -// Update takes the representation of a tracingPolicy and updates it. Returns the server's representation of the tracingPolicy, and an error, if there is any. -func (c *FakeTracingPolicies) Update(ctx context.Context, tracingPolicy *v1alpha1.TracingPolicy, opts v1.UpdateOptions) (result *v1alpha1.TracingPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(tracingpoliciesResource, tracingPolicy), &v1alpha1.TracingPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TracingPolicy), err -} - -// Delete takes name of the tracingPolicy and deletes it. Returns an error if one occurs. -func (c *FakeTracingPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(tracingpoliciesResource, name, opts), &v1alpha1.TracingPolicy{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeTracingPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(tracingpoliciesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.TracingPolicyList{}) - return err -} - -// Patch applies the patch and returns the patched tracingPolicy. -func (c *FakeTracingPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TracingPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(tracingpoliciesResource, name, pt, data, subresources...), &v1alpha1.TracingPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TracingPolicy), err -} diff --git a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_tracingpolicynamespaced.go b/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_tracingpolicynamespaced.go deleted file mode 100644 index aee9d1daa68..00000000000 --- a/vendor/github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake/fake_tracingpolicynamespaced.go +++ /dev/null @@ -1,116 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Tetragon - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1alpha1 "github.com/cilium/tetragon/pkg/k8s/apis/cilium.io/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeTracingPoliciesNamespaced implements TracingPolicyNamespacedInterface -type FakeTracingPoliciesNamespaced struct { - Fake *FakeCiliumV1alpha1 - ns string -} - -var tracingpoliciesnamespacedResource = v1alpha1.SchemeGroupVersion.WithResource("tracingpoliciesnamespaced") - -var tracingpoliciesnamespacedKind = v1alpha1.SchemeGroupVersion.WithKind("TracingPolicyNamespaced") - -// Get takes name of the tracingPolicyNamespaced, and returns the corresponding tracingPolicyNamespaced object, and an error if there is any. -func (c *FakeTracingPoliciesNamespaced) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TracingPolicyNamespaced, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(tracingpoliciesnamespacedResource, c.ns, name), &v1alpha1.TracingPolicyNamespaced{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TracingPolicyNamespaced), err -} - -// List takes label and field selectors, and returns the list of TracingPoliciesNamespaced that match those selectors. -func (c *FakeTracingPoliciesNamespaced) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TracingPolicyNamespacedList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(tracingpoliciesnamespacedResource, tracingpoliciesnamespacedKind, c.ns, opts), &v1alpha1.TracingPolicyNamespacedList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.TracingPolicyNamespacedList{ListMeta: obj.(*v1alpha1.TracingPolicyNamespacedList).ListMeta} - for _, item := range obj.(*v1alpha1.TracingPolicyNamespacedList).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 tracingPoliciesNamespaced. -func (c *FakeTracingPoliciesNamespaced) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(tracingpoliciesnamespacedResource, c.ns, opts)) - -} - -// Create takes the representation of a tracingPolicyNamespaced and creates it. Returns the server's representation of the tracingPolicyNamespaced, and an error, if there is any. -func (c *FakeTracingPoliciesNamespaced) Create(ctx context.Context, tracingPolicyNamespaced *v1alpha1.TracingPolicyNamespaced, opts v1.CreateOptions) (result *v1alpha1.TracingPolicyNamespaced, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(tracingpoliciesnamespacedResource, c.ns, tracingPolicyNamespaced), &v1alpha1.TracingPolicyNamespaced{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TracingPolicyNamespaced), err -} - -// Update takes the representation of a tracingPolicyNamespaced and updates it. Returns the server's representation of the tracingPolicyNamespaced, and an error, if there is any. -func (c *FakeTracingPoliciesNamespaced) Update(ctx context.Context, tracingPolicyNamespaced *v1alpha1.TracingPolicyNamespaced, opts v1.UpdateOptions) (result *v1alpha1.TracingPolicyNamespaced, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(tracingpoliciesnamespacedResource, c.ns, tracingPolicyNamespaced), &v1alpha1.TracingPolicyNamespaced{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TracingPolicyNamespaced), err -} - -// Delete takes name of the tracingPolicyNamespaced and deletes it. Returns an error if one occurs. -func (c *FakeTracingPoliciesNamespaced) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(tracingpoliciesnamespacedResource, c.ns, name, opts), &v1alpha1.TracingPolicyNamespaced{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeTracingPoliciesNamespaced) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(tracingpoliciesnamespacedResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.TracingPolicyNamespacedList{}) - return err -} - -// Patch applies the patch and returns the patched tracingPolicyNamespaced. -func (c *FakeTracingPoliciesNamespaced) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TracingPolicyNamespaced, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(tracingpoliciesnamespacedResource, c.ns, name, pt, data, subresources...), &v1alpha1.TracingPolicyNamespaced{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TracingPolicyNamespaced), err -} diff --git a/vendor/modules.txt b/vendor/modules.txt index c5713dadce4..b73d2bb755c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -237,10 +237,8 @@ github.com/cilium/tetragon/pkg/k8s/apis/cilium.io github.com/cilium/tetragon/pkg/k8s/apis/cilium.io/client github.com/cilium/tetragon/pkg/k8s/apis/cilium.io/v1alpha1 github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned -github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/fake github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/scheme github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1 -github.com/cilium/tetragon/pkg/k8s/client/clientset/versioned/typed/cilium.io/v1alpha1/fake github.com/cilium/tetragon/pkg/k8s/client/informers/externalversions github.com/cilium/tetragon/pkg/k8s/client/informers/externalversions/cilium.io github.com/cilium/tetragon/pkg/k8s/client/informers/externalversions/cilium.io/v1alpha1