gyfora commented on code in PR #394:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/394#discussion_r992133413
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java:
##########
@@ -272,6 +286,46 @@ private void recoverJmDeployment(
restoreJob(deployment, specToRecover, deployment.getStatus(), ctx,
observeConfig, true);
}
+ private boolean shouldRestartJobBecauseUnhealthy(
+ FlinkDeployment deployment, Configuration observeConfig) {
+ if (observeConfig.getBoolean(OPERATOR_CLUSTER_HEALTH_CHECK_ENABLED)) {
+ if (jobHealthChecker == null) {
+ jobHealthChecker = new
JobHealthChecker(Clock.systemDefaultZone());
+ }
+ } else {
+ if (jobHealthChecker != null) {
+ jobHealthChecker = null;
+ }
+ }
+
+ boolean result = false;
+
+ if (jobHealthChecker != null) {
+ final String clusterInfoKey = JobHealthInfo.class.getSimpleName();
+ if
(deployment.getStatus().getClusterInfo().containsKey(clusterInfoKey)) {
+ LOG.debug("Cluster info contains job health info");
+ if (!jobHealthChecker.isJobHealthy(
Review Comment:
I think there are all kinds of concurrency issues here. I think your code
assumes that there is a reconciler per resource, but the reconciler is used
concurrently from multiple thread.
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/KubernetesOperatorConfigOptions.java:
##########
@@ -315,4 +315,28 @@ public static String operatorConfigKey(String key) {
.intType()
.defaultValue(8085)
.withDescription("The port the health probe will use to
expose the status.");
+
+ @Documentation.Section(SECTION_SYSTEM)
Review Comment:
I think these configs should be in `SECTION_DYNAMIC` as it can be defined on
a per resource layer by the user.
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java:
##########
@@ -272,6 +286,46 @@ private void recoverJmDeployment(
restoreJob(deployment, specToRecover, deployment.getStatus(), ctx,
observeConfig, true);
}
+ private boolean shouldRestartJobBecauseUnhealthy(
+ FlinkDeployment deployment, Configuration observeConfig) {
+ if (observeConfig.getBoolean(OPERATOR_CLUSTER_HEALTH_CHECK_ENABLED)) {
+ if (jobHealthChecker == null) {
+ jobHealthChecker = new
JobHealthChecker(Clock.systemDefaultZone());
+ }
+ } else {
+ if (jobHealthChecker != null) {
+ jobHealthChecker = null;
+ }
+ }
Review Comment:
It doesn't look correct to manipulate fields based on resource specific
configs like health check enabled/or not
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]