clientset_generated.go 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // Copyright 2026 the Kilo authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Code generated by client-gen. DO NOT EDIT.
  15. package fake
  16. import (
  17. clientset "github.com/squat/kilo/pkg/k8s/clientset/versioned"
  18. kilov1alpha1 "github.com/squat/kilo/pkg/k8s/clientset/versioned/typed/kilo/v1alpha1"
  19. fakekilov1alpha1 "github.com/squat/kilo/pkg/k8s/clientset/versioned/typed/kilo/v1alpha1/fake"
  20. "k8s.io/apimachinery/pkg/runtime"
  21. "k8s.io/apimachinery/pkg/watch"
  22. "k8s.io/client-go/discovery"
  23. fakediscovery "k8s.io/client-go/discovery/fake"
  24. "k8s.io/client-go/testing"
  25. )
  26. // NewSimpleClientset returns a clientset that will respond with the provided objects.
  27. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
  28. // without applying any validations and/or defaults. It shouldn't be considered a replacement
  29. // for a real clientset and is mostly useful in simple unit tests.
  30. func NewSimpleClientset(objects ...runtime.Object) *Clientset {
  31. o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
  32. for _, obj := range objects {
  33. if err := o.Add(obj); err != nil {
  34. panic(err)
  35. }
  36. }
  37. cs := &Clientset{tracker: o}
  38. cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
  39. cs.AddReactor("*", "*", testing.ObjectReaction(o))
  40. cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
  41. gvr := action.GetResource()
  42. ns := action.GetNamespace()
  43. watch, err := o.Watch(gvr, ns)
  44. if err != nil {
  45. return false, nil, err
  46. }
  47. return true, watch, nil
  48. })
  49. return cs
  50. }
  51. // Clientset implements clientset.Interface. Meant to be embedded into a
  52. // struct to get a default implementation. This makes faking out just the method
  53. // you want to test easier.
  54. type Clientset struct {
  55. testing.Fake
  56. discovery *fakediscovery.FakeDiscovery
  57. tracker testing.ObjectTracker
  58. }
  59. func (c *Clientset) Discovery() discovery.DiscoveryInterface {
  60. return c.discovery
  61. }
  62. func (c *Clientset) Tracker() testing.ObjectTracker {
  63. return c.tracker
  64. }
  65. var (
  66. _ clientset.Interface = &Clientset{}
  67. _ testing.FakeClient = &Clientset{}
  68. )
  69. // KiloV1alpha1 retrieves the KiloV1alpha1Client
  70. func (c *Clientset) KiloV1alpha1() kilov1alpha1.KiloV1alpha1Interface {
  71. return &fakekilov1alpha1.FakeKiloV1alpha1{Fake: &c.Fake}
  72. }