mirror of https://github.com/apache/cloudstack.git
Fail and display error message in case the CKS ISO arch doesnt match the selected template arch
This commit is contained in:
parent
01ac2e5a6a
commit
65b6ffc82c
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Reference in New Issue