Skip to content

Commit 86ab948

Browse files
committed
[FLINK-37562] Do not check all JM replicas in observer
1 parent 93e68f2 commit 86ab948

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/observer/deployment/AbstractFlinkDeploymentObserver.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import io.fabric8.kubernetes.api.model.PodList;
3939
import io.fabric8.kubernetes.api.model.apps.Deployment;
4040
import io.fabric8.kubernetes.api.model.apps.DeploymentCondition;
41-
import io.fabric8.kubernetes.api.model.apps.DeploymentSpec;
4241
import io.fabric8.kubernetes.api.model.apps.DeploymentStatus;
4342
import org.slf4j.Logger;
4443
import org.slf4j.LoggerFactory;
@@ -117,11 +116,11 @@ protected void observeJmDeployment(FlinkResourceContext<FlinkDeployment> ctx) {
117116
ctx.getJosdkContext().getSecondaryResource(Deployment.class);
118117
if (deployment.isPresent()) {
119118
DeploymentStatus status = deployment.get().getStatus();
120-
DeploymentSpec spec = deployment.get().getSpec();
121119
if (status != null
122120
&& status.getAvailableReplicas() != null
123-
&& spec.getReplicas().intValue() == status.getReplicas()
124-
&& spec.getReplicas().intValue() == status.getAvailableReplicas()
121+
// One available JM is enough to run the job correctly
122+
&& status.getReplicas() > 0
123+
&& status.getAvailableReplicas() > 0
125124
&& ctx.getFlinkService().isJobManagerPortReady(ctx.getObserveConfig())) {
126125

127126
// typically it takes a few seconds for the REST server to be ready

flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/TestUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ public static Deployment createDeployment(boolean ready) {
117117
String nowTs = Instant.now().toString();
118118
var status = new DeploymentStatus();
119119
status.setAvailableReplicas(ready ? 1 : 0);
120-
status.setReplicas(1);
120+
status.setReplicas(2);
121121
var availableCondition = new DeploymentCondition();
122122
availableCondition.setType("Available");
123123
availableCondition.setStatus(ready ? "True" : "False");
124124
availableCondition.setLastTransitionTime(nowTs);
125125
status.setConditions(List.of(availableCondition));
126126

127127
DeploymentSpec spec = new DeploymentSpec();
128-
spec.setReplicas(1);
128+
spec.setReplicas(3);
129129

130130
var meta = new ObjectMeta();
131131
meta.setCreationTimestamp(nowTs);

0 commit comments

Comments
 (0)