manager

package
v0.0.0-...-4c17ca5 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeSet

ChangeSet represents a CloudFormation ChangeSet

type NodeGroupSummary

type NodeGroupSummary struct {
	StackName       string
	Cluster         string
	Name            string
	MaxSize         int
	MinSize         int
	DesiredCapacity int
	InstanceType    string
	ImageID         string
	CreationTime    *time.Time
}

NodeGroupSummary represents a summary of a nodegroup stack

type Stack

type Stack = cloudformation.Stack

Stack represents the CloudFormation stack

type StackCollection

type StackCollection struct {
	// contains filtered or unexported fields
}

StackCollection stores the CloudFormation stack information

func NewStackCollection

func NewStackCollection(provider api.ClusterProvider, spec *api.ClusterConfig) *StackCollection

NewStackCollection create a stack manager for a single cluster

func (*StackCollection) AppendNewClusterStackResource

func (c *StackCollection) AppendNewClusterStackResource(plan bool) (bool, error)

AppendNewClusterStackResource will update cluster stack with new resources in append-only way

func (*StackCollection) CreateStack

func (c *StackCollection) CreateStack(name string, stack builder.ResourceSet, tags, parameters map[string]string, errs chan error) error

CreateStack with given name, stack builder instance and parameters; any errors will be written to errs channel, when nil is written, assume completion, do not expect more then one error value on the channel, it's closed immediately after it is written to

func (*StackCollection) DeleteStackByName

func (c *StackCollection) DeleteStackByName(name string) (*Stack, error)

DeleteStackByName sends a request to delete the stack

func (*StackCollection) DeleteStackByNameSync

func (c *StackCollection) DeleteStackByNameSync(name string, errs chan error) error

DeleteStackByNameSync sends a request to delete the stack, and waits until status is DELETE_COMPLETE; any errors will be written to errs channel, assume completion when nil is written, do not expect more then one error value on the channel, it's closed immediately after it is written to

func (*StackCollection) DeleteStackBySpec

func (c *StackCollection) DeleteStackBySpec(s *Stack) (*Stack, error)

DeleteStackBySpec sends a request to delete the stack

func (*StackCollection) DeleteStackBySpecSync

func (c *StackCollection) DeleteStackBySpecSync(s *Stack, errs chan error) error

DeleteStackBySpecSync sends a request to delete the stack, and waits until status is DELETE_COMPLETE; any errors will be written to errs channel, assume completion when nil is written, do not expect more then one error value on the channel, it's closed immediately after it is written to

func (*StackCollection) DeleteTasksForDeprecatedStacks

func (c *StackCollection) DeleteTasksForDeprecatedStacks() (*TaskTree, error)

DeleteTasksForDeprecatedStacks all deprecated stacks

func (*StackCollection) DescribeClusterStack

func (c *StackCollection) DescribeClusterStack() (*Stack, error)

DescribeClusterStack calls DescribeStacks and filters out cluster stack

func (*StackCollection) DescribeIAMServiceAccountStacks

func (c *StackCollection) DescribeIAMServiceAccountStacks() ([]*Stack, error)

DescribeIAMServiceAccountStacks calls DescribeStacks and filters out iamserviceaccounts

func (*StackCollection) DescribeNodeGroupStacks

func (c *StackCollection) DescribeNodeGroupStacks() ([]*Stack, error)

DescribeNodeGroupStacks calls DescribeStacks and filters out nodegroups

func (*StackCollection) DescribeNodeGroupStacksAndResources

func (c *StackCollection) DescribeNodeGroupStacksAndResources() (map[string]StackInfo, error)

DescribeNodeGroupStacksAndResources calls DescribeNodeGroupStacks and fetches all resources, then returns it in a map by nodegroup name

func (*StackCollection) DescribeStack

func (c *StackCollection) DescribeStack(i *Stack) (*Stack, error)

DescribeStack describes a cloudformation stack.

func (*StackCollection) DescribeStackChangeSet

func (c *StackCollection) DescribeStackChangeSet(i *Stack, changeSetName string) (*ChangeSet, error)

