clusterdelete

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package clusterdelete orchestrates cluster destroy workflows across provider implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, opts DeleteOptions) error

Delete runs the provider cleanup workflow and then destroys managed OpenTofu/Terraform resources.

func FormatInstances

func FormatInstances(instances []Instance) string

FormatInstances formats provider instances for human-readable status and confirmation messages.

Types

type ConfirmFunc

type ConfirmFunc func(message string) (bool, error)

ConfirmFunc asks the user to confirm a destructive action.

type DeleteOptions

type DeleteOptions struct {
	ClusterConfig  *clusterconfig.ClusterConfig
	StackDir       string
	Executor       Executor
	Provider       Provider
	AutoApprove    bool
	Confirm        ConfirmFunc
	Status         StatusFunc
	OutputTimeout  time.Duration
	DestroyTimeout time.Duration
}

DeleteOptions controls the cluster delete workflow.

type Executor

type Executor interface {
	OutputJSON(ctx context.Context, dir string) ([]byte, error)
	Destroy(ctx context.Context, dir string, autoApprove bool) error
}

Executor provides Terraform outputs and destroy behavior for cluster delete.

type Instance

type Instance struct {
	ID     string
	Name   string
	Shard  string
	Group  string
	State  string
	Reason string
}

Instance describes a provider VM instance that may need cleanup.

type Provider

type Provider interface {
	Prepare(ctx context.Context, cfg *clusterconfig.ClusterConfig, outputs []byte) error
	ScaleManagedGroupsToZero(ctx context.Context) error
	WaitForManagedInstancesGone(ctx context.Context) error
	RemainingManagedInstances(ctx context.Context) ([]Instance, error)
	TerminateInstances(ctx context.Context, instances []Instance) error
	ListTaggedInstances(ctx context.Context, managedOnly bool) ([]Instance, error)
	ClusterID() string
}

Provider performs provider-specific cleanup before and after destroy.

type StatusFunc

type StatusFunc func(message string)

StatusFunc reports delete workflow status to the caller.

Directories

Path Synopsis
Package aws implements AWS-specific cluster destroy cleanup for the clusterdelete package.
Package aws implements AWS-specific cluster destroy cleanup for the clusterdelete package.
Package google will contain the Google Cloud cluster delete provider implementation.
Package google will contain the Google Cloud cluster delete provider implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL