Class AbstractFlinkResourceObserver<CR extends AbstractFlinkResource<?,?>>
- java.lang.Object
-
- org.apache.flink.kubernetes.operator.observer.AbstractFlinkResourceObserver<CR>
-
- All Implemented Interfaces:
Observer<CR>
- Direct Known Subclasses:
AbstractFlinkDeploymentObserver
,FlinkSessionJobObserver
public abstract class AbstractFlinkResourceObserver<CR extends AbstractFlinkResource<?,?>> extends java.lang.Object implements Observer<CR>
Base observer for all Flink resources.
-
-
Field Summary
Fields Modifier and Type Field Description protected FlinkConfigManager
configManager
protected EventRecorder
eventRecorder
protected org.slf4j.Logger
logger
-
Constructor Summary
Constructors Constructor Description AbstractFlinkResourceObserver(FlinkConfigManager configManager, EventRecorder eventRecorder)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
isResourceReadyToBeObserved(FlinkResourceContext<CR> ctx)
Check whether the resource should be observed.void
observe(FlinkResourceContext<CR> ctx)
Observe the flinkApp status, It will reflect the changed status on the flinkApp resource.protected abstract void
observeInternal(FlinkResourceContext<CR> ctx)
Internal observer logic specific to each resource type.protected abstract void
updateStatusToDeployedIfAlreadyUpgraded(FlinkResourceContext<CR> ctx)
Checks a resource that is currently in the UPGRADING state whether it was already deployed but we simply miss the status information.
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
-
configManager
protected final FlinkConfigManager configManager
-
eventRecorder
protected final EventRecorder eventRecorder
-
-
Constructor Detail
-
AbstractFlinkResourceObserver
public AbstractFlinkResourceObserver(FlinkConfigManager configManager, EventRecorder eventRecorder)
-
-
Method Detail
-
observe
public final void observe(FlinkResourceContext<CR> ctx)
Description copied from interface:Observer
Observe the flinkApp status, It will reflect the changed status on the flinkApp resource.- Specified by:
observe
in interfaceObserver<CR extends AbstractFlinkResource<?,?>>
- Parameters:
ctx
- the context with which the operation is executed
-
isResourceReadyToBeObserved
protected boolean isResourceReadyToBeObserved(FlinkResourceContext<CR> ctx)
Check whether the resource should be observed. In certain states such as suspended applications or in-progress upgrades and rollbacks, observing is not necessary.- Parameters:
ctx
- Resource context- Returns:
- True if we should observe the resource
-
observeInternal
protected abstract void observeInternal(FlinkResourceContext<CR> ctx)
Internal observer logic specific to each resource type.- Parameters:
ctx
- Resource context
-
updateStatusToDeployedIfAlreadyUpgraded
protected abstract void updateStatusToDeployedIfAlreadyUpgraded(FlinkResourceContext<CR> ctx)
Checks a resource that is currently in the UPGRADING state whether it was already deployed but we simply miss the status information. After comparing the target resource generation with the one from the possible deployment if they match we update the status to the already DEPLOYED state.- Parameters:
ctx
- Context for resource.
-
-