DescribeStackChangeSet describes a ChangeSet by name

func (*StackCollection) DescribeStackEvents

func (c *StackCollection) DescribeStackEvents(i *Stack) ([]*cloudformation.StackEvent, error)

DescribeStackEvents describes the events that have occurred on the stack

func (*StackCollection) DescribeStacks

func (c *StackCollection) DescribeStacks() ([]*Stack, error)

DescribeStacks describes the existing stacks

func (*StackCollection) DoCreateStackRequest

func (c *StackCollection) DoCreateStackRequest(i *Stack, templateBody []byte, tags, parameters map[string]string, withIAM bool, withNamedIAM bool) error

DoCreateStackRequest requests the creation of a CloudFormation stack

func (*StackCollection) DoWaitUntilStackIsCreated

func (c *StackCollection) DoWaitUntilStackIsCreated(i *Stack) error

DoWaitUntilStackIsCreated blocks until the given stack's creation has completed.

func (*StackCollection) GetIAMServiceAccountName

func (*StackCollection) GetIAMServiceAccountName(s *Stack) string

GetIAMServiceAccountName will return iamserviceaccount name based on tags

func (*StackCollection) GetIAMServiceAccounts

func (c *StackCollection) GetIAMServiceAccounts() ([]*api.ClusterIAMServiceAccount, error)

GetIAMServiceAccounts calls DescribeIAMServiceAccountStacks and return native iamserviceaccounts

func (*StackCollection) GetNodeGroupName

func (*StackCollection) GetNodeGroupName(s *Stack) string

GetNodeGroupName will return nodegroup name based on tags

func (*StackCollection) GetNodeGroupSummaries

func (c *StackCollection) GetNodeGroupSummaries(name string) ([]*NodeGroupSummary, error)

GetNodeGroupSummaries returns a list of summaries for the nodegroups of a cluster

func (*StackCollection) GetStackTemplate

func (c *StackCollection) GetStackTemplate(stackName string) (string, error)

GetStackTemplate gets the Cloudformation template for a stack

func (*StackCollection) ListIAMServiceAccountStacks

func (c *StackCollection) ListIAMServiceAccountStacks() ([]string, error)

ListIAMServiceAccountStacks calls DescribeIAMServiceAccountStacks and returns only iamserviceaccount names

func (*StackCollection) ListNodeGroupStacks

func (c *StackCollection) ListNodeGroupStacks() ([]string, error)

ListNodeGroupStacks calls DescribeNodeGroupStacks and returns only nodegroup names

func (*StackCollection) ListStacks

func (c *StackCollection) ListStacks(nameRegex string, statusFilters ...string) ([]*Stack, error)

ListStacks gets all of CloudFormation stacks

func (*StackCollection) LookupCloudTrailEvents

func (c *StackCollection) LookupCloudTrailEvents(i *Stack) ([]*cloudtrail.Event, error)

LookupCloudTrailEvents looks up stack events in CloudTrail

func (*StackCollection) MakeChangeSetName

func (c *StackCollection) MakeChangeSetName(action string) string

MakeChangeSetName builds a consistent name for a changeset.

func (*StackCollection) NewTasksToCreateClusterWithNodeGroups

func (c *StackCollection) NewTasksToCreateClusterWithNodeGroups(nodeGroups []*api.NodeGroup) *TaskTree

NewTasksToCreateClusterWithNodeGroups defines all tasks required to create a cluster along with some nodegroups; see CreateAllNodeGroups for how onlyNodeGroupSubset works

func (*StackCollection) NewTasksToCreateIAMServiceAccounts

func (c *StackCollection) NewTasksToCreateIAMServiceAccounts(serviceAccounts []*api.ClusterIAMServiceAccount, oidc *iamoidc.OpenIDConnectManager, clientSetGetter kubernetes.ClientSetGetter) *TaskTree

NewTasksToCreateIAMServiceAccounts defines tasks required to create all of the IAM ServiceAccounts

func (*StackCollection) NewTasksToCreateNodeGroups

