eks

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package eks contains utility functions for interacting with EKS

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureKubectlForEks

func ConfigureKubectlForEks(
	eksCluster *eks.Cluster,
	kubectlOptions *kubectl.KubectlOptions,
) error

ConfigureKubectlForEks adds a new context to the kubeconfig located at the given path that can authenticate with the EKS cluster referenced by the given ARN.

func GetAsgByName

func GetAsgByName(svc *autoscaling.AutoScaling, asgName string) (*autoscaling.Group, error)

GetAsgByName will lookup an AutoScalingGroup that matches the given name. This will return an error if it can not find any ASG that matches the given name.

func GetClusterByArn

func GetClusterByArn(eksClusterArn string) (*eks.Cluster, error)

GetClusterByArn returns the EKS Cluster object that corresponds to the given ARN.

func GetClusterNameFromArn

func GetClusterNameFromArn(eksClusterArnString string) (string, error)

GetClusterNameFromArn extracts the EKS cluster name given the ARN for the cluster.

func GetRegionFromArn

func GetRegionFromArn(eksClusterArnString string) (string, error)

GetRegionFromArn extracts the AWS region that the EKS cluster is in from the ARN of the EKS cluster.

func NewAuthenticatedSession

func NewAuthenticatedSession(region string) (*session.Session, error)

NewAuthenticatedSession gets an AWS Session, checking that the user has credentials properly configured in their environment.

func NewEksClient

func NewEksClient(region string) (*eks.EKS, error)

NewEksClient creates an EKS client.

func RollOutDeployment

func RollOutDeployment(
	region string,
	eksAsgName string,
	kubectlOptions *kubectl.KubectlOptions,
	drainTimeout time.Duration,
	maxRetries int,
	sleepBetweenRetries time.Duration,
) error

RollOutDeployment will perform a zero downtime roll out of the current launch configuration associated with the provided ASG in the provided EKS cluster. This is accomplished by:

  1. Double the desired capacity of the Auto Scaling Group that powers the EKS Cluster. This will launch new EKS workers with the new launch configuration.
  2. Wait for the new nodes to be ready for Pod scheduling in Kubernetes.
  3. Drain the pods scheduled on the old EKS workers (using the equivalent of "kubectl drain"), so that they will be rescheduled on the new EKS workers.
  4. Wait for all the pods to migrate off of the old EKS workers.
  5. Set the desired capacity down to the original value and remove the old EKS workers from the ASG.

TODO feature request: Break up into stages/checkpoints, and store state along the way so that command can pick up from a stage if something bad happens.

func VerifyCluster

func VerifyCluster(
	eksClusterArn string,
	waitForCluster bool,
	waitMaxRetries int,
	waitSleepBetweenRetries time.Duration,
) error

VerifyCluster verifies that the cluster exists, and that the Kubernetes api server is up and accepting traffic. If waitForCluster is true, this command will wait for each stage to reach the true state.

Types

type CouldNotMeetASGCapacityError

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

CouldNotMeetASGCapacityError represents an error related to waiting for ASG to reach desired capacity

func NewCouldNotMeetASGCapacityError

func NewCouldNotMeetASGCapacityError(asgName string, message string) CouldNotMeetASGCapacityError

func (CouldNotMeetASGCapacityError) Error

type CredentialsError

type CredentialsError struct {
	UnderlyingErr error
}

CredentialsError is an error that occurs because AWS credentials can't be found.

func (CredentialsError) Error

func (err CredentialsError) Error() string

type EKSClusterNotReady

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

EKSClusterNotReady is returned when the EKS cluster is detected to not be in the ready state

func (EKSClusterNotReady) Error

func (err EKSClusterNotReady) Error() string

type EKSClusterReadyTimeoutError

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

EKSClusterReadyTimeoutError is returned when we time out waiting for an EKS cluster to be ready.

func (EKSClusterReadyTimeoutError) Error

func (err EKSClusterReadyTimeoutError) Error() string

type LookupError

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

LookupError represents an error related to looking up data on an object.

func NewLookupError

func NewLookupError(objectType string, objectId string, objectProperty string) LookupError

NewLookupError constructs a new LookupError object that can be used to return an error related to a look up error.

func (LookupError) Error

func (err LookupError) Error() string

type MultipleLookupErrors

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

MultipleLookupErrors represents multiple errors found while looking up a resource

func NewMultipleLookupErrors

func NewMultipleLookupErrors() MultipleLookupErrors

func (MultipleLookupErrors) AddError

func (err MultipleLookupErrors) AddError(newErr error)

func (MultipleLookupErrors) Error

func (err MultipleLookupErrors) Error() string

func (MultipleLookupErrors) IsEmpty

func (err MultipleLookupErrors) IsEmpty() bool

type MultipleTerminateInstanceErrors

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

MultipleTerminateInstanceErrors represents multiple errors found while terminating instances

func NewMultipleTerminateInstanceErrors

func NewMultipleTerminateInstanceErrors() MultipleTerminateInstanceErrors

func (MultipleTerminateInstanceErrors) AddError

func (err MultipleTerminateInstanceErrors) AddError(newErr error)

func (MultipleTerminateInstanceErrors) Error

func (MultipleTerminateInstanceErrors) IsEmpty

func (err MultipleTerminateInstanceErrors) IsEmpty() bool

Jump to

Keyboard shortcuts

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