Search in sources :

Example 1 with KubernetesClusterScaleWorker

use of com.cloud.kubernetes.cluster.actionworkers.KubernetesClusterScaleWorker in project cloudstack by apache.

the class KubernetesClusterManagerImpl method scaleKubernetesCluster.

@Override
public boolean scaleKubernetesCluster(ScaleKubernetesClusterCmd cmd) throws CloudRuntimeException {
    if (!KubernetesServiceEnabled.value()) {
        logAndThrow(Level.ERROR, "Kubernetes Service plugin is disabled");
    }
    validateKubernetesClusterScaleParameters(cmd);
    KubernetesClusterVO kubernetesCluster = kubernetesClusterDao.findById(cmd.getId());
    Account owner = accountService.getActiveAccountById(kubernetesCluster.getAccountId());
    String[] keys = getServiceUserKeys(owner);
    KubernetesClusterScaleWorker scaleWorker = new KubernetesClusterScaleWorker(kubernetesClusterDao.findById(cmd.getId()), serviceOfferingDao.findById(cmd.getServiceOfferingId()), cmd.getClusterSize(), cmd.getNodeIds(), cmd.isAutoscalingEnabled(), cmd.getMinSize(), cmd.getMaxSize(), this);
    scaleWorker.setKeys(keys);
    scaleWorker = ComponentContext.inject(scaleWorker);
    return scaleWorker.scaleCluster();
}
Also used : UserAccount(com.cloud.user.UserAccount) Account(com.cloud.user.Account) KubernetesClusterScaleWorker(com.cloud.kubernetes.cluster.actionworkers.KubernetesClusterScaleWorker)

Aggregations

KubernetesClusterScaleWorker (com.cloud.kubernetes.cluster.actionworkers.KubernetesClusterScaleWorker)1 Account (com.cloud.user.Account)1 UserAccount (com.cloud.user.UserAccount)1