[GitHub] [flink-kubernetes-operator] mananmangal commented on a diff in pull request #648: [FLINK-32700] Support job drain for Savepoint upgrade mode

2023-08-30 Thread via GitHub


mananmangal commented on code in PR #648:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/648#discussion_r1310744500


##
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/KubernetesOperatorConfigOptions.java:
##
@@ -566,4 +566,12 @@ public static String operatorConfigKey(String key) {
 .defaultValue(false)
 .withDescription(
 "Indicate whether a savepoint must be taken when 
deleting a FlinkDeployment or FlinkSessionJob.");
+
+@Documentation.Section(SECTION_DYNAMIC)
+public static final ConfigOption DRAIN_ON_SAVEPOINT_DELETION =
+operatorConfig("job.drain-on-savepoint-deletion")
+.booleanType()
+.defaultValue(false)
+.withDescription(
+"Indicate whether a job should be drained before 
deleting a FlinkDeployment or FlinkSessionJob, only if savepoint on deletion is 
enabled.");

Review Comment:
   updated the description.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [flink-kubernetes-operator] mananmangal commented on a diff in pull request #648: [FLINK-32700] Support job drain for Savepoint upgrade mode

2023-08-29 Thread via GitHub


mananmangal commented on code in PR #648:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/648#discussion_r1309162761


##
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/FlinkOperatorConfiguration.java:
##
@@ -185,6 +186,9 @@ public static FlinkOperatorConfiguration 
fromConfiguration(Configuration operato
 boolean savepointOnDeletion =
 
operatorConfig.get(KubernetesOperatorConfigOptions.SAVEPOINT_ON_DELETION);
 
+boolean drainJobOnSavepointDeletion =
+
operatorConfig.get(KubernetesOperatorConfigOptions.DRAIN_ON_SAVEPOINT_DELETION);

Review Comment:
   Got it!
   Updated the PR to reflect these changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [flink-kubernetes-operator] mananmangal commented on a diff in pull request #648: [FLINK-32700] Support job drain for Savepoint upgrade mode

2023-08-28 Thread via GitHub


mananmangal commented on code in PR #648:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/648#discussion_r1291624743


##
flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconcilerTest.java:
##
@@ -1070,4 +1070,33 @@ public void testUpgradeReconciledGeneration() throws 
Exception {
 .getMetadata()
 .getGeneration());
 }
+
+@ParameterizedTest
+
@MethodSource("org.apache.flink.kubernetes.operator.TestUtils#flinkVersions")
+public void testSubmitAndDrainOnCleanUpWithSavepoint(FlinkVersion 
flinkVersion)
+throws Exception {
+var conf = configManager.getDefaultConfig();
+conf.set(KubernetesOperatorConfigOptions.SAVEPOINT_ON_DELETION, true);
+conf.set(KubernetesOperatorConfigOptions.DRAIN_ON_SAVEPOINT_DELETION, 
true);
+configManager.updateDefaultConfig(conf);
+
+FlinkDeployment deployment = 
TestUtils.buildApplicationCluster(flinkVersion);
+
+// session ready
+reconciler.reconcile(deployment, 
TestUtils.createContextWithReadyFlinkDeployment());
+verifyAndSetRunningJobsToStatus(deployment, flinkService.listJobs());
+
+// clean up
+assertEquals(
+null, 
deployment.getStatus().getJobStatus().getSavepointInfo().getLastSavepoint());
+reconciler.cleanup(deployment, 
TestUtils.createContextWithReadyFlinkDeployment());
+assertEquals(
+"savepoint_0",
+deployment
+.getStatus()
+.getJobStatus()
+.getSavepointInfo()
+.getLastSavepoint()
+.getLocation());
+}

Review Comment:
   I understand, I will make these changes.



##
flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconcilerTest.java:
##
@@ -1070,4 +1070,33 @@ public void testUpgradeReconciledGeneration() throws 
Exception {
 .getMetadata()
 .getGeneration());
 }
+
+@ParameterizedTest
+
@MethodSource("org.apache.flink.kubernetes.operator.TestUtils#flinkVersions")
+public void testSubmitAndDrainOnCleanUpWithSavepoint(FlinkVersion 
flinkVersion)
+throws Exception {
+var conf = configManager.getDefaultConfig();
+conf.set(KubernetesOperatorConfigOptions.SAVEPOINT_ON_DELETION, true);
+conf.set(KubernetesOperatorConfigOptions.DRAIN_ON_SAVEPOINT_DELETION, 
true);
+configManager.updateDefaultConfig(conf);
+
+FlinkDeployment deployment = 
TestUtils.buildApplicationCluster(flinkVersion);
+
+// session ready
+reconciler.reconcile(deployment, 
TestUtils.createContextWithReadyFlinkDeployment());
+verifyAndSetRunningJobsToStatus(deployment, flinkService.listJobs());
+
+// clean up
+assertEquals(
+null, 
deployment.getStatus().getJobStatus().getSavepointInfo().getLastSavepoint());
+reconciler.cleanup(deployment, 
TestUtils.createContextWithReadyFlinkDeployment());
+assertEquals(
+"savepoint_0",
+deployment
+.getStatus()
+.getJobStatus()
+.getSavepointInfo()
+.getLastSavepoint()
+.getLocation());
+}

Review Comment:
   Replaced unit tests to AbstractFlinkServiceTests



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [flink-kubernetes-operator] mananmangal commented on a diff in pull request #648: [FLINK-32700] Support job drain for Savepoint upgrade mode

2023-08-11 Thread via GitHub


mananmangal commented on code in PR #648:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/648#discussion_r1291624743


##
flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconcilerTest.java:
##
@@ -1070,4 +1070,33 @@ public void testUpgradeReconciledGeneration() throws 
Exception {
 .getMetadata()
 .getGeneration());
 }
+
+@ParameterizedTest
+
@MethodSource("org.apache.flink.kubernetes.operator.TestUtils#flinkVersions")
+public void testSubmitAndDrainOnCleanUpWithSavepoint(FlinkVersion 
flinkVersion)
+throws Exception {
+var conf = configManager.getDefaultConfig();
+conf.set(KubernetesOperatorConfigOptions.SAVEPOINT_ON_DELETION, true);
+conf.set(KubernetesOperatorConfigOptions.DRAIN_ON_SAVEPOINT_DELETION, 
true);
+configManager.updateDefaultConfig(conf);
+
+FlinkDeployment deployment = 
TestUtils.buildApplicationCluster(flinkVersion);
+
+// session ready
+reconciler.reconcile(deployment, 
TestUtils.createContextWithReadyFlinkDeployment());
+verifyAndSetRunningJobsToStatus(deployment, flinkService.listJobs());
+
+// clean up
+assertEquals(
+null, 
deployment.getStatus().getJobStatus().getSavepointInfo().getLastSavepoint());
+reconciler.cleanup(deployment, 
TestUtils.createContextWithReadyFlinkDeployment());
+assertEquals(
+"savepoint_0",
+deployment
+.getStatus()
+.getJobStatus()
+.getSavepointInfo()
+.getLastSavepoint()
+.getLocation());
+}

Review Comment:
   I understand, I will make these changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org