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

2023-08-30 Thread via GitHub


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


##
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:
   `Indicate whether a job should be drained before deleting a FlinkDeployment 
or FlinkSessionJob, only if savepoint on deletion is enabled.` -> `Indicate 
whether the job should be drained when stopping with savepoint.`



-- 
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] gyfora commented on a diff in pull request #648: [FLINK-32700] Support job drain for Savepoint upgrade mode

2023-08-28 Thread via GitHub


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


##
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:
   Similar to this fix PR: 
https://github.com/apache/flink-kubernetes-operator/pull/659
   
   These configs should not be part of the `FlinkOperatorConfiguration` which 
will prevent it for setting it for a per-resource level. It should be accessed 
from the observeConfig directly.



-- 
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] gyfora commented on a diff in pull request #648: [FLINK-32700] Support job drain for Savepoint upgrade mode

2023-08-10 Thread via GitHub


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


##
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:
   These tests you added don't actually cover that draining was used (the 
proper client method was called).
   
   I suggest removing what you added and replacing with 2 tests in the 
`AbstractFlinkServiceTests` there you can test the changed service methods 
directly and make sure that the Flink client is called with the proper argument.



-- 
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