abstractdog commented on code in PR #6773:
URL: https://github.com/apache/hive/pull/6773#discussion_r4062500115


##########
packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/dependent/HiveDependentResource.java:
##########
@@ -186,21 +195,37 @@ protected Integer resolveReplicaCount(P primary, 
Context<P> context,
         return managed;
       }
       // Fallback: operator restarted and MANAGED_REPLICAS is empty — read 
current value
-      R resource = existing.get();
-      if (resource instanceof io.fabric8.kubernetes.api.model.apps.Deployment 
d) {
-        return d.getSpec() != null && d.getSpec().getReplicas() != null
-            ? d.getSpec().getReplicas() : initialReplicas;
-      }
-      if (resource instanceof io.fabric8.kubernetes.api.model.apps.StatefulSet 
s) {
-        return s.getSpec() != null && s.getSpec().getReplicas() != null
-            ? s.getSpec().getReplicas() : initialReplicas;
-      }
-      return initialReplicas;
+      Integer current = Workloads.replicas(existing.get());

Review Comment:
   in practice no, the API server defaults spec.replicas on write; documented 
that in both the javadoc and the fallback comment. orElse(initialReplicas) now 
expresses it as a floor rather than a null check



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to