deniskuzZ commented on code in PR #6814:
URL: https://github.com/apache/hive/pull/6814#discussion_r4081609769
##########
packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/reconciler/HiveClusterReconciler.java:
##########
@@ -553,6 +561,42 @@ private HiveClusterAutoscaler
getOrCreateAutoscaler(KubernetesClient client) {
return autoscaler;
}
+ /**
+ * Clears autoscaling state for components with autoscaling disabled in spec.
+ */
+ private static void resetAutoscalingStateForDisabledComponents(HiveCluster
resource, HiveClusterAutoscaler scaler) {
+ HiveClusterSpec spec = resource.getSpec();
+ String ns = resource.getMetadata().getNamespace();
+ String clusterName = resource.getMetadata().getName();
+
+ if (!spec.hiveServer2().autoscaling().isEnabled()) {
+ resetComponentAutoscalingState(scaler, ns, clusterName,
ConfigUtils.COMPONENT_HIVESERVER2);
+ }
+ if (spec.metastore().isEnabled() &&
!spec.metastore().autoscaling().isEnabled()) {
+ resetComponentAutoscalingState(scaler, ns, clusterName,
ConfigUtils.COMPONENT_METASTORE);
+ }
+ for (var llap : spec.llapClusters()) {
+ if (!llap.isEnabled()) {
+ continue;
+ }
+ if (!llap.autoscaling().isEnabled()) {
+ resetComponentAutoscalingState(scaler, ns, clusterName,
ConfigUtils.llapComponentKey(llap.name()));
+ }
+ if (spec.tezAm().isEnabled() && !llap.tezAm().autoscaling().isEnabled())
{
+ resetComponentAutoscalingState(scaler, ns, clusterName,
ConfigUtils.tezAmComponentKey(llap.name()));
+ }
+ }
+ }
+
+ private static void resetComponentAutoscalingState(HiveClusterAutoscaler
scaler,
Review Comment:
consider renaming to `clearAutoscalingState`, not to shadow the instance
method it calls
--
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]