Class AbstractJobReconciler<CR extends org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<SPEC,STATUS>,SPEC extends org.apache.flink.kubernetes.operator.api.spec.AbstractFlinkSpec,STATUS extends org.apache.flink.kubernetes.operator.api.status.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 org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<SPEC,STATUS>,SPEC extends org.apache.flink.kubernetes.operator.api.spec.AbstractFlinkSpec,STATUS extends org.apache.flink.kubernetes.operator.api.status.CommonStatus<SPEC>> extends AbstractFlinkResourceReconciler<CR,SPEC,STATUS>
Reconciler responsible for handling the job lifecycle according to the desired and current states.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractJobReconciler.AvailableUpgradeModeObject to capture available upgrade mode.
-
Field Summary
-
Fields inherited from class org.apache.flink.kubernetes.operator.reconciler.deployment.AbstractFlinkResourceReconciler
autoscaler, clock, eventRecorder, MSG_ROLLBACK, MSG_SPEC_CHANGED, MSG_SUBMIT, MSG_SUSPENDED, statusRecorder
-
-
Constructor Summary
Constructors Constructor Description AbstractJobReconciler(EventRecorder eventRecorder, StatusRecorder<CR,STATUS> statusRecorder, org.apache.flink.autoscaler.JobAutoScaler<io.javaoperatorsdk.operator.processing.event.ResourceID,KubernetesJobAutoScalerContext> autoscaler)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcancelJob(FlinkResourceContext<CR> ctx, org.apache.flink.kubernetes.operator.api.spec.UpgradeMode upgradeMode)Cancel the job for the given resource using the specified upgrade mode.protected AbstractJobReconciler.AvailableUpgradeModechangeLastStateIfCheckpointTooOld(FlinkResourceContext<CR> ctx, org.apache.flink.configuration.Configuration deployConfig)protected abstract voidcleanupAfterFailedJob(FlinkResourceContext<CR> ctx)Removes a failed job.protected AbstractJobReconciler.AvailableUpgradeModegetAvailableUpgradeMode(FlinkResourceContext<CR> ctx, org.apache.flink.configuration.Configuration deployConfig)booleanreadyToReconcile(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.booleanreconcileOtherChanges(FlinkResourceContext<CR> ctx)Reconcile any other changes required for this resource that are specific to the reconciler implementation.protected booleanreconcileSpecChange(FlinkResourceContext<CR> ctx, org.apache.flink.configuration.Configuration deployConfig, SPEC lastReconciledSpec)Reconcile spec upgrade on the currently deployed/suspended Flink resource and update the status accordingly.protected voidrestoreJob(FlinkResourceContext<CR> ctx, SPEC spec, org.apache.flink.configuration.Configuration deployConfig, boolean requireHaMetadata)protected voidresubmitJob(FlinkResourceContext<CR> ctx, boolean requireHaMetadata)-
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(EventRecorder eventRecorder, StatusRecorder<CR,STATUS> statusRecorder, org.apache.flink.autoscaler.JobAutoScaler<io.javaoperatorsdk.operator.processing.event.ResourceID,KubernetesJobAutoScalerContext> autoscaler)
-
-
Method Detail
-
readyToReconcile
public boolean readyToReconcile(FlinkResourceContext<CR> ctx)
Description copied from class:AbstractFlinkResourceReconcilerCheck whether the given Flink resource is ready to be reconciled or we are still waiting for any pending operation or condition first.- Specified by:
readyToReconcilein classAbstractFlinkResourceReconciler<CR extends org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<SPEC,STATUS>,SPEC extends org.apache.flink.kubernetes.operator.api.spec.AbstractFlinkSpec,STATUS extends org.apache.flink.kubernetes.operator.api.status.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, SPEC lastReconciledSpec) throws java.lang.Exception
Description copied from class:AbstractFlinkResourceReconcilerReconcile spec upgrade on the currently deployed/suspended Flink resource and update the status accordingly.- Specified by:
reconcileSpecChangein classAbstractFlinkResourceReconciler<CR extends org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<SPEC,STATUS>,SPEC extends org.apache.flink.kubernetes.operator.api.spec.AbstractFlinkSpec,STATUS extends org.apache.flink.kubernetes.operator.api.status.CommonStatus<SPEC>>- Parameters:
ctx- Reconciliation context.deployConfig- Deployment configuration.lastReconciledSpec- Last reconciled spec- Returns:
- True if spec change reconciliation was executed
- Throws:
java.lang.Exception- Error during spec upgrade.
-
getAvailableUpgradeMode
protected AbstractJobReconciler.AvailableUpgradeMode getAvailableUpgradeMode(FlinkResourceContext<CR> ctx, org.apache.flink.configuration.Configuration deployConfig) throws java.lang.Exception
- Throws:
java.lang.Exception
-
changeLastStateIfCheckpointTooOld
@VisibleForTesting protected AbstractJobReconciler.AvailableUpgradeMode changeLastStateIfCheckpointTooOld(FlinkResourceContext<CR> ctx, org.apache.flink.configuration.Configuration deployConfig) throws java.lang.Exception
- Throws:
java.lang.Exception
-
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
-
reconcileOtherChanges
public boolean reconcileOtherChanges(FlinkResourceContext<CR> ctx) throws java.lang.Exception
Description copied from class:AbstractFlinkResourceReconcilerReconcile any other changes required for this resource that are specific to the reconciler implementation.- Specified by:
reconcileOtherChangesin classAbstractFlinkResourceReconciler<CR extends org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<SPEC,STATUS>,SPEC extends org.apache.flink.kubernetes.operator.api.spec.AbstractFlinkSpec,STATUS extends org.apache.flink.kubernetes.operator.api.status.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, org.apache.flink.kubernetes.operator.api.spec.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.
-
-