repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/cache/expiration_cache_fakes.go
vendor/k8s.io/client-go/tools/cache/expiration_cache_fakes.go
/* Copyright 2014 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 cache import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/utils/clock" ) type fakeThreadSafeMap struct { ThreadSafeStore deletedKeys chan<- string } func (c *fakeThreadSafeMap) Delete(key string) { if c.deletedKeys != nil { c.ThreadSafeStore.Delete(key) c.deletedKeys <- key } } // FakeExpirationPolicy keeps the list for keys which never expires. type FakeExpirationPolicy struct { NeverExpire sets.String RetrieveKeyFunc KeyFunc } // IsExpired used to check if object is expired. func (p *FakeExpirationPolicy) IsExpired(obj *TimestampedEntry) bool { key, _ := p.RetrieveKeyFunc(obj) return !p.NeverExpire.Has(key) } // NewFakeExpirationStore creates a new instance for the ExpirationCache. func NewFakeExpirationStore(keyFunc KeyFunc, deletedKeys chan<- string, expirationPolicy ExpirationPolicy, cacheClock clock.Clock) Store { cacheStorage := NewThreadSafeStore(Indexers{}, Indices{}) return &ExpirationCache{ cacheStorage: &fakeThreadSafeMap{cacheStorage, deletedKeys}, keyFunc: keyFunc, clock: cacheClock, expirationPolicy: expirationPolicy, } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/cache/synctrack/lazy.go
vendor/k8s.io/client-go/tools/cache/synctrack/lazy.go
/* Copyright 2023 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 synctrack import ( "sync" "sync/atomic" ) // Lazy defers the computation of `Evaluate` to when it is necessary. It is // possible that Evaluate will be called in parallel from multiple goroutines. type Lazy[T any] struct { Evaluate func() (T, error) cache atomic.Pointer[cacheEntry[T]] } type cacheEntry[T any] struct { eval func() (T, error) lock sync.RWMutex result *T } func (e *cacheEntry[T]) get() (T, error) { if cur := func() *T { e.lock.RLock() defer e.lock.RUnlock() return e.result }(); cur != nil { return *cur, nil } e.lock.Lock() defer e.lock.Unlock() if e.result != nil { return *e.result, nil } r, err := e.eval() if err == nil { e.result = &r } return r, err } func (z *Lazy[T]) newCacheEntry() *cacheEntry[T] { return &cacheEntry[T]{eval: z.Evaluate} } // Notify should be called when something has changed necessitating a new call // to Evaluate. func (z *Lazy[T]) Notify() { z.cache.Swap(z.newCacheEntry()) } // Get should be called to get the current result of a call to Evaluate. If the // current cached value is stale (due to a call to Notify), then Evaluate will // be called synchronously. If subsequent calls to Get happen (without another // Notify), they will all wait for the same return value. // // Error returns are not cached and will cause multiple calls to evaluate! func (z *Lazy[T]) Get() (T, error) { e := z.cache.Load() if e == nil { // Since we don't force a constructor, nil is a possible value. // If multiple Gets race to set this, the swap makes sure only // one wins. z.cache.CompareAndSwap(nil, z.newCacheEntry()) e = z.cache.Load() } return e.get() }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/cache/synctrack/synctrack.go
vendor/k8s.io/client-go/tools/cache/synctrack/synctrack.go
/* Copyright 2022 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 synctrack contains utilities for helping controllers track whether // they are "synced" or not, that is, whether they have processed all items // from the informer's initial list. package synctrack import ( "sync" "sync/atomic" "k8s.io/apimachinery/pkg/util/sets" ) // AsyncTracker helps propagate HasSynced in the face of multiple worker threads. type AsyncTracker[T comparable] struct { UpstreamHasSynced func() bool lock sync.Mutex waiting sets.Set[T] } // Start should be called prior to processing each key which is part of the // initial list. func (t *AsyncTracker[T]) Start(key T) { t.lock.Lock() defer t.lock.Unlock() if t.waiting == nil { t.waiting = sets.New[T](key) } else { t.waiting.Insert(key) } } // Finished should be called when finished processing a key which was part of // the initial list. Since keys are tracked individually, nothing bad happens // if you call Finished without a corresponding call to Start. This makes it // easier to use this in combination with e.g. queues which don't make it easy // to plumb through the isInInitialList boolean. func (t *AsyncTracker[T]) Finished(key T) { t.lock.Lock() defer t.lock.Unlock() if t.waiting != nil { t.waiting.Delete(key) } } // HasSynced returns true if the source is synced and every key present in the // initial list has been processed. This relies on the source not considering // itself synced until *after* it has delivered the notification for the last // key, and that notification handler must have called Start. func (t *AsyncTracker[T]) HasSynced() bool { // Call UpstreamHasSynced first: it might take a lock, which might take // a significant amount of time, and we can't hold our lock while // waiting on that or a user is likely to get a deadlock. if !t.UpstreamHasSynced() { return false } t.lock.Lock() defer t.lock.Unlock() return t.waiting.Len() == 0 } // SingleFileTracker helps propagate HasSynced when events are processed in // order (i.e. via a queue). type SingleFileTracker struct { // Important: count is used with atomic operations so it must be 64-bit // aligned, otherwise atomic operations will panic. Having it at the top of // the struct will guarantee that, even on 32-bit arches. // See https://pkg.go.dev/sync/atomic#pkg-note-BUG for more information. count int64 UpstreamHasSynced func() bool } // Start should be called prior to processing each key which is part of the // initial list. func (t *SingleFileTracker) Start() { atomic.AddInt64(&t.count, 1) } // Finished should be called when finished processing a key which was part of // the initial list. You must never call Finished() before (or without) its // corresponding Start(), that is a logic error that could cause HasSynced to // return a wrong value. To help you notice this should it happen, Finished() // will panic if the internal counter goes negative. func (t *SingleFileTracker) Finished() { result := atomic.AddInt64(&t.count, -1) if result < 0 { panic("synctrack: negative counter; this logic error means HasSynced may return incorrect value") } } // HasSynced returns true if the source is synced and every key present in the // initial list has been processed. This relies on the source not considering // itself synced until *after* it has delivered the notification for the last // key, and that notification handler must have called Start. func (t *SingleFileTracker) HasSynced() bool { // Call UpstreamHasSynced first: it might take a lock, which might take // a significant amount of time, and we don't want to then act on a // stale count value. if !t.UpstreamHasSynced() { return false } return atomic.LoadInt64(&t.count) <= 0 }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/metrics/metrics.go
vendor/k8s.io/client-go/tools/metrics/metrics.go
/* Copyright 2015 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 metrics provides abstractions for registering which metrics // to record. package metrics import ( "context" "net/url" "sync" "time" ) var registerMetrics sync.Once // DurationMetric is a measurement of some amount of time. type DurationMetric interface { Observe(duration time.Duration) } // ExpiryMetric sets some time of expiry. If nil, assume not relevant. type ExpiryMetric interface { Set(expiry *time.Time) } // LatencyMetric observes client latency partitioned by verb and url. type LatencyMetric interface { Observe(ctx context.Context, verb string, u url.URL, latency time.Duration) } type ResolverLatencyMetric interface { Observe(ctx context.Context, host string, latency time.Duration) } // SizeMetric observes client response size partitioned by verb and host. type SizeMetric interface { Observe(ctx context.Context, verb string, host string, size float64) } // ResultMetric counts response codes partitioned by method and host. type ResultMetric interface { Increment(ctx context.Context, code string, method string, host string) } // CallsMetric counts calls that take place for a specific exec plugin. type CallsMetric interface { // Increment increments a counter per exitCode and callStatus. Increment(exitCode int, callStatus string) } // RetryMetric counts the number of retries sent to the server // partitioned by code, method, and host. type RetryMetric interface { IncrementRetry(ctx context.Context, code string, method string, host string) } // TransportCacheMetric shows the number of entries in the internal transport cache type TransportCacheMetric interface { Observe(value int) } // TransportCreateCallsMetric counts the number of times a transport is created // partitioned by the result of the cache: hit, miss, uncacheable type TransportCreateCallsMetric interface { Increment(result string) } var ( // ClientCertExpiry is the expiry time of a client certificate ClientCertExpiry ExpiryMetric = noopExpiry{} // ClientCertRotationAge is the age of a certificate that has just been rotated. ClientCertRotationAge DurationMetric = noopDuration{} // RequestLatency is the latency metric that rest clients will update. RequestLatency LatencyMetric = noopLatency{} // ResolverLatency is the latency metric that DNS resolver will update ResolverLatency ResolverLatencyMetric = noopResolverLatency{} // RequestSize is the request size metric that rest clients will update. RequestSize SizeMetric = noopSize{} // ResponseSize is the response size metric that rest clients will update. ResponseSize SizeMetric = noopSize{} // RateLimiterLatency is the client side rate limiter latency metric. RateLimiterLatency LatencyMetric = noopLatency{} // RequestResult is the result metric that rest clients will update. RequestResult ResultMetric = noopResult{} // ExecPluginCalls is the number of calls made to an exec plugin, partitioned by // exit code and call status. ExecPluginCalls CallsMetric = noopCalls{} // RequestRetry is the retry metric that tracks the number of // retries sent to the server. RequestRetry RetryMetric = noopRetry{} // TransportCacheEntries is the metric that tracks the number of entries in the // internal transport cache. TransportCacheEntries TransportCacheMetric = noopTransportCache{} // TransportCreateCalls is the metric that counts the number of times a new transport // is created TransportCreateCalls TransportCreateCallsMetric = noopTransportCreateCalls{} ) // RegisterOpts contains all the metrics to register. Metrics may be nil. type RegisterOpts struct { ClientCertExpiry ExpiryMetric ClientCertRotationAge DurationMetric RequestLatency LatencyMetric ResolverLatency ResolverLatencyMetric RequestSize SizeMetric ResponseSize SizeMetric RateLimiterLatency LatencyMetric RequestResult ResultMetric ExecPluginCalls CallsMetric RequestRetry RetryMetric TransportCacheEntries TransportCacheMetric TransportCreateCalls TransportCreateCallsMetric } // Register registers metrics for the rest client to use. This can // only be called once. func Register(opts RegisterOpts) { registerMetrics.Do(func() { if opts.ClientCertExpiry != nil { ClientCertExpiry = opts.ClientCertExpiry } if opts.ClientCertRotationAge != nil { ClientCertRotationAge = opts.ClientCertRotationAge } if opts.RequestLatency != nil { RequestLatency = opts.RequestLatency } if opts.ResolverLatency != nil { ResolverLatency = opts.ResolverLatency } if opts.RequestSize != nil { RequestSize = opts.RequestSize } if opts.ResponseSize != nil { ResponseSize = opts.ResponseSize } if opts.RateLimiterLatency != nil { RateLimiterLatency = opts.RateLimiterLatency } if opts.RequestResult != nil { RequestResult = opts.RequestResult } if opts.ExecPluginCalls != nil { ExecPluginCalls = opts.ExecPluginCalls } if opts.RequestRetry != nil { RequestRetry = opts.RequestRetry } if opts.TransportCacheEntries != nil { TransportCacheEntries = opts.TransportCacheEntries } if opts.TransportCreateCalls != nil { TransportCreateCalls = opts.TransportCreateCalls } }) } type noopDuration struct{} func (noopDuration) Observe(time.Duration) {} type noopExpiry struct{} func (noopExpiry) Set(*time.Time) {} type noopLatency struct{} func (noopLatency) Observe(context.Context, string, url.URL, time.Duration) {} type noopResolverLatency struct{} func (n noopResolverLatency) Observe(ctx context.Context, host string, latency time.Duration) { } type noopSize struct{} func (noopSize) Observe(context.Context, string, string, float64) {} type noopResult struct{} func (noopResult) Increment(context.Context, string, string, string) {} type noopCalls struct{} func (noopCalls) Increment(int, string) {} type noopRetry struct{} func (noopRetry) IncrementRetry(context.Context, string, string, string) {} type noopTransportCache struct{} func (noopTransportCache) Observe(int) {} type noopTransportCreateCalls struct{} func (noopTransportCreateCalls) Increment(string) {}
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/record/fake.go
vendor/k8s.io/client-go/tools/record/fake.go
/* Copyright 2015 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 record import ( "fmt" "k8s.io/apimachinery/pkg/runtime" "k8s.io/klog/v2" ) // FakeRecorder is used as a fake during tests. It is thread safe. It is usable // when created manually and not by NewFakeRecorder, however all events may be // thrown away in this case. type FakeRecorder struct { Events chan string IncludeObject bool } var _ EventRecorderLogger = &FakeRecorder{} func objectString(object runtime.Object, includeObject bool) string { if !includeObject { return "" } return fmt.Sprintf(" involvedObject{kind=%s,apiVersion=%s}", object.GetObjectKind().GroupVersionKind().Kind, object.GetObjectKind().GroupVersionKind().GroupVersion(), ) } func annotationsString(annotations map[string]string) string { if len(annotations) == 0 { return "" } else { return " " + fmt.Sprint(annotations) } } func (f *FakeRecorder) writeEvent(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{}) { if f.Events != nil { f.Events <- fmt.Sprintf(eventtype+" "+reason+" "+messageFmt, args...) + objectString(object, f.IncludeObject) + annotationsString(annotations) } } func (f *FakeRecorder) Event(object runtime.Object, eventtype, reason, message string) { f.writeEvent(object, nil, eventtype, reason, "%s", message) } func (f *FakeRecorder) Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{}) { f.writeEvent(object, nil, eventtype, reason, messageFmt, args...) } func (f *FakeRecorder) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{}) { f.writeEvent(object, annotations, eventtype, reason, messageFmt, args...) } func (f *FakeRecorder) WithLogger(logger klog.Logger) EventRecorderLogger { return f } // NewFakeRecorder creates new fake event recorder with event channel with // buffer of given size. func NewFakeRecorder(bufferSize int) *FakeRecorder { return &FakeRecorder{ Events: make(chan string, bufferSize), } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/record/event.go
vendor/k8s.io/client-go/tools/record/event.go
/* Copyright 2014 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 record import ( "context" "fmt" "math/rand" "time" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/watch" restclient "k8s.io/client-go/rest" internalevents "k8s.io/client-go/tools/internal/events" "k8s.io/client-go/tools/record/util" ref "k8s.io/client-go/tools/reference" "k8s.io/klog/v2" "k8s.io/utils/clock" ) const maxTriesPerEvent = 12 var defaultSleepDuration = 10 * time.Second const maxQueuedEvents = 1000 // EventSink knows how to store events (client.Client implements it.) // EventSink must respect the namespace that will be embedded in 'event'. // It is assumed that EventSink will return the same sorts of errors as // pkg/client's REST client. type EventSink interface { Create(event *v1.Event) (*v1.Event, error) Update(event *v1.Event) (*v1.Event, error) Patch(oldEvent *v1.Event, data []byte) (*v1.Event, error) } // CorrelatorOptions allows you to change the default of the EventSourceObjectSpamFilter // and EventAggregator in EventCorrelator type CorrelatorOptions struct { // The lru cache size used for both EventSourceObjectSpamFilter and the EventAggregator // If not specified (zero value), the default specified in events_cache.go will be picked // This means that the LRUCacheSize has to be greater than 0. LRUCacheSize int // The burst size used by the token bucket rate filtering in EventSourceObjectSpamFilter // If not specified (zero value), the default specified in events_cache.go will be picked // This means that the BurstSize has to be greater than 0. BurstSize int // The fill rate of the token bucket in queries per second in EventSourceObjectSpamFilter // If not specified (zero value), the default specified in events_cache.go will be picked // This means that the QPS has to be greater than 0. QPS float32 // The func used by the EventAggregator to group event keys for aggregation // If not specified (zero value), EventAggregatorByReasonFunc will be used KeyFunc EventAggregatorKeyFunc // The func used by the EventAggregator to produced aggregated message // If not specified (zero value), EventAggregatorByReasonMessageFunc will be used MessageFunc EventAggregatorMessageFunc // The number of events in an interval before aggregation happens by the EventAggregator // If not specified (zero value), the default specified in events_cache.go will be picked // This means that the MaxEvents has to be greater than 0 MaxEvents int // The amount of time in seconds that must transpire since the last occurrence of a similar event before it is considered new by the EventAggregator // If not specified (zero value), the default specified in events_cache.go will be picked // This means that the MaxIntervalInSeconds has to be greater than 0 MaxIntervalInSeconds int // The clock used by the EventAggregator to allow for testing // If not specified (zero value), clock.RealClock{} will be used Clock clock.PassiveClock // The func used by EventFilterFunc, which returns a key for given event, based on which filtering will take place // If not specified (zero value), getSpamKey will be used SpamKeyFunc EventSpamKeyFunc } // EventRecorder knows how to record events on behalf of an EventSource. type EventRecorder interface { // Event constructs an event from the given information and puts it in the queue for sending. // 'object' is the object this event is about. Event will make a reference-- or you may also // pass a reference to the object directly. // 'eventtype' of this event, and can be one of Normal, Warning. New types could be added in future // 'reason' is the reason this event is generated. 'reason' should be short and unique; it // should be in UpperCamelCase format (starting with a capital letter). "reason" will be used // to automate handling of events, so imagine people writing switch statements to handle them. // You want to make that easy. // 'message' is intended to be human readable. // // The resulting event will be created in the same namespace as the reference object. Event(object runtime.Object, eventtype, reason, message string) // Eventf is just like Event, but with Sprintf for the message field. Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{}) // AnnotatedEventf is just like eventf, but with annotations attached AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{}) } // EventRecorderLogger extends EventRecorder such that a logger can // be set for methods in EventRecorder. Normally, those methods // uses the global default logger to record errors and debug messages. // If that is not desired, use WithLogger to provide a logger instance. type EventRecorderLogger interface { EventRecorder // WithLogger replaces the context used for logging. This is a cheap call // and meant to be used for contextual logging: // recorder := ... // logger := klog.FromContext(ctx) // recorder.WithLogger(logger).Eventf(...) WithLogger(logger klog.Logger) EventRecorderLogger } // EventBroadcaster knows how to receive events and send them to any EventSink, watcher, or log. type EventBroadcaster interface { // StartEventWatcher starts sending events received from this EventBroadcaster to the given // event handler function. The return value can be ignored or used to stop recording, if // desired. StartEventWatcher(eventHandler func(*v1.Event)) watch.Interface // StartRecordingToSink starts sending events received from this EventBroadcaster to the given // sink. The return value can be ignored or used to stop recording, if desired. StartRecordingToSink(sink EventSink) watch.Interface // StartLogging starts sending events received from this EventBroadcaster to the given logging // function. The return value can be ignored or used to stop recording, if desired. StartLogging(logf func(format string, args ...interface{})) watch.Interface // StartStructuredLogging starts sending events received from this EventBroadcaster to the structured // logging function. The return value can be ignored or used to stop recording, if desired. StartStructuredLogging(verbosity klog.Level) watch.Interface // NewRecorder returns an EventRecorder that can be used to send events to this EventBroadcaster // with the event source set to the given event source. NewRecorder(scheme *runtime.Scheme, source v1.EventSource) EventRecorderLogger // Shutdown shuts down the broadcaster. Once the broadcaster is shut // down, it will only try to record an event in a sink once before // giving up on it with an error message. Shutdown() } // EventRecorderAdapter is a wrapper around a "k8s.io/client-go/tools/record".EventRecorder // implementing the new "k8s.io/client-go/tools/events".EventRecorder interface. type EventRecorderAdapter struct { recorder EventRecorderLogger } var _ internalevents.EventRecorder = &EventRecorderAdapter{} // NewEventRecorderAdapter returns an adapter implementing the new // "k8s.io/client-go/tools/events".EventRecorder interface. func NewEventRecorderAdapter(recorder EventRecorderLogger) *EventRecorderAdapter { return &EventRecorderAdapter{ recorder: recorder, } } // Eventf is a wrapper around v1 Eventf func (a *EventRecorderAdapter) Eventf(regarding, _ runtime.Object, eventtype, reason, action, note string, args ...interface{}) { a.recorder.Eventf(regarding, eventtype, reason, note, args...) } func (a *EventRecorderAdapter) WithLogger(logger klog.Logger) internalevents.EventRecorderLogger { return &EventRecorderAdapter{ recorder: a.recorder.WithLogger(logger), } } // Creates a new event broadcaster. func NewBroadcaster(opts ...BroadcasterOption) EventBroadcaster { c := config{ sleepDuration: defaultSleepDuration, } for _, opt := range opts { opt(&c) } eventBroadcaster := &eventBroadcasterImpl{ Broadcaster: watch.NewLongQueueBroadcaster(maxQueuedEvents, watch.DropIfChannelFull), sleepDuration: c.sleepDuration, options: c.CorrelatorOptions, } ctx := c.Context if ctx == nil { ctx = context.Background() } // The are two scenarios where it makes no sense to wait for context cancelation: // - The context was nil. // - The context was context.Background() to begin with. // // Both cases get checked here: we have cancelation if (and only if) there is a channel. haveCtxCancelation := ctx.Done() != nil eventBroadcaster.cancelationCtx, eventBroadcaster.cancel = context.WithCancel(ctx) if haveCtxCancelation { // Calling Shutdown is not required when a context was provided: // when the context is canceled, this goroutine will shut down // the broadcaster. // // If Shutdown is called first, then this goroutine will // also stop. go func() { <-eventBroadcaster.cancelationCtx.Done() eventBroadcaster.Broadcaster.Shutdown() }() } return eventBroadcaster } func NewBroadcasterForTests(sleepDuration time.Duration) EventBroadcaster { return NewBroadcaster(WithSleepDuration(sleepDuration)) } func NewBroadcasterWithCorrelatorOptions(options CorrelatorOptions) EventBroadcaster { return NewBroadcaster(WithCorrelatorOptions(options)) } func WithCorrelatorOptions(options CorrelatorOptions) BroadcasterOption { return func(c *config) { c.CorrelatorOptions = options } } // WithContext sets a context for the broadcaster. Canceling the context will // shut down the broadcaster, Shutdown doesn't need to be called. The context // can also be used to provide a logger. func WithContext(ctx context.Context) BroadcasterOption { return func(c *config) { c.Context = ctx } } func WithSleepDuration(sleepDuration time.Duration) BroadcasterOption { return func(c *config) { c.sleepDuration = sleepDuration } } type BroadcasterOption func(*config) type config struct { CorrelatorOptions context.Context sleepDuration time.Duration } type eventBroadcasterImpl struct { *watch.Broadcaster sleepDuration time.Duration options CorrelatorOptions cancelationCtx context.Context cancel func() } // StartRecordingToSink starts sending events received from the specified eventBroadcaster to the given sink. // The return value can be ignored or used to stop recording, if desired. // TODO: make me an object with parameterizable queue length and retry interval func (e *eventBroadcasterImpl) StartRecordingToSink(sink EventSink) watch.Interface { eventCorrelator := NewEventCorrelatorWithOptions(e.options) return e.StartEventWatcher( func(event *v1.Event) { e.recordToSink(sink, event, eventCorrelator) }) } func (e *eventBroadcasterImpl) Shutdown() { e.Broadcaster.Shutdown() e.cancel() } func (e *eventBroadcasterImpl) recordToSink(sink EventSink, event *v1.Event, eventCorrelator *EventCorrelator) { // Make a copy before modification, because there could be multiple listeners. // Events are safe to copy like this. eventCopy := *event event = &eventCopy result, err := eventCorrelator.EventCorrelate(event) if err != nil { utilruntime.HandleError(err) } if result.Skip { return } tries := 0 for { if recordEvent(e.cancelationCtx, sink, result.Event, result.Patch, result.Event.Count > 1, eventCorrelator) { break } tries++ if tries >= maxTriesPerEvent { klog.FromContext(e.cancelationCtx).Error(nil, "Unable to write event (retry limit exceeded!)", "event", event) break } // Randomize the first sleep so that various clients won't all be // synced up if the master goes down. delay := e.sleepDuration if tries == 1 { delay = time.Duration(float64(delay) * rand.Float64()) } select { case <-e.cancelationCtx.Done(): klog.FromContext(e.cancelationCtx).Error(nil, "Unable to write event (broadcaster is shut down)", "event", event) return case <-time.After(delay): } } } // recordEvent attempts to write event to a sink. It returns true if the event // was successfully recorded or discarded, false if it should be retried. // If updateExistingEvent is false, it creates a new event, otherwise it updates // existing event. func recordEvent(ctx context.Context, sink EventSink, event *v1.Event, patch []byte, updateExistingEvent bool, eventCorrelator *EventCorrelator) bool { var newEvent *v1.Event var err error if updateExistingEvent { newEvent, err = sink.Patch(event, patch) } // Update can fail because the event may have been removed and it no longer exists. if !updateExistingEvent || (updateExistingEvent && util.IsKeyNotFoundError(err)) { // Making sure that ResourceVersion is empty on creation event.ResourceVersion = "" newEvent, err = sink.Create(event) } if err == nil { // we need to update our event correlator with the server returned state to handle name/resourceversion eventCorrelator.UpdateState(newEvent) return true } // If we can't contact the server, then hold everything while we keep trying. // Otherwise, something about the event is malformed and we should abandon it. switch err.(type) { case *restclient.RequestConstructionError: // We will construct the request the same next time, so don't keep trying. klog.FromContext(ctx).Error(err, "Unable to construct event (will not retry!)", "event", event) return true case *errors.StatusError: if errors.IsAlreadyExists(err) || errors.HasStatusCause(err, v1.NamespaceTerminatingCause) { klog.FromContext(ctx).V(5).Info("Server rejected event (will not retry!)", "event", event, "err", err) } else { klog.FromContext(ctx).Error(err, "Server rejected event (will not retry!)", "event", event) } return true case *errors.UnexpectedObjectError: // We don't expect this; it implies the server's response didn't match a // known pattern. Go ahead and retry. default: // This case includes actual http transport errors. Go ahead and retry. } klog.FromContext(ctx).Error(err, "Unable to write event (may retry after sleeping)", "event", event) return false } // StartLogging starts sending events received from this EventBroadcaster to the given logging function. // The return value can be ignored or used to stop recording, if desired. func (e *eventBroadcasterImpl) StartLogging(logf func(format string, args ...interface{})) watch.Interface { return e.StartEventWatcher( func(e *v1.Event) { logf("Event(%#v): type: '%v' reason: '%v' %v", e.InvolvedObject, e.Type, e.Reason, e.Message) }) } // StartStructuredLogging starts sending events received from this EventBroadcaster to a structured logger. // The logger is retrieved from a context if the broadcaster was constructed with a context, otherwise // the global default is used. // The return value can be ignored or used to stop recording, if desired. func (e *eventBroadcasterImpl) StartStructuredLogging(verbosity klog.Level) watch.Interface { loggerV := klog.FromContext(e.cancelationCtx).V(int(verbosity)) return e.StartEventWatcher( func(e *v1.Event) { loggerV.Info("Event occurred", "object", klog.KRef(e.InvolvedObject.Namespace, e.InvolvedObject.Name), "fieldPath", e.InvolvedObject.FieldPath, "kind", e.InvolvedObject.Kind, "apiVersion", e.InvolvedObject.APIVersion, "type", e.Type, "reason", e.Reason, "message", e.Message) }) } // StartEventWatcher starts sending events received from this EventBroadcaster to the given event handler function. // The return value can be ignored or used to stop recording, if desired. func (e *eventBroadcasterImpl) StartEventWatcher(eventHandler func(*v1.Event)) watch.Interface { watcher, err := e.Watch() if err != nil { // This function traditionally returns no error even though it can fail. // Instead, it logs the error and returns an empty watch. The empty // watch ensures that callers don't crash when calling Stop. klog.FromContext(e.cancelationCtx).Error(err, "Unable start event watcher (will not retry!)") return watch.NewEmptyWatch() } go func() { defer utilruntime.HandleCrash() for { select { case <-e.cancelationCtx.Done(): watcher.Stop() return case watchEvent := <-watcher.ResultChan(): event, ok := watchEvent.Object.(*v1.Event) if !ok { // This is all local, so there's no reason this should // ever happen. continue } eventHandler(event) } } }() return watcher } // NewRecorder returns an EventRecorder that records events with the given event source. func (e *eventBroadcasterImpl) NewRecorder(scheme *runtime.Scheme, source v1.EventSource) EventRecorderLogger { return &recorderImplLogger{recorderImpl: &recorderImpl{scheme, source, e.Broadcaster, clock.RealClock{}}, logger: klog.Background()} } type recorderImpl struct { scheme *runtime.Scheme source v1.EventSource *watch.Broadcaster clock clock.PassiveClock } var _ EventRecorder = &recorderImpl{} func (recorder *recorderImpl) generateEvent(logger klog.Logger, object runtime.Object, annotations map[string]string, eventtype, reason, message string) { ref, err := ref.GetReference(recorder.scheme, object) if err != nil { logger.Error(err, "Could not construct reference, will not report event", "object", object, "eventType", eventtype, "reason", reason, "message", message) return } if !util.ValidateEventType(eventtype) { logger.Error(nil, "Unsupported event type", "eventType", eventtype) return } event := recorder.makeEvent(ref, annotations, eventtype, reason, message) event.Source = recorder.source event.ReportingInstance = recorder.source.Host event.ReportingController = recorder.source.Component // NOTE: events should be a non-blocking operation, but we also need to not // put this in a goroutine, otherwise we'll race to write to a closed channel // when we go to shut down this broadcaster. Just drop events if we get overloaded, // and log an error if that happens (we've configured the broadcaster to drop // outgoing events anyway). sent, err := recorder.ActionOrDrop(watch.Added, event) if err != nil { logger.Error(err, "Unable to record event (will not retry!)") return } if !sent { logger.Error(nil, "Unable to record event: too many queued events, dropped event", "event", event) } } func (recorder *recorderImpl) Event(object runtime.Object, eventtype, reason, message string) { recorder.generateEvent(klog.Background(), object, nil, eventtype, reason, message) } func (recorder *recorderImpl) Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{}) { recorder.Event(object, eventtype, reason, fmt.Sprintf(messageFmt, args...)) } func (recorder *recorderImpl) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{}) { recorder.generateEvent(klog.Background(), object, annotations, eventtype, reason, fmt.Sprintf(messageFmt, args...)) } func (recorder *recorderImpl) makeEvent(ref *v1.ObjectReference, annotations map[string]string, eventtype, reason, message string) *v1.Event { t := metav1.Time{Time: recorder.clock.Now()} namespace := ref.Namespace if namespace == "" { namespace = metav1.NamespaceDefault } return &v1.Event{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("%v.%x", ref.Name, t.UnixNano()), Namespace: namespace, Annotations: annotations, }, InvolvedObject: *ref, Reason: reason, Message: message, FirstTimestamp: t, LastTimestamp: t, Count: 1, Type: eventtype, } } type recorderImplLogger struct { *recorderImpl logger klog.Logger } var _ EventRecorderLogger = &recorderImplLogger{} func (recorder recorderImplLogger) Event(object runtime.Object, eventtype, reason, message string) { recorder.recorderImpl.generateEvent(recorder.logger, object, nil, eventtype, reason, message) } func (recorder recorderImplLogger) Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{}) { recorder.Event(object, eventtype, reason, fmt.Sprintf(messageFmt, args...)) } func (recorder recorderImplLogger) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{}) { recorder.generateEvent(recorder.logger, object, annotations, eventtype, reason, fmt.Sprintf(messageFmt, args...)) } func (recorder recorderImplLogger) WithLogger(logger klog.Logger) EventRecorderLogger { return recorderImplLogger{recorderImpl: recorder.recorderImpl, logger: logger} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/record/events_cache.go
vendor/k8s.io/client-go/tools/record/events_cache.go
/* Copyright 2015 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 record import ( "encoding/json" "fmt" "strings" "sync" "time" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/client-go/util/flowcontrol" "k8s.io/utils/clock" "k8s.io/utils/lru" ) const ( maxLruCacheEntries = 4096 // if we see the same event that varies only by message // more than 10 times in a 10 minute period, aggregate the event defaultAggregateMaxEvents = 10 defaultAggregateIntervalInSeconds = 600 // by default, allow a source to send 25 events about an object // but control the refill rate to 1 new event every 5 minutes // this helps control the long-tail of events for things that are always // unhealthy defaultSpamBurst = 25 defaultSpamQPS = 1. / 300. ) // getEventKey builds unique event key based on source, involvedObject, reason, message func getEventKey(event *v1.Event) string { return strings.Join([]string{ event.Source.Component, event.Source.Host, event.InvolvedObject.Kind, event.InvolvedObject.Namespace, event.InvolvedObject.Name, event.InvolvedObject.FieldPath, string(event.InvolvedObject.UID), event.InvolvedObject.APIVersion, event.Type, event.Reason, event.Message, }, "") } // getSpamKey builds unique event key based on source, involvedObject func getSpamKey(event *v1.Event) string { return strings.Join([]string{ event.Source.Component, event.Source.Host, event.InvolvedObject.Kind, event.InvolvedObject.Namespace, event.InvolvedObject.Name, string(event.InvolvedObject.UID), event.InvolvedObject.APIVersion, event.Type, }, "") } // EventSpamKeyFunc is a function that returns unique key based on provided event type EventSpamKeyFunc func(event *v1.Event) string // EventFilterFunc is a function that returns true if the event should be skipped type EventFilterFunc func(event *v1.Event) bool // EventSourceObjectSpamFilter is responsible for throttling // the amount of events a source and object can produce. type EventSourceObjectSpamFilter struct { // the cache that manages last synced state cache *lru.Cache // burst is the amount of events we allow per source + object burst int // qps is the refill rate of the token bucket in queries per second qps float32 // clock is used to allow for testing over a time interval clock clock.PassiveClock // spamKeyFunc is a func used to create a key based on an event, which is later used to filter spam events. spamKeyFunc EventSpamKeyFunc } // NewEventSourceObjectSpamFilter allows burst events from a source about an object with the specified qps refill. func NewEventSourceObjectSpamFilter(lruCacheSize, burst int, qps float32, clock clock.PassiveClock, spamKeyFunc EventSpamKeyFunc) *EventSourceObjectSpamFilter { return &EventSourceObjectSpamFilter{ cache: lru.New(lruCacheSize), burst: burst, qps: qps, clock: clock, spamKeyFunc: spamKeyFunc, } } // spamRecord holds data used to perform spam filtering decisions. type spamRecord struct { // rateLimiter controls the rate of events about this object rateLimiter flowcontrol.PassiveRateLimiter } // Filter controls that a given source+object are not exceeding the allowed rate. func (f *EventSourceObjectSpamFilter) Filter(event *v1.Event) bool { var record spamRecord // controls our cached information about this event eventKey := f.spamKeyFunc(event) // do we have a record of similar events in our cache? value, found := f.cache.Get(eventKey) if found { record = value.(spamRecord) } // verify we have a rate limiter for this record if record.rateLimiter == nil { record.rateLimiter = flowcontrol.NewTokenBucketPassiveRateLimiterWithClock(f.qps, f.burst, f.clock) } // ensure we have available rate filter := !record.rateLimiter.TryAccept() // update the cache f.cache.Add(eventKey, record) return filter } // EventAggregatorKeyFunc is responsible for grouping events for aggregation // It returns a tuple of the following: // aggregateKey - key the identifies the aggregate group to bucket this event // localKey - key that makes this event in the local group type EventAggregatorKeyFunc func(event *v1.Event) (aggregateKey string, localKey string) // EventAggregatorByReasonFunc aggregates events by exact match on event.Source, event.InvolvedObject, event.Type, // event.Reason, event.ReportingController and event.ReportingInstance func EventAggregatorByReasonFunc(event *v1.Event) (string, string) { return strings.Join([]string{ event.Source.Component, event.Source.Host, event.InvolvedObject.Kind, event.InvolvedObject.Namespace, event.InvolvedObject.Name, string(event.InvolvedObject.UID), event.InvolvedObject.APIVersion, event.Type, event.Reason, event.ReportingController, event.ReportingInstance, }, ""), event.Message } // EventAggregatorMessageFunc is responsible for producing an aggregation message type EventAggregatorMessageFunc func(event *v1.Event) string // EventAggregatorByReasonMessageFunc returns an aggregate message by prefixing the incoming message func EventAggregatorByReasonMessageFunc(event *v1.Event) string { return "(combined from similar events): " + event.Message } // EventAggregator identifies similar events and aggregates them into a single event type EventAggregator struct { sync.RWMutex // The cache that manages aggregation state cache *lru.Cache // The function that groups events for aggregation keyFunc EventAggregatorKeyFunc // The function that generates a message for an aggregate event messageFunc EventAggregatorMessageFunc // The maximum number of events in the specified interval before aggregation occurs maxEvents uint // The amount of time in seconds that must transpire since the last occurrence of a similar event before it's considered new maxIntervalInSeconds uint // clock is used to allow for testing over a time interval clock clock.PassiveClock } // NewEventAggregator returns a new instance of an EventAggregator func NewEventAggregator(lruCacheSize int, keyFunc EventAggregatorKeyFunc, messageFunc EventAggregatorMessageFunc, maxEvents int, maxIntervalInSeconds int, clock clock.PassiveClock) *EventAggregator { return &EventAggregator{ cache: lru.New(lruCacheSize), keyFunc: keyFunc, messageFunc: messageFunc, maxEvents: uint(maxEvents), maxIntervalInSeconds: uint(maxIntervalInSeconds), clock: clock, } } // aggregateRecord holds data used to perform aggregation decisions type aggregateRecord struct { // we track the number of unique local keys we have seen in the aggregate set to know when to actually aggregate // if the size of this set exceeds the max, we know we need to aggregate localKeys sets.String // The last time at which the aggregate was recorded lastTimestamp metav1.Time } // EventAggregate checks if a similar event has been seen according to the // aggregation configuration (max events, max interval, etc) and returns: // // - The (potentially modified) event that should be created // - The cache key for the event, for correlation purposes. This will be set to // the full key for normal events, and to the result of // EventAggregatorMessageFunc for aggregate events. func (e *EventAggregator) EventAggregate(newEvent *v1.Event) (*v1.Event, string) { now := metav1.NewTime(e.clock.Now()) var record aggregateRecord // eventKey is the full cache key for this event eventKey := getEventKey(newEvent) // aggregateKey is for the aggregate event, if one is needed. aggregateKey, localKey := e.keyFunc(newEvent) // Do we have a record of similar events in our cache? e.Lock() defer e.Unlock() value, found := e.cache.Get(aggregateKey) if found { record = value.(aggregateRecord) } // Is the previous record too old? If so, make a fresh one. Note: if we didn't // find a similar record, its lastTimestamp will be the zero value, so we // create a new one in that case. maxInterval := time.Duration(e.maxIntervalInSeconds) * time.Second interval := now.Time.Sub(record.lastTimestamp.Time) if interval > maxInterval { record = aggregateRecord{localKeys: sets.NewString()} } // Write the new event into the aggregation record and put it on the cache record.localKeys.Insert(localKey) record.lastTimestamp = now e.cache.Add(aggregateKey, record) // If we are not yet over the threshold for unique events, don't correlate them if uint(record.localKeys.Len()) < e.maxEvents { return newEvent, eventKey } // do not grow our local key set any larger than max record.localKeys.PopAny() // create a new aggregate event, and return the aggregateKey as the cache key // (so that it can be overwritten.) eventCopy := &v1.Event{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("%v.%x", newEvent.InvolvedObject.Name, now.UnixNano()), Namespace: newEvent.Namespace, }, Count: 1, FirstTimestamp: now, InvolvedObject: newEvent.InvolvedObject, LastTimestamp: now, Message: e.messageFunc(newEvent), Type: newEvent.Type, Reason: newEvent.Reason, Source: newEvent.Source, } return eventCopy, aggregateKey } // eventLog records data about when an event was observed type eventLog struct { // The number of times the event has occurred since first occurrence. count uint // The time at which the event was first recorded. firstTimestamp metav1.Time // The unique name of the first occurrence of this event name string // Resource version returned from previous interaction with server resourceVersion string } // eventLogger logs occurrences of an event type eventLogger struct { sync.RWMutex cache *lru.Cache clock clock.PassiveClock } // newEventLogger observes events and counts their frequencies func newEventLogger(lruCacheEntries int, clock clock.PassiveClock) *eventLogger { return &eventLogger{cache: lru.New(lruCacheEntries), clock: clock} } // eventObserve records an event, or updates an existing one if key is a cache hit func (e *eventLogger) eventObserve(newEvent *v1.Event, key string) (*v1.Event, []byte, error) { var ( patch []byte err error ) eventCopy := *newEvent event := &eventCopy e.Lock() defer e.Unlock() // Check if there is an existing event we should update lastObservation := e.lastEventObservationFromCache(key) // If we found a result, prepare a patch if lastObservation.count > 0 { // update the event based on the last observation so patch will work as desired event.Name = lastObservation.name event.ResourceVersion = lastObservation.resourceVersion event.FirstTimestamp = lastObservation.firstTimestamp event.Count = int32(lastObservation.count) + 1 eventCopy2 := *event eventCopy2.Count = 0 eventCopy2.LastTimestamp = metav1.NewTime(time.Unix(0, 0)) eventCopy2.Message = "" newData, _ := json.Marshal(event) oldData, _ := json.Marshal(eventCopy2) patch, err = strategicpatch.CreateTwoWayMergePatch(oldData, newData, event) } // record our new observation e.cache.Add( key, eventLog{ count: uint(event.Count), firstTimestamp: event.FirstTimestamp, name: event.Name, resourceVersion: event.ResourceVersion, }, ) return event, patch, err } // updateState updates its internal tracking information based on latest server state func (e *eventLogger) updateState(event *v1.Event) { key := getEventKey(event) e.Lock() defer e.Unlock() // record our new observation e.cache.Add( key, eventLog{ count: uint(event.Count), firstTimestamp: event.FirstTimestamp, name: event.Name, resourceVersion: event.ResourceVersion, }, ) } // lastEventObservationFromCache returns the event from the cache, reads must be protected via external lock func (e *eventLogger) lastEventObservationFromCache(key string) eventLog { value, ok := e.cache.Get(key) if ok { observationValue, ok := value.(eventLog) if ok { return observationValue } } return eventLog{} } // EventCorrelator processes all incoming events and performs analysis to avoid overwhelming the system. It can filter all // incoming events to see if the event should be filtered from further processing. It can aggregate similar events that occur // frequently to protect the system from spamming events that are difficult for users to distinguish. It performs de-duplication // to ensure events that are observed multiple times are compacted into a single event with increasing counts. type EventCorrelator struct { // the function to filter the event filterFunc EventFilterFunc // the object that performs event aggregation aggregator *EventAggregator // the object that observes events as they come through logger *eventLogger } // EventCorrelateResult is the result of a Correlate type EventCorrelateResult struct { // the event after correlation Event *v1.Event // if provided, perform a strategic patch when updating the record on the server Patch []byte // if true, do no further processing of the event Skip bool } // NewEventCorrelator returns an EventCorrelator configured with default values. // // The EventCorrelator is responsible for event filtering, aggregating, and counting // prior to interacting with the API server to record the event. // // The default behavior is as follows: // - Aggregation is performed if a similar event is recorded 10 times // in a 10 minute rolling interval. A similar event is an event that varies only by // the Event.Message field. Rather than recording the precise event, aggregation // will create a new event whose message reports that it has combined events with // the same reason. // - Events are incrementally counted if the exact same event is encountered multiple // times. // - A source may burst 25 events about an object, but has a refill rate budget // per object of 1 event every 5 minutes to control long-tail of spam. func NewEventCorrelator(clock clock.PassiveClock) *EventCorrelator { cacheSize := maxLruCacheEntries spamFilter := NewEventSourceObjectSpamFilter(cacheSize, defaultSpamBurst, defaultSpamQPS, clock, getSpamKey) return &EventCorrelator{ filterFunc: spamFilter.Filter, aggregator: NewEventAggregator( cacheSize, EventAggregatorByReasonFunc, EventAggregatorByReasonMessageFunc, defaultAggregateMaxEvents, defaultAggregateIntervalInSeconds, clock), logger: newEventLogger(cacheSize, clock), } } func NewEventCorrelatorWithOptions(options CorrelatorOptions) *EventCorrelator { optionsWithDefaults := populateDefaults(options) spamFilter := NewEventSourceObjectSpamFilter( optionsWithDefaults.LRUCacheSize, optionsWithDefaults.BurstSize, optionsWithDefaults.QPS, optionsWithDefaults.Clock, optionsWithDefaults.SpamKeyFunc) return &EventCorrelator{ filterFunc: spamFilter.Filter, aggregator: NewEventAggregator( optionsWithDefaults.LRUCacheSize, optionsWithDefaults.KeyFunc, optionsWithDefaults.MessageFunc, optionsWithDefaults.MaxEvents, optionsWithDefaults.MaxIntervalInSeconds, optionsWithDefaults.Clock), logger: newEventLogger(optionsWithDefaults.LRUCacheSize, optionsWithDefaults.Clock), } } // populateDefaults populates the zero value options with defaults func populateDefaults(options CorrelatorOptions) CorrelatorOptions { if options.LRUCacheSize == 0 { options.LRUCacheSize = maxLruCacheEntries } if options.BurstSize == 0 { options.BurstSize = defaultSpamBurst } if options.QPS == 0 { options.QPS = defaultSpamQPS } if options.KeyFunc == nil { options.KeyFunc = EventAggregatorByReasonFunc } if options.MessageFunc == nil { options.MessageFunc = EventAggregatorByReasonMessageFunc } if options.MaxEvents == 0 { options.MaxEvents = defaultAggregateMaxEvents } if options.MaxIntervalInSeconds == 0 { options.MaxIntervalInSeconds = defaultAggregateIntervalInSeconds } if options.Clock == nil { options.Clock = clock.RealClock{} } if options.SpamKeyFunc == nil { options.SpamKeyFunc = getSpamKey } return options } // EventCorrelate filters, aggregates, counts, and de-duplicates all incoming events func (c *EventCorrelator) EventCorrelate(newEvent *v1.Event) (*EventCorrelateResult, error) { if newEvent == nil { return nil, fmt.Errorf("event is nil") } aggregateEvent, ckey := c.aggregator.EventAggregate(newEvent) observedEvent, patch, err := c.logger.eventObserve(aggregateEvent, ckey) if c.filterFunc(observedEvent) { return &EventCorrelateResult{Skip: true}, nil } return &EventCorrelateResult{Event: observedEvent, Patch: patch}, err } // UpdateState based on the latest observed state from server func (c *EventCorrelator) UpdateState(event *v1.Event) { c.logger.updateState(event) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/record/doc.go
vendor/k8s.io/client-go/tools/record/doc.go
/* Copyright 2014 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 record has all client logic for recording and reporting // "k8s.io/api/core/v1".Event events. package record // import "k8s.io/client-go/tools/record"
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/record/util/util.go
vendor/k8s.io/client-go/tools/record/util/util.go
/* Copyright 2019 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 util import ( "net/http" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" ) // ValidateEventType checks that eventtype is an expected type of event func ValidateEventType(eventtype string) bool { switch eventtype { case v1.EventTypeNormal, v1.EventTypeWarning: return true } return false } // IsKeyNotFoundError is utility function that checks if an error is not found error func IsKeyNotFoundError(err error) bool { statusErr, _ := err.(*errors.StatusError) return statusErr != nil && statusErr.Status().Code == http.StatusNotFound }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/reference/ref.go
vendor/k8s.io/client-go/tools/reference/ref.go
/* Copyright 2014 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 reference import ( "errors" "fmt" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" ) var ( // Errors that could be returned by GetReference. ErrNilObject = errors.New("can't reference a nil object") ) // GetReference returns an ObjectReference which refers to the given // object, or an error if the object doesn't follow the conventions // that would allow this. // TODO: should take a meta.Interface see https://issue.k8s.io/7127 func GetReference(scheme *runtime.Scheme, obj runtime.Object) (*v1.ObjectReference, error) { if obj == nil { return nil, ErrNilObject } if ref, ok := obj.(*v1.ObjectReference); ok { // Don't make a reference to a reference. return ref, nil } // An object that implements only List has enough metadata to build a reference var listMeta metav1.Common objectMeta, err := meta.Accessor(obj) if err != nil { listMeta, err = meta.CommonAccessor(obj) if err != nil { return nil, err } } else { listMeta = objectMeta } gvk := obj.GetObjectKind().GroupVersionKind() // If object meta doesn't contain data about kind and/or version, // we are falling back to scheme. // // TODO: This doesn't work for CRDs, which are not registered in scheme. if gvk.Empty() { gvks, _, err := scheme.ObjectKinds(obj) if err != nil { return nil, err } if len(gvks) == 0 || gvks[0].Empty() { return nil, fmt.Errorf("unexpected gvks registered for object %T: %v", obj, gvks) } // TODO: The same object can be registered for multiple group versions // (although in practise this doesn't seem to be used). // In such case, the version set may not be correct. gvk = gvks[0] } kind := gvk.Kind version := gvk.GroupVersion().String() // only has list metadata if objectMeta == nil { return &v1.ObjectReference{ Kind: kind, APIVersion: version, ResourceVersion: listMeta.GetResourceVersion(), }, nil } return &v1.ObjectReference{ Kind: kind, APIVersion: version, Name: objectMeta.GetName(), Namespace: objectMeta.GetNamespace(), UID: objectMeta.GetUID(), ResourceVersion: objectMeta.GetResourceVersion(), }, nil } // GetPartialReference is exactly like GetReference, but allows you to set the FieldPath. func GetPartialReference(scheme *runtime.Scheme, obj runtime.Object, fieldPath string) (*v1.ObjectReference, error) { ref, err := GetReference(scheme, obj) if err != nil { return nil, err } ref.FieldPath = fieldPath return ref, nil }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/fallback.go
vendor/k8s.io/client-go/tools/remotecommand/fallback.go
/* Copyright 2023 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 remotecommand import ( "context" "k8s.io/klog/v2" ) var _ Executor = &FallbackExecutor{} type FallbackExecutor struct { primary Executor secondary Executor shouldFallback func(error) bool } // NewFallbackExecutor creates an Executor that first attempts to use the // WebSocketExecutor, falling back to the legacy SPDYExecutor if the initial // websocket "StreamWithContext" call fails. // func NewFallbackExecutor(config *restclient.Config, method string, url *url.URL) (Executor, error) { func NewFallbackExecutor(primary, secondary Executor, shouldFallback func(error) bool) (Executor, error) { return &FallbackExecutor{ primary: primary, secondary: secondary, shouldFallback: shouldFallback, }, nil } // Stream is deprecated. Please use "StreamWithContext". func (f *FallbackExecutor) Stream(options StreamOptions) error { return f.StreamWithContext(context.Background(), options) } // StreamWithContext initially attempts to call "StreamWithContext" using the // primary executor, falling back to calling the secondary executor if the // initial primary call to upgrade to a websocket connection fails. func (f *FallbackExecutor) StreamWithContext(ctx context.Context, options StreamOptions) error { err := f.primary.StreamWithContext(ctx, options) if f.shouldFallback(err) { klog.V(4).Infof("RemoteCommand fallback: %v", err) return f.secondary.StreamWithContext(ctx, options) } return err }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/v4.go
vendor/k8s.io/client-go/tools/remotecommand/v4.go
/* Copyright 2016 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 remotecommand import ( "encoding/json" "errors" "fmt" "strconv" "sync" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/remotecommand" "k8s.io/client-go/util/exec" ) // streamProtocolV4 implements version 4 of the streaming protocol for attach // and exec. This version adds support for exit codes on the error stream through // the use of metav1.Status instead of plain text messages. type streamProtocolV4 struct { *streamProtocolV3 } var _ streamProtocolHandler = &streamProtocolV4{} func newStreamProtocolV4(options StreamOptions) streamProtocolHandler { return &streamProtocolV4{ streamProtocolV3: newStreamProtocolV3(options).(*streamProtocolV3), } } func (p *streamProtocolV4) createStreams(conn streamCreator) error { return p.streamProtocolV3.createStreams(conn) } func (p *streamProtocolV4) handleResizes() { p.streamProtocolV3.handleResizes() } func (p *streamProtocolV4) stream(conn streamCreator) error { if err := p.createStreams(conn); err != nil { return err } // now that all the streams have been created, proceed with reading & copying errorChan := watchErrorStream(p.errorStream, &errorDecoderV4{}) p.handleResizes() p.copyStdin() var wg sync.WaitGroup p.copyStdout(&wg) p.copyStderr(&wg) // we're waiting for stdout/stderr to finish copying wg.Wait() // waits for errorStream to finish reading with an error or nil return <-errorChan } // errorDecoderV4 interprets the json-marshaled metav1.Status on the error channel // and creates an exec.ExitError from it. type errorDecoderV4 struct{} func (d *errorDecoderV4) decode(message []byte) error { status := metav1.Status{} err := json.Unmarshal(message, &status) if err != nil { return fmt.Errorf("error stream protocol error: %v in %q", err, string(message)) } switch status.Status { case metav1.StatusSuccess: return nil case metav1.StatusFailure: if status.Reason == remotecommand.NonZeroExitCodeReason { if status.Details == nil { return errors.New("error stream protocol error: details must be set") } for i := range status.Details.Causes { c := &status.Details.Causes[i] if c.Type != remotecommand.ExitCodeCauseType { continue } rc, err := strconv.ParseUint(c.Message, 10, 8) if err != nil { return fmt.Errorf("error stream protocol error: invalid exit code value %q", c.Message) } return exec.CodeExitError{ Err: fmt.Errorf("command terminated with exit code %d", rc), Code: int(rc), } } return fmt.Errorf("error stream protocol error: no %s cause given", remotecommand.ExitCodeCauseType) } default: return errors.New("error stream protocol error: unknown error") } return errors.New(status.Message) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/v5.go
vendor/k8s.io/client-go/tools/remotecommand/v5.go
/* Copyright 2023 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 remotecommand // streamProtocolV5 add support for V5 of the remote command subprotocol. // For the streamProtocolHandler, this version is the same as V4. type streamProtocolV5 struct { *streamProtocolV4 } var _ streamProtocolHandler = &streamProtocolV5{} func newStreamProtocolV5(options StreamOptions) streamProtocolHandler { return &streamProtocolV5{ streamProtocolV4: newStreamProtocolV4(options).(*streamProtocolV4), } } func (p *streamProtocolV5) stream(conn streamCreator) error { return p.streamProtocolV4.stream(conn) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/errorstream.go
vendor/k8s.io/client-go/tools/remotecommand/errorstream.go
/* Copyright 2016 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 remotecommand import ( "fmt" "io" "k8s.io/apimachinery/pkg/util/runtime" ) // errorStreamDecoder interprets the data on the error channel and creates a go error object from it. type errorStreamDecoder interface { decode(message []byte) error } // watchErrorStream watches the errorStream for remote command error data, // decodes it with the given errorStreamDecoder, sends the decoded error (or nil if the remote // command exited successfully) to the returned error channel, and closes it. // This function returns immediately. func watchErrorStream(errorStream io.Reader, d errorStreamDecoder) chan error { errorChan := make(chan error) go func() { defer runtime.HandleCrash() message, err := io.ReadAll(errorStream) switch { case err != nil && err != io.EOF: errorChan <- fmt.Errorf("error reading from error stream: %s", err) case len(message) > 0: errorChan <- d.decode(message) default: errorChan <- nil } close(errorChan) }() return errorChan }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/websocket.go
vendor/k8s.io/client-go/tools/remotecommand/websocket.go
/* Copyright 2023 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 remotecommand import ( "context" "errors" "fmt" "io" "net" "net/http" "sync" "time" gwebsocket "github.com/gorilla/websocket" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/apimachinery/pkg/util/remotecommand" restclient "k8s.io/client-go/rest" "k8s.io/client-go/transport/websocket" "k8s.io/klog/v2" ) // writeDeadline defines the time that a client-side write to the websocket // connection must complete before an i/o timeout occurs. const writeDeadline = 60 * time.Second var ( _ Executor = &wsStreamExecutor{} _ streamCreator = &wsStreamCreator{} _ httpstream.Stream = &stream{} streamType2streamID = map[string]byte{ v1.StreamTypeStdin: remotecommand.StreamStdIn, v1.StreamTypeStdout: remotecommand.StreamStdOut, v1.StreamTypeStderr: remotecommand.StreamStdErr, v1.StreamTypeError: remotecommand.StreamErr, v1.StreamTypeResize: remotecommand.StreamResize, } ) const ( // pingPeriod defines how often a heartbeat "ping" message is sent. pingPeriod = 5 * time.Second // pingReadDeadline defines the time waiting for a response heartbeat // "pong" message before a timeout error occurs for websocket reading. // This duration must always be greater than the "pingPeriod". By defining // this deadline in terms of the ping period, we are essentially saying // we can drop "X" (e.g. 12) pings before firing the timeout. pingReadDeadline = (pingPeriod * 12) + (1 * time.Second) ) // wsStreamExecutor handles transporting standard shell streams over an httpstream connection. type wsStreamExecutor struct { transport http.RoundTripper upgrader websocket.ConnectionHolder method string url string // requested protocols in priority order (e.g. v5.channel.k8s.io before v4.channel.k8s.io). protocols []string // selected protocol from the handshake process; could be empty string if handshake fails. negotiated string // period defines how often a "ping" heartbeat message is sent to the other endpoint. heartbeatPeriod time.Duration // deadline defines the amount of time before "pong" response must be received. heartbeatDeadline time.Duration } func NewWebSocketExecutor(config *restclient.Config, method, url string) (Executor, error) { // Only supports V5 protocol for correct version skew functionality. // Previous api servers will proxy upgrade requests to legacy websocket // servers on container runtimes which support V1-V4. These legacy // websocket servers will not handle the new CLOSE signal. return NewWebSocketExecutorForProtocols(config, method, url, remotecommand.StreamProtocolV5Name) } // NewWebSocketExecutorForProtocols allows to execute commands via a WebSocket connection. func NewWebSocketExecutorForProtocols(config *restclient.Config, method, url string, protocols ...string) (Executor, error) { transport, upgrader, err := websocket.RoundTripperFor(config) if err != nil { return nil, fmt.Errorf("error creating websocket transports: %v", err) } return &wsStreamExecutor{ transport: transport, upgrader: upgrader, method: method, url: url, protocols: protocols, heartbeatPeriod: pingPeriod, heartbeatDeadline: pingReadDeadline, }, nil } // Deprecated: use StreamWithContext instead to avoid possible resource leaks. // See https://github.com/kubernetes/kubernetes/pull/103177 for details. func (e *wsStreamExecutor) Stream(options StreamOptions) error { return e.StreamWithContext(context.Background(), options) } // StreamWithContext upgrades an HTTPRequest to a WebSocket connection, and starts the various // goroutines to implement the necessary streams over the connection. The "options" parameter // defines which streams are requested. Returns an error if one occurred. This method is NOT // safe to run concurrently with the same executor (because of the state stored in the upgrader). func (e *wsStreamExecutor) StreamWithContext(ctx context.Context, options StreamOptions) error { req, err := http.NewRequestWithContext(ctx, e.method, e.url, nil) if err != nil { return err } conn, err := websocket.Negotiate(e.transport, e.upgrader, req, e.protocols...) if err != nil { return err } if conn == nil { panic(fmt.Errorf("websocket connection is nil")) } defer conn.Close() e.negotiated = conn.Subprotocol() klog.V(4).Infof("The subprotocol is %s", e.negotiated) var streamer streamProtocolHandler switch e.negotiated { case remotecommand.StreamProtocolV5Name: streamer = newStreamProtocolV5(options) case remotecommand.StreamProtocolV4Name: streamer = newStreamProtocolV4(options) case remotecommand.StreamProtocolV3Name: streamer = newStreamProtocolV3(options) case remotecommand.StreamProtocolV2Name: streamer = newStreamProtocolV2(options) case "": klog.V(4).Infof("The server did not negotiate a streaming protocol version. Falling back to %s", remotecommand.StreamProtocolV1Name) fallthrough case remotecommand.StreamProtocolV1Name: streamer = newStreamProtocolV1(options) } panicChan := make(chan any, 1) errorChan := make(chan error, 1) go func() { defer func() { if p := recover(); p != nil { panicChan <- p } }() creator := newWSStreamCreator(conn) go creator.readDemuxLoop( e.upgrader.DataBufferSize(), e.heartbeatPeriod, e.heartbeatDeadline, ) errorChan <- streamer.stream(creator) }() select { case p := <-panicChan: panic(p) case err := <-errorChan: return err case <-ctx.Done(): return ctx.Err() } } type wsStreamCreator struct { conn *gwebsocket.Conn // Protects writing to websocket connection; reading is lock-free connWriteLock sync.Mutex // map of stream id to stream; multiple streams read/write the connection streams map[byte]*stream streamsMu sync.Mutex // setStreamErr holds the error to return to anyone calling setStreams. // this is populated in closeAllStreamReaders setStreamErr error } func newWSStreamCreator(conn *gwebsocket.Conn) *wsStreamCreator { return &wsStreamCreator{ conn: conn, streams: map[byte]*stream{}, } } func (c *wsStreamCreator) getStream(id byte) *stream { c.streamsMu.Lock() defer c.streamsMu.Unlock() return c.streams[id] } func (c *wsStreamCreator) setStream(id byte, s *stream) error { c.streamsMu.Lock() defer c.streamsMu.Unlock() if c.setStreamErr != nil { return c.setStreamErr } c.streams[id] = s return nil } // CreateStream uses id from passed headers to create a stream over "c.conn" connection. // Returns a Stream structure or nil and an error if one occurred. func (c *wsStreamCreator) CreateStream(headers http.Header) (httpstream.Stream, error) { streamType := headers.Get(v1.StreamType) id, ok := streamType2streamID[streamType] if !ok { return nil, fmt.Errorf("unknown stream type: %s", streamType) } if s := c.getStream(id); s != nil { return nil, fmt.Errorf("duplicate stream for type %s", streamType) } reader, writer := io.Pipe() s := &stream{ headers: headers, readPipe: reader, writePipe: writer, conn: c.conn, connWriteLock: &c.connWriteLock, id: id, } if err := c.setStream(id, s); err != nil { _ = s.writePipe.Close() _ = s.readPipe.Close() return nil, err } return s, nil } // readDemuxLoop is the lock-free reading processor for this endpoint of the websocket // connection. This loop reads the connection, and demultiplexes the data // into one of the individual stream pipes (by checking the stream id). This // loop can *not* be run concurrently, because there can only be one websocket // connection reader at a time (a read mutex would provide no benefit). func (c *wsStreamCreator) readDemuxLoop(bufferSize int, period time.Duration, deadline time.Duration) { // Initialize and start the ping/pong heartbeat. h := newHeartbeat(c.conn, period, deadline) // Set initial timeout for websocket connection reading. if err := c.conn.SetReadDeadline(time.Now().Add(deadline)); err != nil { klog.Errorf("Websocket initial setting read deadline failed %v", err) return } go h.start() // Buffer size must correspond to the same size allocated // for the read buffer during websocket client creation. A // difference can cause incomplete connection reads. readBuffer := make([]byte, bufferSize) for { // NextReader() only returns data messages (BinaryMessage or Text // Message). Even though this call will never return control frames // such as ping, pong, or close, this call is necessary for these // message types to be processed. There can only be one reader // at a time, so this reader loop must *not* be run concurrently; // there is no lock for reading. Calling "NextReader()" before the // current reader has been processed will close the current reader. // If the heartbeat read deadline times out, this "NextReader()" will // return an i/o error, and error handling will clean up. messageType, r, err := c.conn.NextReader() if err != nil { websocketErr, ok := err.(*gwebsocket.CloseError) if ok && websocketErr.Code == gwebsocket.CloseNormalClosure { err = nil // readers will get io.EOF as it's a normal closure } else { err = fmt.Errorf("next reader: %w", err) } c.closeAllStreamReaders(err) return } // All remote command protocols send/receive only binary data messages. if messageType != gwebsocket.BinaryMessage { c.closeAllStreamReaders(fmt.Errorf("unexpected message type: %d", messageType)) return } // It's ok to read just a single byte because the underlying library wraps the actual // connection with a buffered reader anyway. _, err = io.ReadFull(r, readBuffer[:1]) if err != nil { c.closeAllStreamReaders(fmt.Errorf("read stream id: %w", err)) return } streamID := readBuffer[0] s := c.getStream(streamID) if s == nil { klog.Errorf("Unknown stream id %d, discarding message", streamID) continue } for { nr, errRead := r.Read(readBuffer) if nr > 0 { // Write the data to the stream's pipe. This can block. _, errWrite := s.writePipe.Write(readBuffer[:nr]) if errWrite != nil { // Pipe must have been closed by the stream user. // Nothing to do, discard the message. break } } if errRead != nil { if errRead == io.EOF { break } c.closeAllStreamReaders(fmt.Errorf("read message: %w", err)) return } } } } // closeAllStreamReaders closes readers in all streams. // This unblocks all stream.Read() calls, and keeps any future streams from being created. func (c *wsStreamCreator) closeAllStreamReaders(err error) { c.streamsMu.Lock() defer c.streamsMu.Unlock() for _, s := range c.streams { // Closing writePipe unblocks all readPipe.Read() callers and prevents any future writes. _ = s.writePipe.CloseWithError(err) } // ensure callers to setStreams receive an error after this point if err != nil { c.setStreamErr = err } else { c.setStreamErr = fmt.Errorf("closed all streams") } } type stream struct { headers http.Header readPipe *io.PipeReader writePipe *io.PipeWriter // conn is used for writing directly into the connection. // Is nil after Close() / Reset() to prevent future writes. conn *gwebsocket.Conn // connWriteLock protects conn against concurrent write operations. There must be a single writer and a single reader only. // The mutex is shared across all streams because the underlying connection is shared. connWriteLock *sync.Mutex id byte } func (s *stream) Read(p []byte) (n int, err error) { return s.readPipe.Read(p) } // Write writes directly to the underlying WebSocket connection. func (s *stream) Write(p []byte) (n int, err error) { klog.V(4).Infof("Write() on stream %d", s.id) defer klog.V(4).Infof("Write() done on stream %d", s.id) s.connWriteLock.Lock() defer s.connWriteLock.Unlock() if s.conn == nil { return 0, fmt.Errorf("write on closed stream %d", s.id) } err = s.conn.SetWriteDeadline(time.Now().Add(writeDeadline)) if err != nil { klog.V(7).Infof("Websocket setting write deadline failed %v", err) return 0, err } // Message writer buffers the message data, so we don't need to do that ourselves. // Just write id and the data as two separate writes to avoid allocating an intermediate buffer. w, err := s.conn.NextWriter(gwebsocket.BinaryMessage) if err != nil { return 0, err } defer func() { if w != nil { w.Close() } }() _, err = w.Write([]byte{s.id}) if err != nil { return 0, err } n, err = w.Write(p) if err != nil { return n, err } err = w.Close() w = nil return n, err } // Close half-closes the stream, indicating this side is finished with the stream. func (s *stream) Close() error { klog.V(4).Infof("Close() on stream %d", s.id) defer klog.V(4).Infof("Close() done on stream %d", s.id) s.connWriteLock.Lock() defer s.connWriteLock.Unlock() if s.conn == nil { return fmt.Errorf("Close() on already closed stream %d", s.id) } // Communicate the CLOSE stream signal to the other websocket endpoint. err := s.conn.WriteMessage(gwebsocket.BinaryMessage, []byte{remotecommand.StreamClose, s.id}) s.conn = nil return err } func (s *stream) Reset() error { klog.V(4).Infof("Reset() on stream %d", s.id) defer klog.V(4).Infof("Reset() done on stream %d", s.id) s.Close() return s.writePipe.Close() } func (s *stream) Headers() http.Header { return s.headers } func (s *stream) Identifier() uint32 { return uint32(s.id) } // heartbeat encasulates data necessary for the websocket ping/pong heartbeat. This // heartbeat works by setting a read deadline on the websocket connection, then // pushing this deadline into the future for every successful heartbeat. If the // heartbeat "pong" fails to respond within the deadline, then the "NextReader()" call // inside the "readDemuxLoop" will return an i/o error prompting a connection close // and cleanup. type heartbeat struct { conn *gwebsocket.Conn // period defines how often a "ping" heartbeat message is sent to the other endpoint period time.Duration // closing the "closer" channel will clean up the heartbeat timers closer chan struct{} // optional data to send with "ping" message message []byte // optionally received data message with "pong" message, same as sent with ping pongMessage []byte } // newHeartbeat creates heartbeat structure encapsulating fields necessary to // run the websocket connection ping/pong mechanism and sets up handlers on // the websocket connection. func newHeartbeat(conn *gwebsocket.Conn, period time.Duration, deadline time.Duration) *heartbeat { h := &heartbeat{ conn: conn, period: period, closer: make(chan struct{}), } // Set up handler for receiving returned "pong" message from other endpoint // by pushing the read deadline into the future. The "msg" received could // be empty. h.conn.SetPongHandler(func(msg string) error { // Push the read deadline into the future. klog.V(8).Infof("Pong message received (%s)--resetting read deadline", msg) err := h.conn.SetReadDeadline(time.Now().Add(deadline)) if err != nil { klog.Errorf("Websocket setting read deadline failed %v", err) return err } if len(msg) > 0 { h.pongMessage = []byte(msg) } return nil }) // Set up handler to cleanup timers when this endpoint receives "Close" message. closeHandler := h.conn.CloseHandler() h.conn.SetCloseHandler(func(code int, text string) error { close(h.closer) return closeHandler(code, text) }) return h } // setMessage is optional data sent with "ping" heartbeat. According to the websocket RFC // this data sent with "ping" message should be returned in "pong" message. func (h *heartbeat) setMessage(msg string) { h.message = []byte(msg) } // start the heartbeat by setting up necesssary handlers and looping by sending "ping" // message every "period" until the "closer" channel is closed. func (h *heartbeat) start() { // Loop to continually send "ping" message through websocket connection every "period". t := time.NewTicker(h.period) defer t.Stop() for { select { case <-h.closer: klog.V(8).Infof("closed channel--returning") return case <-t.C: // "WriteControl" does not need to be protected by a mutex. According to // gorilla/websockets library docs: "The Close and WriteControl methods can // be called concurrently with all other methods." if err := h.conn.WriteControl(gwebsocket.PingMessage, h.message, time.Now().Add(pingReadDeadline)); err == nil { klog.V(8).Infof("Websocket Ping succeeeded") } else { klog.Errorf("Websocket Ping failed: %v", err) if errors.Is(err, gwebsocket.ErrCloseSent) { // we continue because c.conn.CloseChan will manage closing the connection already continue } else if e, ok := err.(net.Error); ok && e.Timeout() { // Continue, in case this is a transient failure. // c.conn.CloseChan above will tell us when the connection is // actually closed. // If Temporary function hadn't been deprecated, we would have used it. // But most of temporary errors are timeout errors anyway. continue } return } } } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/v2.go
vendor/k8s.io/client-go/tools/remotecommand/v2.go
/* Copyright 2015 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 remotecommand import ( "fmt" "io" "net/http" "sync" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/runtime" ) // streamProtocolV2 implements version 2 of the streaming protocol for attach // and exec. The original streaming protocol was metav1. As a result, this // version is referred to as version 2, even though it is the first actual // numbered version. type streamProtocolV2 struct { StreamOptions errorStream io.Reader remoteStdin io.ReadWriteCloser remoteStdout io.Reader remoteStderr io.Reader } var _ streamProtocolHandler = &streamProtocolV2{} func newStreamProtocolV2(options StreamOptions) streamProtocolHandler { return &streamProtocolV2{ StreamOptions: options, } } func (p *streamProtocolV2) createStreams(conn streamCreator) error { var err error headers := http.Header{} // set up error stream headers.Set(v1.StreamType, v1.StreamTypeError) p.errorStream, err = conn.CreateStream(headers) if err != nil { return err } // set up stdin stream if p.Stdin != nil { headers.Set(v1.StreamType, v1.StreamTypeStdin) p.remoteStdin, err = conn.CreateStream(headers) if err != nil { return err } } // set up stdout stream if p.Stdout != nil { headers.Set(v1.StreamType, v1.StreamTypeStdout) p.remoteStdout, err = conn.CreateStream(headers) if err != nil { return err } } // set up stderr stream if p.Stderr != nil && !p.Tty { headers.Set(v1.StreamType, v1.StreamTypeStderr) p.remoteStderr, err = conn.CreateStream(headers) if err != nil { return err } } return nil } func (p *streamProtocolV2) copyStdin() { if p.Stdin != nil { var once sync.Once // copy from client's stdin to container's stdin go func() { defer runtime.HandleCrash() // if p.stdin is noninteractive, p.g. `echo abc | kubectl exec -i <pod> -- cat`, make sure // we close remoteStdin as soon as the copy from p.stdin to remoteStdin finishes. Otherwise // the executed command will remain running. defer once.Do(func() { p.remoteStdin.Close() }) if _, err := io.Copy(p.remoteStdin, readerWrapper{p.Stdin}); err != nil { runtime.HandleError(err) } }() // read from remoteStdin until the stream is closed. this is essential to // be able to exit interactive sessions cleanly and not leak goroutines or // hang the client's terminal. // // TODO we aren't using go-dockerclient any more; revisit this to determine if it's still // required by engine-api. // // go-dockerclient's current hijack implementation // (https://github.com/fsouza/go-dockerclient/blob/89f3d56d93788dfe85f864a44f85d9738fca0670/client.go#L564) // waits for all three streams (stdin/stdout/stderr) to finish copying // before returning. When hijack finishes copying stdout/stderr, it calls // Close() on its side of remoteStdin, which allows this copy to complete. // When that happens, we must Close() on our side of remoteStdin, to // allow the copy in hijack to complete, and hijack to return. go func() { defer runtime.HandleCrash() defer once.Do(func() { p.remoteStdin.Close() }) // this "copy" doesn't actually read anything - it's just here to wait for // the server to close remoteStdin. if _, err := io.Copy(io.Discard, p.remoteStdin); err != nil { runtime.HandleError(err) } }() } } func (p *streamProtocolV2) copyStdout(wg *sync.WaitGroup) { if p.Stdout == nil { return } wg.Add(1) go func() { defer runtime.HandleCrash() defer wg.Done() // make sure, packet in queue can be consumed. // block in queue may lead to deadlock in conn.server // issue: https://github.com/kubernetes/kubernetes/issues/96339 defer io.Copy(io.Discard, p.remoteStdout) if _, err := io.Copy(p.Stdout, p.remoteStdout); err != nil { runtime.HandleError(err) } }() } func (p *streamProtocolV2) copyStderr(wg *sync.WaitGroup) { if p.Stderr == nil || p.Tty { return } wg.Add(1) go func() { defer runtime.HandleCrash() defer wg.Done() defer io.Copy(io.Discard, p.remoteStderr) if _, err := io.Copy(p.Stderr, p.remoteStderr); err != nil { runtime.HandleError(err) } }() } func (p *streamProtocolV2) stream(conn streamCreator) error { if err := p.createStreams(conn); err != nil { return err } // now that all the streams have been created, proceed with reading & copying errorChan := watchErrorStream(p.errorStream, &errorDecoderV2{}) p.copyStdin() var wg sync.WaitGroup p.copyStdout(&wg) p.copyStderr(&wg) // we're waiting for stdout/stderr to finish copying wg.Wait() // waits for errorStream to finish reading with an error or nil return <-errorChan } // errorDecoderV2 interprets the error channel data as plain text. type errorDecoderV2 struct{} func (d *errorDecoderV2) decode(message []byte) error { return fmt.Errorf("error executing remote command: %s", message) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/reader.go
vendor/k8s.io/client-go/tools/remotecommand/reader.go
/* Copyright 2018 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 remotecommand import ( "io" ) // readerWrapper delegates to an io.Reader so that only the io.Reader interface is implemented, // to keep io.Copy from doing things we don't want when copying from the reader to the data stream. // // If the Stdin io.Reader provided to remotecommand implements a WriteTo function (like bytes.Buffer does[1]), // io.Copy calls that method[2] to attempt to write the entire buffer to the stream in one call. // That results in an oversized call to spdystream.Stream#Write [3], // which results in a single oversized data frame[4] that is too large. // // [1] https://golang.org/pkg/bytes/#Buffer.WriteTo // [2] https://golang.org/pkg/io/#Copy // [3] https://github.com/kubernetes/kubernetes/blob/90295640ef87db9daa0144c5617afe889e7992b2/vendor/github.com/docker/spdystream/stream.go#L66-L73 // [4] https://github.com/kubernetes/kubernetes/blob/90295640ef87db9daa0144c5617afe889e7992b2/vendor/github.com/docker/spdystream/spdy/write.go#L302-L304 type readerWrapper struct { reader io.Reader } func (r readerWrapper) Read(p []byte) (int, error) { return r.reader.Read(p) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/v3.go
vendor/k8s.io/client-go/tools/remotecommand/v3.go
/* Copyright 2016 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 remotecommand import ( "encoding/json" "io" "net/http" "sync" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/runtime" ) // streamProtocolV3 implements version 3 of the streaming protocol for attach // and exec. This version adds support for resizing the container's terminal. type streamProtocolV3 struct { *streamProtocolV2 resizeStream io.Writer } var _ streamProtocolHandler = &streamProtocolV3{} func newStreamProtocolV3(options StreamOptions) streamProtocolHandler { return &streamProtocolV3{ streamProtocolV2: newStreamProtocolV2(options).(*streamProtocolV2), } } func (p *streamProtocolV3) createStreams(conn streamCreator) error { // set up the streams from v2 if err := p.streamProtocolV2.createStreams(conn); err != nil { return err } // set up resize stream if p.Tty { headers := http.Header{} headers.Set(v1.StreamType, v1.StreamTypeResize) var err error p.resizeStream, err = conn.CreateStream(headers) if err != nil { return err } } return nil } func (p *streamProtocolV3) handleResizes() { if p.resizeStream == nil || p.TerminalSizeQueue == nil { return } go func() { defer runtime.HandleCrash() encoder := json.NewEncoder(p.resizeStream) for { size := p.TerminalSizeQueue.Next() if size == nil { return } if err := encoder.Encode(&size); err != nil { runtime.HandleError(err) } } }() } func (p *streamProtocolV3) stream(conn streamCreator) error { if err := p.createStreams(conn); err != nil { return err } // now that all the streams have been created, proceed with reading & copying errorChan := watchErrorStream(p.errorStream, &errorDecoderV3{}) p.handleResizes() p.copyStdin() var wg sync.WaitGroup p.copyStdout(&wg) p.copyStderr(&wg) // we're waiting for stdout/stderr to finish copying wg.Wait() // waits for errorStream to finish reading with an error or nil return <-errorChan } type errorDecoderV3 struct { errorDecoderV2 }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/resize.go
vendor/k8s.io/client-go/tools/remotecommand/resize.go
/* Copyright 2017 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 remotecommand // TerminalSize and TerminalSizeQueue was a part of k8s.io/kubernetes/pkg/util/term // and were moved in order to decouple client from other term dependencies // TerminalSize represents the width and height of a terminal. type TerminalSize struct { Width uint16 Height uint16 } // TerminalSizeQueue is capable of returning terminal resize events as they occur. type TerminalSizeQueue interface { // Next returns the new terminal size after the terminal has been resized. It returns nil when // monitoring has been stopped. Next() *TerminalSize }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/doc.go
vendor/k8s.io/client-go/tools/remotecommand/doc.go
/* Copyright 2015 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 remotecommand adds support for executing commands in containers, // with support for separate stdin, stdout, and stderr streams, as well as // TTY. package remotecommand // import "k8s.io/client-go/tools/remotecommand"
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/remotecommand.go
vendor/k8s.io/client-go/tools/remotecommand/remotecommand.go
/* Copyright 2015 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 remotecommand import ( "context" "io" "net/http" "k8s.io/apimachinery/pkg/util/httpstream" ) // StreamOptions holds information pertaining to the current streaming session: // input/output streams, if the client is requesting a TTY, and a terminal size queue to // support terminal resizing. type StreamOptions struct { Stdin io.Reader Stdout io.Writer Stderr io.Writer Tty bool TerminalSizeQueue TerminalSizeQueue } // Executor is an interface for transporting shell-style streams. type Executor interface { // Deprecated: use StreamWithContext instead to avoid possible resource leaks. // See https://github.com/kubernetes/kubernetes/pull/103177 for details. Stream(options StreamOptions) error // StreamWithContext initiates the transport of the standard shell streams. It will // transport any non-nil stream to a remote system, and return an error if a problem // occurs. If tty is set, the stderr stream is not used (raw TTY manages stdout and // stderr over the stdout stream). // The context controls the entire lifetime of stream execution. StreamWithContext(ctx context.Context, options StreamOptions) error } type streamCreator interface { CreateStream(headers http.Header) (httpstream.Stream, error) } type streamProtocolHandler interface { stream(conn streamCreator) error }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/spdy.go
vendor/k8s.io/client-go/tools/remotecommand/spdy.go
/* Copyright 2023 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 remotecommand import ( "context" "fmt" "net/http" "net/url" "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/apimachinery/pkg/util/remotecommand" restclient "k8s.io/client-go/rest" "k8s.io/client-go/transport/spdy" "k8s.io/klog/v2" ) // spdyStreamExecutor handles transporting standard shell streams over an httpstream connection. type spdyStreamExecutor struct { upgrader spdy.Upgrader transport http.RoundTripper method string url *url.URL protocols []string rejectRedirects bool // if true, receiving redirect from upstream is an error } // NewSPDYExecutor connects to the provided server and upgrades the connection to // multiplexed bidirectional streams. func NewSPDYExecutor(config *restclient.Config, method string, url *url.URL) (Executor, error) { wrapper, upgradeRoundTripper, err := spdy.RoundTripperFor(config) if err != nil { return nil, err } return NewSPDYExecutorForTransports(wrapper, upgradeRoundTripper, method, url) } // NewSPDYExecutorRejectRedirects returns an Executor that will upgrade the future // connection to a SPDY bi-directional streaming connection when calling "Stream" (deprecated) // or "StreamWithContext" (preferred). Additionally, if the upstream server returns a redirect // during the attempted upgrade in these "Stream" calls, an error is returned. func NewSPDYExecutorRejectRedirects(transport http.RoundTripper, upgrader spdy.Upgrader, method string, url *url.URL) (Executor, error) { executor, err := NewSPDYExecutorForTransports(transport, upgrader, method, url) if err != nil { return nil, err } spdyExecutor := executor.(*spdyStreamExecutor) spdyExecutor.rejectRedirects = true return spdyExecutor, nil } // NewSPDYExecutorForTransports connects to the provided server using the given transport, // upgrades the response using the given upgrader to multiplexed bidirectional streams. func NewSPDYExecutorForTransports(transport http.RoundTripper, upgrader spdy.Upgrader, method string, url *url.URL) (Executor, error) { return NewSPDYExecutorForProtocols( transport, upgrader, method, url, remotecommand.StreamProtocolV5Name, remotecommand.StreamProtocolV4Name, remotecommand.StreamProtocolV3Name, remotecommand.StreamProtocolV2Name, remotecommand.StreamProtocolV1Name, ) } // NewSPDYExecutorForProtocols connects to the provided server and upgrades the connection to // multiplexed bidirectional streams using only the provided protocols. Exposed for testing, most // callers should use NewSPDYExecutor or NewSPDYExecutorForTransports. func NewSPDYExecutorForProtocols(transport http.RoundTripper, upgrader spdy.Upgrader, method string, url *url.URL, protocols ...string) (Executor, error) { return &spdyStreamExecutor{ upgrader: upgrader, transport: transport, method: method, url: url, protocols: protocols, }, nil } // Stream opens a protocol streamer to the server and streams until a client closes // the connection or the server disconnects. func (e *spdyStreamExecutor) Stream(options StreamOptions) error { return e.StreamWithContext(context.Background(), options) } // newConnectionAndStream creates a new SPDY connection and a stream protocol handler upon it. func (e *spdyStreamExecutor) newConnectionAndStream(ctx context.Context, options StreamOptions) (httpstream.Connection, streamProtocolHandler, error) { req, err := http.NewRequestWithContext(ctx, e.method, e.url.String(), nil) if err != nil { return nil, nil, fmt.Errorf("error creating request: %v", err) } client := http.Client{Transport: e.transport} if e.rejectRedirects { client.CheckRedirect = func(req *http.Request, via []*http.Request) error { return fmt.Errorf("redirect not allowed") } } conn, protocol, err := spdy.Negotiate( e.upgrader, &client, req, e.protocols..., ) if err != nil { return nil, nil, err } var streamer streamProtocolHandler switch protocol { case remotecommand.StreamProtocolV5Name: streamer = newStreamProtocolV5(options) case remotecommand.StreamProtocolV4Name: streamer = newStreamProtocolV4(options) case remotecommand.StreamProtocolV3Name: streamer = newStreamProtocolV3(options) case remotecommand.StreamProtocolV2Name: streamer = newStreamProtocolV2(options) case "": klog.V(4).Infof("The server did not negotiate a streaming protocol version. Falling back to %s", remotecommand.StreamProtocolV1Name) fallthrough case remotecommand.StreamProtocolV1Name: streamer = newStreamProtocolV1(options) } return conn, streamer, nil } // StreamWithContext opens a protocol streamer to the server and streams until a client closes // the connection or the server disconnects or the context is done. func (e *spdyStreamExecutor) StreamWithContext(ctx context.Context, options StreamOptions) error { conn, streamer, err := e.newConnectionAndStream(ctx, options) if err != nil { return err } defer conn.Close() panicChan := make(chan any, 1) errorChan := make(chan error, 1) go func() { defer func() { if p := recover(); p != nil { panicChan <- p } }() errorChan <- streamer.stream(conn) }() select { case p := <-panicChan: panic(p) case err := <-errorChan: return err case <-ctx.Done(): return ctx.Err() } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/remotecommand/v1.go
vendor/k8s.io/client-go/tools/remotecommand/v1.go
/* Copyright 2015 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 remotecommand import ( "fmt" "io" "net/http" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/klog/v2" ) // streamProtocolV1 implements the first version of the streaming exec & attach // protocol. This version has some bugs, such as not being able to detect when // non-interactive stdin data has ended. See https://issues.k8s.io/13394 and // https://issues.k8s.io/13395 for more details. type streamProtocolV1 struct { StreamOptions errorStream httpstream.Stream remoteStdin httpstream.Stream remoteStdout httpstream.Stream remoteStderr httpstream.Stream } var _ streamProtocolHandler = &streamProtocolV1{} func newStreamProtocolV1(options StreamOptions) streamProtocolHandler { return &streamProtocolV1{ StreamOptions: options, } } func (p *streamProtocolV1) stream(conn streamCreator) error { doneChan := make(chan struct{}, 2) errorChan := make(chan error) cp := func(s string, dst io.Writer, src io.Reader) { klog.V(6).Infof("Copying %s", s) defer klog.V(6).Infof("Done copying %s", s) if _, err := io.Copy(dst, src); err != nil && err != io.EOF { klog.Errorf("Error copying %s: %v", s, err) } if s == v1.StreamTypeStdout || s == v1.StreamTypeStderr { doneChan <- struct{}{} } } // set up all the streams first var err error headers := http.Header{} headers.Set(v1.StreamType, v1.StreamTypeError) p.errorStream, err = conn.CreateStream(headers) if err != nil { return err } defer p.errorStream.Reset() // Create all the streams first, then start the copy goroutines. The server doesn't start its copy // goroutines until it's received all of the streams. If the client creates the stdin stream and // immediately begins copying stdin data to the server, it's possible to overwhelm and wedge the // spdy frame handler in the server so that it is full of unprocessed frames. The frames aren't // getting processed because the server hasn't started its copying, and it won't do that until it // gets all the streams. By creating all the streams first, we ensure that the server is ready to // process data before the client starts sending any. See https://issues.k8s.io/16373 for more info. if p.Stdin != nil { headers.Set(v1.StreamType, v1.StreamTypeStdin) p.remoteStdin, err = conn.CreateStream(headers) if err != nil { return err } defer p.remoteStdin.Reset() } if p.Stdout != nil { headers.Set(v1.StreamType, v1.StreamTypeStdout) p.remoteStdout, err = conn.CreateStream(headers) if err != nil { return err } defer p.remoteStdout.Reset() } if p.Stderr != nil && !p.Tty { headers.Set(v1.StreamType, v1.StreamTypeStderr) p.remoteStderr, err = conn.CreateStream(headers) if err != nil { return err } defer p.remoteStderr.Reset() } // now that all the streams have been created, proceed with reading & copying // always read from errorStream go func() { message, err := io.ReadAll(p.errorStream) if err != nil && err != io.EOF { errorChan <- fmt.Errorf("Error reading from error stream: %s", err) return } if len(message) > 0 { errorChan <- fmt.Errorf("Error executing remote command: %s", message) return } }() if p.Stdin != nil { // TODO this goroutine will never exit cleanly (the io.Copy never unblocks) // because stdin is not closed until the process exits. If we try to call // stdin.Close(), it returns no error but doesn't unblock the copy. It will // exit when the process exits, instead. go cp(v1.StreamTypeStdin, p.remoteStdin, readerWrapper{p.Stdin}) } waitCount := 0 completedStreams := 0 if p.Stdout != nil { waitCount++ go cp(v1.StreamTypeStdout, p.Stdout, p.remoteStdout) } if p.Stderr != nil && !p.Tty { waitCount++ go cp(v1.StreamTypeStderr, p.Stderr, p.remoteStderr) } Loop: for { select { case <-doneChan: completedStreams++ if completedStreams == waitCount { break Loop } case err := <-errorChan: return err } } return nil }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/pager/pager.go
vendor/k8s.io/client-go/tools/pager/pager.go
/* Copyright 2017 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 pager import ( "context" "fmt" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" ) const defaultPageSize = 500 const defaultPageBufferSize = 10 // ListPageFunc returns a list object for the given list options. type ListPageFunc func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) // SimplePageFunc adapts a context-less list function into one that accepts a context. func SimplePageFunc(fn func(opts metav1.ListOptions) (runtime.Object, error)) ListPageFunc { return func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { return fn(opts) } } // ListPager assists client code in breaking large list queries into multiple // smaller chunks of PageSize or smaller. PageFn is expected to accept a // metav1.ListOptions that supports paging and return a list. The pager does // not alter the field or label selectors on the initial options list. type ListPager struct { PageSize int64 PageFn ListPageFunc FullListIfExpired bool // Number of pages to buffer PageBufferSize int32 } // New creates a new pager from the provided pager function using the default // options. It will fall back to a full list if an expiration error is encountered // as a last resort. func New(fn ListPageFunc) *ListPager { return &ListPager{ PageSize: defaultPageSize, PageFn: fn, FullListIfExpired: true, PageBufferSize: defaultPageBufferSize, } } // TODO: introduce other types of paging functions - such as those that retrieve from a list // of namespaces. // List returns a single list object, but attempts to retrieve smaller chunks from the // server to reduce the impact on the server. If the chunk attempt fails, it will load // the full list instead. The Limit field on options, if unset, will default to the page size. // // If items in the returned list are retained for different durations, and you want to avoid // retaining the whole slice returned by p.PageFn as long as any item is referenced, // use ListWithAlloc instead. func (p *ListPager) List(ctx context.Context, options metav1.ListOptions) (runtime.Object, bool, error) { return p.list(ctx, options, false) } // ListWithAlloc works like List, but avoids retaining references to the items slice returned by p.PageFn. // It does this by making a shallow copy of non-pointer items in the slice returned by p.PageFn. // // If the items in the returned list are not retained, or are retained for the same duration, use List instead for memory efficiency. func (p *ListPager) ListWithAlloc(ctx context.Context, options metav1.ListOptions) (runtime.Object, bool, error) { return p.list(ctx, options, true) } func (p *ListPager) list(ctx context.Context, options metav1.ListOptions, allocNew bool) (runtime.Object, bool, error) { if options.Limit == 0 { options.Limit = p.PageSize } requestedResourceVersion := options.ResourceVersion requestedResourceVersionMatch := options.ResourceVersionMatch var list *metainternalversion.List paginatedResult := false for { select { case <-ctx.Done(): return nil, paginatedResult, ctx.Err() default: } obj, err := p.PageFn(ctx, options) if err != nil { // Only fallback to full list if an "Expired" errors is returned, FullListIfExpired is true, and // the "Expired" error occurred in page 2 or later (since full list is intended to prevent a pager.List from // failing when the resource versions is established by the first page request falls out of the compaction // during the subsequent list requests). if !errors.IsResourceExpired(err) || !p.FullListIfExpired || options.Continue == "" { return nil, paginatedResult, err } // the list expired while we were processing, fall back to a full list at // the requested ResourceVersion. options.Limit = 0 options.Continue = "" options.ResourceVersion = requestedResourceVersion options.ResourceVersionMatch = requestedResourceVersionMatch result, err := p.PageFn(ctx, options) return result, paginatedResult, err } m, err := meta.ListAccessor(obj) if err != nil { return nil, paginatedResult, fmt.Errorf("returned object must be a list: %v", err) } // exit early and return the object we got if we haven't processed any pages if len(m.GetContinue()) == 0 && list == nil { return obj, paginatedResult, nil } // initialize the list and fill its contents if list == nil { list = &metainternalversion.List{Items: make([]runtime.Object, 0, options.Limit+1)} list.ResourceVersion = m.GetResourceVersion() list.SelfLink = m.GetSelfLink() } eachListItemFunc := meta.EachListItem if allocNew { eachListItemFunc = meta.EachListItemWithAlloc } if err := eachListItemFunc(obj, func(obj runtime.Object) error { list.Items = append(list.Items, obj) return nil }); err != nil { return nil, paginatedResult, err } // if we have no more items, return the list if len(m.GetContinue()) == 0 { return list, paginatedResult, nil } // set the next loop up options.Continue = m.GetContinue() // Clear the ResourceVersion(Match) on the subsequent List calls to avoid the // `specifying resource version is not allowed when using continue` error. // See https://github.com/kubernetes/kubernetes/issues/85221#issuecomment-553748143. options.ResourceVersion = "" options.ResourceVersionMatch = "" // At this point, result is already paginated. paginatedResult = true } } // EachListItem fetches runtime.Object items using this ListPager and invokes fn on each item. If // fn returns an error, processing stops and that error is returned. If fn does not return an error, // any error encountered while retrieving the list from the server is returned. If the context // cancels or times out, the context error is returned. Since the list is retrieved in paginated // chunks, an "Expired" error (metav1.StatusReasonExpired) may be returned if the pagination list // requests exceed the expiration limit of the apiserver being called. // // Items are retrieved in chunks from the server to reduce the impact on the server with up to // ListPager.PageBufferSize chunks buffered concurrently in the background. // // If items passed to fn are retained for different durations, and you want to avoid // retaining the whole slice returned by p.PageFn as long as any item is referenced, // use EachListItemWithAlloc instead. func (p *ListPager) EachListItem(ctx context.Context, options metav1.ListOptions, fn func(obj runtime.Object) error) error { return p.eachListChunkBuffered(ctx, options, func(obj runtime.Object) error { return meta.EachListItem(obj, fn) }) } // EachListItemWithAlloc works like EachListItem, but avoids retaining references to the items slice returned by p.PageFn. // It does this by making a shallow copy of non-pointer items in the slice returned by p.PageFn. // // If the items passed to fn are not retained, or are retained for the same duration, use EachListItem instead for memory efficiency. func (p *ListPager) EachListItemWithAlloc(ctx context.Context, options metav1.ListOptions, fn func(obj runtime.Object) error) error { return p.eachListChunkBuffered(ctx, options, func(obj runtime.Object) error { return meta.EachListItemWithAlloc(obj, fn) }) } // eachListChunkBuffered fetches runtimeObject list chunks using this ListPager and invokes fn on // each list chunk. If fn returns an error, processing stops and that error is returned. If fn does // not return an error, any error encountered while retrieving the list from the server is // returned. If the context cancels or times out, the context error is returned. Since the list is // retrieved in paginated chunks, an "Expired" error (metav1.StatusReasonExpired) may be returned if // the pagination list requests exceed the expiration limit of the apiserver being called. // // Up to ListPager.PageBufferSize chunks are buffered concurrently in the background. func (p *ListPager) eachListChunkBuffered(ctx context.Context, options metav1.ListOptions, fn func(obj runtime.Object) error) error { if p.PageBufferSize < 0 { return fmt.Errorf("ListPager.PageBufferSize must be >= 0, got %d", p.PageBufferSize) } // Ensure background goroutine is stopped if this call exits before all list items are // processed. Cancelation error from this deferred cancel call is never returned to caller; // either the list result has already been sent to bgResultC or the fn error is returned and // the cancelation error is discarded. ctx, cancel := context.WithCancel(ctx) defer cancel() chunkC := make(chan runtime.Object, p.PageBufferSize) bgResultC := make(chan error, 1) go func() { defer utilruntime.HandleCrash() var err error defer func() { close(chunkC) bgResultC <- err }() err = p.eachListChunk(ctx, options, func(chunk runtime.Object) error { select { case chunkC <- chunk: // buffer the chunk, this can block case <-ctx.Done(): return ctx.Err() } return nil }) }() for o := range chunkC { select { case <-ctx.Done(): return ctx.Err() default: } err := fn(o) if err != nil { return err // any fn error should be returned immediately } } // promote the results of our background goroutine to the foreground return <-bgResultC } // eachListChunk fetches runtimeObject list chunks using this ListPager and invokes fn on each list // chunk. If fn returns an error, processing stops and that error is returned. If fn does not return // an error, any error encountered while retrieving the list from the server is returned. If the // context cancels or times out, the context error is returned. Since the list is retrieved in // paginated chunks, an "Expired" error (metav1.StatusReasonExpired) may be returned if the // pagination list requests exceed the expiration limit of the apiserver being called. func (p *ListPager) eachListChunk(ctx context.Context, options metav1.ListOptions, fn func(obj runtime.Object) error) error { if options.Limit == 0 { options.Limit = p.PageSize } for { select { case <-ctx.Done(): return ctx.Err() default: } obj, err := p.PageFn(ctx, options) if err != nil { return err } m, err := meta.ListAccessor(obj) if err != nil { return fmt.Errorf("returned object must be a list: %v", err) } if err := fn(obj); err != nil { return err } // if we have no more items, return. if len(m.GetContinue()) == 0 { return nil } // set the next loop up options.Continue = m.GetContinue() } }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/leaderelection/metrics.go
vendor/k8s.io/client-go/tools/leaderelection/metrics.go
/* Copyright 2018 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 leaderelection import ( "sync" ) // This file provides abstractions for setting the provider (e.g., prometheus) // of metrics. type leaderMetricsAdapter interface { leaderOn(name string) leaderOff(name string) slowpathExercised(name string) } // LeaderMetric instruments metrics used in leader election. type LeaderMetric interface { On(name string) Off(name string) SlowpathExercised(name string) } type noopMetric struct{} func (noopMetric) On(name string) {} func (noopMetric) Off(name string) {} func (noopMetric) SlowpathExercised(name string) {} // defaultLeaderMetrics expects the caller to lock before setting any metrics. type defaultLeaderMetrics struct { // leader's value indicates if the current process is the owner of name lease leader LeaderMetric } func (m *defaultLeaderMetrics) leaderOn(name string) { if m == nil { return } m.leader.On(name) } func (m *defaultLeaderMetrics) leaderOff(name string) { if m == nil { return } m.leader.Off(name) } func (m *defaultLeaderMetrics) slowpathExercised(name string) { if m == nil { return } m.leader.SlowpathExercised(name) } type noMetrics struct{} func (noMetrics) leaderOn(name string) {} func (noMetrics) leaderOff(name string) {} func (noMetrics) slowpathExercised(name string) {} // MetricsProvider generates various metrics used by the leader election. type MetricsProvider interface { NewLeaderMetric() LeaderMetric } type noopMetricsProvider struct{} func (noopMetricsProvider) NewLeaderMetric() LeaderMetric { return noopMetric{} } var globalMetricsFactory = leaderMetricsFactory{ metricsProvider: noopMetricsProvider{}, } type leaderMetricsFactory struct { metricsProvider MetricsProvider onlyOnce sync.Once } func (f *leaderMetricsFactory) setProvider(mp MetricsProvider) { f.onlyOnce.Do(func() { f.metricsProvider = mp }) } func (f *leaderMetricsFactory) newLeaderMetrics() leaderMetricsAdapter { mp := f.metricsProvider if mp == (noopMetricsProvider{}) { return noMetrics{} } return &defaultLeaderMetrics{ leader: mp.NewLeaderMetric(), } } // SetProvider sets the metrics provider for all subsequently created work // queues. Only the first call has an effect. func SetProvider(metricsProvider MetricsProvider) { globalMetricsFactory.setProvider(metricsProvider) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go
vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go
/* Copyright 2015 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 leaderelection implements leader election of a set of endpoints. // It uses an annotation in the endpoints object to store the record of the // election state. This implementation does not guarantee that only one // client is acting as a leader (a.k.a. fencing). // // A client only acts on timestamps captured locally to infer the state of the // leader election. The client does not consider timestamps in the leader // election record to be accurate because these timestamps may not have been // produced by a local clock. The implemention does not depend on their // accuracy and only uses their change to indicate that another client has // renewed the leader lease. Thus the implementation is tolerant to arbitrary // clock skew, but is not tolerant to arbitrary clock skew rate. // // However the level of tolerance to skew rate can be configured by setting // RenewDeadline and LeaseDuration appropriately. The tolerance expressed as a // maximum tolerated ratio of time passed on the fastest node to time passed on // the slowest node can be approximately achieved with a configuration that sets // the same ratio of LeaseDuration to RenewDeadline. For example if a user wanted // to tolerate some nodes progressing forward in time twice as fast as other nodes, // the user could set LeaseDuration to 60 seconds and RenewDeadline to 30 seconds. // // While not required, some method of clock synchronization between nodes in the // cluster is highly recommended. It's important to keep in mind when configuring // this client that the tolerance to skew rate varies inversely to master // availability. // // Larger clusters often have a more lenient SLA for API latency. This should be // taken into account when configuring the client. The rate of leader transitions // should be monitored and RetryPeriod and LeaseDuration should be increased // until the rate is stable and acceptably low. It's important to keep in mind // when configuring this client that the tolerance to API latency varies inversely // to master availability. // // DISCLAIMER: this is an alpha API. This library will likely change significantly // or even be removed entirely in subsequent releases. Depend on this API at // your own risk. package leaderelection import ( "bytes" "context" "fmt" "sync" "time" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" rl "k8s.io/client-go/tools/leaderelection/resourcelock" "k8s.io/klog/v2" "k8s.io/utils/clock" ) const ( JitterFactor = 1.2 ) // NewLeaderElector creates a LeaderElector from a LeaderElectionConfig func NewLeaderElector(lec LeaderElectionConfig) (*LeaderElector, error) { if lec.LeaseDuration <= lec.RenewDeadline { return nil, fmt.Errorf("leaseDuration must be greater than renewDeadline") } if lec.RenewDeadline <= time.Duration(JitterFactor*float64(lec.RetryPeriod)) { return nil, fmt.Errorf("renewDeadline must be greater than retryPeriod*JitterFactor") } if lec.LeaseDuration < 1 { return nil, fmt.Errorf("leaseDuration must be greater than zero") } if lec.RenewDeadline < 1 { return nil, fmt.Errorf("renewDeadline must be greater than zero") } if lec.RetryPeriod < 1 { return nil, fmt.Errorf("retryPeriod must be greater than zero") } if lec.Callbacks.OnStartedLeading == nil { return nil, fmt.Errorf("OnStartedLeading callback must not be nil") } if lec.Callbacks.OnStoppedLeading == nil { return nil, fmt.Errorf("OnStoppedLeading callback must not be nil") } if lec.Lock == nil { return nil, fmt.Errorf("Lock must not be nil.") } id := lec.Lock.Identity() if id == "" { return nil, fmt.Errorf("Lock identity is empty") } le := LeaderElector{ config: lec, clock: clock.RealClock{}, metrics: globalMetricsFactory.newLeaderMetrics(), } le.metrics.leaderOff(le.config.Name) return &le, nil } type LeaderElectionConfig struct { // Lock is the resource that will be used for locking Lock rl.Interface // LeaseDuration is the duration that non-leader candidates will // wait to force acquire leadership. This is measured against time of // last observed ack. // // A client needs to wait a full LeaseDuration without observing a change to // the record before it can attempt to take over. When all clients are // shutdown and a new set of clients are started with different names against // the same leader record, they must wait the full LeaseDuration before // attempting to acquire the lease. Thus LeaseDuration should be as short as // possible (within your tolerance for clock skew rate) to avoid a possible // long waits in the scenario. // // Core clients default this value to 15 seconds. LeaseDuration time.Duration // RenewDeadline is the duration that the acting master will retry // refreshing leadership before giving up. // // Core clients default this value to 10 seconds. RenewDeadline time.Duration // RetryPeriod is the duration the LeaderElector clients should wait // between tries of actions. // // Core clients default this value to 2 seconds. RetryPeriod time.Duration // Callbacks are callbacks that are triggered during certain lifecycle // events of the LeaderElector Callbacks LeaderCallbacks // WatchDog is the associated health checker // WatchDog may be null if it's not needed/configured. WatchDog *HealthzAdaptor // ReleaseOnCancel should be set true if the lock should be released // when the run context is cancelled. If you set this to true, you must // ensure all code guarded by this lease has successfully completed // prior to cancelling the context, or you may have two processes // simultaneously acting on the critical path. ReleaseOnCancel bool // Name is the name of the resource lock for debugging Name string // Coordinated will use the Coordinated Leader Election feature // WARNING: Coordinated leader election is ALPHA. Coordinated bool } // LeaderCallbacks are callbacks that are triggered during certain // lifecycle events of the LeaderElector. These are invoked asynchronously. // // possible future callbacks: // - OnChallenge() type LeaderCallbacks struct { // OnStartedLeading is called when a LeaderElector client starts leading OnStartedLeading func(context.Context) // OnStoppedLeading is called when a LeaderElector client stops leading. // This callback is always called when the LeaderElector exits, even if it did not start leading. // Users should not assume that OnStoppedLeading is only called after OnStartedLeading. // see: https://github.com/kubernetes/kubernetes/pull/127675#discussion_r1780059887 OnStoppedLeading func() // OnNewLeader is called when the client observes a leader that is // not the previously observed leader. This includes the first observed // leader when the client starts. OnNewLeader func(identity string) } // LeaderElector is a leader election client. type LeaderElector struct { config LeaderElectionConfig // internal bookkeeping observedRecord rl.LeaderElectionRecord observedRawRecord []byte observedTime time.Time // used to implement OnNewLeader(), may lag slightly from the // value observedRecord.HolderIdentity if the transition has // not yet been reported. reportedLeader string // clock is wrapper around time to allow for less flaky testing clock clock.Clock // used to lock the observedRecord observedRecordLock sync.Mutex metrics leaderMetricsAdapter } // Run starts the leader election loop. Run will not return // before leader election loop is stopped by ctx or it has // stopped holding the leader lease func (le *LeaderElector) Run(ctx context.Context) { defer runtime.HandleCrash() defer le.config.Callbacks.OnStoppedLeading() if !le.acquire(ctx) { return // ctx signalled done } ctx, cancel := context.WithCancel(ctx) defer cancel() go le.config.Callbacks.OnStartedLeading(ctx) le.renew(ctx) } // RunOrDie starts a client with the provided config or panics if the config // fails to validate. RunOrDie blocks until leader election loop is // stopped by ctx or it has stopped holding the leader lease func RunOrDie(ctx context.Context, lec LeaderElectionConfig) { le, err := NewLeaderElector(lec) if err != nil { panic(err) } if lec.WatchDog != nil { lec.WatchDog.SetLeaderElection(le) } le.Run(ctx) } // GetLeader returns the identity of the last observed leader or returns the empty string if // no leader has yet been observed. // This function is for informational purposes. (e.g. monitoring, logs, etc.) func (le *LeaderElector) GetLeader() string { return le.getObservedRecord().HolderIdentity } // IsLeader returns true if the last observed leader was this client else returns false. func (le *LeaderElector) IsLeader() bool { return le.getObservedRecord().HolderIdentity == le.config.Lock.Identity() } // acquire loops calling tryAcquireOrRenew and returns true immediately when tryAcquireOrRenew succeeds. // Returns false if ctx signals done. func (le *LeaderElector) acquire(ctx context.Context) bool { ctx, cancel := context.WithCancel(ctx) defer cancel() succeeded := false desc := le.config.Lock.Describe() klog.Infof("attempting to acquire leader lease %v...", desc) wait.JitterUntil(func() { if !le.config.Coordinated { succeeded = le.tryAcquireOrRenew(ctx) } else { succeeded = le.tryCoordinatedRenew(ctx) } le.maybeReportTransition() if !succeeded { klog.V(4).Infof("failed to acquire lease %v", desc) return } le.config.Lock.RecordEvent("became leader") le.metrics.leaderOn(le.config.Name) klog.Infof("successfully acquired lease %v", desc) cancel() }, le.config.RetryPeriod, JitterFactor, true, ctx.Done()) return succeeded } // renew loops calling tryAcquireOrRenew and returns immediately when tryAcquireOrRenew fails or ctx signals done. func (le *LeaderElector) renew(ctx context.Context) { defer le.config.Lock.RecordEvent("stopped leading") ctx, cancel := context.WithCancel(ctx) defer cancel() wait.Until(func() { err := wait.PollUntilContextTimeout(ctx, le.config.RetryPeriod, le.config.RenewDeadline, true, func(ctx context.Context) (done bool, err error) { if !le.config.Coordinated { return le.tryAcquireOrRenew(ctx), nil } else { return le.tryCoordinatedRenew(ctx), nil } }) le.maybeReportTransition() desc := le.config.Lock.Describe() if err == nil { klog.V(5).Infof("successfully renewed lease %v", desc) return } le.metrics.leaderOff(le.config.Name) klog.Infof("failed to renew lease %v: %v", desc, err) cancel() }, le.config.RetryPeriod, ctx.Done()) // if we hold the lease, give it up if le.config.ReleaseOnCancel { le.release() } } // release attempts to release the leader lease if we have acquired it. func (le *LeaderElector) release() bool { if !le.IsLeader() { return true } now := metav1.NewTime(le.clock.Now()) leaderElectionRecord := rl.LeaderElectionRecord{ LeaderTransitions: le.observedRecord.LeaderTransitions, LeaseDurationSeconds: 1, RenewTime: now, AcquireTime: now, } timeoutCtx, timeoutCancel := context.WithTimeout(context.Background(), le.config.RenewDeadline) defer timeoutCancel() if err := le.config.Lock.Update(timeoutCtx, leaderElectionRecord); err != nil { klog.Errorf("Failed to release lock: %v", err) return false } le.setObservedRecord(&leaderElectionRecord) return true } // tryCoordinatedRenew checks if it acquired a lease and tries to renew the // lease if it has already been acquired. Returns true on success else returns // false. func (le *LeaderElector) tryCoordinatedRenew(ctx context.Context) bool { now := metav1.NewTime(le.clock.Now()) leaderElectionRecord := rl.LeaderElectionRecord{ HolderIdentity: le.config.Lock.Identity(), LeaseDurationSeconds: int(le.config.LeaseDuration / time.Second), RenewTime: now, AcquireTime: now, } // 1. obtain the electionRecord oldLeaderElectionRecord, oldLeaderElectionRawRecord, err := le.config.Lock.Get(ctx) if err != nil { if !errors.IsNotFound(err) { klog.Errorf("error retrieving resource lock %v: %v", le.config.Lock.Describe(), err) return false } klog.Infof("lease lock not found: %v", le.config.Lock.Describe()) return false } // 2. Record obtained, check the Identity & Time if !bytes.Equal(le.observedRawRecord, oldLeaderElectionRawRecord) { le.setObservedRecord(oldLeaderElectionRecord) le.observedRawRecord = oldLeaderElectionRawRecord } hasExpired := le.observedTime.Add(time.Second * time.Duration(oldLeaderElectionRecord.LeaseDurationSeconds)).Before(now.Time) if hasExpired { klog.Infof("lock has expired: %v", le.config.Lock.Describe()) return false } if !le.IsLeader() { klog.V(6).Infof("lock is held by %v and has not yet expired: %v", oldLeaderElectionRecord.HolderIdentity, le.config.Lock.Describe()) return false } // 2b. If the lease has been marked as "end of term", don't renew it if le.IsLeader() && oldLeaderElectionRecord.PreferredHolder != "" { klog.V(4).Infof("lock is marked as 'end of term': %v", le.config.Lock.Describe()) // TODO: Instead of letting lease expire, the holder may deleted it directly // This will not be compatible with all controllers, so it needs to be opt-in behavior. // We must ensure all code guarded by this lease has successfully completed // prior to releasing or there may be two processes // simultaneously acting on the critical path. // Usually once this returns false, the process is terminated.. // xref: OnStoppedLeading return false } // 3. We're going to try to update. The leaderElectionRecord is set to it's default // here. Let's correct it before updating. if le.IsLeader() { leaderElectionRecord.AcquireTime = oldLeaderElectionRecord.AcquireTime leaderElectionRecord.LeaderTransitions = oldLeaderElectionRecord.LeaderTransitions leaderElectionRecord.Strategy = oldLeaderElectionRecord.Strategy le.metrics.slowpathExercised(le.config.Name) } else { leaderElectionRecord.LeaderTransitions = oldLeaderElectionRecord.LeaderTransitions + 1 } // update the lock itself if err = le.config.Lock.Update(ctx, leaderElectionRecord); err != nil { klog.Errorf("Failed to update lock: %v", err) return false } le.setObservedRecord(&leaderElectionRecord) return true } // tryAcquireOrRenew tries to acquire a leader lease if it is not already acquired, // else it tries to renew the lease if it has already been acquired. Returns true // on success else returns false. func (le *LeaderElector) tryAcquireOrRenew(ctx context.Context) bool { now := metav1.NewTime(le.clock.Now()) leaderElectionRecord := rl.LeaderElectionRecord{ HolderIdentity: le.config.Lock.Identity(), LeaseDurationSeconds: int(le.config.LeaseDuration / time.Second), RenewTime: now, AcquireTime: now, } // 1. fast path for the leader to update optimistically assuming that the record observed // last time is the current version. if le.IsLeader() && le.isLeaseValid(now.Time) { oldObservedRecord := le.getObservedRecord() leaderElectionRecord.AcquireTime = oldObservedRecord.AcquireTime leaderElectionRecord.LeaderTransitions = oldObservedRecord.LeaderTransitions err := le.config.Lock.Update(ctx, leaderElectionRecord) if err == nil { le.setObservedRecord(&leaderElectionRecord) return true } klog.Errorf("Failed to update lock optimistically: %v, falling back to slow path", err) } // 2. obtain or create the ElectionRecord oldLeaderElectionRecord, oldLeaderElectionRawRecord, err := le.config.Lock.Get(ctx) if err != nil { if !errors.IsNotFound(err) { klog.Errorf("error retrieving resource lock %v: %v", le.config.Lock.Describe(), err) return false } if err = le.config.Lock.Create(ctx, leaderElectionRecord); err != nil { klog.Errorf("error initially creating leader election record: %v", err) return false } le.setObservedRecord(&leaderElectionRecord) return true } // 3. Record obtained, check the Identity & Time if !bytes.Equal(le.observedRawRecord, oldLeaderElectionRawRecord) { le.setObservedRecord(oldLeaderElectionRecord) le.observedRawRecord = oldLeaderElectionRawRecord } if len(oldLeaderElectionRecord.HolderIdentity) > 0 && le.isLeaseValid(now.Time) && !le.IsLeader() { klog.V(4).Infof("lock is held by %v and has not yet expired", oldLeaderElectionRecord.HolderIdentity) return false } // 4. We're going to try to update. The leaderElectionRecord is set to it's default // here. Let's correct it before updating. if le.IsLeader() { leaderElectionRecord.AcquireTime = oldLeaderElectionRecord.AcquireTime leaderElectionRecord.LeaderTransitions = oldLeaderElectionRecord.LeaderTransitions le.metrics.slowpathExercised(le.config.Name) } else { leaderElectionRecord.LeaderTransitions = oldLeaderElectionRecord.LeaderTransitions + 1 } // update the lock itself if err = le.config.Lock.Update(ctx, leaderElectionRecord); err != nil { klog.Errorf("Failed to update lock: %v", err) return false } le.setObservedRecord(&leaderElectionRecord) return true } func (le *LeaderElector) maybeReportTransition() { if le.observedRecord.HolderIdentity == le.reportedLeader { return } le.reportedLeader = le.observedRecord.HolderIdentity if le.config.Callbacks.OnNewLeader != nil { go le.config.Callbacks.OnNewLeader(le.reportedLeader) } } // Check will determine if the current lease is expired by more than timeout. func (le *LeaderElector) Check(maxTolerableExpiredLease time.Duration) error { if !le.IsLeader() { // Currently not concerned with the case that we are hot standby return nil } // If we are more than timeout seconds after the lease duration that is past the timeout // on the lease renew. Time to start reporting ourselves as unhealthy. We should have // died but conditions like deadlock can prevent this. (See #70819) if le.clock.Since(le.observedTime) > le.config.LeaseDuration+maxTolerableExpiredLease { return fmt.Errorf("failed election to renew leadership on lease %s", le.config.Name) } return nil } func (le *LeaderElector) isLeaseValid(now time.Time) bool { return le.observedTime.Add(time.Second * time.Duration(le.getObservedRecord().LeaseDurationSeconds)).After(now) } // setObservedRecord will set a new observedRecord and update observedTime to the current time. // Protect critical sections with lock. func (le *LeaderElector) setObservedRecord(observedRecord *rl.LeaderElectionRecord) { le.observedRecordLock.Lock() defer le.observedRecordLock.Unlock() le.observedRecord = *observedRecord le.observedTime = le.clock.Now() } // getObservedRecord returns observersRecord. // Protect critical sections with lock. func (le *LeaderElector) getObservedRecord() rl.LeaderElectionRecord { le.observedRecordLock.Lock() defer le.observedRecordLock.Unlock() return le.observedRecord }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/leaderelection/leasecandidate.go
vendor/k8s.io/client-go/tools/leaderelection/leasecandidate.go
/* Copyright 2024 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 leaderelection import ( "context" "reflect" "time" v1 "k8s.io/api/coordination/v1" v1alpha2 "k8s.io/api/coordination/v1alpha2" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" coordinationv1alpha2client "k8s.io/client-go/kubernetes/typed/coordination/v1alpha2" "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" "k8s.io/klog/v2" "k8s.io/utils/clock" ) const requeueInterval = 5 * time.Minute type CacheSyncWaiter interface { WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool } type LeaseCandidate struct { leaseClient coordinationv1alpha2client.LeaseCandidateInterface leaseCandidateInformer cache.SharedIndexInformer informerFactory informers.SharedInformerFactory hasSynced cache.InformerSynced // At most there will be one item in this Queue (since we only watch one item) queue workqueue.TypedRateLimitingInterface[int] name string namespace string // controller lease leaseName string clock clock.Clock binaryVersion, emulationVersion string strategy v1.CoordinatedLeaseStrategy } // NewCandidate creates new LeaseCandidate controller that creates a // LeaseCandidate object if it does not exist and watches changes // to the corresponding object and renews if PingTime is set. // WARNING: This is an ALPHA feature. Ensure that the CoordinatedLeaderElection // feature gate is on. func NewCandidate(clientset kubernetes.Interface, candidateNamespace string, candidateName string, targetLease string, binaryVersion, emulationVersion string, strategy v1.CoordinatedLeaseStrategy, ) (*LeaseCandidate, CacheSyncWaiter, error) { fieldSelector := fields.OneTermEqualSelector("metadata.name", candidateName).String() // A separate informer factory is required because this must start before informerFactories // are started for leader elected components informerFactory := informers.NewSharedInformerFactoryWithOptions( clientset, 5*time.Minute, informers.WithTweakListOptions(func(options *metav1.ListOptions) { options.FieldSelector = fieldSelector }), ) leaseCandidateInformer := informerFactory.Coordination().V1alpha2().LeaseCandidates().Informer() lc := &LeaseCandidate{ leaseClient: clientset.CoordinationV1alpha2().LeaseCandidates(candidateNamespace), leaseCandidateInformer: leaseCandidateInformer, informerFactory: informerFactory, name: candidateName, namespace: candidateNamespace, leaseName: targetLease, clock: clock.RealClock{}, binaryVersion: binaryVersion, emulationVersion: emulationVersion, strategy: strategy, } lc.queue = workqueue.NewTypedRateLimitingQueueWithConfig(workqueue.DefaultTypedControllerRateLimiter[int](), workqueue.TypedRateLimitingQueueConfig[int]{Name: "leasecandidate"}) h, err := leaseCandidateInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ UpdateFunc: func(oldObj, newObj interface{}) { if leasecandidate, ok := newObj.(*v1alpha2.LeaseCandidate); ok { if leasecandidate.Spec.PingTime != nil && leasecandidate.Spec.PingTime.After(leasecandidate.Spec.RenewTime.Time) { lc.enqueueLease() } } }, }) if err != nil { return nil, nil, err } lc.hasSynced = h.HasSynced return lc, informerFactory, nil } func (c *LeaseCandidate) Run(ctx context.Context) { defer c.queue.ShutDown() c.informerFactory.Start(ctx.Done()) if !cache.WaitForNamedCacheSync("leasecandidateclient", ctx.Done(), c.hasSynced) { return } c.enqueueLease() go c.runWorker(ctx) <-ctx.Done() } func (c *LeaseCandidate) runWorker(ctx context.Context) { for c.processNextWorkItem(ctx) { } } func (c *LeaseCandidate) processNextWorkItem(ctx context.Context) bool { key, shutdown := c.queue.Get() if shutdown { return false } defer c.queue.Done(key) err := c.ensureLease(ctx) if err == nil { c.queue.AddAfter(key, requeueInterval) return true } utilruntime.HandleError(err) c.queue.AddRateLimited(key) return true } func (c *LeaseCandidate) enqueueLease() { c.queue.Add(0) } // ensureLease creates the lease if it does not exist and renew it if it exists. Returns the lease and // a bool (true if this call created the lease), or any error that occurs. func (c *LeaseCandidate) ensureLease(ctx context.Context) error { lease, err := c.leaseClient.Get(ctx, c.name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { klog.V(2).Infof("Creating lease candidate") // lease does not exist, create it. leaseToCreate := c.newLeaseCandidate() if _, err := c.leaseClient.Create(ctx, leaseToCreate, metav1.CreateOptions{}); err != nil { return err } klog.V(2).Infof("Created lease candidate") return nil } else if err != nil { return err } klog.V(2).Infof("lease candidate exists. Renewing.") clone := lease.DeepCopy() clone.Spec.RenewTime = &metav1.MicroTime{Time: c.clock.Now()} _, err = c.leaseClient.Update(ctx, clone, metav1.UpdateOptions{}) if err != nil { return err } return nil } func (c *LeaseCandidate) newLeaseCandidate() *v1alpha2.LeaseCandidate { lc := &v1alpha2.LeaseCandidate{ ObjectMeta: metav1.ObjectMeta{ Name: c.name, Namespace: c.namespace, }, Spec: v1alpha2.LeaseCandidateSpec{ LeaseName: c.leaseName, BinaryVersion: c.binaryVersion, EmulationVersion: c.emulationVersion, Strategy: c.strategy, }, } lc.Spec.RenewTime = &metav1.MicroTime{Time: c.clock.Now()} return lc }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/leaderelection/healthzadaptor.go
vendor/k8s.io/client-go/tools/leaderelection/healthzadaptor.go
/* Copyright 2015 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 leaderelection import ( "net/http" "sync" "time" ) // HealthzAdaptor associates the /healthz endpoint with the LeaderElection object. // It helps deal with the /healthz endpoint being set up prior to the LeaderElection. // This contains the code needed to act as an adaptor between the leader // election code the health check code. It allows us to provide health // status about the leader election. Most specifically about if the leader // has failed to renew without exiting the process. In that case we should // report not healthy and rely on the kubelet to take down the process. type HealthzAdaptor struct { pointerLock sync.Mutex le *LeaderElector timeout time.Duration } // Name returns the name of the health check we are implementing. func (l *HealthzAdaptor) Name() string { return "leaderElection" } // Check is called by the healthz endpoint handler. // It fails (returns an error) if we own the lease but had not been able to renew it. func (l *HealthzAdaptor) Check(req *http.Request) error { l.pointerLock.Lock() defer l.pointerLock.Unlock() if l.le == nil { return nil } return l.le.Check(l.timeout) } // SetLeaderElection ties a leader election object to a HealthzAdaptor func (l *HealthzAdaptor) SetLeaderElection(le *LeaderElector) { l.pointerLock.Lock() defer l.pointerLock.Unlock() l.le = le } // NewLeaderHealthzAdaptor creates a basic healthz adaptor to monitor a leader election. // timeout determines the time beyond the lease expiry to be allowed for timeout. // checks within the timeout period after the lease expires will still return healthy. func NewLeaderHealthzAdaptor(timeout time.Duration) *HealthzAdaptor { result := &HealthzAdaptor{ timeout: timeout, } return result }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/leaselock.go
vendor/k8s.io/client-go/tools/leaderelection/resourcelock/leaselock.go
/* Copyright 2018 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 resourcelock import ( "context" "encoding/json" "errors" "fmt" coordinationv1 "k8s.io/api/coordination/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" coordinationv1client "k8s.io/client-go/kubernetes/typed/coordination/v1" ) type LeaseLock struct { // LeaseMeta should contain a Name and a Namespace of a // LeaseMeta object that the LeaderElector will attempt to lead. LeaseMeta metav1.ObjectMeta Client coordinationv1client.LeasesGetter LockConfig ResourceLockConfig lease *coordinationv1.Lease } // Get returns the election record from a Lease spec func (ll *LeaseLock) Get(ctx context.Context) (*LeaderElectionRecord, []byte, error) { lease, err := ll.Client.Leases(ll.LeaseMeta.Namespace).Get(ctx, ll.LeaseMeta.Name, metav1.GetOptions{}) if err != nil { return nil, nil, err } ll.lease = lease record := LeaseSpecToLeaderElectionRecord(&ll.lease.Spec) recordByte, err := json.Marshal(*record) if err != nil { return nil, nil, err } return record, recordByte, nil } // Create attempts to create a Lease func (ll *LeaseLock) Create(ctx context.Context, ler LeaderElectionRecord) error { var err error ll.lease, err = ll.Client.Leases(ll.LeaseMeta.Namespace).Create(ctx, &coordinationv1.Lease{ ObjectMeta: metav1.ObjectMeta{ Name: ll.LeaseMeta.Name, Namespace: ll.LeaseMeta.Namespace, }, Spec: LeaderElectionRecordToLeaseSpec(&ler), }, metav1.CreateOptions{}) return err } // Update will update an existing Lease spec. func (ll *LeaseLock) Update(ctx context.Context, ler LeaderElectionRecord) error { if ll.lease == nil { return errors.New("lease not initialized, call get or create first") } ll.lease.Spec = LeaderElectionRecordToLeaseSpec(&ler) lease, err := ll.Client.Leases(ll.LeaseMeta.Namespace).Update(ctx, ll.lease, metav1.UpdateOptions{}) if err != nil { return err } ll.lease = lease return nil } // RecordEvent in leader election while adding meta-data func (ll *LeaseLock) RecordEvent(s string) { if ll.LockConfig.EventRecorder == nil { return } events := fmt.Sprintf("%v %v", ll.LockConfig.Identity, s) subject := &coordinationv1.Lease{ObjectMeta: ll.lease.ObjectMeta} // Populate the type meta, so we don't have to get it from the schema subject.Kind = "Lease" subject.APIVersion = coordinationv1.SchemeGroupVersion.String() ll.LockConfig.EventRecorder.Eventf(subject, corev1.EventTypeNormal, "LeaderElection", events) } // Describe is used to convert details on current resource lock // into a string func (ll *LeaseLock) Describe() string { return fmt.Sprintf("%v/%v", ll.LeaseMeta.Namespace, ll.LeaseMeta.Name) } // Identity returns the Identity of the lock func (ll *LeaseLock) Identity() string { return ll.LockConfig.Identity } func LeaseSpecToLeaderElectionRecord(spec *coordinationv1.LeaseSpec) *LeaderElectionRecord { var r LeaderElectionRecord if spec.HolderIdentity != nil { r.HolderIdentity = *spec.HolderIdentity } if spec.LeaseDurationSeconds != nil { r.LeaseDurationSeconds = int(*spec.LeaseDurationSeconds) } if spec.LeaseTransitions != nil { r.LeaderTransitions = int(*spec.LeaseTransitions) } if spec.AcquireTime != nil { r.AcquireTime = metav1.Time{Time: spec.AcquireTime.Time} } if spec.RenewTime != nil { r.RenewTime = metav1.Time{Time: spec.RenewTime.Time} } if spec.PreferredHolder != nil { r.PreferredHolder = *spec.PreferredHolder } if spec.Strategy != nil { r.Strategy = *spec.Strategy } return &r } func LeaderElectionRecordToLeaseSpec(ler *LeaderElectionRecord) coordinationv1.LeaseSpec { leaseDurationSeconds := int32(ler.LeaseDurationSeconds) leaseTransitions := int32(ler.LeaderTransitions) spec := coordinationv1.LeaseSpec{ HolderIdentity: &ler.HolderIdentity, LeaseDurationSeconds: &leaseDurationSeconds, AcquireTime: &metav1.MicroTime{Time: ler.AcquireTime.Time}, RenewTime: &metav1.MicroTime{Time: ler.RenewTime.Time}, LeaseTransitions: &leaseTransitions, } if ler.PreferredHolder != "" { spec.PreferredHolder = &ler.PreferredHolder } if ler.Strategy != "" { spec.Strategy = &ler.Strategy } return spec }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/interface.go
vendor/k8s.io/client-go/tools/leaderelection/resourcelock/interface.go
/* Copyright 2016 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 resourcelock import ( "context" "fmt" "time" v1 "k8s.io/api/coordination/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" clientset "k8s.io/client-go/kubernetes" coordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" restclient "k8s.io/client-go/rest" ) const ( LeaderElectionRecordAnnotationKey = "control-plane.alpha.kubernetes.io/leader" endpointsResourceLock = "endpoints" configMapsResourceLock = "configmaps" LeasesResourceLock = "leases" endpointsLeasesResourceLock = "endpointsleases" configMapsLeasesResourceLock = "configmapsleases" ) // LeaderElectionRecord is the record that is stored in the leader election annotation. // This information should be used for observational purposes only and could be replaced // with a random string (e.g. UUID) with only slight modification of this code. // TODO(mikedanese): this should potentially be versioned type LeaderElectionRecord struct { // HolderIdentity is the ID that owns the lease. If empty, no one owns this lease and // all callers may acquire. Versions of this library prior to Kubernetes 1.14 will not // attempt to acquire leases with empty identities and will wait for the full lease // interval to expire before attempting to reacquire. This value is set to empty when // a client voluntarily steps down. HolderIdentity string `json:"holderIdentity"` LeaseDurationSeconds int `json:"leaseDurationSeconds"` AcquireTime metav1.Time `json:"acquireTime"` RenewTime metav1.Time `json:"renewTime"` LeaderTransitions int `json:"leaderTransitions"` Strategy v1.CoordinatedLeaseStrategy `json:"strategy"` PreferredHolder string `json:"preferredHolder"` } // EventRecorder records a change in the ResourceLock. type EventRecorder interface { Eventf(obj runtime.Object, eventType, reason, message string, args ...interface{}) } // ResourceLockConfig common data that exists across different // resource locks type ResourceLockConfig struct { // Identity is the unique string identifying a lease holder across // all participants in an election. Identity string // EventRecorder is optional. EventRecorder EventRecorder } // Interface offers a common interface for locking on arbitrary // resources used in leader election. The Interface is used // to hide the details on specific implementations in order to allow // them to change over time. This interface is strictly for use // by the leaderelection code. type Interface interface { // Get returns the LeaderElectionRecord Get(ctx context.Context) (*LeaderElectionRecord, []byte, error) // Create attempts to create a LeaderElectionRecord Create(ctx context.Context, ler LeaderElectionRecord) error // Update will update and existing LeaderElectionRecord Update(ctx context.Context, ler LeaderElectionRecord) error // RecordEvent is used to record events RecordEvent(string) // Identity will return the locks Identity Identity() string // Describe is used to convert details on current resource lock // into a string Describe() string } // Manufacture will create a lock of a given type according to the input parameters func New(lockType string, ns string, name string, coreClient corev1.CoreV1Interface, coordinationClient coordinationv1.CoordinationV1Interface, rlc ResourceLockConfig) (Interface, error) { leaseLock := &LeaseLock{ LeaseMeta: metav1.ObjectMeta{ Namespace: ns, Name: name, }, Client: coordinationClient, LockConfig: rlc, } switch lockType { case endpointsResourceLock: return nil, fmt.Errorf("endpoints lock is removed, migrate to %s", LeasesResourceLock) case configMapsResourceLock: return nil, fmt.Errorf("configmaps lock is removed, migrate to %s", LeasesResourceLock) case LeasesResourceLock: return leaseLock, nil case endpointsLeasesResourceLock: return nil, fmt.Errorf("endpointsleases lock is removed, migrate to %s", LeasesResourceLock) case configMapsLeasesResourceLock: return nil, fmt.Errorf("configmapsleases lock is removed, migrated to %s", LeasesResourceLock) default: return nil, fmt.Errorf("Invalid lock-type %s", lockType) } } // NewFromKubeconfig will create a lock of a given type according to the input parameters. // Timeout set for a client used to contact to Kubernetes should be lower than // RenewDeadline to keep a single hung request from forcing a leader loss. // Setting it to max(time.Second, RenewDeadline/2) as a reasonable heuristic. func NewFromKubeconfig(lockType string, ns string, name string, rlc ResourceLockConfig, kubeconfig *restclient.Config, renewDeadline time.Duration) (Interface, error) { // shallow copy, do not modify the kubeconfig config := *kubeconfig timeout := renewDeadline / 2 if timeout < time.Second { timeout = time.Second } config.Timeout = timeout leaderElectionClient := clientset.NewForConfigOrDie(restclient.AddUserAgent(&config, "leader-election")) return New(lockType, ns, name, leaderElectionClient.CoreV1(), leaderElectionClient.CoordinationV1(), rlc) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/multilock.go
vendor/k8s.io/client-go/tools/leaderelection/resourcelock/multilock.go
/* Copyright 2019 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 resourcelock import ( "bytes" "context" "encoding/json" apierrors "k8s.io/apimachinery/pkg/api/errors" ) const ( UnknownLeader = "leaderelection.k8s.io/unknown" ) // MultiLock is used for lock's migration type MultiLock struct { Primary Interface Secondary Interface } // Get returns the older election record of the lock func (ml *MultiLock) Get(ctx context.Context) (*LeaderElectionRecord, []byte, error) { primary, primaryRaw, err := ml.Primary.Get(ctx) if err != nil { return nil, nil, err } secondary, secondaryRaw, err := ml.Secondary.Get(ctx) if err != nil { // Lock is held by old client if apierrors.IsNotFound(err) && primary.HolderIdentity != ml.Identity() { return primary, primaryRaw, nil } return nil, nil, err } if primary.HolderIdentity != secondary.HolderIdentity { primary.HolderIdentity = UnknownLeader primaryRaw, err = json.Marshal(primary) if err != nil { return nil, nil, err } } return primary, ConcatRawRecord(primaryRaw, secondaryRaw), nil } // Create attempts to create both primary lock and secondary lock func (ml *MultiLock) Create(ctx context.Context, ler LeaderElectionRecord) error { err := ml.Primary.Create(ctx, ler) if err != nil && !apierrors.IsAlreadyExists(err) { return err } return ml.Secondary.Create(ctx, ler) } // Update will update and existing annotation on both two resources. func (ml *MultiLock) Update(ctx context.Context, ler LeaderElectionRecord) error { err := ml.Primary.Update(ctx, ler) if err != nil { return err } _, _, err = ml.Secondary.Get(ctx) if err != nil && apierrors.IsNotFound(err) { return ml.Secondary.Create(ctx, ler) } return ml.Secondary.Update(ctx, ler) } // RecordEvent in leader election while adding meta-data func (ml *MultiLock) RecordEvent(s string) { ml.Primary.RecordEvent(s) ml.Secondary.RecordEvent(s) } // Describe is used to convert details on current resource lock // into a string func (ml *MultiLock) Describe() string { return ml.Primary.Describe() } // Identity returns the Identity of the lock func (ml *MultiLock) Identity() string { return ml.Primary.Identity() } func ConcatRawRecord(primaryRaw, secondaryRaw []byte) []byte { return bytes.Join([][]byte{primaryRaw, secondaryRaw}, []byte(",")) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/tools/internal/events/interfaces.go
vendor/k8s.io/client-go/tools/internal/events/interfaces.go
/* Copyright 2019 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 internal is needed to break an import cycle: record.EventRecorderAdapter // needs this interface definition to implement it, but event.NewEventBroadcasterAdapter // needs record.NewBroadcaster. Therefore this interface cannot be in event/interfaces.go. package internal import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/klog/v2" ) // EventRecorder knows how to record events on behalf of an EventSource. type EventRecorder interface { // Eventf constructs an event from the given information and puts it in the queue for sending. // 'regarding' is the object this event is about. Event will make a reference-- or you may also // pass a reference to the object directly. // 'related' is the secondary object for more complex actions. E.g. when regarding object triggers // a creation or deletion of related object. // 'type' of this event, and can be one of Normal, Warning. New types could be added in future // 'reason' is the reason this event is generated. 'reason' should be short and unique; it // should be in UpperCamelCase format (starting with a capital letter). "reason" will be used // to automate handling of events, so imagine people writing switch statements to handle them. // You want to make that easy. // 'action' explains what happened with regarding/what action did the ReportingController // (ReportingController is a type of a Controller reporting an Event, e.g. k8s.io/node-controller, k8s.io/kubelet.) // take in regarding's name; it should be in UpperCamelCase format (starting with a capital letter). // 'note' is intended to be human readable. Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{}) } // EventRecorderLogger extends EventRecorder such that a logger can // be set for methods in EventRecorder. Normally, those methods // uses the global default logger to record errors and debug messages. // If that is not desired, use WithLogger to provide a logger instance. type EventRecorderLogger interface { EventRecorder // WithLogger replaces the context used for logging. This is a cheap call // and meant to be used for contextual logging: // recorder := ... // logger := klog.FromContext(ctx) // recorder.WithLogger(logger).Eventf(...) WithLogger(logger klog.Logger) EventRecorderLogger }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/metadata/metadata.go
vendor/k8s.io/client-go/metadata/metadata.go
/* Copyright 2018 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 metadata import ( "context" "encoding/json" "fmt" "net/http" "time" "k8s.io/klog/v2" metainternalversionscheme "k8s.io/apimachinery/pkg/apis/meta/internalversion/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/rest" "k8s.io/client-go/util/consistencydetector" "k8s.io/client-go/util/watchlist" ) var deleteScheme = runtime.NewScheme() var parameterScheme = runtime.NewScheme() var deleteOptionsCodec = serializer.NewCodecFactory(deleteScheme) var dynamicParameterCodec = runtime.NewParameterCodec(parameterScheme) var versionV1 = schema.GroupVersion{Version: "v1"} func init() { metav1.AddToGroupVersion(parameterScheme, versionV1) metav1.AddToGroupVersion(deleteScheme, versionV1) } // Client allows callers to retrieve the object metadata for any // Kubernetes-compatible API endpoint. The client uses the // meta.k8s.io/v1 PartialObjectMetadata resource to more efficiently // retrieve just the necessary metadata, but on older servers // (Kubernetes 1.14 and before) will retrieve the object and then // convert the metadata. type Client struct { client *rest.RESTClient } var _ Interface = &Client{} // ConfigFor returns a copy of the provided config with the // appropriate metadata client defaults set. func ConfigFor(inConfig *rest.Config) *rest.Config { config := rest.CopyConfig(inConfig) config.AcceptContentTypes = "application/vnd.kubernetes.protobuf,application/json" config.ContentType = "application/vnd.kubernetes.protobuf" config.NegotiatedSerializer = metainternalversionscheme.Codecs.WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() } return config } // NewForConfigOrDie creates a new metadata client for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) Interface { ret, err := NewForConfig(c) if err != nil { panic(err) } return ret } // NewForConfig creates a new metadata client that can retrieve object // metadata details about any Kubernetes object (core, aggregated, or custom // resource based) in the form of PartialObjectMetadata objects, or returns // an error. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(inConfig *rest.Config) (Interface, error) { config := ConfigFor(inConfig) httpClient, err := rest.HTTPClientFor(config) if err != nil { return nil, err } return NewForConfigAndClient(config, httpClient) } // NewForConfigAndClient creates a new metadata client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. func NewForConfigAndClient(inConfig *rest.Config, h *http.Client) (Interface, error) { config := ConfigFor(inConfig) // for serializing the options config.GroupVersion = &schema.GroupVersion{} config.APIPath = "/this-value-should-never-be-sent" restClient, err := rest.RESTClientForConfigAndClient(config, h) if err != nil { return nil, err } return &Client{client: restClient}, nil } type client struct { client *Client namespace string resource schema.GroupVersionResource } // Resource returns an interface that can access cluster or namespace // scoped instances of resource. func (c *Client) Resource(resource schema.GroupVersionResource) Getter { return &client{client: c, resource: resource} } // Namespace returns an interface that can access namespace-scoped instances of the // provided resource. func (c *client) Namespace(ns string) ResourceInterface { ret := *c ret.namespace = ns return &ret } // Delete removes the provided resource from the server. func (c *client) Delete(ctx context.Context, name string, opts metav1.DeleteOptions, subresources ...string) error { if len(name) == 0 { return fmt.Errorf("name is required") } // if DeleteOptions are delivered to Negotiator for serialization, // HTTP-Request header will bring "Content-Type: application/vnd.kubernetes.protobuf" // apiextensions-apiserver uses unstructuredNegotiatedSerializer to decode the input, // server-side will reply with 406 errors. // The special treatment here is to be compatible with CRD Handler // see: https://github.com/kubernetes/kubernetes/blob/1a845ccd076bbf1b03420fe694c85a5cd3bd6bed/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/customresource_handler.go#L843 deleteOptionsByte, err := runtime.Encode(deleteOptionsCodec.LegacyCodec(schema.GroupVersion{Version: "v1"}), &opts) if err != nil { return err } result := c.client.client. Delete(). AbsPath(append(c.makeURLSegments(name), subresources...)...). SetHeader("Content-Type", runtime.ContentTypeJSON). Body(deleteOptionsByte). Do(ctx) return result.Error() } // DeleteCollection triggers deletion of all resources in the specified scope (namespace or cluster). func (c *client) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOptions metav1.ListOptions) error { // See comment on Delete deleteOptionsByte, err := runtime.Encode(deleteOptionsCodec.LegacyCodec(schema.GroupVersion{Version: "v1"}), &opts) if err != nil { return err } result := c.client.client. Delete(). AbsPath(c.makeURLSegments("")...). SetHeader("Content-Type", runtime.ContentTypeJSON). Body(deleteOptionsByte). SpecificallyVersionedParams(&listOptions, dynamicParameterCodec, versionV1). Do(ctx) return result.Error() } // Get returns the resource with name from the specified scope (namespace or cluster). func (c *client) Get(ctx context.Context, name string, opts metav1.GetOptions, subresources ...string) (*metav1.PartialObjectMetadata, error) { if len(name) == 0 { return nil, fmt.Errorf("name is required") } result := c.client.client.Get().AbsPath(append(c.makeURLSegments(name), subresources...)...). SetHeader("Accept", "application/vnd.kubernetes.protobuf;as=PartialObjectMetadata;g=meta.k8s.io;v=v1,application/json;as=PartialObjectMetadata;g=meta.k8s.io;v=v1,application/json"). SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1). Do(ctx) if err := result.Error(); err != nil { return nil, err } obj, err := result.Get() if runtime.IsNotRegisteredError(err) { klog.FromContext(ctx).V(5).Info("Could not retrieve PartialObjectMetadata", "err", err) rawBytes, err := result.Raw() if err != nil { return nil, err } var partial metav1.PartialObjectMetadata if err := json.Unmarshal(rawBytes, &partial); err != nil { return nil, fmt.Errorf("unable to decode returned object as PartialObjectMetadata: %v", err) } if !isLikelyObjectMetadata(&partial) { return nil, fmt.Errorf("object does not appear to match the ObjectMeta schema: %#v", partial) } partial.TypeMeta = metav1.TypeMeta{} return &partial, nil } if err != nil { return nil, err } partial, ok := obj.(*metav1.PartialObjectMetadata) if !ok { return nil, fmt.Errorf("unexpected object, expected PartialObjectMetadata but got %T", obj) } return partial, nil } // List returns all resources within the specified scope (namespace or cluster). func (c *client) List(ctx context.Context, opts metav1.ListOptions) (*metav1.PartialObjectMetadataList, error) { if watchListOptions, hasWatchListOptionsPrepared, watchListOptionsErr := watchlist.PrepareWatchListOptionsFromListOptions(opts); watchListOptionsErr != nil { klog.FromContext(ctx).Error(watchListOptionsErr, "Failed preparing watchlist options, falling back to the standard LIST semantics", "resource", c.resource) } else if hasWatchListOptionsPrepared { result, err := c.watchList(ctx, watchListOptions) if err == nil { consistencydetector.CheckWatchListFromCacheDataConsistencyIfRequested(ctx, fmt.Sprintf("watchlist request for %v", c.resource), c.list, opts, result) return result, nil } klog.FromContext(ctx).Error(err, "The watchlist request ended with an error, falling back to the standard LIST semantics", "resource", c.resource) } result, err := c.list(ctx, opts) if err == nil { consistencydetector.CheckListFromCacheDataConsistencyIfRequested(ctx, fmt.Sprintf("list request for %v", c.resource), c.list, opts, result) } return result, err } func (c *client) list(ctx context.Context, opts metav1.ListOptions) (*metav1.PartialObjectMetadataList, error) { result := c.client.client.Get().AbsPath(c.makeURLSegments("")...). SetHeader("Accept", "application/vnd.kubernetes.protobuf;as=PartialObjectMetadataList;g=meta.k8s.io;v=v1,application/json;as=PartialObjectMetadataList;g=meta.k8s.io;v=v1,application/json"). SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1). Do(ctx) if err := result.Error(); err != nil { return nil, err } obj, err := result.Get() if runtime.IsNotRegisteredError(err) { klog.FromContext(ctx).V(5).Info("Could not retrieve PartialObjectMetadataList", "err", err) rawBytes, err := result.Raw() if err != nil { return nil, err } var partial metav1.PartialObjectMetadataList if err := json.Unmarshal(rawBytes, &partial); err != nil { return nil, fmt.Errorf("unable to decode returned object as PartialObjectMetadataList: %v", err) } partial.TypeMeta = metav1.TypeMeta{} return &partial, nil } if err != nil { return nil, err } partial, ok := obj.(*metav1.PartialObjectMetadataList) if !ok { return nil, fmt.Errorf("unexpected object, expected PartialObjectMetadata but got %T", obj) } return partial, nil } // watchList establishes a watch stream with the server and returns PartialObjectMetadataList. func (c *client) watchList(ctx context.Context, opts metav1.ListOptions) (*metav1.PartialObjectMetadataList, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } result := &metav1.PartialObjectMetadataList{} err := c.client.client.Get(). AbsPath(c.makeURLSegments("")...). SetHeader("Accept", "application/vnd.kubernetes.protobuf;as=PartialObjectMetadata;g=meta.k8s.io;v=v1,application/json;as=PartialObjectMetadata;g=meta.k8s.io;v=v1,application/json"). SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1). Timeout(timeout). WatchList(ctx). Into(result) return result, err } // Watch finds all changes to the resources in the specified scope (namespace or cluster). func (c *client) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } opts.Watch = true return c.client.client.Get(). AbsPath(c.makeURLSegments("")...). SetHeader("Accept", "application/vnd.kubernetes.protobuf;as=PartialObjectMetadata;g=meta.k8s.io;v=v1,application/json;as=PartialObjectMetadata;g=meta.k8s.io;v=v1,application/json"). SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1). Timeout(timeout). Watch(ctx) } // Patch modifies the named resource in the specified scope (namespace or cluster). func (c *client) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*metav1.PartialObjectMetadata, error) { if len(name) == 0 { return nil, fmt.Errorf("name is required") } result := c.client.client. Patch(pt). AbsPath(append(c.makeURLSegments(name), subresources...)...). Body(data). SetHeader("Accept", "application/vnd.kubernetes.protobuf;as=PartialObjectMetadata;g=meta.k8s.io;v=v1,application/json;as=PartialObjectMetadata;g=meta.k8s.io;v=v1,application/json"). SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1). Do(ctx) if err := result.Error(); err != nil { return nil, err } obj, err := result.Get() if runtime.IsNotRegisteredError(err) { rawBytes, err := result.Raw() if err != nil { return nil, err } var partial metav1.PartialObjectMetadata if err := json.Unmarshal(rawBytes, &partial); err != nil { return nil, fmt.Errorf("unable to decode returned object as PartialObjectMetadata: %v", err) } if !isLikelyObjectMetadata(&partial) { return nil, fmt.Errorf("object does not appear to match the ObjectMeta schema") } partial.TypeMeta = metav1.TypeMeta{} return &partial, nil } if err != nil { return nil, err } partial, ok := obj.(*metav1.PartialObjectMetadata) if !ok { return nil, fmt.Errorf("unexpected object, expected PartialObjectMetadata but got %T", obj) } return partial, nil } func (c *client) makeURLSegments(name string) []string { url := []string{} if len(c.resource.Group) == 0 { url = append(url, "api") } else { url = append(url, "apis", c.resource.Group) } url = append(url, c.resource.Version) if len(c.namespace) > 0 { url = append(url, "namespaces", c.namespace) } url = append(url, c.resource.Resource) if len(name) > 0 { url = append(url, name) } return url } func isLikelyObjectMetadata(meta *metav1.PartialObjectMetadata) bool { return len(meta.UID) > 0 || !meta.CreationTimestamp.IsZero() || len(meta.Name) > 0 || len(meta.GenerateName) > 0 }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/metadata/interface.go
vendor/k8s.io/client-go/metadata/interface.go
/* Copyright 2016 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 metadata import ( "context" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" ) // Interface allows a caller to get the metadata (in the form of PartialObjectMetadata objects) // from any Kubernetes compatible resource API. type Interface interface { Resource(resource schema.GroupVersionResource) Getter } // ResourceInterface contains the set of methods that may be invoked on objects by their metadata. // Update is not supported by the server, but Patch can be used for the actions Update would handle. type ResourceInterface interface { Delete(ctx context.Context, name string, options metav1.DeleteOptions, subresources ...string) error DeleteCollection(ctx context.Context, options metav1.DeleteOptions, listOptions metav1.ListOptions) error Get(ctx context.Context, name string, options metav1.GetOptions, subresources ...string) (*metav1.PartialObjectMetadata, error) List(ctx context.Context, opts metav1.ListOptions) (*metav1.PartialObjectMetadataList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, options metav1.PatchOptions, subresources ...string) (*metav1.PartialObjectMetadata, error) } // Getter handles both namespaced and non-namespaced resource types consistently. type Getter interface { Namespace(string) ResourceInterface ResourceInterface }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/generic.go
vendor/k8s.io/client-go/informers/generic.go
/* 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 informers import ( fmt "fmt" v1 "k8s.io/api/admissionregistration/v1" v1alpha1 "k8s.io/api/admissionregistration/v1alpha1" v1beta1 "k8s.io/api/admissionregistration/v1beta1" apiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" appsv1 "k8s.io/api/apps/v1" appsv1beta1 "k8s.io/api/apps/v1beta1" v1beta2 "k8s.io/api/apps/v1beta2" autoscalingv1 "k8s.io/api/autoscaling/v1" v2 "k8s.io/api/autoscaling/v2" v2beta1 "k8s.io/api/autoscaling/v2beta1" v2beta2 "k8s.io/api/autoscaling/v2beta2" batchv1 "k8s.io/api/batch/v1" batchv1beta1 "k8s.io/api/batch/v1beta1" certificatesv1 "k8s.io/api/certificates/v1" certificatesv1alpha1 "k8s.io/api/certificates/v1alpha1" certificatesv1beta1 "k8s.io/api/certificates/v1beta1" coordinationv1 "k8s.io/api/coordination/v1" v1alpha2 "k8s.io/api/coordination/v1alpha2" coordinationv1beta1 "k8s.io/api/coordination/v1beta1" corev1 "k8s.io/api/core/v1" discoveryv1 "k8s.io/api/discovery/v1" discoveryv1beta1 "k8s.io/api/discovery/v1beta1" eventsv1 "k8s.io/api/events/v1" eventsv1beta1 "k8s.io/api/events/v1beta1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1" flowcontrolv1 "k8s.io/api/flowcontrol/v1" flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" v1beta3 "k8s.io/api/flowcontrol/v1beta3" networkingv1 "k8s.io/api/networking/v1" networkingv1alpha1 "k8s.io/api/networking/v1alpha1" networkingv1beta1 "k8s.io/api/networking/v1beta1" nodev1 "k8s.io/api/node/v1" nodev1alpha1 "k8s.io/api/node/v1alpha1" nodev1beta1 "k8s.io/api/node/v1beta1" policyv1 "k8s.io/api/policy/v1" policyv1beta1 "k8s.io/api/policy/v1beta1" rbacv1 "k8s.io/api/rbac/v1" rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" rbacv1beta1 "k8s.io/api/rbac/v1beta1" v1alpha3 "k8s.io/api/resource/v1alpha3" resourcev1beta1 "k8s.io/api/resource/v1beta1" schedulingv1 "k8s.io/api/scheduling/v1" schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" storagev1beta1 "k8s.io/api/storage/v1beta1" storagemigrationv1alpha1 "k8s.io/api/storagemigration/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) // GenericInformer is type of SharedIndexInformer which will locate and delegate to other // sharedInformers based on type type GenericInformer interface { Informer() cache.SharedIndexInformer Lister() cache.GenericLister } type genericInformer struct { informer cache.SharedIndexInformer resource schema.GroupResource } // Informer returns the SharedIndexInformer. func (f *genericInformer) Informer() cache.SharedIndexInformer { return f.informer } // Lister returns the GenericLister. func (f *genericInformer) Lister() cache.GenericLister { return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) } // ForResource gives generic access to a shared informer of the matching type // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=admissionregistration.k8s.io, Version=v1 case v1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().MutatingWebhookConfigurations().Informer()}, nil case v1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().ValidatingAdmissionPolicies().Informer()}, nil case v1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().ValidatingAdmissionPolicyBindings().Informer()}, nil case v1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().ValidatingWebhookConfigurations().Informer()}, nil // Group=admissionregistration.k8s.io, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1alpha1().MutatingAdmissionPolicies().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicybindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1alpha1().MutatingAdmissionPolicyBindings().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1alpha1().ValidatingAdmissionPolicies().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1alpha1().ValidatingAdmissionPolicyBindings().Informer()}, nil // Group=admissionregistration.k8s.io, Version=v1beta1 case v1beta1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1beta1().MutatingWebhookConfigurations().Informer()}, nil case v1beta1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1beta1().ValidatingAdmissionPolicies().Informer()}, nil case v1beta1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1beta1().ValidatingAdmissionPolicyBindings().Informer()}, nil case v1beta1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1beta1().ValidatingWebhookConfigurations().Informer()}, nil // Group=apps, Version=v1 case appsv1.SchemeGroupVersion.WithResource("controllerrevisions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().ControllerRevisions().Informer()}, nil case appsv1.SchemeGroupVersion.WithResource("daemonsets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().DaemonSets().Informer()}, nil case appsv1.SchemeGroupVersion.WithResource("deployments"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().Deployments().Informer()}, nil case appsv1.SchemeGroupVersion.WithResource("replicasets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().ReplicaSets().Informer()}, nil case appsv1.SchemeGroupVersion.WithResource("statefulsets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().StatefulSets().Informer()}, nil // Group=apps, Version=v1beta1 case appsv1beta1.SchemeGroupVersion.WithResource("controllerrevisions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().ControllerRevisions().Informer()}, nil case appsv1beta1.SchemeGroupVersion.WithResource("deployments"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().Deployments().Informer()}, nil case appsv1beta1.SchemeGroupVersion.WithResource("statefulsets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().StatefulSets().Informer()}, nil // Group=apps, Version=v1beta2 case v1beta2.SchemeGroupVersion.WithResource("controllerrevisions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().ControllerRevisions().Informer()}, nil case v1beta2.SchemeGroupVersion.WithResource("daemonsets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().DaemonSets().Informer()}, nil case v1beta2.SchemeGroupVersion.WithResource("deployments"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().Deployments().Informer()}, nil case v1beta2.SchemeGroupVersion.WithResource("replicasets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().ReplicaSets().Informer()}, nil case v1beta2.SchemeGroupVersion.WithResource("statefulsets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().StatefulSets().Informer()}, nil // Group=autoscaling, Version=v1 case autoscalingv1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1().HorizontalPodAutoscalers().Informer()}, nil // Group=autoscaling, Version=v2 case v2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2().HorizontalPodAutoscalers().Informer()}, nil // Group=autoscaling, Version=v2beta1 case v2beta1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta1().HorizontalPodAutoscalers().Informer()}, nil // Group=autoscaling, Version=v2beta2 case v2beta2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta2().HorizontalPodAutoscalers().Informer()}, nil // Group=batch, Version=v1 case batchv1.SchemeGroupVersion.WithResource("cronjobs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().CronJobs().Informer()}, nil case batchv1.SchemeGroupVersion.WithResource("jobs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().Jobs().Informer()}, nil // Group=batch, Version=v1beta1 case batchv1beta1.SchemeGroupVersion.WithResource("cronjobs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1beta1().CronJobs().Informer()}, nil // Group=certificates.k8s.io, Version=v1 case certificatesv1.SchemeGroupVersion.WithResource("certificatesigningrequests"): return &genericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1().CertificateSigningRequests().Informer()}, nil // Group=certificates.k8s.io, Version=v1alpha1 case certificatesv1alpha1.SchemeGroupVersion.WithResource("clustertrustbundles"): return &genericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1alpha1().ClusterTrustBundles().Informer()}, nil // Group=certificates.k8s.io, Version=v1beta1 case certificatesv1beta1.SchemeGroupVersion.WithResource("certificatesigningrequests"): return &genericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1beta1().CertificateSigningRequests().Informer()}, nil // Group=coordination.k8s.io, Version=v1 case coordinationv1.SchemeGroupVersion.WithResource("leases"): return &genericInformer{resource: resource.GroupResource(), informer: f.Coordination().V1().Leases().Informer()}, nil // Group=coordination.k8s.io, Version=v1alpha2 case v1alpha2.SchemeGroupVersion.WithResource("leasecandidates"): return &genericInformer{resource: resource.GroupResource(), informer: f.Coordination().V1alpha2().LeaseCandidates().Informer()}, nil // Group=coordination.k8s.io, Version=v1beta1 case coordinationv1beta1.SchemeGroupVersion.WithResource("leases"): return &genericInformer{resource: resource.GroupResource(), informer: f.Coordination().V1beta1().Leases().Informer()}, nil // Group=core, Version=v1 case corev1.SchemeGroupVersion.WithResource("componentstatuses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ComponentStatuses().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("configmaps"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ConfigMaps().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("endpoints"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Endpoints().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("events"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Events().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("limitranges"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().LimitRanges().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("namespaces"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Namespaces().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("nodes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Nodes().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("persistentvolumes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PersistentVolumes().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("persistentvolumeclaims"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PersistentVolumeClaims().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("pods"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Pods().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("podtemplates"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PodTemplates().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("replicationcontrollers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ReplicationControllers().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("resourcequotas"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ResourceQuotas().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("secrets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Secrets().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("services"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Services().Informer()}, nil case corev1.SchemeGroupVersion.WithResource("serviceaccounts"): return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ServiceAccounts().Informer()}, nil // Group=discovery.k8s.io, Version=v1 case discoveryv1.SchemeGroupVersion.WithResource("endpointslices"): return &genericInformer{resource: resource.GroupResource(), informer: f.Discovery().V1().EndpointSlices().Informer()}, nil // Group=discovery.k8s.io, Version=v1beta1 case discoveryv1beta1.SchemeGroupVersion.WithResource("endpointslices"): return &genericInformer{resource: resource.GroupResource(), informer: f.Discovery().V1beta1().EndpointSlices().Informer()}, nil // Group=events.k8s.io, Version=v1 case eventsv1.SchemeGroupVersion.WithResource("events"): return &genericInformer{resource: resource.GroupResource(), informer: f.Events().V1().Events().Informer()}, nil // Group=events.k8s.io, Version=v1beta1 case eventsv1beta1.SchemeGroupVersion.WithResource("events"): return &genericInformer{resource: resource.GroupResource(), informer: f.Events().V1beta1().Events().Informer()}, nil // Group=extensions, Version=v1beta1 case extensionsv1beta1.SchemeGroupVersion.WithResource("daemonsets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().DaemonSets().Informer()}, nil case extensionsv1beta1.SchemeGroupVersion.WithResource("deployments"): return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Deployments().Informer()}, nil case extensionsv1beta1.SchemeGroupVersion.WithResource("ingresses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Ingresses().Informer()}, nil case extensionsv1beta1.SchemeGroupVersion.WithResource("networkpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().NetworkPolicies().Informer()}, nil case extensionsv1beta1.SchemeGroupVersion.WithResource("replicasets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().ReplicaSets().Informer()}, nil // Group=flowcontrol.apiserver.k8s.io, Version=v1 case flowcontrolv1.SchemeGroupVersion.WithResource("flowschemas"): return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1().FlowSchemas().Informer()}, nil case flowcontrolv1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1().PriorityLevelConfigurations().Informer()}, nil // Group=flowcontrol.apiserver.k8s.io, Version=v1beta1 case flowcontrolv1beta1.SchemeGroupVersion.WithResource("flowschemas"): return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta1().FlowSchemas().Informer()}, nil case flowcontrolv1beta1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta1().PriorityLevelConfigurations().Informer()}, nil // Group=flowcontrol.apiserver.k8s.io, Version=v1beta2 case flowcontrolv1beta2.SchemeGroupVersion.WithResource("flowschemas"): return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta2().FlowSchemas().Informer()}, nil case flowcontrolv1beta2.SchemeGroupVersion.WithResource("prioritylevelconfigurations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta2().PriorityLevelConfigurations().Informer()}, nil // Group=flowcontrol.apiserver.k8s.io, Version=v1beta3 case v1beta3.SchemeGroupVersion.WithResource("flowschemas"): return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta3().FlowSchemas().Informer()}, nil case v1beta3.SchemeGroupVersion.WithResource("prioritylevelconfigurations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta3().PriorityLevelConfigurations().Informer()}, nil // Group=internal.apiserver.k8s.io, Version=v1alpha1 case apiserverinternalv1alpha1.SchemeGroupVersion.WithResource("storageversions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Internal().V1alpha1().StorageVersions().Informer()}, nil // Group=networking.k8s.io, Version=v1 case networkingv1.SchemeGroupVersion.WithResource("ingresses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().Ingresses().Informer()}, nil case networkingv1.SchemeGroupVersion.WithResource("ingressclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().IngressClasses().Informer()}, nil case networkingv1.SchemeGroupVersion.WithResource("networkpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().NetworkPolicies().Informer()}, nil // Group=networking.k8s.io, Version=v1alpha1 case networkingv1alpha1.SchemeGroupVersion.WithResource("ipaddresses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha1().IPAddresses().Informer()}, nil case networkingv1alpha1.SchemeGroupVersion.WithResource("servicecidrs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha1().ServiceCIDRs().Informer()}, nil // Group=networking.k8s.io, Version=v1beta1 case networkingv1beta1.SchemeGroupVersion.WithResource("ipaddresses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().IPAddresses().Informer()}, nil case networkingv1beta1.SchemeGroupVersion.WithResource("ingresses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().Ingresses().Informer()}, nil case networkingv1beta1.SchemeGroupVersion.WithResource("ingressclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().IngressClasses().Informer()}, nil case networkingv1beta1.SchemeGroupVersion.WithResource("servicecidrs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().ServiceCIDRs().Informer()}, nil // Group=node.k8s.io, Version=v1 case nodev1.SchemeGroupVersion.WithResource("runtimeclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1().RuntimeClasses().Informer()}, nil // Group=node.k8s.io, Version=v1alpha1 case nodev1alpha1.SchemeGroupVersion.WithResource("runtimeclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1alpha1().RuntimeClasses().Informer()}, nil // Group=node.k8s.io, Version=v1beta1 case nodev1beta1.SchemeGroupVersion.WithResource("runtimeclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1beta1().RuntimeClasses().Informer()}, nil // Group=policy, Version=v1 case policyv1.SchemeGroupVersion.WithResource("poddisruptionbudgets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1().PodDisruptionBudgets().Informer()}, nil // Group=policy, Version=v1beta1 case policyv1beta1.SchemeGroupVersion.WithResource("poddisruptionbudgets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1beta1().PodDisruptionBudgets().Informer()}, nil // Group=rbac.authorization.k8s.io, Version=v1 case rbacv1.SchemeGroupVersion.WithResource("clusterroles"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().ClusterRoles().Informer()}, nil case rbacv1.SchemeGroupVersion.WithResource("clusterrolebindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().ClusterRoleBindings().Informer()}, nil case rbacv1.SchemeGroupVersion.WithResource("roles"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().Roles().Informer()}, nil case rbacv1.SchemeGroupVersion.WithResource("rolebindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().RoleBindings().Informer()}, nil // Group=rbac.authorization.k8s.io, Version=v1alpha1 case rbacv1alpha1.SchemeGroupVersion.WithResource("clusterroles"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoles().Informer()}, nil case rbacv1alpha1.SchemeGroupVersion.WithResource("clusterrolebindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoleBindings().Informer()}, nil case rbacv1alpha1.SchemeGroupVersion.WithResource("roles"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().Roles().Informer()}, nil case rbacv1alpha1.SchemeGroupVersion.WithResource("rolebindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().RoleBindings().Informer()}, nil // Group=rbac.authorization.k8s.io, Version=v1beta1 case rbacv1beta1.SchemeGroupVersion.WithResource("clusterroles"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().ClusterRoles().Informer()}, nil case rbacv1beta1.SchemeGroupVersion.WithResource("clusterrolebindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().ClusterRoleBindings().Informer()}, nil case rbacv1beta1.SchemeGroupVersion.WithResource("roles"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().Roles().Informer()}, nil case rbacv1beta1.SchemeGroupVersion.WithResource("rolebindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().RoleBindings().Informer()}, nil // Group=resource.k8s.io, Version=v1alpha3 case v1alpha3.SchemeGroupVersion.WithResource("deviceclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha3().DeviceClasses().Informer()}, nil case v1alpha3.SchemeGroupVersion.WithResource("resourceclaims"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha3().ResourceClaims().Informer()}, nil case v1alpha3.SchemeGroupVersion.WithResource("resourceclaimtemplates"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha3().ResourceClaimTemplates().Informer()}, nil case v1alpha3.SchemeGroupVersion.WithResource("resourceslices"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha3().ResourceSlices().Informer()}, nil // Group=resource.k8s.io, Version=v1beta1 case resourcev1beta1.SchemeGroupVersion.WithResource("deviceclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta1().DeviceClasses().Informer()}, nil case resourcev1beta1.SchemeGroupVersion.WithResource("resourceclaims"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta1().ResourceClaims().Informer()}, nil case resourcev1beta1.SchemeGroupVersion.WithResource("resourceclaimtemplates"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta1().ResourceClaimTemplates().Informer()}, nil case resourcev1beta1.SchemeGroupVersion.WithResource("resourceslices"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta1().ResourceSlices().Informer()}, nil // Group=scheduling.k8s.io, Version=v1 case schedulingv1.SchemeGroupVersion.WithResource("priorityclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().PriorityClasses().Informer()}, nil // Group=scheduling.k8s.io, Version=v1alpha1 case schedulingv1alpha1.SchemeGroupVersion.WithResource("priorityclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().PriorityClasses().Informer()}, nil // Group=scheduling.k8s.io, Version=v1beta1 case schedulingv1beta1.SchemeGroupVersion.WithResource("priorityclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().PriorityClasses().Informer()}, nil // Group=storage.k8s.io, Version=v1 case storagev1.SchemeGroupVersion.WithResource("csidrivers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSIDrivers().Informer()}, nil case storagev1.SchemeGroupVersion.WithResource("csinodes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSINodes().Informer()}, nil case storagev1.SchemeGroupVersion.WithResource("csistoragecapacities"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSIStorageCapacities().Informer()}, nil case storagev1.SchemeGroupVersion.WithResource("storageclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().StorageClasses().Informer()}, nil case storagev1.SchemeGroupVersion.WithResource("volumeattachments"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().VolumeAttachments().Informer()}, nil // Group=storage.k8s.io, Version=v1alpha1 case storagev1alpha1.SchemeGroupVersion.WithResource("csistoragecapacities"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1alpha1().CSIStorageCapacities().Informer()}, nil case storagev1alpha1.SchemeGroupVersion.WithResource("volumeattachments"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1alpha1().VolumeAttachments().Informer()}, nil case storagev1alpha1.SchemeGroupVersion.WithResource("volumeattributesclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1alpha1().VolumeAttributesClasses().Informer()}, nil // Group=storage.k8s.io, Version=v1beta1 case storagev1beta1.SchemeGroupVersion.WithResource("csidrivers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSIDrivers().Informer()}, nil case storagev1beta1.SchemeGroupVersion.WithResource("csinodes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSINodes().Informer()}, nil case storagev1beta1.SchemeGroupVersion.WithResource("csistoragecapacities"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSIStorageCapacities().Informer()}, nil case storagev1beta1.SchemeGroupVersion.WithResource("storageclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().StorageClasses().Informer()}, nil case storagev1beta1.SchemeGroupVersion.WithResource("volumeattachments"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().VolumeAttachments().Informer()}, nil case storagev1beta1.SchemeGroupVersion.WithResource("volumeattributesclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().VolumeAttributesClasses().Informer()}, nil // Group=storagemigration.k8s.io, Version=v1alpha1 case storagemigrationv1alpha1.SchemeGroupVersion.WithResource("storageversionmigrations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Storagemigration().V1alpha1().StorageVersionMigrations().Informer()}, nil } return nil, fmt.Errorf("no informer found for %v", resource) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/factory.go
vendor/k8s.io/client-go/informers/factory.go
/* 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 informers import ( reflect "reflect" sync "sync" time "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" admissionregistration "k8s.io/client-go/informers/admissionregistration" apiserverinternal "k8s.io/client-go/informers/apiserverinternal" apps "k8s.io/client-go/informers/apps" autoscaling "k8s.io/client-go/informers/autoscaling" batch "k8s.io/client-go/informers/batch" certificates "k8s.io/client-go/informers/certificates" coordination "k8s.io/client-go/informers/coordination" core "k8s.io/client-go/informers/core" discovery "k8s.io/client-go/informers/discovery" events "k8s.io/client-go/informers/events" extensions "k8s.io/client-go/informers/extensions" flowcontrol "k8s.io/client-go/informers/flowcontrol" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" networking "k8s.io/client-go/informers/networking" node "k8s.io/client-go/informers/node" policy "k8s.io/client-go/informers/policy" rbac "k8s.io/client-go/informers/rbac" resource "k8s.io/client-go/informers/resource" scheduling "k8s.io/client-go/informers/scheduling" storage "k8s.io/client-go/informers/storage" storagemigration "k8s.io/client-go/informers/storagemigration" kubernetes "k8s.io/client-go/kubernetes" cache "k8s.io/client-go/tools/cache" ) // SharedInformerOption defines the functional option type for SharedInformerFactory. type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory type sharedInformerFactory struct { client kubernetes.Interface namespace string tweakListOptions internalinterfaces.TweakListOptionsFunc lock sync.Mutex defaultResync time.Duration customResync map[reflect.Type]time.Duration transform cache.TransformFunc informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. // This allows Start() to be called multiple times safely. startedInformers map[reflect.Type]bool // wg tracks how many goroutines were started. wg sync.WaitGroup // shuttingDown is true when Shutdown has been called. It may still be running // because it needs to wait for goroutines. shuttingDown bool } // WithCustomResyncConfig sets a custom resync period for the specified informer types. func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { return func(factory *sharedInformerFactory) *sharedInformerFactory { for k, v := range resyncConfig { factory.customResync[reflect.TypeOf(k)] = v } return factory } } // WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { return func(factory *sharedInformerFactory) *sharedInformerFactory { factory.tweakListOptions = tweakListOptions return factory } } // WithNamespace limits the SharedInformerFactory to the specified namespace. func WithNamespace(namespace string) SharedInformerOption { return func(factory *sharedInformerFactory) *sharedInformerFactory { factory.namespace = namespace return factory } } // WithTransform sets a transform on all informers. func WithTransform(transform cache.TransformFunc) SharedInformerOption { return func(factory *sharedInformerFactory) *sharedInformerFactory { factory.transform = transform return factory } } // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client kubernetes.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) } // NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. // Listers obtained via this SharedInformerFactory will be subject to the same filters // as specified here. // Deprecated: Please use NewSharedInformerFactoryWithOptions instead func NewFilteredSharedInformerFactory(client kubernetes.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) } // NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. func NewSharedInformerFactoryWithOptions(client kubernetes.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { factory := &sharedInformerFactory{ client: client, namespace: v1.NamespaceAll, defaultResync: defaultResync, informers: make(map[reflect.Type]cache.SharedIndexInformer), startedInformers: make(map[reflect.Type]bool), customResync: make(map[reflect.Type]time.Duration), } // Apply all options for _, opt := range options { factory = opt(factory) } return factory } func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { f.lock.Lock() defer f.lock.Unlock() if f.shuttingDown { return } for informerType, informer := range f.informers { if !f.startedInformers[informerType] { f.wg.Add(1) // We need a new variable in each loop iteration, // otherwise the goroutine would use the loop variable // and that keeps changing. informer := informer go func() { defer f.wg.Done() informer.Run(stopCh) }() f.startedInformers[informerType] = true } } } func (f *sharedInformerFactory) Shutdown() { f.lock.Lock() f.shuttingDown = true f.lock.Unlock() // Will return immediately if there is nothing to wait for. f.wg.Wait() } func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { informers := func() map[reflect.Type]cache.SharedIndexInformer { f.lock.Lock() defer f.lock.Unlock() informers := map[reflect.Type]cache.SharedIndexInformer{} for informerType, informer := range f.informers { if f.startedInformers[informerType] { informers[informerType] = informer } } return informers }() res := map[reflect.Type]bool{} for informType, informer := range informers { res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) } return res } // InformerFor returns the SharedIndexInformer for obj using an internal // client. func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { f.lock.Lock() defer f.lock.Unlock() informerType := reflect.TypeOf(obj) informer, exists := f.informers[informerType] if exists { return informer } resyncPeriod, exists := f.customResync[informerType] if !exists { resyncPeriod = f.defaultResync } informer = newFunc(f.client, resyncPeriod) informer.SetTransform(f.transform) f.informers[informerType] = informer return informer } // SharedInformerFactory provides shared informers for resources in all known // API group versions. // // It is typically used like this: // // ctx, cancel := context.Background() // defer cancel() // factory := NewSharedInformerFactory(client, resyncPeriod) // defer factory.WaitForStop() // Returns immediately if nothing was started. // genericInformer := factory.ForResource(resource) // typedInformer := factory.SomeAPIGroup().V1().SomeType() // factory.Start(ctx.Done()) // Start processing these informers. // synced := factory.WaitForCacheSync(ctx.Done()) // for v, ok := range synced { // if !ok { // fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) // return // } // } // // // Creating informers can also be created after Start, but then // // Start must be called again: // anotherGenericInformer := factory.ForResource(resource) // factory.Start(ctx.Done()) type SharedInformerFactory interface { internalinterfaces.SharedInformerFactory // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new // informers can be started anymore and Start will return without // doing anything. // // In addition, Shutdown blocks until all goroutines have terminated. For that // to happen, the close channel(s) that they were started with must be closed, // either before Shutdown gets called or while it is waiting. // // Shutdown may be called multiple times, even concurrently. All such calls will // block until all goroutines have terminated. Shutdown() // WaitForCacheSync blocks until all started informers' caches were synced // or the stop channel gets closed. WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool // ForResource gives generic access to a shared informer of the matching type. ForResource(resource schema.GroupVersionResource) (GenericInformer, error) // InformerFor returns the SharedIndexInformer for obj using an internal // client. InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer Admissionregistration() admissionregistration.Interface Internal() apiserverinternal.Interface Apps() apps.Interface Autoscaling() autoscaling.Interface Batch() batch.Interface Certificates() certificates.Interface Coordination() coordination.Interface Core() core.Interface Discovery() discovery.Interface Events() events.Interface Extensions() extensions.Interface Flowcontrol() flowcontrol.Interface Networking() networking.Interface Node() node.Interface Policy() policy.Interface Rbac() rbac.Interface Resource() resource.Interface Scheduling() scheduling.Interface Storage() storage.Interface Storagemigration() storagemigration.Interface } func (f *sharedInformerFactory) Admissionregistration() admissionregistration.Interface { return admissionregistration.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Internal() apiserverinternal.Interface { return apiserverinternal.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Apps() apps.Interface { return apps.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Autoscaling() autoscaling.Interface { return autoscaling.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Batch() batch.Interface { return batch.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Certificates() certificates.Interface { return certificates.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Coordination() coordination.Interface { return coordination.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Core() core.Interface { return core.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Discovery() discovery.Interface { return discovery.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Events() events.Interface { return events.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Extensions() extensions.Interface { return extensions.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Flowcontrol() flowcontrol.Interface { return flowcontrol.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Networking() networking.Interface { return networking.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Node() node.Interface { return node.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Policy() policy.Interface { return policy.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Rbac() rbac.Interface { return rbac.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Resource() resource.Interface { return resource.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Scheduling() scheduling.Interface { return scheduling.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Storage() storage.Interface { return storage.New(f, f.namespace, f.tweakListOptions) } func (f *sharedInformerFactory) Storagemigration() storagemigration.Interface { return storagemigration.New(f, f.namespace, f.tweakListOptions) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/doc.go
vendor/k8s.io/client-go/informers/doc.go
/* Copyright 2023 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 informers provides generated informers for Kubernetes APIs. package informers // import "k8s.io/client-go/informers"
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/batch/interface.go
vendor/k8s.io/client-go/informers/batch/interface.go
/* 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 batch import ( v1 "k8s.io/client-go/informers/batch/v1" v1beta1 "k8s.io/client-go/informers/batch/v1beta1" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // 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 // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } type group 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 &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } // V1 returns a new v1.Interface. func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) } // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/batch/v1/job.go
vendor/k8s.io/client-go/informers/batch/v1/job.go
/* 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 v1 import ( context "context" time "time" apibatchv1 "k8s.io/api/batch/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" batchv1 "k8s.io/client-go/listers/batch/v1" cache "k8s.io/client-go/tools/cache" ) // JobInformer provides access to a shared informer and lister for // Jobs. type JobInformer interface { Informer() cache.SharedIndexInformer Lister() batchv1.JobLister } type jobInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewJobInformer constructs a new informer for Job 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 NewJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredJobInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredJobInformer constructs a new informer for Job 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 NewFilteredJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.BatchV1().Jobs(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.BatchV1().Jobs(namespace).Watch(context.TODO(), options) }, }, &apibatchv1.Job{}, resyncPeriod, indexers, ) } func (f *jobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *jobInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apibatchv1.Job{}, f.defaultInformer) } func (f *jobInformer) Lister() batchv1.JobLister { return batchv1.NewJobLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/batch/v1/interface.go
vendor/k8s.io/client-go/informers/batch/v1/interface.go
/* 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 v1 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // CronJobs returns a CronJobInformer. CronJobs() CronJobInformer // Jobs returns a JobInformer. Jobs() JobInformer } 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} } // CronJobs returns a CronJobInformer. func (v *version) CronJobs() CronJobInformer { return &cronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // Jobs returns a JobInformer. func (v *version) Jobs() JobInformer { return &jobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go
vendor/k8s.io/client-go/informers/batch/v1/cronjob.go
/* 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 v1 import ( context "context" time "time" apibatchv1 "k8s.io/api/batch/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" batchv1 "k8s.io/client-go/listers/batch/v1" cache "k8s.io/client-go/tools/cache" ) // CronJobInformer provides access to a shared informer and lister for // CronJobs. type CronJobInformer interface { Informer() cache.SharedIndexInformer Lister() batchv1.CronJobLister } type cronJobInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewCronJobInformer constructs a new informer for CronJob 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 NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredCronJobInformer constructs a new informer for CronJob 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 NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.BatchV1().CronJobs(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.BatchV1().CronJobs(namespace).Watch(context.TODO(), options) }, }, &apibatchv1.CronJob{}, resyncPeriod, indexers, ) } func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cronJobInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apibatchv1.CronJob{}, f.defaultInformer) } func (f *cronJobInformer) Lister() batchv1.CronJobLister { return batchv1.NewCronJobLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go
vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go
/* 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 v1beta1 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // CronJobs returns a CronJobInformer. CronJobs() CronJobInformer } 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} } // CronJobs returns a CronJobInformer. func (v *version) CronJobs() CronJobInformer { return &cronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go
vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go
/* 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 v1beta1 import ( context "context" time "time" apibatchv1beta1 "k8s.io/api/batch/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" batchv1beta1 "k8s.io/client-go/listers/batch/v1beta1" cache "k8s.io/client-go/tools/cache" ) // CronJobInformer provides access to a shared informer and lister for // CronJobs. type CronJobInformer interface { Informer() cache.SharedIndexInformer Lister() batchv1beta1.CronJobLister } type cronJobInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewCronJobInformer constructs a new informer for CronJob 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 NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredCronJobInformer constructs a new informer for CronJob 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 NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.BatchV1beta1().CronJobs(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.BatchV1beta1().CronJobs(namespace).Watch(context.TODO(), options) }, }, &apibatchv1beta1.CronJob{}, resyncPeriod, indexers, ) } func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cronJobInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apibatchv1beta1.CronJob{}, f.defaultInformer) } func (f *cronJobInformer) Lister() batchv1beta1.CronJobLister { return batchv1beta1.NewCronJobLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/discovery/interface.go
vendor/k8s.io/client-go/informers/discovery/interface.go
/* 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 discovery import ( v1 "k8s.io/client-go/informers/discovery/v1" v1beta1 "k8s.io/client-go/informers/discovery/v1beta1" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // 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 // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } type group 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 &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } // V1 returns a new v1.Interface. func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) } // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go
vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go
/* 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 v1 import ( context "context" time "time" apidiscoveryv1 "k8s.io/api/discovery/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" discoveryv1 "k8s.io/client-go/listers/discovery/v1" cache "k8s.io/client-go/tools/cache" ) // EndpointSliceInformer provides access to a shared informer and lister for // EndpointSlices. type EndpointSliceInformer interface { Informer() cache.SharedIndexInformer Lister() discoveryv1.EndpointSliceLister } type endpointSliceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewEndpointSliceInformer constructs a new informer for EndpointSlice 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 NewEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice 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 NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.DiscoveryV1().EndpointSlices(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.DiscoveryV1().EndpointSlices(namespace).Watch(context.TODO(), options) }, }, &apidiscoveryv1.EndpointSlice{}, resyncPeriod, indexers, ) } func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apidiscoveryv1.EndpointSlice{}, f.defaultInformer) } func (f *endpointSliceInformer) Lister() discoveryv1.EndpointSliceLister { return discoveryv1.NewEndpointSliceLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/discovery/v1/interface.go
vendor/k8s.io/client-go/informers/discovery/v1/interface.go
/* 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 v1 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // EndpointSlices returns a EndpointSliceInformer. EndpointSlices() EndpointSliceInformer } 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} } // EndpointSlices returns a EndpointSliceInformer. func (v *version) EndpointSlices() EndpointSliceInformer { return &endpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go
vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go
/* 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 v1beta1 import ( context "context" time "time" apidiscoveryv1beta1 "k8s.io/api/discovery/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" discoveryv1beta1 "k8s.io/client-go/listers/discovery/v1beta1" cache "k8s.io/client-go/tools/cache" ) // EndpointSliceInformer provides access to a shared informer and lister for // EndpointSlices. type EndpointSliceInformer interface { Informer() cache.SharedIndexInformer Lister() discoveryv1beta1.EndpointSliceLister } type endpointSliceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewEndpointSliceInformer constructs a new informer for EndpointSlice 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 NewEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice 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 NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.DiscoveryV1beta1().EndpointSlices(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.DiscoveryV1beta1().EndpointSlices(namespace).Watch(context.TODO(), options) }, }, &apidiscoveryv1beta1.EndpointSlice{}, resyncPeriod, indexers, ) } func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apidiscoveryv1beta1.EndpointSlice{}, f.defaultInformer) } func (f *endpointSliceInformer) Lister() discoveryv1beta1.EndpointSliceLister { return discoveryv1beta1.NewEndpointSliceLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go
vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go
/* 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 v1beta1 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // EndpointSlices returns a EndpointSliceInformer. EndpointSlices() EndpointSliceInformer } 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} } // EndpointSlices returns a EndpointSliceInformer. func (v *version) EndpointSlices() EndpointSliceInformer { return &endpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/interface.go
vendor/k8s.io/client-go/informers/storage/interface.go
/* 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 storage import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" v1 "k8s.io/client-go/informers/storage/v1" v1alpha1 "k8s.io/client-go/informers/storage/v1alpha1" v1beta1 "k8s.io/client-go/informers/storage/v1beta1" ) // 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 // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } type group 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 &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } // V1 returns a new v1.Interface. 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) } // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go
vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go
/* 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 "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // CSIStorageCapacities returns a CSIStorageCapacityInformer. CSIStorageCapacities() CSIStorageCapacityInformer // VolumeAttachments returns a VolumeAttachmentInformer. VolumeAttachments() VolumeAttachmentInformer // VolumeAttributesClasses returns a VolumeAttributesClassInformer. VolumeAttributesClasses() VolumeAttributesClassInformer } 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} } // CSIStorageCapacities returns a CSIStorageCapacityInformer. func (v *version) CSIStorageCapacities() CSIStorageCapacityInformer { return &cSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // VolumeAttachments returns a VolumeAttachmentInformer. func (v *version) VolumeAttachments() VolumeAttachmentInformer { return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // VolumeAttributesClasses returns a VolumeAttributesClassInformer. func (v *version) VolumeAttributesClasses() VolumeAttributesClassInformer { return &volumeAttributesClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go
vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go
/* 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 ( context "context" time "time" apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" cache "k8s.io/client-go/tools/cache" ) // VolumeAttachmentInformer provides access to a shared informer and lister for // VolumeAttachments. type VolumeAttachmentInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1alpha1.VolumeAttachmentLister } type volumeAttachmentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment 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 NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) } // NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment 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 NewFilteredVolumeAttachmentInformer(client kubernetes.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.StorageV1alpha1().VolumeAttachments().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1alpha1().VolumeAttachments().Watch(context.TODO(), options) }, }, &apistoragev1alpha1.VolumeAttachment{}, resyncPeriod, indexers, ) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1alpha1.VolumeAttachment{}, f.defaultInformer) } func (f *volumeAttachmentInformer) Lister() storagev1alpha1.VolumeAttachmentLister { return storagev1alpha1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattributesclass.go
vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattributesclass.go
/* 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 ( context "context" time "time" apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" cache "k8s.io/client-go/tools/cache" ) // VolumeAttributesClassInformer provides access to a shared informer and lister for // VolumeAttributesClasses. type VolumeAttributesClassInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1alpha1.VolumeAttributesClassLister } type volumeAttributesClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass 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 NewVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredVolumeAttributesClassInformer(client, resyncPeriod, indexers, nil) } // NewFilteredVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass 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 NewFilteredVolumeAttributesClassInformer(client kubernetes.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.StorageV1alpha1().VolumeAttributesClasses().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1alpha1().VolumeAttributesClasses().Watch(context.TODO(), options) }, }, &apistoragev1alpha1.VolumeAttributesClass{}, resyncPeriod, indexers, ) } func (f *volumeAttributesClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredVolumeAttributesClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *volumeAttributesClassInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1alpha1.VolumeAttributesClass{}, f.defaultInformer) } func (f *volumeAttributesClassInformer) Lister() storagev1alpha1.VolumeAttributesClassLister { return storagev1alpha1.NewVolumeAttributesClassLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go
vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go
/* 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 ( context "context" time "time" apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" cache "k8s.io/client-go/tools/cache" ) // CSIStorageCapacityInformer provides access to a shared informer and lister for // CSIStorageCapacities. type CSIStorageCapacityInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1alpha1.CSIStorageCapacityLister } type cSIStorageCapacityInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity 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 NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity 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 NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1alpha1().CSIStorageCapacities(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1alpha1().CSIStorageCapacities(namespace).Watch(context.TODO(), options) }, }, &apistoragev1alpha1.CSIStorageCapacity{}, resyncPeriod, indexers, ) } func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1alpha1.CSIStorageCapacity{}, f.defaultInformer) } func (f *cSIStorageCapacityInformer) Lister() storagev1alpha1.CSIStorageCapacityLister { return storagev1alpha1.NewCSIStorageCapacityLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go
vendor/k8s.io/client-go/informers/storage/v1/csidriver.go
/* 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 v1 import ( context "context" time "time" apistoragev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1 "k8s.io/client-go/listers/storage/v1" cache "k8s.io/client-go/tools/cache" ) // CSIDriverInformer provides access to a shared informer and lister for // CSIDrivers. type CSIDriverInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1.CSIDriverLister } type cSIDriverInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewCSIDriverInformer constructs a new informer for CSIDriver 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 NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredCSIDriverInformer(client, resyncPeriod, indexers, nil) } // NewFilteredCSIDriverInformer constructs a new informer for CSIDriver 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 NewFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1().CSIDrivers().List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1().CSIDrivers().Watch(context.TODO(), options) }, }, &apistoragev1.CSIDriver{}, resyncPeriod, indexers, ) } func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredCSIDriverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1.CSIDriver{}, f.defaultInformer) } func (f *cSIDriverInformer) Lister() storagev1.CSIDriverLister { return storagev1.NewCSIDriverLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go
vendor/k8s.io/client-go/informers/storage/v1/storageclass.go
/* 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 v1 import ( context "context" time "time" apistoragev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1 "k8s.io/client-go/listers/storage/v1" cache "k8s.io/client-go/tools/cache" ) // StorageClassInformer provides access to a shared informer and lister for // StorageClasses. type StorageClassInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1.StorageClassLister } type storageClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewStorageClassInformer constructs a new informer for StorageClass 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 NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredStorageClassInformer(client, resyncPeriod, indexers, nil) } // NewFilteredStorageClassInformer constructs a new informer for StorageClass 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 NewFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1().StorageClasses().List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1().StorageClasses().Watch(context.TODO(), options) }, }, &apistoragev1.StorageClass{}, resyncPeriod, indexers, ) } func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredStorageClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *storageClassInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1.StorageClass{}, f.defaultInformer) } func (f *storageClassInformer) Lister() storagev1.StorageClassLister { return storagev1.NewStorageClassLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1/interface.go
vendor/k8s.io/client-go/informers/storage/v1/interface.go
/* 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 v1 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // CSIDrivers returns a CSIDriverInformer. CSIDrivers() CSIDriverInformer // CSINodes returns a CSINodeInformer. CSINodes() CSINodeInformer // CSIStorageCapacities returns a CSIStorageCapacityInformer. CSIStorageCapacities() CSIStorageCapacityInformer // StorageClasses returns a StorageClassInformer. StorageClasses() StorageClassInformer // VolumeAttachments returns a VolumeAttachmentInformer. VolumeAttachments() VolumeAttachmentInformer } 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} } // CSIDrivers returns a CSIDriverInformer. func (v *version) CSIDrivers() CSIDriverInformer { return &cSIDriverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // CSINodes returns a CSINodeInformer. func (v *version) CSINodes() CSINodeInformer { return &cSINodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // CSIStorageCapacities returns a CSIStorageCapacityInformer. func (v *version) CSIStorageCapacities() CSIStorageCapacityInformer { return &cSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // StorageClasses returns a StorageClassInformer. func (v *version) StorageClasses() StorageClassInformer { return &storageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // VolumeAttachments returns a VolumeAttachmentInformer. func (v *version) VolumeAttachments() VolumeAttachmentInformer { return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go
vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go
/* 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 v1 import ( context "context" time "time" apistoragev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1 "k8s.io/client-go/listers/storage/v1" cache "k8s.io/client-go/tools/cache" ) // VolumeAttachmentInformer provides access to a shared informer and lister for // VolumeAttachments. type VolumeAttachmentInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1.VolumeAttachmentLister } type volumeAttachmentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment 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 NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) } // NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment 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 NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1().VolumeAttachments().List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1().VolumeAttachments().Watch(context.TODO(), options) }, }, &apistoragev1.VolumeAttachment{}, resyncPeriod, indexers, ) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1.VolumeAttachment{}, f.defaultInformer) } func (f *volumeAttachmentInformer) Lister() storagev1.VolumeAttachmentLister { return storagev1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1/csinode.go
vendor/k8s.io/client-go/informers/storage/v1/csinode.go
/* 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 v1 import ( context "context" time "time" apistoragev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1 "k8s.io/client-go/listers/storage/v1" cache "k8s.io/client-go/tools/cache" ) // CSINodeInformer provides access to a shared informer and lister for // CSINodes. type CSINodeInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1.CSINodeLister } type cSINodeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewCSINodeInformer constructs a new informer for CSINode 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 NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredCSINodeInformer(client, resyncPeriod, indexers, nil) } // NewFilteredCSINodeInformer constructs a new informer for CSINode 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 NewFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1().CSINodes().List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1().CSINodes().Watch(context.TODO(), options) }, }, &apistoragev1.CSINode{}, resyncPeriod, indexers, ) } func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredCSINodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1.CSINode{}, f.defaultInformer) } func (f *cSINodeInformer) Lister() storagev1.CSINodeLister { return storagev1.NewCSINodeLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1/csistoragecapacity.go
vendor/k8s.io/client-go/informers/storage/v1/csistoragecapacity.go
/* 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 v1 import ( context "context" time "time" apistoragev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1 "k8s.io/client-go/listers/storage/v1" cache "k8s.io/client-go/tools/cache" ) // CSIStorageCapacityInformer provides access to a shared informer and lister for // CSIStorageCapacities. type CSIStorageCapacityInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1.CSIStorageCapacityLister } type cSIStorageCapacityInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity 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 NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity 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 NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1().CSIStorageCapacities(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1().CSIStorageCapacities(namespace).Watch(context.TODO(), options) }, }, &apistoragev1.CSIStorageCapacity{}, resyncPeriod, indexers, ) } func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1.CSIStorageCapacity{}, f.defaultInformer) } func (f *cSIStorageCapacityInformer) Lister() storagev1.CSIStorageCapacityLister { return storagev1.NewCSIStorageCapacityLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go
vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go
/* 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 v1beta1 import ( context "context" time "time" apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" cache "k8s.io/client-go/tools/cache" ) // CSIDriverInformer provides access to a shared informer and lister for // CSIDrivers. type CSIDriverInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.CSIDriverLister } type cSIDriverInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewCSIDriverInformer constructs a new informer for CSIDriver 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 NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredCSIDriverInformer(client, resyncPeriod, indexers, nil) } // NewFilteredCSIDriverInformer constructs a new informer for CSIDriver 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 NewFilteredCSIDriverInformer(client kubernetes.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.StorageV1beta1().CSIDrivers().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1beta1().CSIDrivers().Watch(context.TODO(), options) }, }, &apistoragev1beta1.CSIDriver{}, resyncPeriod, indexers, ) } func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredCSIDriverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1beta1.CSIDriver{}, f.defaultInformer) } func (f *cSIDriverInformer) Lister() storagev1beta1.CSIDriverLister { return storagev1beta1.NewCSIDriverLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go
vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go
/* 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 v1beta1 import ( context "context" time "time" apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" cache "k8s.io/client-go/tools/cache" ) // StorageClassInformer provides access to a shared informer and lister for // StorageClasses. type StorageClassInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.StorageClassLister } type storageClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewStorageClassInformer constructs a new informer for StorageClass 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 NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredStorageClassInformer(client, resyncPeriod, indexers, nil) } // NewFilteredStorageClassInformer constructs a new informer for StorageClass 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 NewFilteredStorageClassInformer(client kubernetes.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.StorageV1beta1().StorageClasses().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1beta1().StorageClasses().Watch(context.TODO(), options) }, }, &apistoragev1beta1.StorageClass{}, resyncPeriod, indexers, ) } func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredStorageClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *storageClassInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1beta1.StorageClass{}, f.defaultInformer) } func (f *storageClassInformer) Lister() storagev1beta1.StorageClassLister { return storagev1beta1.NewStorageClassLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go
vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go
/* 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 v1beta1 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // CSIDrivers returns a CSIDriverInformer. CSIDrivers() CSIDriverInformer // CSINodes returns a CSINodeInformer. CSINodes() CSINodeInformer // CSIStorageCapacities returns a CSIStorageCapacityInformer. CSIStorageCapacities() CSIStorageCapacityInformer // StorageClasses returns a StorageClassInformer. StorageClasses() StorageClassInformer // VolumeAttachments returns a VolumeAttachmentInformer. VolumeAttachments() VolumeAttachmentInformer // VolumeAttributesClasses returns a VolumeAttributesClassInformer. VolumeAttributesClasses() VolumeAttributesClassInformer } 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} } // CSIDrivers returns a CSIDriverInformer. func (v *version) CSIDrivers() CSIDriverInformer { return &cSIDriverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // CSINodes returns a CSINodeInformer. func (v *version) CSINodes() CSINodeInformer { return &cSINodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // CSIStorageCapacities returns a CSIStorageCapacityInformer. func (v *version) CSIStorageCapacities() CSIStorageCapacityInformer { return &cSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // StorageClasses returns a StorageClassInformer. func (v *version) StorageClasses() StorageClassInformer { return &storageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // VolumeAttachments returns a VolumeAttachmentInformer. func (v *version) VolumeAttachments() VolumeAttachmentInformer { return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // VolumeAttributesClasses returns a VolumeAttributesClassInformer. func (v *version) VolumeAttributesClasses() VolumeAttributesClassInformer { return &volumeAttributesClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go
vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go
/* 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 v1beta1 import ( context "context" time "time" apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" cache "k8s.io/client-go/tools/cache" ) // VolumeAttachmentInformer provides access to a shared informer and lister for // VolumeAttachments. type VolumeAttachmentInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.VolumeAttachmentLister } type volumeAttachmentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment 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 NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) } // NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment 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 NewFilteredVolumeAttachmentInformer(client kubernetes.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.StorageV1beta1().VolumeAttachments().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1beta1().VolumeAttachments().Watch(context.TODO(), options) }, }, &apistoragev1beta1.VolumeAttachment{}, resyncPeriod, indexers, ) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1beta1.VolumeAttachment{}, f.defaultInformer) } func (f *volumeAttachmentInformer) Lister() storagev1beta1.VolumeAttachmentLister { return storagev1beta1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattributesclass.go
vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattributesclass.go
/* 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 v1beta1 import ( context "context" time "time" apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" cache "k8s.io/client-go/tools/cache" ) // VolumeAttributesClassInformer provides access to a shared informer and lister for // VolumeAttributesClasses. type VolumeAttributesClassInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.VolumeAttributesClassLister } type volumeAttributesClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass 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 NewVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredVolumeAttributesClassInformer(client, resyncPeriod, indexers, nil) } // NewFilteredVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass 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 NewFilteredVolumeAttributesClassInformer(client kubernetes.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.StorageV1beta1().VolumeAttributesClasses().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1beta1().VolumeAttributesClasses().Watch(context.TODO(), options) }, }, &apistoragev1beta1.VolumeAttributesClass{}, resyncPeriod, indexers, ) } func (f *volumeAttributesClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredVolumeAttributesClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *volumeAttributesClassInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1beta1.VolumeAttributesClass{}, f.defaultInformer) } func (f *volumeAttributesClassInformer) Lister() storagev1beta1.VolumeAttributesClassLister { return storagev1beta1.NewVolumeAttributesClassLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go
vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go
/* 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 v1beta1 import ( context "context" time "time" apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" cache "k8s.io/client-go/tools/cache" ) // CSINodeInformer provides access to a shared informer and lister for // CSINodes. type CSINodeInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.CSINodeLister } type cSINodeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewCSINodeInformer constructs a new informer for CSINode 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 NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredCSINodeInformer(client, resyncPeriod, indexers, nil) } // NewFilteredCSINodeInformer constructs a new informer for CSINode 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 NewFilteredCSINodeInformer(client kubernetes.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.StorageV1beta1().CSINodes().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1beta1().CSINodes().Watch(context.TODO(), options) }, }, &apistoragev1beta1.CSINode{}, resyncPeriod, indexers, ) } func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredCSINodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1beta1.CSINode{}, f.defaultInformer) } func (f *cSINodeInformer) Lister() storagev1beta1.CSINodeLister { return storagev1beta1.NewCSINodeLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go
vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go
/* 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 v1beta1 import ( context "context" time "time" apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" storagev1beta1 "k8s.io/client-go/listers/storage/v1beta1" cache "k8s.io/client-go/tools/cache" ) // CSIStorageCapacityInformer provides access to a shared informer and lister for // CSIStorageCapacities. type CSIStorageCapacityInformer interface { Informer() cache.SharedIndexInformer Lister() storagev1beta1.CSIStorageCapacityLister } type cSIStorageCapacityInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity 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 NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity 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 NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1beta1().CSIStorageCapacities(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.StorageV1beta1().CSIStorageCapacities(namespace).Watch(context.TODO(), options) }, }, &apistoragev1beta1.CSIStorageCapacity{}, resyncPeriod, indexers, ) } func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apistoragev1beta1.CSIStorageCapacity{}, f.defaultInformer) } func (f *cSIStorageCapacityInformer) Lister() storagev1beta1.CSIStorageCapacityLister { return storagev1beta1.NewCSIStorageCapacityLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/interface.go
vendor/k8s.io/client-go/informers/apps/interface.go
/* 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 apps import ( v1 "k8s.io/client-go/informers/apps/v1" v1beta1 "k8s.io/client-go/informers/apps/v1beta1" v1beta2 "k8s.io/client-go/informers/apps/v1beta2" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // 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 // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface // V1beta2 provides access to shared informers for resources in V1beta2. V1beta2() v1beta2.Interface } type group 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 &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } // V1 returns a new v1.Interface. func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) } // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) } // V1beta2 returns a new v1beta2.Interface. func (g *group) V1beta2() v1beta2.Interface { return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go
vendor/k8s.io/client-go/informers/apps/v1/statefulset.go
/* 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 v1 import ( context "context" time "time" apiappsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1 "k8s.io/client-go/listers/apps/v1" cache "k8s.io/client-go/tools/cache" ) // StatefulSetInformer provides access to a shared informer and lister for // StatefulSets. type StatefulSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1.StatefulSetLister } type statefulSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewStatefulSetInformer constructs a new informer for StatefulSet 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 NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredStatefulSetInformer constructs a new informer for StatefulSet 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 NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().StatefulSets(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().StatefulSets(namespace).Watch(context.TODO(), options) }, }, &apiappsv1.StatefulSet{}, resyncPeriod, indexers, ) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1.StatefulSet{}, f.defaultInformer) } func (f *statefulSetInformer) Lister() appsv1.StatefulSetLister { return appsv1.NewStatefulSetLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go
vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go
/* 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 v1 import ( context "context" time "time" apiappsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1 "k8s.io/client-go/listers/apps/v1" cache "k8s.io/client-go/tools/cache" ) // ControllerRevisionInformer provides access to a shared informer and lister for // ControllerRevisions. type ControllerRevisionInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1.ControllerRevisionLister } type controllerRevisionInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewControllerRevisionInformer constructs a new informer for ControllerRevision 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 NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision 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 NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().ControllerRevisions(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().ControllerRevisions(namespace).Watch(context.TODO(), options) }, }, &apiappsv1.ControllerRevision{}, resyncPeriod, indexers, ) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1.ControllerRevision{}, f.defaultInformer) } func (f *controllerRevisionInformer) Lister() appsv1.ControllerRevisionLister { return appsv1.NewControllerRevisionLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1/interface.go
vendor/k8s.io/client-go/informers/apps/v1/interface.go
/* 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 v1 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // ControllerRevisions returns a ControllerRevisionInformer. ControllerRevisions() ControllerRevisionInformer // DaemonSets returns a DaemonSetInformer. DaemonSets() DaemonSetInformer // Deployments returns a DeploymentInformer. Deployments() DeploymentInformer // ReplicaSets returns a ReplicaSetInformer. ReplicaSets() ReplicaSetInformer // StatefulSets returns a StatefulSetInformer. StatefulSets() StatefulSetInformer } 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} } // ControllerRevisions returns a ControllerRevisionInformer. func (v *version) ControllerRevisions() ControllerRevisionInformer { return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // DaemonSets returns a DaemonSetInformer. func (v *version) DaemonSets() DaemonSetInformer { return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // Deployments returns a DeploymentInformer. func (v *version) Deployments() DeploymentInformer { return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // ReplicaSets returns a ReplicaSetInformer. func (v *version) ReplicaSets() ReplicaSetInformer { return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // StatefulSets returns a StatefulSetInformer. func (v *version) StatefulSets() StatefulSetInformer { return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go
vendor/k8s.io/client-go/informers/apps/v1/daemonset.go
/* 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 v1 import ( context "context" time "time" apiappsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1 "k8s.io/client-go/listers/apps/v1" cache "k8s.io/client-go/tools/cache" ) // DaemonSetInformer provides access to a shared informer and lister for // DaemonSets. type DaemonSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1.DaemonSetLister } type daemonSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewDaemonSetInformer constructs a new informer for DaemonSet 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 NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredDaemonSetInformer constructs a new informer for DaemonSet 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 NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().DaemonSets(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().DaemonSets(namespace).Watch(context.TODO(), options) }, }, &apiappsv1.DaemonSet{}, resyncPeriod, indexers, ) } func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1.DaemonSet{}, f.defaultInformer) } func (f *daemonSetInformer) Lister() appsv1.DaemonSetLister { return appsv1.NewDaemonSetLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1/deployment.go
vendor/k8s.io/client-go/informers/apps/v1/deployment.go
/* 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 v1 import ( context "context" time "time" apiappsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1 "k8s.io/client-go/listers/apps/v1" cache "k8s.io/client-go/tools/cache" ) // DeploymentInformer provides access to a shared informer and lister for // Deployments. type DeploymentInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1.DeploymentLister } type deploymentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewDeploymentInformer constructs a new informer for Deployment 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 NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredDeploymentInformer constructs a new informer for Deployment 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 NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().Deployments(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().Deployments(namespace).Watch(context.TODO(), options) }, }, &apiappsv1.Deployment{}, resyncPeriod, indexers, ) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1.Deployment{}, f.defaultInformer) } func (f *deploymentInformer) Lister() appsv1.DeploymentLister { return appsv1.NewDeploymentLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go
vendor/k8s.io/client-go/informers/apps/v1/replicaset.go
/* 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 v1 import ( context "context" time "time" apiappsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1 "k8s.io/client-go/listers/apps/v1" cache "k8s.io/client-go/tools/cache" ) // ReplicaSetInformer provides access to a shared informer and lister for // ReplicaSets. type ReplicaSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1.ReplicaSetLister } type replicaSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewReplicaSetInformer constructs a new informer for ReplicaSet 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 NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet 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 NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().ReplicaSets(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().ReplicaSets(namespace).Watch(context.TODO(), options) }, }, &apiappsv1.ReplicaSet{}, resyncPeriod, indexers, ) } func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1.ReplicaSet{}, f.defaultInformer) } func (f *replicaSetInformer) Lister() appsv1.ReplicaSetLister { return appsv1.NewReplicaSetLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go
vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go
/* 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 v1beta1 import ( context "context" time "time" apiappsv1beta1 "k8s.io/api/apps/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1beta1 "k8s.io/client-go/listers/apps/v1beta1" cache "k8s.io/client-go/tools/cache" ) // StatefulSetInformer provides access to a shared informer and lister for // StatefulSets. type StatefulSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta1.StatefulSetLister } type statefulSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewStatefulSetInformer constructs a new informer for StatefulSet 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 NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredStatefulSetInformer constructs a new informer for StatefulSet 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 NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta1().StatefulSets(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta1().StatefulSets(namespace).Watch(context.TODO(), options) }, }, &apiappsv1beta1.StatefulSet{}, resyncPeriod, indexers, ) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1beta1.StatefulSet{}, f.defaultInformer) } func (f *statefulSetInformer) Lister() appsv1beta1.StatefulSetLister { return appsv1beta1.NewStatefulSetLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go
vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go
/* 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 v1beta1 import ( context "context" time "time" apiappsv1beta1 "k8s.io/api/apps/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1beta1 "k8s.io/client-go/listers/apps/v1beta1" cache "k8s.io/client-go/tools/cache" ) // ControllerRevisionInformer provides access to a shared informer and lister for // ControllerRevisions. type ControllerRevisionInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta1.ControllerRevisionLister } type controllerRevisionInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewControllerRevisionInformer constructs a new informer for ControllerRevision 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 NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision 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 NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta1().ControllerRevisions(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta1().ControllerRevisions(namespace).Watch(context.TODO(), options) }, }, &apiappsv1beta1.ControllerRevision{}, resyncPeriod, indexers, ) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1beta1.ControllerRevision{}, f.defaultInformer) } func (f *controllerRevisionInformer) Lister() appsv1beta1.ControllerRevisionLister { return appsv1beta1.NewControllerRevisionLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go
vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go
/* 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 v1beta1 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // ControllerRevisions returns a ControllerRevisionInformer. ControllerRevisions() ControllerRevisionInformer // Deployments returns a DeploymentInformer. Deployments() DeploymentInformer // StatefulSets returns a StatefulSetInformer. StatefulSets() StatefulSetInformer } 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} } // ControllerRevisions returns a ControllerRevisionInformer. func (v *version) ControllerRevisions() ControllerRevisionInformer { return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // Deployments returns a DeploymentInformer. func (v *version) Deployments() DeploymentInformer { return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // StatefulSets returns a StatefulSetInformer. func (v *version) StatefulSets() StatefulSetInformer { return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go
vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go
/* 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 v1beta1 import ( context "context" time "time" apiappsv1beta1 "k8s.io/api/apps/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1beta1 "k8s.io/client-go/listers/apps/v1beta1" cache "k8s.io/client-go/tools/cache" ) // DeploymentInformer provides access to a shared informer and lister for // Deployments. type DeploymentInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta1.DeploymentLister } type deploymentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewDeploymentInformer constructs a new informer for Deployment 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 NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredDeploymentInformer constructs a new informer for Deployment 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 NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta1().Deployments(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta1().Deployments(namespace).Watch(context.TODO(), options) }, }, &apiappsv1beta1.Deployment{}, resyncPeriod, indexers, ) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1beta1.Deployment{}, f.defaultInformer) } func (f *deploymentInformer) Lister() appsv1beta1.DeploymentLister { return appsv1beta1.NewDeploymentLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go
vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go
/* 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 v1beta2 import ( context "context" time "time" apiappsv1beta2 "k8s.io/api/apps/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" cache "k8s.io/client-go/tools/cache" ) // StatefulSetInformer provides access to a shared informer and lister for // StatefulSets. type StatefulSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta2.StatefulSetLister } type statefulSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewStatefulSetInformer constructs a new informer for StatefulSet 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 NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredStatefulSetInformer constructs a new informer for StatefulSet 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 NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta2().StatefulSets(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta2().StatefulSets(namespace).Watch(context.TODO(), options) }, }, &apiappsv1beta2.StatefulSet{}, resyncPeriod, indexers, ) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1beta2.StatefulSet{}, f.defaultInformer) } func (f *statefulSetInformer) Lister() appsv1beta2.StatefulSetLister { return appsv1beta2.NewStatefulSetLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go
vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go
/* 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 v1beta2 import ( context "context" time "time" apiappsv1beta2 "k8s.io/api/apps/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" cache "k8s.io/client-go/tools/cache" ) // ControllerRevisionInformer provides access to a shared informer and lister for // ControllerRevisions. type ControllerRevisionInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta2.ControllerRevisionLister } type controllerRevisionInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewControllerRevisionInformer constructs a new informer for ControllerRevision 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 NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision 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 NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta2().ControllerRevisions(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta2().ControllerRevisions(namespace).Watch(context.TODO(), options) }, }, &apiappsv1beta2.ControllerRevision{}, resyncPeriod, indexers, ) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1beta2.ControllerRevision{}, f.defaultInformer) } func (f *controllerRevisionInformer) Lister() appsv1beta2.ControllerRevisionLister { return appsv1beta2.NewControllerRevisionLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go
vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go
/* 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 v1beta2 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // ControllerRevisions returns a ControllerRevisionInformer. ControllerRevisions() ControllerRevisionInformer // DaemonSets returns a DaemonSetInformer. DaemonSets() DaemonSetInformer // Deployments returns a DeploymentInformer. Deployments() DeploymentInformer // ReplicaSets returns a ReplicaSetInformer. ReplicaSets() ReplicaSetInformer // StatefulSets returns a StatefulSetInformer. StatefulSets() StatefulSetInformer } 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} } // ControllerRevisions returns a ControllerRevisionInformer. func (v *version) ControllerRevisions() ControllerRevisionInformer { return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // DaemonSets returns a DaemonSetInformer. func (v *version) DaemonSets() DaemonSetInformer { return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // Deployments returns a DeploymentInformer. func (v *version) Deployments() DeploymentInformer { return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // ReplicaSets returns a ReplicaSetInformer. func (v *version) ReplicaSets() ReplicaSetInformer { return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // StatefulSets returns a StatefulSetInformer. func (v *version) StatefulSets() StatefulSetInformer { return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go
vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go
/* 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 v1beta2 import ( context "context" time "time" apiappsv1beta2 "k8s.io/api/apps/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" cache "k8s.io/client-go/tools/cache" ) // DaemonSetInformer provides access to a shared informer and lister for // DaemonSets. type DaemonSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta2.DaemonSetLister } type daemonSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewDaemonSetInformer constructs a new informer for DaemonSet 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 NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredDaemonSetInformer constructs a new informer for DaemonSet 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 NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta2().DaemonSets(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta2().DaemonSets(namespace).Watch(context.TODO(), options) }, }, &apiappsv1beta2.DaemonSet{}, resyncPeriod, indexers, ) } func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1beta2.DaemonSet{}, f.defaultInformer) } func (f *daemonSetInformer) Lister() appsv1beta2.DaemonSetLister { return appsv1beta2.NewDaemonSetLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go
vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go
/* 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 v1beta2 import ( context "context" time "time" apiappsv1beta2 "k8s.io/api/apps/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" cache "k8s.io/client-go/tools/cache" ) // DeploymentInformer provides access to a shared informer and lister for // Deployments. type DeploymentInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta2.DeploymentLister } type deploymentInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewDeploymentInformer constructs a new informer for Deployment 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 NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredDeploymentInformer constructs a new informer for Deployment 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 NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta2().Deployments(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta2().Deployments(namespace).Watch(context.TODO(), options) }, }, &apiappsv1beta2.Deployment{}, resyncPeriod, indexers, ) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1beta2.Deployment{}, f.defaultInformer) } func (f *deploymentInformer) Lister() appsv1beta2.DeploymentLister { return appsv1beta2.NewDeploymentLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go
vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go
/* 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 v1beta2 import ( context "context" time "time" apiappsv1beta2 "k8s.io/api/apps/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" appsv1beta2 "k8s.io/client-go/listers/apps/v1beta2" cache "k8s.io/client-go/tools/cache" ) // ReplicaSetInformer provides access to a shared informer and lister for // ReplicaSets. type ReplicaSetInformer interface { Informer() cache.SharedIndexInformer Lister() appsv1beta2.ReplicaSetLister } type replicaSetInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewReplicaSetInformer constructs a new informer for ReplicaSet 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 NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet 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 NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta2().ReplicaSets(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1beta2().ReplicaSets(namespace).Watch(context.TODO(), options) }, }, &apiappsv1beta2.ReplicaSet{}, resyncPeriod, indexers, ) } func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiappsv1beta2.ReplicaSet{}, f.defaultInformer) } func (f *replicaSetInformer) Lister() appsv1beta2.ReplicaSetLister { return appsv1beta2.NewReplicaSetLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/resource/interface.go
vendor/k8s.io/client-go/informers/resource/interface.go
/* 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 resource import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" v1alpha3 "k8s.io/client-go/informers/resource/v1alpha3" v1beta1 "k8s.io/client-go/informers/resource/v1beta1" ) // Interface provides access to each of this group's versions. type Interface interface { // V1alpha3 provides access to shared informers for resources in V1alpha3. V1alpha3() v1alpha3.Interface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } type group 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 &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } // V1alpha3 returns a new v1alpha3.Interface. func (g *group) V1alpha3() v1alpha3.Interface { return v1alpha3.New(g.factory, g.namespace, g.tweakListOptions) } // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/resource/v1beta1/deviceclass.go
vendor/k8s.io/client-go/informers/resource/v1beta1/deviceclass.go
/* 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 v1beta1 import ( context "context" time "time" apiresourcev1beta1 "k8s.io/api/resource/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" resourcev1beta1 "k8s.io/client-go/listers/resource/v1beta1" cache "k8s.io/client-go/tools/cache" ) // DeviceClassInformer provides access to a shared informer and lister for // DeviceClasses. type DeviceClassInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta1.DeviceClassLister } type deviceClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewDeviceClassInformer constructs a new informer for DeviceClass 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 NewDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredDeviceClassInformer(client, resyncPeriod, indexers, nil) } // NewFilteredDeviceClassInformer constructs a new informer for DeviceClass 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 NewFilteredDeviceClassInformer(client kubernetes.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.ResourceV1beta1().DeviceClasses().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1beta1().DeviceClasses().Watch(context.TODO(), options) }, }, &apiresourcev1beta1.DeviceClass{}, resyncPeriod, indexers, ) } func (f *deviceClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredDeviceClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *deviceClassInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiresourcev1beta1.DeviceClass{}, f.defaultInformer) } func (f *deviceClassInformer) Lister() resourcev1beta1.DeviceClassLister { return resourcev1beta1.NewDeviceClassLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaimtemplate.go
vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaimtemplate.go
/* 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 v1beta1 import ( context "context" time "time" apiresourcev1beta1 "k8s.io/api/resource/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" resourcev1beta1 "k8s.io/client-go/listers/resource/v1beta1" cache "k8s.io/client-go/tools/cache" ) // ResourceClaimTemplateInformer provides access to a shared informer and lister for // ResourceClaimTemplates. type ResourceClaimTemplateInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta1.ResourceClaimTemplateLister } type resourceClaimTemplateInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate 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 NewResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredResourceClaimTemplateInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate 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 NewFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1beta1().ResourceClaimTemplates(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1beta1().ResourceClaimTemplates(namespace).Watch(context.TODO(), options) }, }, &apiresourcev1beta1.ResourceClaimTemplate{}, resyncPeriod, indexers, ) } func (f *resourceClaimTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredResourceClaimTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *resourceClaimTemplateInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiresourcev1beta1.ResourceClaimTemplate{}, f.defaultInformer) } func (f *resourceClaimTemplateInformer) Lister() resourcev1beta1.ResourceClaimTemplateLister { return resourcev1beta1.NewResourceClaimTemplateLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/resource/v1beta1/interface.go
vendor/k8s.io/client-go/informers/resource/v1beta1/interface.go
/* 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 v1beta1 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // DeviceClasses returns a DeviceClassInformer. DeviceClasses() DeviceClassInformer // ResourceClaims returns a ResourceClaimInformer. ResourceClaims() ResourceClaimInformer // ResourceClaimTemplates returns a ResourceClaimTemplateInformer. ResourceClaimTemplates() ResourceClaimTemplateInformer // ResourceSlices returns a ResourceSliceInformer. ResourceSlices() ResourceSliceInformer } 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} } // DeviceClasses returns a DeviceClassInformer. func (v *version) DeviceClasses() DeviceClassInformer { return &deviceClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // ResourceClaims returns a ResourceClaimInformer. func (v *version) ResourceClaims() ResourceClaimInformer { return &resourceClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // ResourceClaimTemplates returns a ResourceClaimTemplateInformer. func (v *version) ResourceClaimTemplates() ResourceClaimTemplateInformer { return &resourceClaimTemplateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // ResourceSlices returns a ResourceSliceInformer. func (v *version) ResourceSlices() ResourceSliceInformer { return &resourceSliceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaim.go
vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaim.go
/* 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 v1beta1 import ( context "context" time "time" apiresourcev1beta1 "k8s.io/api/resource/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" resourcev1beta1 "k8s.io/client-go/listers/resource/v1beta1" cache "k8s.io/client-go/tools/cache" ) // ResourceClaimInformer provides access to a shared informer and lister for // ResourceClaims. type ResourceClaimInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta1.ResourceClaimLister } type resourceClaimInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewResourceClaimInformer constructs a new informer for ResourceClaim 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 NewResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredResourceClaimInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredResourceClaimInformer constructs a new informer for ResourceClaim 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 NewFilteredResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1beta1().ResourceClaims(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1beta1().ResourceClaims(namespace).Watch(context.TODO(), options) }, }, &apiresourcev1beta1.ResourceClaim{}, resyncPeriod, indexers, ) } func (f *resourceClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredResourceClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *resourceClaimInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiresourcev1beta1.ResourceClaim{}, f.defaultInformer) } func (f *resourceClaimInformer) Lister() resourcev1beta1.ResourceClaimLister { return resourcev1beta1.NewResourceClaimLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceslice.go
vendor/k8s.io/client-go/informers/resource/v1beta1/resourceslice.go
/* 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 v1beta1 import ( context "context" time "time" apiresourcev1beta1 "k8s.io/api/resource/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" resourcev1beta1 "k8s.io/client-go/listers/resource/v1beta1" cache "k8s.io/client-go/tools/cache" ) // ResourceSliceInformer provides access to a shared informer and lister for // ResourceSlices. type ResourceSliceInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1beta1.ResourceSliceLister } type resourceSliceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewResourceSliceInformer constructs a new informer for ResourceSlice 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 NewResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredResourceSliceInformer(client, resyncPeriod, indexers, nil) } // NewFilteredResourceSliceInformer constructs a new informer for ResourceSlice 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 NewFilteredResourceSliceInformer(client kubernetes.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.ResourceV1beta1().ResourceSlices().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1beta1().ResourceSlices().Watch(context.TODO(), options) }, }, &apiresourcev1beta1.ResourceSlice{}, resyncPeriod, indexers, ) } func (f *resourceSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredResourceSliceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *resourceSliceInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiresourcev1beta1.ResourceSlice{}, f.defaultInformer) } func (f *resourceSliceInformer) Lister() resourcev1beta1.ResourceSliceLister { return resourcev1beta1.NewResourceSliceLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/resource/v1alpha3/deviceclass.go
vendor/k8s.io/client-go/informers/resource/v1alpha3/deviceclass.go
/* 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 v1alpha3 import ( context "context" time "time" apiresourcev1alpha3 "k8s.io/api/resource/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" resourcev1alpha3 "k8s.io/client-go/listers/resource/v1alpha3" cache "k8s.io/client-go/tools/cache" ) // DeviceClassInformer provides access to a shared informer and lister for // DeviceClasses. type DeviceClassInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1alpha3.DeviceClassLister } type deviceClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewDeviceClassInformer constructs a new informer for DeviceClass 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 NewDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredDeviceClassInformer(client, resyncPeriod, indexers, nil) } // NewFilteredDeviceClassInformer constructs a new informer for DeviceClass 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 NewFilteredDeviceClassInformer(client kubernetes.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.ResourceV1alpha3().DeviceClasses().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1alpha3().DeviceClasses().Watch(context.TODO(), options) }, }, &apiresourcev1alpha3.DeviceClass{}, resyncPeriod, indexers, ) } func (f *deviceClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredDeviceClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *deviceClassInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiresourcev1alpha3.DeviceClass{}, f.defaultInformer) } func (f *deviceClassInformer) Lister() resourcev1alpha3.DeviceClassLister { return resourcev1alpha3.NewDeviceClassLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/resource/v1alpha3/resourceclaimtemplate.go
vendor/k8s.io/client-go/informers/resource/v1alpha3/resourceclaimtemplate.go
/* 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 v1alpha3 import ( context "context" time "time" apiresourcev1alpha3 "k8s.io/api/resource/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" resourcev1alpha3 "k8s.io/client-go/listers/resource/v1alpha3" cache "k8s.io/client-go/tools/cache" ) // ResourceClaimTemplateInformer provides access to a shared informer and lister for // ResourceClaimTemplates. type ResourceClaimTemplateInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1alpha3.ResourceClaimTemplateLister } type resourceClaimTemplateInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate 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 NewResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredResourceClaimTemplateInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate 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 NewFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1alpha3().ResourceClaimTemplates(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1alpha3().ResourceClaimTemplates(namespace).Watch(context.TODO(), options) }, }, &apiresourcev1alpha3.ResourceClaimTemplate{}, resyncPeriod, indexers, ) } func (f *resourceClaimTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredResourceClaimTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *resourceClaimTemplateInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiresourcev1alpha3.ResourceClaimTemplate{}, f.defaultInformer) } func (f *resourceClaimTemplateInformer) Lister() resourcev1alpha3.ResourceClaimTemplateLister { return resourcev1alpha3.NewResourceClaimTemplateLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/resource/v1alpha3/interface.go
vendor/k8s.io/client-go/informers/resource/v1alpha3/interface.go
/* 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 v1alpha3 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // DeviceClasses returns a DeviceClassInformer. DeviceClasses() DeviceClassInformer // ResourceClaims returns a ResourceClaimInformer. ResourceClaims() ResourceClaimInformer // ResourceClaimTemplates returns a ResourceClaimTemplateInformer. ResourceClaimTemplates() ResourceClaimTemplateInformer // ResourceSlices returns a ResourceSliceInformer. ResourceSlices() ResourceSliceInformer } 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} } // DeviceClasses returns a DeviceClassInformer. func (v *version) DeviceClasses() DeviceClassInformer { return &deviceClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // ResourceClaims returns a ResourceClaimInformer. func (v *version) ResourceClaims() ResourceClaimInformer { return &resourceClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // ResourceClaimTemplates returns a ResourceClaimTemplateInformer. func (v *version) ResourceClaimTemplates() ResourceClaimTemplateInformer { return &resourceClaimTemplateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // ResourceSlices returns a ResourceSliceInformer. func (v *version) ResourceSlices() ResourceSliceInformer { return &resourceSliceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/resource/v1alpha3/resourceclaim.go
vendor/k8s.io/client-go/informers/resource/v1alpha3/resourceclaim.go
/* 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 v1alpha3 import ( context "context" time "time" apiresourcev1alpha3 "k8s.io/api/resource/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" resourcev1alpha3 "k8s.io/client-go/listers/resource/v1alpha3" cache "k8s.io/client-go/tools/cache" ) // ResourceClaimInformer provides access to a shared informer and lister for // ResourceClaims. type ResourceClaimInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1alpha3.ResourceClaimLister } type resourceClaimInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewResourceClaimInformer constructs a new informer for ResourceClaim 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 NewResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredResourceClaimInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredResourceClaimInformer constructs a new informer for ResourceClaim 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 NewFilteredResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1alpha3().ResourceClaims(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1alpha3().ResourceClaims(namespace).Watch(context.TODO(), options) }, }, &apiresourcev1alpha3.ResourceClaim{}, resyncPeriod, indexers, ) } func (f *resourceClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredResourceClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *resourceClaimInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiresourcev1alpha3.ResourceClaim{}, f.defaultInformer) } func (f *resourceClaimInformer) Lister() resourcev1alpha3.ResourceClaimLister { return resourcev1alpha3.NewResourceClaimLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/resource/v1alpha3/resourceslice.go
vendor/k8s.io/client-go/informers/resource/v1alpha3/resourceslice.go
/* 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 v1alpha3 import ( context "context" time "time" apiresourcev1alpha3 "k8s.io/api/resource/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" resourcev1alpha3 "k8s.io/client-go/listers/resource/v1alpha3" cache "k8s.io/client-go/tools/cache" ) // ResourceSliceInformer provides access to a shared informer and lister for // ResourceSlices. type ResourceSliceInformer interface { Informer() cache.SharedIndexInformer Lister() resourcev1alpha3.ResourceSliceLister } type resourceSliceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewResourceSliceInformer constructs a new informer for ResourceSlice 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 NewResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredResourceSliceInformer(client, resyncPeriod, indexers, nil) } // NewFilteredResourceSliceInformer constructs a new informer for ResourceSlice 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 NewFilteredResourceSliceInformer(client kubernetes.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.ResourceV1alpha3().ResourceSlices().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.ResourceV1alpha3().ResourceSlices().Watch(context.TODO(), options) }, }, &apiresourcev1alpha3.ResourceSlice{}, resyncPeriod, indexers, ) } func (f *resourceSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredResourceSliceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *resourceSliceInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiresourcev1alpha3.ResourceSlice{}, f.defaultInformer) } func (f *resourceSliceInformer) Lister() resourcev1alpha3.ResourceSliceLister { return resourcev1alpha3.NewResourceSliceLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/flowcontrol/interface.go
vendor/k8s.io/client-go/informers/flowcontrol/interface.go
/* 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 flowcontrol import ( v1 "k8s.io/client-go/informers/flowcontrol/v1" v1beta1 "k8s.io/client-go/informers/flowcontrol/v1beta1" v1beta2 "k8s.io/client-go/informers/flowcontrol/v1beta2" v1beta3 "k8s.io/client-go/informers/flowcontrol/v1beta3" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // 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 // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface // V1beta2 provides access to shared informers for resources in V1beta2. V1beta2() v1beta2.Interface // V1beta3 provides access to shared informers for resources in V1beta3. V1beta3() v1beta3.Interface } type group 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 &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } // V1 returns a new v1.Interface. func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) } // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) } // V1beta2 returns a new v1beta2.Interface. func (g *group) V1beta2() v1beta2.Interface { return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) } // V1beta3 returns a new v1beta3.Interface. func (g *group) V1beta3() v1beta3.Interface { return v1beta3.New(g.factory, g.namespace, g.tweakListOptions) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/flowcontrol/v1/flowschema.go
vendor/k8s.io/client-go/informers/flowcontrol/v1/flowschema.go
/* 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 v1 import ( context "context" time "time" apiflowcontrolv1 "k8s.io/api/flowcontrol/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" flowcontrolv1 "k8s.io/client-go/listers/flowcontrol/v1" cache "k8s.io/client-go/tools/cache" ) // FlowSchemaInformer provides access to a shared informer and lister for // FlowSchemas. type FlowSchemaInformer interface { Informer() cache.SharedIndexInformer Lister() flowcontrolv1.FlowSchemaLister } type flowSchemaInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewFlowSchemaInformer constructs a new informer for FlowSchema 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 NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) } // NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema 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 NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.FlowcontrolV1().FlowSchemas().List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.FlowcontrolV1().FlowSchemas().Watch(context.TODO(), options) }, }, &apiflowcontrolv1.FlowSchema{}, resyncPeriod, indexers, ) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiflowcontrolv1.FlowSchema{}, f.defaultInformer) } func (f *flowSchemaInformer) Lister() flowcontrolv1.FlowSchemaLister { return flowcontrolv1.NewFlowSchemaLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/flowcontrol/v1/interface.go
vendor/k8s.io/client-go/informers/flowcontrol/v1/interface.go
/* 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 v1 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // FlowSchemas returns a FlowSchemaInformer. FlowSchemas() FlowSchemaInformer // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. PriorityLevelConfigurations() PriorityLevelConfigurationInformer } 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} } // FlowSchemas returns a FlowSchemaInformer. func (v *version) FlowSchemas() FlowSchemaInformer { return &flowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. func (v *version) PriorityLevelConfigurations() PriorityLevelConfigurationInformer { return &priorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/flowcontrol/v1/prioritylevelconfiguration.go
vendor/k8s.io/client-go/informers/flowcontrol/v1/prioritylevelconfiguration.go
/* 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 v1 import ( context "context" time "time" apiflowcontrolv1 "k8s.io/api/flowcontrol/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" flowcontrolv1 "k8s.io/client-go/listers/flowcontrol/v1" cache "k8s.io/client-go/tools/cache" ) // PriorityLevelConfigurationInformer provides access to a shared informer and lister for // PriorityLevelConfigurations. type PriorityLevelConfigurationInformer interface { Informer() cache.SharedIndexInformer Lister() flowcontrolv1.PriorityLevelConfigurationLister } type priorityLevelConfigurationInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration 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 NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) } // NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration 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 NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.FlowcontrolV1().PriorityLevelConfigurations().List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.FlowcontrolV1().PriorityLevelConfigurations().Watch(context.TODO(), options) }, }, &apiflowcontrolv1.PriorityLevelConfiguration{}, resyncPeriod, indexers, ) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiflowcontrolv1.PriorityLevelConfiguration{}, f.defaultInformer) } func (f *priorityLevelConfigurationInformer) Lister() flowcontrolv1.PriorityLevelConfigurationLister { return flowcontrolv1.NewPriorityLevelConfigurationLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go
vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go
/* 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 v1beta1 import ( context "context" time "time" apiflowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" flowcontrolv1beta1 "k8s.io/client-go/listers/flowcontrol/v1beta1" cache "k8s.io/client-go/tools/cache" ) // FlowSchemaInformer provides access to a shared informer and lister for // FlowSchemas. type FlowSchemaInformer interface { Informer() cache.SharedIndexInformer Lister() flowcontrolv1beta1.FlowSchemaLister } type flowSchemaInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } // NewFlowSchemaInformer constructs a new informer for FlowSchema 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 NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) } // NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema 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 NewFilteredFlowSchemaInformer(client kubernetes.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.FlowcontrolV1beta1().FlowSchemas().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.FlowcontrolV1beta1().FlowSchemas().Watch(context.TODO(), options) }, }, &apiflowcontrolv1beta1.FlowSchema{}, resyncPeriod, indexers, ) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&apiflowcontrolv1beta1.FlowSchema{}, f.defaultInformer) } func (f *flowSchemaInformer) Lister() flowcontrolv1beta1.FlowSchemaLister { return flowcontrolv1beta1.NewFlowSchemaLister(f.Informer().GetIndexer()) }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false
kubev2v/forklift
https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go
vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go
/* 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 v1beta1 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // FlowSchemas returns a FlowSchemaInformer. FlowSchemas() FlowSchemaInformer // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. PriorityLevelConfigurations() PriorityLevelConfigurationInformer } 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} } // FlowSchemas returns a FlowSchemaInformer. func (v *version) FlowSchemas() FlowSchemaInformer { return &flowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. func (v *version) PriorityLevelConfigurations() PriorityLevelConfigurationInformer { return &priorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} }
go
Apache-2.0
b3b4703e958c25d54c4d48138d9e80ae32fadac3
2026-01-07T09:44:30.792320Z
false