Class SharedInformerFactory
java.lang.Object
io.fabric8.kubernetes.client.dsl.base.OperationSupport
io.fabric8.kubernetes.client.dsl.base.BaseOperation
io.fabric8.kubernetes.client.informers.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
-
Field Summary
Fields inherited from class io.fabric8.kubernetes.client.dsl.base.BaseOperation
apiVersion, doneableType, listType, typeFields inherited from class io.fabric8.kubernetes.client.dsl.base.OperationSupport
apiGroupName, apiGroupVersion, client, config, context, JSON, JSON_MAPPER, JSON_PATCH, name, namespace, resourceT, STRATEGIC_MERGE_JSON_PATCH, YAML_MAPPERFields inherited from interface io.fabric8.kubernetes.client.dsl.Waitable
DEFAULT_BACKOFF_MULTIPLIER, DEFAULT_INITIAL_BACKOFF_MILLIS -
Constructor Summary
Constructors Constructor Description SharedInformerFactory(ExecutorService threadPool, okhttp3.OkHttpClient okHttpClient, Config configuration)Constructor with thread pool specified. -
Method Summary
Modifier and Type Method Description voidaddSharedInformerEventListener(SharedInformerEventListener event)<T> SharedIndexInformer<T>getExistingSharedIndexInformer(Class<T> apiTypeClass)Gets existing shared index informer, return null if the requesting informer is never constructed.<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.<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.<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.<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.voidstartAllRegisteredInformers()Starts all registered informers.voidstopAllRegisteredInformers()Stop all registered informers and shut down thread pool.voidstopAllRegisteredInformers(boolean shutDownThreadPool)Stop all registered informersMethods inherited from class io.fabric8.kubernetes.client.dsl.base.BaseOperation
cascading, create, create, createNew, createOrReplace, createOrReplaceWithNew, delete, delete, delete, edit, fetchListUrl, forOperationType, fromServer, get, getApiVersion, getConfigType, getDoneableType, getFieldQueryParam, getFields, getFieldsNot, getGracePeriodSeconds, getItem, getKind, getLabelQueryParam, getLabels, getLabelsIn, getLabelsNot, getLabelsNotIn, getListType, getMandatory, getOperationType, getPropagationPolicy, getReloadingFromServer, getResourceT, getResourceVersion, getRootPaths, getType, handleCreate, handleDeploymentRollback, handleGet, handlePatch, handlePatch, handleReplace, handleResponse, handleScale, inAnyNamespace, inNamespace, isApiGroup, isCascading, isReady, isReloadingFromServer, isResourceNamespaced, list, list, list, load, load, load, load, lockResourceVersion, newInstance, patch, replace, require, sendPatchedObject, setListType, setNamespace, setType, updateApiVersion, updateApiVersion, updateApiVersionResource, updateStatus, waitUntilCondition, waitUntilReady, watch, watch, watch, withField, withFields, withGracePeriod, withItem, withLabel, withLabel, withLabelIn, withLabelNotIn, withLabels, withLabelSelector, withName, withoutField, withoutFields, withoutLabel, withoutLabel, withoutLabels, withPropagationPolicy, withResourceVersion, withWaitRetryBackoffMethods inherited from class io.fabric8.kubernetes.client.dsl.base.OperationSupport
assertResponseCode, checkName, checkNamespace, createStatus, createStatus, getAPIGroup, getAPIVersion, getConfig, getName, getNamespace, getNamespacedUrl, getNamespacedUrl, getNamespacedUrl, getObjectValueAsMap, getResourceUrl, getResourceUrl, getRootUrl, handleCreate, handleDelete, handleDelete, handleDeploymentRollback, handleGet, handleGet, handleMetric, handlePatch, handlePatch, handleReplace, handleReplace, handleResponse, handleResponse, handleResponse, handleResponse, handleScale, handleStatusUpdate, requestException, requestFailure, unmarshal, unmarshal, unmarshal
-
Constructor Details
-
SharedInformerFactory
public SharedInformerFactory(ExecutorService threadPool, okhttp3.OkHttpClient okHttpClient, Config configuration)Constructor with thread pool specified.- Parameters:
threadPool- specified thread pool.okHttpClient- OkHttp clientconfiguration- 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 parameterL- the type's list parameter- Parameters:
apiTypeClass- apiType classapiListTypeClass- api list type classresyncPeriodInMillis- 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 parameterL- the type's list parameter- Parameters:
customResourceContext- basic information about the Custom Resource Definition corresponding to that custom resourceapiTypeClass- apiType classapiListTypeClass- api list type classresyncPeriodInMillis- 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 parameterL- the type's list parameter- Parameters:
customResourceContext- basic information about the Custom Resource Definition corresponding to that custom resourceapiTypeClass- apiType classapiListTypeClass- api list type classoperationContext- operation contextresyncPeriodInMillis- 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 parameterL- the type's list parameter- Parameters:
apiTypeClass- apiType classapiListTypeClass- api list type classoperationContext- operation contextresyncPeriodInMillis- resync period in milliseconds- Returns:
- the shared index informer
-
getExistingSharedIndexInformer
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
-