Skip to content
Snippets Groups Projects
Commit 29454fa7 authored by Patryk Kazimierowski's avatar Patryk Kazimierowski
Browse files

some changes

parent 0793cecd
No related branches found
No related tags found
2 merge requests!231Resolve "Add application instance scaling support",!209Draft: Resolve "Add application instance scaling support"
Pipeline #94326 failed
......@@ -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);
}
......
......@@ -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) {
......
......@@ -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();
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment