fdegner commented on issue #11994:
URL: https://github.com/apache/cloudstack/issues/11994#issuecomment-4933090996

   Good morning,
   
   autoscaling of Kubernetes clusters on KVM fails when more than a single 
service offering is used in a cluster.
   
   The cluster-autoscaler calls `ScaleKubernetesClusterCmd` with only a new 
`clustersize` (no offering). `createNodeTypeToServiceOfferingMap()` injects a 
single global `DEFAULT`, and `scaleCluster()` then compares every node type's 
real VM offering against that global default instead of against that node 
type's own stored offering (`control_node_service_offering_id` / 
`worker_node_service_offering_id`). 
   
   This leads to a code path were `scaleKubernetesClusterOffering() -> 
validateKubernetesClusterScaleOfferingParameters()` are called, subsequently 
triggering the hypervisor type check which then fails and leads to the observed 
error.
   
   
[plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterScaleWorker.java](https://github.com/apache/cloudstack/blob/348ce953a99246a756b527994f7745a7be038234/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterScaleWorker.java#L547)
   ```java
       public boolean scaleCluster() throws CloudRuntimeException {
           ...
           for (KubernetesClusterNodeType nodeType : Arrays.asList(CONTROL, 
ETCD, WORKER)) {
               ...
               // This is were things go wrong
               boolean isNodeOfferingScalingNeeded = 
isServiceOfferingScalingNeededForNodeType(existingServiceOffering, 
scalingServiceOffering);
               ...
               if (isNodeOfferingScalingNeeded && clusterSizeScalingNeeded) {
                   if (newVMRequired > 0) {
                       scaleKubernetesClusterOffering(nodeType, 
scalingServiceOffering, updateNodeOffering, updateClusterOffering);
                       scaleKubernetesClusterSize(nodeType);
                   } else {
                       scaleKubernetesClusterSize(nodeType);
                       scaleKubernetesClusterOffering(nodeType, 
scalingServiceOffering, updateNodeOffering, updateClusterOffering);
                   }
               } else if (isNodeOfferingScalingNeeded) {
                   scaleKubernetesClusterOffering(nodeType, 
scalingServiceOffering, updateNodeOffering, updateClusterOffering);
               } else if (clusterSizeScalingNeeded) {
                   scaleKubernetesClusterSize(nodeType); // We should end up 
here instead!
               }
           }
           ...
       }
   ```
   
   
   


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

Reply via email to