func (c *StackCollection) NewTasksToCreateNodeGroups(nodeGroups []*api.NodeGroup) *TaskTree

NewTasksToCreateNodeGroups defines tasks required to create all of the nodegroups

func (*StackCollection) NewTasksToDeleteClusterWithNodeGroups

func (c *StackCollection) NewTasksToDeleteClusterWithNodeGroups(deleteOIDCProvider bool, oidc *iamoidc.OpenIDConnectManager, clientSetGetter kubernetes.ClientSetGetter, wait bool, cleanup func(chan error, string) error) (*TaskTree, error)

NewTasksToDeleteClusterWithNodeGroups defines tasks required to delete the given cluster along with all of its resources

func (*StackCollection) NewTasksToDeleteIAMServiceAccounts

func (c *StackCollection) NewTasksToDeleteIAMServiceAccounts(shouldDelete func(string) bool, oidc *iamoidc.OpenIDConnectManager, clientSetGetter kubernetes.ClientSetGetter, wait bool) (*TaskTree, error)

NewTasksToDeleteIAMServiceAccounts defines tasks required to delete all of the iamserviceaccounts

func (*StackCollection) NewTasksToDeleteNodeGroups

func (c *StackCollection) NewTasksToDeleteNodeGroups(shouldDelete func(string) bool, wait bool, cleanup func(chan error, string) error) (*TaskTree, error)

NewTasksToDeleteNodeGroups defines tasks required to delete all of the nodegroups

func (*StackCollection) NewTasksToDeleteOIDCProviderWithIAMServiceAccounts

func (c *StackCollection) NewTasksToDeleteOIDCProviderWithIAMServiceAccounts(oidc *iamoidc.OpenIDConnectManager, clientSetGetter kubernetes.ClientSetGetter) (*TaskTree, error)

NewTasksToDeleteOIDCProviderWithIAMServiceAccounts defines tasks required to delete all of the iamserviceaccounts along with associated IAM ODIC provider

func (*StackCollection) ScaleNodeGroup

func (c *StackCollection) ScaleNodeGroup(ng *api.NodeGroup) error

ScaleNodeGroup will scale an existing nodegroup

func (*StackCollection) StackStatusIsNotReady

func (*StackCollection) StackStatusIsNotReady(s *Stack) bool

StackStatusIsNotReady will return true when stack statate is non-ready

func (*StackCollection) StackStatusIsNotTransitional

func (*StackCollection) StackStatusIsNotTransitional(s *Stack) bool

StackStatusIsNotTransitional will return true when stack statate is non-transitional

func (*StackCollection) UpdateStack

func (c *StackCollection) UpdateStack(stackName string, changeSetName string, description string, template []byte, parameters map[string]string) error

UpdateStack will update a CloudFormation stack by creating and executing a ChangeSet

type StackInfo

type StackInfo struct {
	Stack     *Stack
	Resources []*cloudformation.StackResource
	Template  *string
}

StackInfo hold the stack along with template and resources

type Task

type Task interface {
	Describe() string
	Do(chan error) error
}

Task is a common interface for the stack manager tasks

type TaskTree

type TaskTree struct {
	Parallel  bool
	PlanMode  bool
	IsSubTask bool
	// contains filtered or unexported fields
}

TaskTree wraps a set of tasks

func (*TaskTree) Append

func (t *TaskTree) Append(newTasks ...Task)

Append new tasks to the set

func (*TaskTree) Describe

func (t *TaskTree) Describe() string

Describe the set

func (*TaskTree) Do

func (t *TaskTree) Do(allErrs chan error) error

Do will run through the set in the backround, it may return an error immediately, or eventually write to the errs channel; it will close the channel once all tasks are completed

func (*TaskTree) DoAllSync

func (t *TaskTree) DoAllSync() []error

DoAllSync will run through the set in the foregounds and return all the errors in a slice

func (*TaskTree) Len

func (t *TaskTree) Len() int

Len returns number of tasks in the set

Jump to

Keyboard shortcuts

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