Skip to content

Commit

Permalink
Pause eksa cluster before moving capi for delete
Browse files Browse the repository at this point in the history
  • Loading branch information
tatlat authored and eks-distro-pr-bot committed Feb 21, 2024
1 parent 83f875e commit 59a1df0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/dependencies/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ func (f *Factory) WithClusterDeleter() *Factory {
f.buildSteps = append(f.buildSteps, func(ctx context.Context) error {
var opts []clustermanager.DeleterOpt
if f.config.noTimeouts {
opts = append(opts, clustermanager.WithDeleterNoTimeouts())
opts = append(opts, clustermanager.WithDeleterApplyClusterTimeout(time.Hour))
}

f.dependencies.ClusterDeleter = clustermanager.NewDeleter(
Expand Down
8 changes: 7 additions & 1 deletion pkg/workflows/management/delete_move_capi.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ import (
type moveClusterManagementForDeleteTask struct{}

func (s *moveClusterManagementForDeleteTask) Run(ctx context.Context, commandContext *task.CommandContext) task.Task {
err := commandContext.ClusterManager.PauseEKSAControllerReconcile(ctx, commandContext.WorkloadCluster, commandContext.ClusterSpec, commandContext.Provider)
if err != nil {
commandContext.SetError(err)
return &workflows.CollectDiagnosticsTask{}
}

logger.Info("Moving cluster management from workload cluster to bootstrap")
err := commandContext.ClusterManager.MoveCAPI(ctx, commandContext.WorkloadCluster, commandContext.BootstrapCluster, commandContext.WorkloadCluster.Name, commandContext.ClusterSpec, types.WithNodeRef())
err = commandContext.ClusterManager.MoveCAPI(ctx, commandContext.WorkloadCluster, commandContext.BootstrapCluster, commandContext.WorkloadCluster.Name, commandContext.ClusterSpec, types.WithNodeRef())
if err != nil {
commandContext.SetError(err)
return &workflows.CollectDiagnosticsTask{}
Expand Down
1 change: 1 addition & 0 deletions pkg/workflows/management/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func (c *deleteTestSetup) expectInstallCAPI(err error) {
}

func (c *deleteTestSetup) expectMoveCAPI(err error) {
c.clusterManager.EXPECT().PauseEKSAControllerReconcile(c.ctx, c.workloadCluster, c.clusterSpec, c.provider)
c.clusterManager.EXPECT().MoveCAPI(c.ctx, c.workloadCluster, c.bootstrapCluster, c.workloadCluster.Name, c.clusterSpec, gomock.Any()).Return(err)
}

Expand Down

0 comments on commit 59a1df0

Please sign in to comment.