Class KubernetesConfigMapWatcher
java.lang.Object
io.micronaut.kubernetes.configuration.KubernetesConfigMapWatcher
- All Implemented Interfaces:
io.kubernetes.client.informer.ResourceEventHandler<io.kubernetes.client.openapi.models.V1ConfigMap>
@Context
@Requires(env="k8s") @Requires(beans=io.micronaut.kubernetes.client.reactor.CoreV1ApiReactorClient.class) @Requires(property="micronaut.config-client.enabled",value="true",defaultValue="false") @Requires(condition=KubernetesConfigMapWatcherCondition.class)
public final class KubernetesConfigMapWatcher
extends Object
implements io.kubernetes.client.informer.ResourceEventHandler<io.kubernetes.client.openapi.models.V1ConfigMap>
Watches for ConfigMap changes and makes the appropriate changes to the
Environment
by adding or removing
PropertySource
s.- Since:
- 1.0.0
- Author:
- Álvaro Sánchez-Mariscal
-
Constructor Summary
ConstructorDescriptionKubernetesConfigMapWatcher
(io.micronaut.context.env.Environment environment, io.kubernetes.client.openapi.ApiClient apiClient, io.kubernetes.client.openapi.apis.CoreV1Api coreV1Api, io.micronaut.kubernetes.client.reactor.CoreV1ApiReactorClient coreV1ApiReactorClient, KubernetesConfiguration configuration, ExecutorService executorService, io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.runtime.context.scope.refresh.RefreshEvent> eventPublisher) Deprecated.KubernetesConfigMapWatcher
(io.micronaut.context.env.Environment environment, KubernetesConfiguration configuration, io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.runtime.context.scope.refresh.RefreshEvent> eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionvoid
onAdd
(io.kubernetes.client.openapi.models.V1ConfigMap configMap) void
onApplicationEvent
(io.micronaut.discovery.event.ServiceReadyEvent event) void
onDelete
(io.kubernetes.client.openapi.models.V1ConfigMap configMap, boolean deletedFinalStateUnknown) void
onUpdate
(io.kubernetes.client.openapi.models.V1ConfigMap oldObj, io.kubernetes.client.openapi.models.V1ConfigMap configMap)
-
Constructor Details
-
KubernetesConfigMapWatcher
public KubernetesConfigMapWatcher(io.micronaut.context.env.Environment environment, io.kubernetes.client.openapi.ApiClient apiClient, io.kubernetes.client.openapi.apis.CoreV1Api coreV1Api, io.micronaut.kubernetes.client.reactor.CoreV1ApiReactorClient coreV1ApiReactorClient, KubernetesConfiguration configuration, @Named("io") ExecutorService executorService, io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.runtime.context.scope.refresh.RefreshEvent> eventPublisher) Deprecated.- Parameters:
environment
- theEnvironment
apiClient
- theApiClient
coreV1Api
- theCoreV1Api
coreV1ApiReactorClient
- theCoreV1ApiReactorClient
configuration
- theKubernetesConfiguration
executorService
- the IOExecutorService
where the watch publisher will be scheduled oneventPublisher
- theApplicationEventPublisher
-
KubernetesConfigMapWatcher
@Inject public KubernetesConfigMapWatcher(io.micronaut.context.env.Environment environment, KubernetesConfiguration configuration, io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.runtime.context.scope.refresh.RefreshEvent> eventPublisher)
-
-
Method Details
-
onApplicationEvent
@EventListener public void onApplicationEvent(io.micronaut.discovery.event.ServiceReadyEvent event) -
onAdd
public void onAdd(io.kubernetes.client.openapi.models.V1ConfigMap configMap) - Specified by:
onAdd
in interfaceio.kubernetes.client.informer.ResourceEventHandler<io.kubernetes.client.openapi.models.V1ConfigMap>
-
onUpdate
public void onUpdate(io.kubernetes.client.openapi.models.V1ConfigMap oldObj, io.kubernetes.client.openapi.models.V1ConfigMap configMap) - Specified by:
onUpdate
in interfaceio.kubernetes.client.informer.ResourceEventHandler<io.kubernetes.client.openapi.models.V1ConfigMap>
-
onDelete
public void onDelete(io.kubernetes.client.openapi.models.V1ConfigMap configMap, boolean deletedFinalStateUnknown) - Specified by:
onDelete
in interfaceio.kubernetes.client.informer.ResourceEventHandler<io.kubernetes.client.openapi.models.V1ConfigMap>
-
KubernetesConfigMapWatcher(Environment, KubernetesConfiguration, ApplicationEventPublisher)