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 Modifier and Type Field Description protected FlinkService
flinkService
-
Fields inherited from class org.apache.flink.kubernetes.operator.reconciler.deployment.AbstractFlinkResourceReconciler
clock, configManager, eventRecorder, 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<FlinkDeployment,FlinkDeploymentStatus> statusRecorder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.javaoperatorsdk.operator.api.reconciler.DeleteControl
cleanupInternal(FlinkDeployment deployment, io.javaoperatorsdk.operator.api.reconciler.Context<?> context)
Shut down and clean up all Flink job/cluster resources.protected void
deploy(FlinkDeployment cr, FlinkDeploymentSpec spec, FlinkDeploymentStatus status, io.javaoperatorsdk.operator.api.reconciler.Context<?> ctx, 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.Configuration
getDeployConfig(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, io.javaoperatorsdk.operator.api.reconciler.Context<?>, org.apache.flink.configuration.Configuration, java.util.Optional<java.lang.String>, boolean)
.protected FlinkService
getFlinkService(FlinkDeployment resource, io.javaoperatorsdk.operator.api.reconciler.Context<?> context)
Get the Flink service related to the resource and context.protected org.apache.flink.configuration.Configuration
getObserveConfig(FlinkDeployment resource, io.javaoperatorsdk.operator.api.reconciler.Context<?> context)
Get Flink configuration for client interactions with the running Flink deployment/session job.protected boolean
readyToReconcile(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.boolean
reconcileOtherChanges(FlinkDeployment flinkApp, io.javaoperatorsdk.operator.api.reconciler.Context<?> ctx, org.apache.flink.configuration.Configuration observeConfig)
Reconcile any other changes required for this resource that are specific to the reconciler implementation.protected boolean
reconcileSpecChange(FlinkDeployment deployment, io.javaoperatorsdk.operator.api.reconciler.Context<?> ctx, org.apache.flink.configuration.Configuration observeConfig, org.apache.flink.configuration.Configuration deployConfig, DiffType type)
Reconcile spec upgrade on the currently deployed/suspended Flink resource and update the status accordingly.protected void
rollback(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, setClock, setOwnerReference, shouldRecoverDeployment
-
-
-
-
Field Detail
-
flinkService
protected final FlinkService flinkService
-
-
Constructor Detail
-
SessionReconciler
public SessionReconciler(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, FlinkService flinkService, FlinkConfigManager configManager, EventRecorder eventRecorder, StatusRecorder<FlinkDeployment,FlinkDeploymentStatus> statusRecorder)
-
-
Method Detail
-
getFlinkService
protected FlinkService getFlinkService(FlinkDeployment resource, io.javaoperatorsdk.operator.api.reconciler.Context<?> context)
Description copied from class:AbstractFlinkResourceReconciler
Get the Flink service related to the resource and context.- Specified by:
getFlinkService
in classAbstractFlinkResourceReconciler<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>
- Parameters:
resource
- Resource being reconciled.context
- Current context.- Returns:
- Flink service implementation.
-
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:AbstractFlinkResourceReconciler
Get Flink configuration object for deploying the given spec usingAbstractFlinkResourceReconciler.deploy(CR, SPEC, STATUS, io.javaoperatorsdk.operator.api.reconciler.Context<?>, org.apache.flink.configuration.Configuration, java.util.Optional<java.lang.String>, boolean)
.- Specified by:
getDeployConfig
in 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:AbstractFlinkResourceReconciler
Get Flink configuration for client interactions with the running Flink deployment/session job.- Specified by:
getObserveConfig
in 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: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<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 boolean reconcileSpecChange(FlinkDeployment deployment, io.javaoperatorsdk.operator.api.reconciler.Context<?> ctx, org.apache.flink.configuration.Configuration observeConfig, org.apache.flink.configuration.Configuration deployConfig, DiffType type) 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<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>
- Parameters:
deployment
- Related Flink resource.observeConfig
- Observe configuration.deployConfig
- Deployment configuration.- Returns:
- True if spec change reconciliation was executed
- Throws:
java.lang.Exception
- Error during spec upgrade.
-
deploy
protected void deploy(FlinkDeployment cr, FlinkDeploymentSpec spec, FlinkDeploymentStatus status, io.javaoperatorsdk.operator.api.reconciler.Context<?> ctx, org.apache.flink.configuration.Configuration deployConfig, java.util.Optional<java.lang.String> savepoint, boolean requireHaMetadata) throws java.lang.Exception
Description copied from class:AbstractFlinkResourceReconciler
Deploys the target resource spec to Kubernetes.- Specified by:
deploy
in classAbstractFlinkResourceReconciler<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>
- Parameters:
cr
- Related resource.spec
- Spec that should be deployed to Kubernetes.status
- Status object of the resourcectx
- Reconciliation context.deployConfig
- 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:AbstractFlinkResourceReconciler
Rollback deployed resource to the last stable spec.- Specified by:
rollback
in 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, io.javaoperatorsdk.operator.api.reconciler.Context<?> ctx, org.apache.flink.configuration.Configuration observeConfig) 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<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:AbstractFlinkResourceReconciler
Shut down and clean up all Flink job/cluster resources.- Specified by:
cleanupInternal
in classAbstractFlinkResourceReconciler<FlinkDeployment,FlinkDeploymentSpec,FlinkDeploymentStatus>
- Parameters:
deployment
- Resource being reconciled.context
- Current context.- Returns:
- DeleteControl object.
-
-