Repository navigation
Conversation
Add spec.jobManager.deploymentType (Job | Deployment) to choose the Kubernetes workload that runs the application-mode JobManager. Unset means Job. Deployment requires application mode, high availability and restartPolicy Never, and the field is immutable. Nothing reads the field yet besides validation. ES-1028
When spec.jobManager.deploymentType is Deployment, the desired state holds a single-replica JobManager Deployment with the Recreate strategy instead of the JobManager Job. It reuses the Job's name, labels and pod spec, with pod restartPolicy Always. The operator sets execution.shutdown-on-application-finish to false so the JobManager keeps running after the job reaches a terminal state, and a Lost job no longer triggers cleanup in this mode. ES-1028
In Deployment mode the observer reads the JobManager Deployment instead of the Job and selects pods with the Deployment's selector. It picks the newest pod that is not being deleted, so the replacement of a recreated JobManager pod is observed instead of the terminating one. The update is complete once the Deployment is at the next revision. ES-1028
…nt mode With a JobManager Deployment, Kubernetes restarts the JobManager pod, so the pod and workload no longer signal that the job ended. Succeeded, Failed and Cancelled come only from the Flink API, and the recorded state is kept while the API is unavailable during a restart. A Lost job is tracked again once the Flink API reports it. While deploying, a JobManager container that restarts 3 times without becoming ready marks the job DeployFailed. ES-1028
reconcileJob, cancelJob and reconcileDeletion now work on the workload that runs the job, either the JobManager Deployment or the Job, through shared create and delete helpers, so the Job and Deployment modes share one set of branches. On update, after stop-with-savepoint finishes, the old Deployment is deleted and the next revision is created from the savepoint. A terminal job whose cleanup policy removes the JobManager deletes the Deployment. A Deployment that failed to deploy is removed so its pod stops restarting. ES-1028
Volcano sets its scheduler metadata on the JobManager Deployment's pod template and counts the Deployment's pods and resources in the pod group, as it does for the JobManager Job. ES-1028
Stop rejecting deploymentType Deployment together with restartPolicy FromSavepointOnFailure, because admission keeps setting that policy on existing clusters during the rollout. With a JobManager Deployment the restart policy now has no effect: ShouldRestart returns false, so the operator never restores a failed job from a savepoint. Kubernetes recreates the JobManager pod and Flink HA recovers the state. ShouldRestart and IsTerminated now take the FlinkClusterSpec so they can see the JobManager deployment type. ES-1028
…oth modes Changes from review: - deriveJobStatus handles the Deployment through the shared switch: getState reports a crash-looping JobManager Deployment pod as failed, and the separate Deployment state function is removed. - shouldCleanup holds both Deployment cleanup rules (keep on Lost, remove the Deployment on DeployFailed). - observeJob has a single observe path. - The JobManager pod log is no longer fetched in Deployment mode. - Volcano shares one helper for Deployment resources. - jobManagerContainerName moves next to the converter constants. - A comment explains why the immutability check exists in both the CEL rule and the webhook. ES-1028
The field-level self == oldSelf rule did not run when deploymentType went from unset to set. A rule on JobManagerSpec now compares the effective values, with unset treated as Job. The webhook check stays. ES-1028
- A stopped job whose JobManager Deployment was created again for the current or next revision, for example after stop-with-savepoint for an update, moves to Deploying, as it does with the Job. - An active job whose JobManager Deployment is missing goes back to Pending, so the Deployment is created again. It no longer becomes Lost. - While a recently started JobManager recovers its job from HA metadata, a job missing from the Flink API keeps its state. A Lost job gets a recovery timeout, after which the AfterJobFails cleanup applies. - A crash-looping JobManager container fails a Running job with a failure reason, not just a deploying one. Crash looping means CrashLoopBackOff after short runs. - Once the job is terminated, the JobManager Deployment is scaled to 0 instead of being kept running or deleted. Like the JobManager Job, the object stays without a pod. It is deleted only by the DeleteCluster policy. - Job mode selects the first pod again. Only the Deployment selects the newest pod. - Create and delete logs name the JobManager Deployment or job submitter. ES-1028
Testing resultsTest scenarios
Scenario 7: JM pod is expected to be restored for Issues found
|
Overview
Add
spec.jobManager.deploymentType(Job|Deployment). WithDeployment, the Application-mode JobManager runs as a Kubernetes Deployment instead of a Job, so Kubernetes recreates a lost JobManager pod and Flink HA recovers the job. The default staysJob, which behaves exactly as before.Why
Today the JobManager is a Job with
restartPolicy: Never, so a lost JobManager pod comes back only as a side effect ofrestartPolicy: FromSavepointOnFailure. After a terminal failure, that policy restarts from an old savepoint and loses data that was already acknowledged. We want a real JobManager recovery mechanism so we can stop relying on it for streaming. ES-1028Description
JobManagerDeploymentType(Jobdefault when unset, read throughGetDeploymentType()).Deploymentrequires Application mode and HA. The field is immutable, enforced by the webhook plus a CEL rule onjobManagerthat compares effective values.restartPolicyis ignored withDeployment:ShouldRestartreturns false, so a failed job is never restored from a savepoint. This is accepted rather than rejected because admission still setsFromSavepointOnFailureduring the rollout.ShouldRestartandIsTerminatednow take theFlinkClusterSpec.Recreate, podrestartPolicy: Always, and the same name, labels and pod spec as the JobManager Job.execution.shutdown-on-application-finish: false.AfterJobFailsafter 10 min.DeployFailedand a running jobFailed, with a failure reason.DeleteCluster.Merge order: this PR → operator release v0.7.0 → flink-admission PR → flink-admission release v0.4.13 → cluster-config C → D → E (see ES-1028).
Test Plan
make testpasses (unit tests cover both modes)make verify-helm-crd-schemapasses