Class AbstractJobReconciler<CR extends AbstractFlinkResource<SPEC,STATUS>,SPEC extends AbstractFlinkSpec,STATUS extends CommonStatus<SPEC>>
- java.lang.Object
-
- org.apache.flink.kubernetes.operator.reconciler.deployment.AbstractFlinkResourceReconciler<CR,SPEC,STATUS>
-
- org.apache.flink.kubernetes.operator.reconciler.deployment.AbstractJobReconciler<CR,SPEC,STATUS>
-
- All Implemented Interfaces:
Reconciler<CR>
- Direct Known Subclasses:
ApplicationReconciler
,SessionJobReconciler
public abstract class AbstractJobReconciler<CR extends AbstractFlinkResource<SPEC,STATUS>,SPEC extends AbstractFlinkSpec,STATUS extends CommonStatus<SPEC>> extends AbstractFlinkResourceReconciler<CR,SPEC,STATUS>
Reconciler responsible for handling the job lifecycle according to the desired and current states.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.kubernetes.operator.reconciler.deployment.AbstractFlinkResourceReconciler
clock, eventRecorder, kubernetesClient, MSG_ROLLBACK, MSG_SPEC_CHANGED, MSG_SUBMIT, MSG_SUSPENDED, resourceScaler, statusRecorder
-
-
Constructor Summary
Constructors Constructor Description AbstractJobReconciler(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, EventRecorder eventRecorder, StatusRecorder<CR,STATUS> statusRecorder, JobAutoScalerFactory autoscalerFactory)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
cancelJob(FlinkResourceContext<CR> ctx, UpgradeMode upgradeMode)
Cancel the job for the given resource using the specified upgrade mode.protected abstract void
cleanupAfterFailedJob(FlinkResourceContext<CR> ctx)
Removes a failed job.protected java.util.Optional<UpgradeMode>
getAvailableUpgradeMode(FlinkResourceContext<CR> ctx, org.apache.flink.configuration.Configuration deployConfig)
boolean
readyToReconcile(FlinkResourceContext<CR> ctx)
Check whether the given Flink resource is ready to be reconciled or we are still waiting for any pending operation or condition first.boolean
reconcileOtherChanges(FlinkResourceContext<CR> ctx)
Reconcile any other changes required for this resource that are specific to the reconciler implementation.protected boolean
reconcileSpecChange(FlinkResourceContext<CR> ctx, org.apache.flink.configuration.Configuration deployConfig)
Reconcile spec upgrade on the currently deployed/suspended Flink resource and update the status accordingly.protected void
restoreJob(FlinkResourceContext<CR> ctx, SPEC spec, org.apache.flink.configuration.Configuration deployConfig, boolean requireHaMetadata)
protected void
resubmitJob(FlinkResourceContext<CR> ctx, boolean requireHaMetadata)
protected void
rollback(FlinkResourceContext<CR> ctx)
Rollback deployed resource to the last stable spec.-
Methods inherited from class org.apache.flink.kubernetes.operator.reconciler.deployment.AbstractFlinkResourceReconciler
cleanup, cleanupInternal, deploy, flinkVersionChanged, reconcile, setClock, setOwnerReference, shouldRecoverDeployment
-
-
-
-
Constructor Detail
-
AbstractJobReconciler
public AbstractJobReconciler(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, EventRecorder eventRecorder, StatusRecorder<CR,STATUS> statusRecorder, JobAutoScalerFactory autoscalerFactory)
-
-
Method Detail
-
readyToReconcile
public boolean readyToReconcile(FlinkResourceContext<CR> ctx)
Description copied from class:AbstractFlinkResourceReconciler
Check whether the given Flink resource is ready to be reconciled or we are still waiting for any pending operation or condition first.- Specified by:
readyToReconcile
in classAbstractFlinkResourceReconciler<CR extends AbstractFlinkResource<SPEC,STATUS>,SPEC extends AbstractFlinkSpec,STATUS extends CommonStatus<SPEC>>
- Parameters:
ctx
- Reconciliation context.- Returns:
- True if the resource is ready to be reconciled.
-
reconcileSpecChange
protected boolean reconcileSpecChange(FlinkResourceContext<CR> ctx, org.apache.flink.configuration.Configuration deployConfig) throws java.lang.Exception
Description copied from class:AbstractFlinkResourceReconciler
Reconcile spec upgrade on the currently deployed/suspended Flink resource and update the status accordingly.- Specified by:
reconcileSpecChange
in classAbstractFlinkResourceReconciler<CR extends AbstractFlinkResource<SPEC,STATUS>,SPEC extends AbstractFlinkSpec,STATUS extends CommonStatus<SPEC>>
- Parameters:
ctx
- Reconciliation context.deployConfig
- Deployment configuration.- Returns:
- True if spec change reconciliation was executed
- Throws:
java.lang.Exception
- Error during spec upgrade.
-
getAvailableUpgradeMode
protected java.util.Optional<UpgradeMode> getAvailableUpgradeMode(FlinkResourceContext<CR> ctx, org.apache.flink.configuration.Configuration deployConfig)
-
restoreJob
protected void restoreJob(FlinkResourceContext<CR> ctx, SPEC spec, org.apache.flink.configuration.Configuration deployConfig, boolean requireHaMetadata) throws java.lang.Exception
- Throws:
java.lang.Exception
-
rollback
protected void rollback(FlinkResourceContext<CR> ctx) throws java.lang.Exception
Description copied from class:AbstractFlinkResourceReconciler
Rollback deployed resource to the last stable spec.- Specified by:
rollback
in classAbstractFlinkResourceReconciler<CR extends AbstractFlinkResource<SPEC,STATUS>,SPEC extends AbstractFlinkSpec,STATUS extends CommonStatus<SPEC>>
- Parameters:
ctx
- Reconciliation context.- Throws:
java.lang.Exception
- Error during rollback.
-
reconcileOtherChanges
public boolean reconcileOtherChanges(FlinkResourceContext<CR> ctx) throws java.lang.Exception
Description copied from class:AbstractFlinkResourceReconciler
Reconcile any other changes required for this resource that are specific to the reconciler implementation.- Specified by:
reconcileOtherChanges
in classAbstractFlinkResourceReconciler<CR extends AbstractFlinkResource<SPEC,STATUS>,SPEC extends AbstractFlinkSpec,STATUS extends CommonStatus<SPEC>>
- Parameters:
ctx
- Reconciliation context.- Returns:
- True if any further reconciliation action was taken.
- Throws:
java.lang.Exception
- Error during reconciliation.
-
resubmitJob
protected void resubmitJob(FlinkResourceContext<CR> ctx, boolean requireHaMetadata) throws java.lang.Exception
- Throws:
java.lang.Exception
-
cancelJob
protected abstract void cancelJob(FlinkResourceContext<CR> ctx, UpgradeMode upgradeMode) throws java.lang.Exception
Cancel the job for the given resource using the specified upgrade mode.- Parameters:
ctx
- Reconciler context.upgradeMode
- Upgrade mode used during cancel.- Throws:
java.lang.Exception
- Error during cancellation.
-
cleanupAfterFailedJob
protected abstract void cleanupAfterFailedJob(FlinkResourceContext<CR> ctx) throws java.lang.Exception
Removes a failed job.- Parameters:
ctx
- Reconciler context.- Throws:
java.lang.Exception
- Error during cancellation.
-
-