Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(destroy): add disable stage to destroy server group stage #3848

Merged
merged 2 commits into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
package com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup

import com.netflix.spinnaker.kork.dynamicconfig.DynamicConfigService
import com.netflix.spinnaker.orca.api.pipeline.graph.TaskNode
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
import com.netflix.spinnaker.orca.clouddriver.ForceCacheRefreshAware
import com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.TargetServerGroupLinearStageSupport
import com.netflix.spinnaker.orca.clouddriver.tasks.MonitorKatoTask
import com.netflix.spinnaker.orca.clouddriver.tasks.servergroup.*
import com.netflix.spinnaker.orca.api.pipeline.graph.TaskNode
import com.netflix.spinnaker.orca.clouddriver.tasks.servergroup.DestroyServerGroupTask
import com.netflix.spinnaker.orca.clouddriver.tasks.servergroup.WaitForDestroyedServerGroupTask
import com.netflix.spinnaker.orca.pipeline.graph.StageGraphBuilderImpl
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component

Expand All @@ -37,17 +39,26 @@ class DestroyServerGroupStage extends TargetServerGroupLinearStageSupport implem
this.dynamicConfigService = dynamicConfigService
}

private static void addDisableStage(Map<String, Object> context, StageGraphBuilderImpl graph) {
graph.add {
it.name = "disableServerGroup"
it.type = getType(DisableServerGroupStage)
it.context.putAll(context)
}
}

@Override
protected void taskGraphInternal(StageExecution stage, TaskNode.Builder builder) {
builder
.withTask("disableServerGroup", DisableServerGroupTask)
.withTask("monitorServerGroup", MonitorKatoTask)
.withTask("waitForNotUpInstances", WaitForAllInstancesNotUpTask)
protected void preStatic(Map<String, Object> context, StageGraphBuilderImpl graph) {
addDisableStage(context, graph)
}

if (isForceCacheRefreshEnabled(dynamicConfigService)) {
builder.withTask("forceCacheRefresh", ServerGroupCacheForceRefreshTask)
}
@Override
protected void preDynamic(Map<String, Object> context, StageGraphBuilderImpl graph) {
addDisableStage(context, graph)
}

@Override
protected void taskGraphInternal(StageExecution stage, TaskNode.Builder builder) {
builder
.withTask("destroyServerGroup", DestroyServerGroupTask)
.withTask("monitorServerGroup", MonitorKatoTask)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import org.springframework.stereotype.Component

@Slf4j
@Component
@Deprecated
/**
* @deprecated this does not handle some corner cases (like the platformHealthOnly flag), use {@link WaitForRequiredInstancesDownTask} instead
*/
class WaitForAllInstancesNotUpTask extends AbstractWaitingForInstancesTask {
@Override
protected boolean hasSucceeded(StageExecution stage, Map serverGroup, List<Map> instances, Collection<String> interestingHealthProviderNames) {
Expand Down