use of com.cloud.kubernetes.cluster.KubernetesCluster in project cloudstack by apache.
the class KubernetesClusterActionWorker method attachIsoKubernetesVMs.
protected void attachIsoKubernetesVMs(List<UserVm> clusterVMs, final KubernetesSupportedVersion kubernetesSupportedVersion) throws CloudRuntimeException {
KubernetesSupportedVersion version = kubernetesSupportedVersion;
if (kubernetesSupportedVersion == null) {
version = kubernetesSupportedVersionDao.findById(kubernetesCluster.getKubernetesVersionId());
}
KubernetesCluster.Event failedEvent = KubernetesCluster.Event.OperationFailed;
KubernetesCluster cluster = kubernetesClusterDao.findById(kubernetesCluster.getId());
if (cluster != null && cluster.getState() == KubernetesCluster.State.Starting) {
failedEvent = KubernetesCluster.Event.CreateFailed;
}
if (version == null) {
logTransitStateAndThrow(Level.ERROR, String.format("Unable to find Kubernetes version for cluster : %s", kubernetesCluster.getName()), kubernetesCluster.getId(), failedEvent);
}
VMTemplateVO iso = templateDao.findById(version.getIsoId());
if (iso == null) {
logTransitStateAndThrow(Level.ERROR, String.format("Unable to attach ISO to Kubernetes cluster : %s. Binaries ISO not found.", kubernetesCluster.getName()), kubernetesCluster.getId(), failedEvent);
}
if (!iso.getFormat().equals(Storage.ImageFormat.ISO)) {
logTransitStateAndThrow(Level.ERROR, String.format("Unable to attach ISO to Kubernetes cluster : %s. Invalid Binaries ISO.", kubernetesCluster.getName()), kubernetesCluster.getId(), failedEvent);
}
if (!iso.getState().equals(VirtualMachineTemplate.State.Active)) {
logTransitStateAndThrow(Level.ERROR, String.format("Unable to attach ISO to Kubernetes cluster : %s. Binaries ISO not active.", kubernetesCluster.getName()), kubernetesCluster.getId(), failedEvent);
}
for (UserVm vm : clusterVMs) {
try {
templateService.attachIso(iso.getId(), vm.getId(), true);
if (LOGGER.isInfoEnabled()) {
LOGGER.info(String.format("Attached binaries ISO for VM : %s in cluster: %s", vm.getDisplayName(), kubernetesCluster.getName()));
}
} catch (CloudRuntimeException ex) {
logTransitStateAndThrow(Level.ERROR, String.format("Failed to attach binaries ISO for VM : %s in the Kubernetes cluster name: %s", vm.getDisplayName(), kubernetesCluster.getName()), kubernetesCluster.getId(), failedEvent, ex);
}
}
}
use of com.cloud.kubernetes.cluster.KubernetesCluster in project cloudstack by apache.
the class StopKubernetesClusterCmd method getEventDescription.
@Override
public String getEventDescription() {
String description = "Stopping Kubernetes cluster";
KubernetesCluster cluster = _entityMgr.findById(KubernetesCluster.class, getId());
if (cluster != null) {
description += String.format(" ID: %s", cluster.getUuid());
} else {
description += String.format(" ID: %d", getId());
}
return description;
}
use of com.cloud.kubernetes.cluster.KubernetesCluster in project cloudstack by apache.
the class StartKubernetesClusterCmd method getEventDescription.
@Override
public String getEventDescription() {
String description = "Starting Kubernetes cluster";
KubernetesCluster cluster = _entityMgr.findById(KubernetesCluster.class, getId());
if (cluster != null) {
description += String.format(" ID: %s", cluster.getUuid());
} else {
description += String.format(" ID: %d", getId());
}
return description;
}
use of com.cloud.kubernetes.cluster.KubernetesCluster in project cloudstack by apache.
the class UpgradeKubernetesClusterCmd method getEventDescription.
@Override
public String getEventDescription() {
String description = "Upgrading Kubernetes cluster";
KubernetesCluster cluster = _entityMgr.findById(KubernetesCluster.class, getId());
if (cluster != null) {
description += String.format(" ID: %s", cluster.getUuid());
} else {
description += String.format(" ID: %d", getId());
}
return description;
}
use of com.cloud.kubernetes.cluster.KubernetesCluster in project cloudstack by apache.
the class DeleteKubernetesClusterCmd method getEventDescription.
@Override
public String getEventDescription() {
String description = "Deleting Kubernetes cluster";
KubernetesCluster cluster = _entityMgr.findById(KubernetesCluster.class, getId());
if (cluster != null) {
description += String.format(" ID: %s", cluster.getUuid());
} else {
description += String.format(" ID: %d", getId());
}
return description;
}
Aggregations