File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
flink-kubernetes-operator/src
main/java/org/apache/flink/kubernetes/operator/observer/deployment
test/java/org/apache/flink/kubernetes/operator Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 3838import io .fabric8 .kubernetes .api .model .PodList ;
3939import io .fabric8 .kubernetes .api .model .apps .Deployment ;
4040import io .fabric8 .kubernetes .api .model .apps .DeploymentCondition ;
41- import io .fabric8 .kubernetes .api .model .apps .DeploymentSpec ;
4241import io .fabric8 .kubernetes .api .model .apps .DeploymentStatus ;
4342import org .slf4j .Logger ;
4443import 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
Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments