diff --git a/src/main/java/net/geant/nmaas/nmservice/deployment/containerorchestrators/kubernetes/components/helm/HelmKServiceManager.java b/src/main/java/net/geant/nmaas/nmservice/deployment/containerorchestrators/kubernetes/components/helm/HelmKServiceManager.java index c89387d25d3d432e5eaa2ea0aa083e3ddf8d1982..7271bfce1befe1bf37fb3a9241a19a3408c96703 100644 --- a/src/main/java/net/geant/nmaas/nmservice/deployment/containerorchestrators/kubernetes/components/helm/HelmKServiceManager.java +++ b/src/main/java/net/geant/nmaas/nmservice/deployment/containerorchestrators/kubernetes/components/helm/HelmKServiceManager.java @@ -196,7 +196,7 @@ public class HelmKServiceManager implements KServiceLifecycleManager { public void scaleDeployment(AppDeployment deployment, int replicas) { KubernetesNmServiceInfo serviceInfo = repositoryManager.loadService(deployment.getDeploymentId()); String namespace = namespaceService.namespace(serviceInfo.getDomain()); - String releaseName = deployment.getDeploymentId().value(); + String releaseName = serviceInfo.getDescriptiveDeploymentId().getValue(); helmCommandExecutor.executeScaleCommand(namespace, releaseName, replicas); } diff --git a/src/main/java/net/geant/nmaas/nmservice/deployment/containerorchestrators/kubernetes/components/helm/commands/HelmUpgradeCommand.java b/src/main/java/net/geant/nmaas/nmservice/deployment/containerorchestrators/kubernetes/components/helm/commands/HelmUpgradeCommand.java index 1f64a1a04974d9068eca9e28bc701e78cbea15a7..63b68198521ee9505ba665c6daf5b9ebb8ac05f0 100644 --- a/src/main/java/net/geant/nmaas/nmservice/deployment/containerorchestrators/kubernetes/components/helm/commands/HelmUpgradeCommand.java +++ b/src/main/java/net/geant/nmaas/nmservice/deployment/containerorchestrators/kubernetes/components/helm/commands/HelmUpgradeCommand.java @@ -91,7 +91,6 @@ public class HelmUpgradeCommand extends HelmCommand { sb.append(HELM) .append(SPACE).append(UPGRADE) .append(SPACE).append(OPTION_NAMESPACE).append(SPACE).append(namespace) - .append(SPACE).append(releaseName) .append(SPACE).append(releaseName); for (String setValue : setValues) { diff --git a/src/main/java/net/geant/nmaas/orchestration/AppLifecycleState.java b/src/main/java/net/geant/nmaas/orchestration/AppLifecycleState.java index 1a0543a6b25b8720aab58840c013655be902930e..cd031bab5e9b572adf7b9a1b4b805675d839f86f 100644 --- a/src/main/java/net/geant/nmaas/orchestration/AppLifecycleState.java +++ b/src/main/java/net/geant/nmaas/orchestration/AppLifecycleState.java @@ -218,6 +218,10 @@ public enum AppLifecycleState { APPLICATION_CONFIGURATION_REMOVAL_FAILED { @Override public String getUserFriendlyState() { return "APP_INSTANCE.PROGRESS.APP_CONF_REMOVE_ERROR"; } + }, + APPLICATION_SCALED_DOWN{ + @Override + public String getUserFriendlyState(){ return "APP_INSTANCE.PROGRESS.APP_SCALED_DOWN"; } }; public abstract String getUserFriendlyState(); diff --git a/src/main/java/net/geant/nmaas/orchestration/entities/AppDeploymentState.java b/src/main/java/net/geant/nmaas/orchestration/entities/AppDeploymentState.java index 21d54f0d3d8fc59602c02764c1a251e290e3036b..0964c30950b5e904ca50a96fb54005e1d1d61de0 100644 --- a/src/main/java/net/geant/nmaas/orchestration/entities/AppDeploymentState.java +++ b/src/main/java/net/geant/nmaas/orchestration/entities/AppDeploymentState.java @@ -167,7 +167,8 @@ public enum AppDeploymentState { case DEPLOYMENT_FAILED: return APPLICATION_DEPLOYMENT_FAILED; default: - return nextStateForNotMatchingNmServiceDeploymentState(this, state); } + return nextStateForNotMatchingNmServiceDeploymentState(this, state); + } } }, APPLICATION_CONFIGURATION_FAILED { @@ -264,7 +265,7 @@ public enum AppDeploymentState { @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { - if (NmServiceDeploymentState.UPGRADE_INITIATED.equals(state)) { + if (NmServiceDeploymentState.UPGRADE_INITIATED.equals(state)) { return APPLICATION_UPGRADE_IN_PROGRESS; } return nextStateForNotMatchingNmServiceDeploymentState(this, state); @@ -277,7 +278,9 @@ public enum AppDeploymentState { }, APPLICATION_DEPLOYMENT_VERIFICATION_FAILED { @Override - public AppLifecycleState lifecycleState() { return AppLifecycleState.APPLICATION_DEPLOYMENT_VERIFICATION_FAILED; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.APPLICATION_DEPLOYMENT_VERIFICATION_FAILED; + } @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { @@ -285,7 +288,9 @@ public enum AppDeploymentState { } @Override - public boolean isInFailedState() { return true; } + public boolean isInFailedState() { + return true; + } }, APPLICATION_RESTART_IN_PROGRESS { @Override @@ -333,7 +338,9 @@ public enum AppDeploymentState { } @Override - public boolean isInFailedState() { return true; } + public boolean isInFailedState() { + return true; + } }, APPLICATION_UPGRADE_IN_PROGRESS { @Override @@ -388,11 +395,15 @@ public enum AppDeploymentState { } @Override - public boolean isInFailedState() { return true; } + public boolean isInFailedState() { + return true; + } }, APPLICATION_REMOVAL_IN_PROGRESS { @Override - public AppLifecycleState lifecycleState() { return AppLifecycleState.APPLICATION_REMOVAL_IN_PROGRESS; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.APPLICATION_REMOVAL_IN_PROGRESS; + } @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { @@ -408,7 +419,9 @@ public enum AppDeploymentState { }, APPLICATION_REMOVED { @Override - public AppLifecycleState lifecycleState() { return AppLifecycleState.APPLICATION_REMOVED; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.APPLICATION_REMOVED; + } @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { @@ -418,7 +431,7 @@ public enum AppDeploymentState { case CONFIGURATION_REMOVAL_INITIATED: return APPLICATION_CONFIGURATION_REMOVAL_IN_PROGRESS; default: - return nextStateForNotMatchingNmServiceDeploymentState(this, state); + return nextStateForNotMatchingNmServiceDeploymentState(this, state); } } @@ -430,7 +443,9 @@ public enum AppDeploymentState { }, APPLICATION_REMOVAL_FAILED { @Override - public AppLifecycleState lifecycleState() { return AppLifecycleState.APPLICATION_REMOVAL_FAILED; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.APPLICATION_REMOVAL_FAILED; + } @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { @@ -438,11 +453,15 @@ public enum AppDeploymentState { } @Override - public boolean isInFailedState() { return true; } + public boolean isInFailedState() { + return true; + } }, APPLICATION_CONFIGURATION_REMOVAL_IN_PROGRESS { @Override - public AppLifecycleState lifecycleState() { return AppLifecycleState.APPLICATION_CONFIGURATION_REMOVAL_IN_PROGRESS; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.APPLICATION_CONFIGURATION_REMOVAL_IN_PROGRESS; + } @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { @@ -458,11 +477,13 @@ public enum AppDeploymentState { }, APPLICATION_CONFIGURATION_REMOVED { @Override - public AppLifecycleState lifecycleState() { return AppLifecycleState.APPLICATION_CONFIGURATION_REMOVED; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.APPLICATION_CONFIGURATION_REMOVED; + } @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { - if (NmServiceDeploymentState.FAILED_APPLICATION_REMOVED.equals(state)) { + if (NmServiceDeploymentState.FAILED_APPLICATION_REMOVED.equals(state)) { return FAILED_APPLICATION_REMOVED; } return nextStateForNotMatchingNmServiceDeploymentState(this, state); @@ -470,7 +491,9 @@ public enum AppDeploymentState { }, APPLICATION_CONFIGURATION_REMOVAL_FAILED { @Override - public AppLifecycleState lifecycleState() { return AppLifecycleState.APPLICATION_CONFIGURATION_REMOVAL_FAILED; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.APPLICATION_CONFIGURATION_REMOVAL_FAILED; + } @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { @@ -479,7 +502,9 @@ public enum AppDeploymentState { }, FAILED_APPLICATION_REMOVED { @Override - public AppLifecycleState lifecycleState() {return AppLifecycleState.FAILED_APPLICATION_REMOVED; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.FAILED_APPLICATION_REMOVED; + } @Override public boolean isInEndState() { @@ -488,7 +513,9 @@ public enum AppDeploymentState { }, APPLICATION_CONFIGURATION_UPDATE_IN_PROGRESS { @Override - public AppLifecycleState lifecycleState() { return AppLifecycleState.APPLICATION_CONFIGURATION_UPDATE_IN_PROGRESS; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.APPLICATION_CONFIGURATION_UPDATE_IN_PROGRESS; + } @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { @@ -504,7 +531,9 @@ public enum AppDeploymentState { }, APPLICATION_CONFIGURATION_UPDATED { @Override - public AppLifecycleState lifecycleState() { return AppLifecycleState.APPLICATION_CONFIGURATION_UPDATED; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.APPLICATION_CONFIGURATION_UPDATED; + } @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { @@ -520,7 +549,9 @@ public enum AppDeploymentState { }, APPLICATION_CONFIGURATION_UPDATE_FAILED { @Override - public AppLifecycleState lifecycleState() { return AppLifecycleState.APPLICATION_CONFIGURATION_UPDATE_FAILED; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.APPLICATION_CONFIGURATION_UPDATE_FAILED; + } @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { @@ -528,11 +559,15 @@ public enum AppDeploymentState { } @Override - public boolean isInFailedState() { return true; } + public boolean isInFailedState() { + return true; + } }, INTERNAL_ERROR { @Override - public AppLifecycleState lifecycleState() { return AppLifecycleState.INTERNAL_ERROR; } + public AppLifecycleState lifecycleState() { + return AppLifecycleState.INTERNAL_ERROR; + } @Override public AppDeploymentState nextState(NmServiceDeploymentState state) { @@ -540,12 +575,25 @@ public enum AppDeploymentState { } @Override - public boolean isInFailedState() { return true; } + public boolean isInFailedState() { + return true; + } }, SCALED_DOWN { @Override public AppLifecycleState lifecycleState() { - return null; + return AppLifecycleState.APPLICATION_SCALED_DOWN; + } + + @Override + public AppDeploymentState nextState(NmServiceDeploymentState state) { + //TODO + return APPLICATION_CONFIGURED; + } + + @Override + public boolean isInRunningState() { + return true; } }; @@ -569,7 +617,7 @@ public enum AppDeploymentState { if (!currentAppDeploymentState.isInEndState() && newNmServiceState.equals(NmServiceDeploymentState.REMOVAL_INITIATED)) { return APPLICATION_REMOVAL_IN_PROGRESS; } - if(currentAppDeploymentState.isInFailedState()) { + if (currentAppDeploymentState.isInFailedState()) { switch (newNmServiceState) { case INIT: return REQUESTED; @@ -582,7 +630,7 @@ public enum AppDeploymentState { default: } } - if(currentAppDeploymentState.isInRunningState()) { + if (currentAppDeploymentState.isInRunningState()) { switch (newNmServiceState) { case RESTART_INITIATED: return APPLICATION_RESTART_IN_PROGRESS;