Skip to content

Commit

Permalink
fix(kubernetes): Percent enable disable (#1477)
Browse files Browse the repository at this point in the history
Operation aborts preamaturely when target percent is not 100
  • Loading branch information
lwander committed Mar 1, 2017
1 parent 3f78844 commit f6f5958
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -83,7 +83,6 @@ abstract class AbstractEnableDisableKubernetesAtomicOperation implements AtomicO
getResource = {
return credentials.apiAdaptor.getReplicationController(namespace, description.serverGroupName)
}
pods = credentials.apiAdaptor.getReplicationControllerPods(namespace, description.serverGroupName)
} else if (replicaSet) {
desired = credentials.apiAdaptor.toggleReplicaSetSpecLabels(namespace, description.serverGroupName, services, action)
getGeneration = { ReplicaSet rs ->
Expand All @@ -92,7 +91,6 @@ abstract class AbstractEnableDisableKubernetesAtomicOperation implements AtomicO
getResource = {
return credentials.apiAdaptor.getReplicaSet(namespace, description.serverGroupName)
}
pods = credentials.apiAdaptor.getReplicaSetPods(namespace, description.serverGroupName)
} else {
throw new KubernetesOperationException("No replication controller or replica set $description.serverGroupName in $namespace.")
}
Expand All @@ -101,6 +99,14 @@ abstract class AbstractEnableDisableKubernetesAtomicOperation implements AtomicO
throw new KubernetesOperationException("Server group failed to reach a consistent state. This is likely a bug with Kubernetes itself.")
}
}

if (replicationController) {
pods = credentials.apiAdaptor.getReplicationControllerPods(namespace, description.serverGroupName)
} else if (replicaSet) {
pods = credentials.apiAdaptor.getReplicaSetPods(namespace, description.serverGroupName)
} else {
throw new KubernetesOperationException("No replication controller or replica set $description.serverGroupName in $namespace.")
}

if (!pods) {
task.updateStatus basePhase, "No pods to ${basePhase.toLowerCase()}. Operation finshed successfully."
Expand Down

0 comments on commit f6f5958

Please sign in to comment.