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
configManager, eventRecorder, flinkService, kubernetesClient, MSG_ROLLBACK, MSG_SPEC_CHANGED, MSG_SUBMIT, MSG_SUSPENDED, statusRecorder
-
-
Constructor Summary
Constructors Constructor Description AbstractJobReconciler(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, FlinkService flinkService, FlinkConfigManager configManager, EventRecorder eventRecorder, StatusRecorder<STATUS> statusRecorder)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcancelJob(CR resource, UpgradeMode upgradeMode, org.apache.flink.configuration.Configuration observeConfig)Cancel the job for the given resource using the specified upgrade mode.protected java.util.Optional<UpgradeMode>getAvailableUpgradeMode(CR resource, org.apache.flink.configuration.Configuration deployConfig, org.apache.flink.configuration.Configuration observeConfig)booleanreadyToReconcile(CR resource, io.javaoperatorsdk.operator.api.reconciler.Context context, org.apache.flink.configuration.Configuration deployConfig)Check whether the given Flink resource is ready to be reconciled or we are still waiting for any pending operation or condition first.booleanreconcileOtherChanges(CR resource, org.apache.flink.configuration.Configuration observeConfig)Reconcile any other changes required for this resource that are specific to the reconciler implementation.protected voidreconcileSpecChange(CR resource, org.apache.flink.configuration.Configuration observeConfig, org.apache.flink.configuration.Configuration deployConfig)Reconcile spec upgrade on the currently deployed/suspended Flink resource and update the status accordingly.protected voidrestoreJob(CR resource, SPEC spec, STATUS status, org.apache.flink.configuration.Configuration deployConfig, boolean requireHaMetadata)protected voidrollback(CR resource, io.javaoperatorsdk.operator.api.reconciler.Context context, org.apache.flink.configuration.Configuration observeConfig)Rollback deployed resource to the last stable spec.-
Methods inherited from class org.apache.flink.kubernetes.operator.reconciler.deployment.AbstractFlinkResourceReconciler
cleanup, cleanupInternal, deploy, flinkVersionChanged, getDeployConfig, getObserveConfig, reconcile, shouldRecoverDeployment
-
-
-
-
Constructor Detail
-
AbstractJobReconciler
public AbstractJobReconciler(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, FlinkService flinkService, FlinkConfigManager configManager, EventRecorder eventRecorder, StatusRecorder<STATUS> statusRecorder)
-
-
Method Detail
-
readyToReconcile
public boolean readyToReconcile(CR resource, io.javaoperatorsdk.operator.api.reconciler.Context context, org.apache.flink.configuration.Configuration deployConfig)
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 AbstractFlinkResource<SPEC,STATUS>,SPEC extends AbstractFlinkSpec,STATUS extends CommonStatus<SPEC>>- Parameters:
resource- Related Flink resource.context- Reconciliation context.deployConfig- Deployment configuration.- Returns:
- True if the resource is ready to be reconciled.
-
reconcileSpecChange
protected void reconcileSpecChange(CR resource, org.apache.flink.configuration.Configuration observeConfig, org.apache.flink.configuration.Configuration deployConfig) 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 AbstractFlinkResource<SPEC,STATUS>,SPEC extends AbstractFlinkSpec,STATUS extends CommonStatus<SPEC>>- Parameters:
resource- Related Flink resource.observeConfig- Observe configuration.deployConfig- Deployment configuration.- Throws:
java.lang.Exception- Error during spec upgrade.
-
getAvailableUpgradeMode
protected java.util.Optional<UpgradeMode> getAvailableUpgradeMode(CR resource, org.apache.flink.configuration.Configuration deployConfig, org.apache.flink.configuration.Configuration observeConfig)
-
restoreJob
protected void restoreJob(CR resource, SPEC spec, STATUS status, org.apache.flink.configuration.Configuration deployConfig, boolean requireHaMetadata) throws java.lang.Exception
- Throws:
java.lang.Exception
-
rollback
protected void rollback(CR resource, io.javaoperatorsdk.operator.api.reconciler.Context context, org.apache.flink.configuration.Configuration observeConfig) throws java.lang.Exception
Description copied from class:AbstractFlinkResourceReconcilerRollback deployed resource to the last stable spec.- Specified by:
rollbackin classAbstractFlinkResourceReconciler<CR extends AbstractFlinkResource<SPEC,STATUS>,SPEC extends AbstractFlinkSpec,STATUS extends CommonStatus<SPEC>>- Parameters:
resource- Related Flink resource.context- Reconciliation context.observeConfig- Observe configuration.- Throws:
java.lang.Exception- Error during rollback.
-
reconcileOtherChanges
public boolean reconcileOtherChanges(CR resource, org.apache.flink.configuration.Configuration observeConfig) 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 AbstractFlinkResource<SPEC,STATUS>,SPEC extends AbstractFlinkSpec,STATUS extends CommonStatus<SPEC>>- Parameters:
resource- Related Flink resource.observeConfig- Observe configuration.- Returns:
- True if any further reconciliation action was taken.
- Throws:
java.lang.Exception- Error during reconciliation.
-
cancelJob
protected abstract void cancelJob(CR resource, UpgradeMode upgradeMode, org.apache.flink.configuration.Configuration observeConfig) throws java.lang.Exception
Cancel the job for the given resource using the specified upgrade mode.- Parameters:
resource- Related Flink resource.upgradeMode- Upgrade mode used during cancel.observeConfig- Observe configuration.- Throws:
java.lang.Exception- Error during cancellation.
-
-