Class SessionReconciler
- java.lang.Object
-
- org.apache.flink.kubernetes.operator.reconciler.deployment.AbstractFlinkResourceReconciler<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>
-
- org.apache.flink.kubernetes.operator.reconciler.deployment.SessionReconciler
-
- All Implemented Interfaces:
Reconciler<FlinkDeployment>
public class SessionReconciler extends AbstractFlinkResourceReconciler<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>
Reconciler responsible for handling the session cluster 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 SessionReconciler(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, FlinkService flinkService, FlinkConfigManager configManager, EventRecorder eventRecorder, StatusRecorder<FlinkDeploymentStatus> statusRecorder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.javaoperatorsdk.operator.api.reconciler.DeleteControlcleanupInternal(FlinkDeployment deployment, io.javaoperatorsdk.operator.api.reconciler.Context context)Shut down and clean up all Flink job/cluster resources.protected voiddeploy(FlinkDeployment cr, FlinkDeploymentSpec spec, FlinkDeploymentStatus status, org.apache.flink.configuration.Configuration deployConfig, java.util.Optional<java.lang.String> savepoint, boolean requireHaMetadata)Deploys the target resource spec to Kubernetes.protected org.apache.flink.configuration.ConfigurationgetDeployConfig(io.fabric8.kubernetes.api.model.ObjectMeta meta, FlinkDeploymentSpec spec, io.javaoperatorsdk.operator.api.reconciler.Context ctx)Get Flink configuration object for deploying the given spec usingAbstractFlinkResourceReconciler.deploy(CR, SPEC, STATUS, org.apache.flink.configuration.Configuration, java.util.Optional<java.lang.String>, boolean).protected org.apache.flink.configuration.ConfigurationgetObserveConfig(FlinkDeployment resource, io.javaoperatorsdk.operator.api.reconciler.Context context)Get Flink configuration for client interactions with the running Flink deployment/session job.protected booleanreadyToReconcile(FlinkDeployment deployment, io.javaoperatorsdk.operator.api.reconciler.Context ctx, 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(FlinkDeployment flinkApp, org.apache.flink.configuration.Configuration observeConfig)Reconcile any other changes required for this resource that are specific to the reconciler implementation.protected voidreconcileSpecChange(FlinkDeployment deployment, 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 voidrollback(FlinkDeployment deployment, io.javaoperatorsdk.operator.api.reconciler.Context ctx, 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, flinkVersionChanged, reconcile, shouldRecoverDeployment
-
-
-
-
Constructor Detail
-
SessionReconciler
public SessionReconciler(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, FlinkService flinkService, FlinkConfigManager configManager, EventRecorder eventRecorder, StatusRecorder<FlinkDeploymentStatus> statusRecorder)
-
-
Method Detail
-
getDeployConfig
protected org.apache.flink.configuration.Configuration getDeployConfig(io.fabric8.kubernetes.api.model.ObjectMeta meta, FlinkDeploymentSpec spec, io.javaoperatorsdk.operator.api.reconciler.Context ctx)Description copied from class:AbstractFlinkResourceReconcilerGet Flink configuration object for deploying the given spec usingAbstractFlinkResourceReconciler.deploy(CR, SPEC, STATUS, org.apache.flink.configuration.Configuration, java.util.Optional<java.lang.String>, boolean).- Specified by:
getDeployConfigin classAbstractFlinkResourceReconciler<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>- Parameters:
meta- ObjectMeta of the related resource.spec- Spec for which the config should be created.ctx- Reconciliation context.- Returns:
- Deployment configuration.
-
getObserveConfig
protected org.apache.flink.configuration.Configuration getObserveConfig(FlinkDeployment resource, io.javaoperatorsdk.operator.api.reconciler.Context context)
Description copied from class:AbstractFlinkResourceReconcilerGet Flink configuration for client interactions with the running Flink deployment/session job.- Specified by:
getObserveConfigin classAbstractFlinkResourceReconciler<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>- Parameters:
resource- Related Flink resource.context- Reconciliation context.- Returns:
- Observe configuration.
-
readyToReconcile
protected boolean readyToReconcile(FlinkDeployment deployment, io.javaoperatorsdk.operator.api.reconciler.Context ctx, 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<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>- Parameters:
deployment- Related Flink resource.ctx- Reconciliation context.deployConfig- Deployment configuration.- Returns:
- True if the resource is ready to be reconciled.
-
reconcileSpecChange
protected void reconcileSpecChange(FlinkDeployment deployment, 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<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>- Parameters:
deployment- Related Flink resource.observeConfig- Observe configuration.deployConfig- Deployment configuration.- Throws:
java.lang.Exception- Error during spec upgrade.
-
deploy
protected void deploy(FlinkDeployment cr, FlinkDeploymentSpec spec, FlinkDeploymentStatus status, org.apache.flink.configuration.Configuration deployConfig, java.util.Optional<java.lang.String> savepoint, boolean requireHaMetadata) throws java.lang.Exception
Description copied from class:AbstractFlinkResourceReconcilerDeploys the target resource spec to Kubernetes.- Specified by:
deployin classAbstractFlinkResourceReconciler<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>- Parameters:
cr- Related resource.spec- Spec that should be deployed to Kubernetes.status- Status object of the resourcedeployConfig- Flink conf for the deployment.savepoint- Optional savepoint path for applications and session jobs.requireHaMetadata- Flag used by application deployments to validate HA metadata- Throws:
java.lang.Exception- Error during deployment.
-
rollback
protected void rollback(FlinkDeployment deployment, io.javaoperatorsdk.operator.api.reconciler.Context ctx, 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<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>- Parameters:
deployment- Related Flink resource.ctx- Reconciliation context.observeConfig- Observe configuration.- Throws:
java.lang.Exception- Error during rollback.
-
reconcileOtherChanges
public boolean reconcileOtherChanges(FlinkDeployment flinkApp, 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<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>- Parameters:
flinkApp- Related Flink resource.observeConfig- Observe configuration.- Returns:
- True if any further reconciliation action was taken.
- Throws:
java.lang.Exception- Error during reconciliation.
-
cleanupInternal
public io.javaoperatorsdk.operator.api.reconciler.DeleteControl cleanupInternal(FlinkDeployment deployment, io.javaoperatorsdk.operator.api.reconciler.Context context)
Description copied from class:AbstractFlinkResourceReconcilerShut down and clean up all Flink job/cluster resources.- Specified by:
cleanupInternalin classAbstractFlinkResourceReconciler<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>- Parameters:
deployment- Resource being reconciled.context- Current context.- Returns:
- DeleteControl object.
-
-