Documentation ¶
Index ¶
- Constants
- func Apply(ctx context.Context, obj Object, changedBy, changeReason string, ...) (runtime.Object, error)
- func AttachResourceEventHandler[TObj Object](ctx context.Context, handler TypedResourceEventHandler[TObj], namespace string, ...) error
- func Client(ctx context.Context, gvk schema.GroupVersionKind, namespace string) (dynamic.ResourceInterface, bool, error)
- func ClientForObject(ctx context.Context, obj runtime.Object, namespace string) (dynamic.ResourceInterface, schema.GroupVersionKind, bool, error)
- func DecodeObject[T Object](bytes []byte) (T, error)
- func Delete(ctx context.Context, gvk schema.GroupVersionKind, namespace string, ...) error
- func DeleteObject(ctx context.Context, obj Object) error
- func DspLabel(name string) string
- func Get(ctx context.Context, gvk schema.GroupVersionKind, namespace string, ...) (runtime.Object, error)
- func GetObject(ctx context.Context, obj Object) error
- func GroupVersionKindForObject(obj runtime.Object) (schema.GroupVersionKind, error)
- func IsDspLabel(label string) bool
- func IsPvcResizingError(err error) bool
- func NewK8sObject[TObj Object]() TObj
- func StartAndSyncInformer(ctx context.Context, informer cache.SharedIndexInformer) bool
- func Watch(ctx context.Context, gvk schema.GroupVersionKind, namespace string, ...) (watch.Interface, error)
- type ConversionEventHandler
- type ConversionStage
- type NewListWatcherFunc
- type Object
- type PodReference
- type ResourceFilter
- type TypedFilteringResourceEventHandler
- func (t TypedFilteringResourceEventHandler[TObj]) OnAdd(obj TObj)
- func (t TypedFilteringResourceEventHandler[TObj]) OnConversionError(i interface{}, stage ConversionStage, conversionError error)
- func (t TypedFilteringResourceEventHandler[TObj]) OnDelete(obj TObj)
- func (t TypedFilteringResourceEventHandler[TObj]) OnDeleteUnknown(i interface{}, key string)
- func (t TypedFilteringResourceEventHandler[TObj]) OnUpdate(oldObj, newObj TObj)
- type TypedResourceEventHandler
- type TypedResourceEventHandlerFuncs
- func (t TypedResourceEventHandlerFuncs[TObj]) OnAdd(obj TObj)
- func (t TypedResourceEventHandlerFuncs[TObj]) OnConversionError(i interface{}, stage ConversionStage, conversionError error)
- func (t TypedResourceEventHandlerFuncs[TObj]) OnDelete(obj TObj)
- func (t TypedResourceEventHandlerFuncs[TObj]) OnDeleteUnknown(i interface{}, key string)
- func (t TypedResourceEventHandlerFuncs[TObj]) OnUpdate(oldObj, newObj TObj)
- type TypedSharedIndexInformer
Constants ¶
const ConversionStageAdd = ConversionStage("Add")
const ConversionStageDelete = ConversionStage("Delete")
const ConversionStageUpdate = ConversionStage("Update")
const DspChangeDateAnnotation = "change-date"
const DspChangeReasonAnnotation = "change-reason"
const DspChangedByAnnotation = "changed-by"
const DspKubernetesLabelDomain = "tiki-dsp.io"
const DspKubernetesLabelPrefix = DspKubernetesLabelDomain + "/"
const DspNamespaceEnv = "DSP_NAMESPACE"
const DspPodEnv = "DSP_POD"
Variables ¶
This section is empty.
Functions ¶
func AttachResourceEventHandler ¶ added in v2.19.0
func AttachResourceEventHandler[TObj Object](ctx context.Context, handler TypedResourceEventHandler[TObj], namespace string, resyncPeriod time.Duration, listOptionsModifier dynamicinformer.TweakListOptionsFunc, filter ResourceFilter[TObj]) error
func Client ¶
func Client(ctx context.Context, gvk schema.GroupVersionKind, namespace string) (dynamic.ResourceInterface, bool, error)
func ClientForObject ¶
func DecodeObject ¶ added in v2.23.0
func GroupVersionKindForObject ¶
func GroupVersionKindForObject(obj runtime.Object) (schema.GroupVersionKind, error)
func IsDspLabel ¶ added in v2.7.0
func IsPvcResizingError ¶ added in v2.0.17
func NewK8sObject ¶ added in v2.10.0
func NewK8sObject[TObj Object]() TObj
func StartAndSyncInformer ¶ added in v2.10.0
func StartAndSyncInformer(ctx context.Context, informer cache.SharedIndexInformer) bool
StartAndSyncInformer starts the informer in a goroutine and waits until the initial cache sync is done. it returns a boolean that signals if the cache sync was successful.
Both the informer and the cache sync can be stopped by cancelling the provided context.
Types ¶
type ConversionEventHandler ¶ added in v2.19.0
type ConversionEventHandler[TObj Object] struct { Target TypedResourceEventHandler[TObj] }
func (ConversionEventHandler[TObj]) OnAdd ¶ added in v2.19.0
func (c ConversionEventHandler[TObj]) OnAdd(obj interface{}, _ bool)
func (ConversionEventHandler[TObj]) OnDelete ¶ added in v2.19.0
func (c ConversionEventHandler[TObj]) OnDelete(obj interface{})
func (ConversionEventHandler[TObj]) OnUpdate ¶ added in v2.19.0
func (c ConversionEventHandler[TObj]) OnUpdate(oldObj, newObj interface{})
type ConversionStage ¶ added in v2.19.0
type ConversionStage string
type NewListWatcherFunc ¶ added in v2.10.0
type NewListWatcherFunc func(resourceInterface dynamic.NamespaceableResourceInterface) cache.ListerWatcher
func NewFilteredListWatcherFunc ¶ added in v2.10.0
func NewFilteredListWatcherFunc(ctx context.Context, namespace string, optionsModifier dynamicinformer.TweakListOptionsFunc) NewListWatcherFunc
NewFilteredListWatcherFunc creates a NewListWatcherFunc with the specified <ctx> and <namespace>.
If the optionsModifier is not nil, it will be applied to the ListOptions passed to the ListFunc and WatchFunc before calling List and Watch.
type PodReference ¶
func GetCurrentPodReference ¶
func GetCurrentPodReference() (*PodReference, error)
type ResourceFilter ¶ added in v2.19.0
type TypedFilteringResourceEventHandler ¶ added in v2.19.0
type TypedFilteringResourceEventHandler[TObj Object] struct { FilterFunc ResourceFilter[TObj] Handler TypedResourceEventHandler[TObj] }
func (TypedFilteringResourceEventHandler[TObj]) OnAdd ¶ added in v2.19.0
func (t TypedFilteringResourceEventHandler[TObj]) OnAdd(obj TObj)
func (TypedFilteringResourceEventHandler[TObj]) OnConversionError ¶ added in v2.19.0
func (t TypedFilteringResourceEventHandler[TObj]) OnConversionError(i interface{}, stage ConversionStage, conversionError error)
func (TypedFilteringResourceEventHandler[TObj]) OnDelete ¶ added in v2.19.0
func (t TypedFilteringResourceEventHandler[TObj]) OnDelete(obj TObj)
func (TypedFilteringResourceEventHandler[TObj]) OnDeleteUnknown ¶ added in v2.19.0
func (t TypedFilteringResourceEventHandler[TObj]) OnDeleteUnknown(i interface{}, key string)
func (TypedFilteringResourceEventHandler[TObj]) OnUpdate ¶ added in v2.19.0
func (t TypedFilteringResourceEventHandler[TObj]) OnUpdate(oldObj, newObj TObj)
type TypedResourceEventHandler ¶ added in v2.19.0
type TypedResourceEventHandler[TObj Object] interface { OnAdd(obj TObj) OnUpdate(oldObj, newObj TObj) OnDelete(obj TObj) OnDeleteUnknown(i interface{}, key string) OnConversionError(i interface{}, stage ConversionStage, conversionError error) }
type TypedResourceEventHandlerFuncs ¶ added in v2.19.0
type TypedResourceEventHandlerFuncs[TObj Object] struct { OnAddFunc func(obj TObj) OnUpdateFunc func(oldObj, newObj TObj) OnDeleteFunc func(obj TObj) OnDeleteUnknownFunc func(i interface{}, key string) OnConversionErrorFunc func(i interface{}, stage ConversionStage, conversionError error) }
func (TypedResourceEventHandlerFuncs[TObj]) OnAdd ¶ added in v2.19.0
func (t TypedResourceEventHandlerFuncs[TObj]) OnAdd(obj TObj)
func (TypedResourceEventHandlerFuncs[TObj]) OnConversionError ¶ added in v2.19.0
func (t TypedResourceEventHandlerFuncs[TObj]) OnConversionError(i interface{}, stage ConversionStage, conversionError error)
func (TypedResourceEventHandlerFuncs[TObj]) OnDelete ¶ added in v2.19.0
func (t TypedResourceEventHandlerFuncs[TObj]) OnDelete(obj TObj)
func (TypedResourceEventHandlerFuncs[TObj]) OnDeleteUnknown ¶ added in v2.19.0
func (t TypedResourceEventHandlerFuncs[TObj]) OnDeleteUnknown(i interface{}, key string)
func (TypedResourceEventHandlerFuncs[TObj]) OnUpdate ¶ added in v2.19.0
func (t TypedResourceEventHandlerFuncs[TObj]) OnUpdate(oldObj, newObj TObj)
type TypedSharedIndexInformer ¶ added in v2.19.0
type TypedSharedIndexInformer[TObj Object] interface { cache.SharedIndexInformer }
func NewSharedIndexInformer ¶ added in v2.10.0
func NewSharedIndexInformer[TObj Object](ctx context.Context, newLw NewListWatcherFunc, resyncPeriod time.Duration, indexers cache.Indexers) (TypedSharedIndexInformer[TObj], error)
NewSharedIndexInformer create a new SharedIndexInformer with given <resyncPeriod> and <indexers>. The NewListWatcherFunc will be called with a NamespaceableResourceInterface for the GroupVersionResource that was resolved for <TObj>.
If <newLw> is nil, a default list watcher for all namespaces with no list option modifications will be used.
If <indexers> is nil, a default indexer indexing by 'namespace': <namespace> will be used.