Class SharedInformerFactory

All Implemented Interfaces:
AnyNamespaceable, Cascading, CascadingEditReplacePatchDeletable, Createable, CreateFromServerGettable, CreateOrReplaceable, Deletable, Editable, EditReplacePatchable, EditReplacePatchDeletable, Filterable, FilterWatchListDeletable, FilterWatchListMultiDeletable, FromServerable, Gettable, Listable, Loadable, Lockable, MixedOperation, MultiDeleteable, Nameable, Namespaceable, NonNamespaceOperation, Operation, Patchable, Readiable, Replaceable, Requirable, Resource, StatusUpdatable, Versionable, VersionWatchable, Waitable, Watchable, WatchListDeletable, FromServerGettable, GracePeriodConfigurable, OperationInfo, PropagationPolicyConfigurable

public class SharedInformerFactory
extends BaseOperation
SharedInformerFactory class constructs and caches informers for api types. This has been taken from https://github.com/kubernetes-client/java/blob/master/util/src/main/java/io/kubernetes/client/informer/SharedInformerFactory.java which is ported from offical go client https://github.com/kubernetes/client-go/blob/master/informers/factory.go
  • Constructor Details

    • SharedInformerFactory

      public SharedInformerFactory​(ExecutorService threadPool, okhttp3.OkHttpClient okHttpClient, Config configuration)
      Constructor with thread pool specified.
      Parameters:
      threadPool - specified thread pool.
      okHttpClient - OkHttp client
      configuration - configuration for client
  • Method Details

    • sharedIndexInformerFor

      public <T extends io.fabric8.kubernetes.api.model.HasMetadata,​ L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>> SharedIndexInformer<T> sharedIndexInformerFor​(Class<T> apiTypeClass, Class<L> apiListTypeClass, long resyncPeriodInMillis)
      Constructs and returns a shared index informer with resync period specified. And the informer cache will be overwritten.
      Type Parameters:
      T - the type parameter
      L - the type's list parameter
      Parameters:
      apiTypeClass - apiType class
      apiListTypeClass - api list type class
      resyncPeriodInMillis - resync period in milliseconds
      Returns:
      the shared index informer
    • sharedIndexInformerForCustomResource

      public <T extends io.fabric8.kubernetes.api.model.HasMetadata,​ L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>> SharedIndexInformer<T> sharedIndexInformerForCustomResource​(CustomResourceDefinitionContext customResourceContext, Class<T> apiTypeClass, Class<L> apiListTypeClass, long resyncPeriodInMillis)
      Constructs and returns a shared index informer with resync period specified for custom resources.
      Type Parameters:
      T - the type parameter
      L - the type's list parameter
      Parameters:
      customResourceContext - basic information about the Custom Resource Definition corresponding to that custom resource
      apiTypeClass - apiType class
      apiListTypeClass - api list type class
      resyncPeriodInMillis - resync period in milliseconds
      Returns:
      the shared index informer
    • sharedIndexInformerForCustomResource

      public <T extends io.fabric8.kubernetes.api.model.HasMetadata,​ L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>> SharedIndexInformer<T> sharedIndexInformerForCustomResource​(CustomResourceDefinitionContext customResourceContext, Class<T> apiTypeClass, Class<L> apiListTypeClass, OperationContext operationContext, long resyncPeriodInMillis)
      Constructs and returns a shared index informer with resync period specified for custom resources.
      Type Parameters:
      T - the type parameter
      L - the type's list parameter
      Parameters:
      customResourceContext - basic information about the Custom Resource Definition corresponding to that custom resource
      apiTypeClass - apiType class
      apiListTypeClass - api list type class
      operationContext - operation context
      resyncPeriodInMillis - resync period in milliseconds
      Returns:
      the shared index informer
    • sharedIndexInformerFor

      public <T extends io.fabric8.kubernetes.api.model.HasMetadata,​ L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>> SharedIndexInformer<T> sharedIndexInformerFor​(Class<T> apiTypeClass, Class<L> apiListTypeClass, OperationContext operationContext, long resyncPeriodInMillis)
      Constructs and returns a shared index informer with resync period specified. And the informer cache will be overwritten.
      Type Parameters:
      T - the type parameter
      L - the type's list parameter
      Parameters:
      apiTypeClass - apiType class
      apiListTypeClass - api list type class
      operationContext - operation context
      resyncPeriodInMillis - resync period in milliseconds
      Returns:
      the shared index informer
    • getExistingSharedIndexInformer

      public <T> SharedIndexInformer<T> getExistingSharedIndexInformer​(Class<T> apiTypeClass)
      Gets existing shared index informer, return null if the requesting informer is never constructed.
      Type Parameters:
      T - type of API type
      Parameters:
      apiTypeClass - API type class
      Returns:
      SharedIndexInformer object
    • startAllRegisteredInformers

      public void startAllRegisteredInformers()
      Starts all registered informers.
    • stopAllRegisteredInformers

      public void stopAllRegisteredInformers()
      Stop all registered informers and shut down thread pool.
    • stopAllRegisteredInformers

      public void stopAllRegisteredInformers​(boolean shutDownThreadPool)
      Stop all registered informers
      Parameters:
      shutDownThreadPool - Whether to shut down thread pool or not.
    • addSharedInformerEventListener

      public void addSharedInformerEventListener​(SharedInformerEventListener event)