This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch opensuse-fix
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 65b6ffc82c3540f52caf32a2e030b77ee107aafc
Author: nvazquez <nicovazque...@gmail.com>
AuthorDate: Wed Jun 18 11:13:25 2025 -0300

    Fail and display error message in case the CKS ISO arch doesnt match the 
selected template arch
---
 .../cluster/KubernetesClusterManagerImpl.java          | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git 
a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java
 
b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java
index fc7f52f2750..b1c1c2cd81d 100644
--- 
a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java
+++ 
b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java
@@ -1304,6 +1304,9 @@ public class KubernetesClusterManagerImpl extends 
ManagerBase implements Kuberne
 
         final Network defaultNetwork = 
getKubernetesClusterNetworkIfMissing(cmd.getName(), zone, owner, 
(int)controlNodeCount, (int)clusterSize, 
cmd.getExternalLoadBalancerIpAddress(), cmd.getNetworkId());
         final VMTemplateVO finalTemplate = getKubernetesServiceTemplate(zone, 
deployDestination.getCluster().getHypervisorType());
+
+        
compareKubernetesIsoArchToSelectedTemplateArch(clusterKubernetesVersion, 
finalTemplate);
+
         final long cores = serviceOffering.getCpu() * (controlNodeCount + 
clusterSize);
         final long memory = serviceOffering.getRamSize() * (controlNodeCount + 
clusterSize);
 
@@ -1332,6 +1335,21 @@ public class KubernetesClusterManagerImpl extends 
ManagerBase implements Kuberne
         return cluster;
     }
 
+    private void 
compareKubernetesIsoArchToSelectedTemplateArch(KubernetesSupportedVersion 
clusterKubernetesVersion, VMTemplateVO finalTemplate) {
+        VMTemplateVO cksIso = 
templateDao.findById(clusterKubernetesVersion.getIsoId());
+        if (cksIso == null) {
+            String err = String.format("Cannot find Kubernetes ISO associated 
to the Kubernetes version %s (id=%s)",
+                    clusterKubernetesVersion.getName(), 
clusterKubernetesVersion.getUuid());
+            throw new CloudRuntimeException(err);
+        }
+        if (!cksIso.getArch().equals(finalTemplate.getArch())) {
+            String err = String.format("The selected Kubernetes ISO %s arch 
(%s) doesn't match the template %s arch (%s) " +
+                            "to deploy the Kubernetes cluster",
+                    clusterKubernetesVersion.getName(), cksIso.getArch(), 
finalTemplate.getName(), finalTemplate.getArch());
+            throw new CloudRuntimeException(err);
+        }
+    }
+
     private SecurityGroup getOrCreateSecurityGroupForAccount(Account owner) {
         String securityGroupName = String.format("%s-%s", 
KubernetesClusterActionWorker.CKS_CLUSTER_SECURITY_GROUP_NAME, owner.getUuid());
         String securityGroupDesc = String.format("%s and account %s", 
KubernetesClusterActionWorker.CKS_SECURITY_GROUP_DESCRIPTION, owner.getName());

Reply via email to