Documentation
¶
Overview ¶
Package eks contains utility functions for interacting with EKS
Index ¶
- func ConfigureKubectlForEks(eksCluster *eks.Cluster, kubectlOptions *kubectl.KubectlOptions) error
- func GetAsgByName(svc *autoscaling.AutoScaling, asgName string) (*autoscaling.Group, error)
- func GetClusterByArn(eksClusterArn string) (*eks.Cluster, error)
- func GetClusterNameFromArn(eksClusterArnString string) (string, error)
- func GetRegionFromArn(eksClusterArnString string) (string, error)
- func NewAuthenticatedSession(region string) (*session.Session, error)
- func NewEksClient(region string) (*eks.EKS, error)
- func RollOutDeployment(region string, eksAsgName string, kubectlOptions *kubectl.KubectlOptions, ...) error
- func VerifyCluster(eksClusterArn string, waitForCluster bool, waitMaxRetries int, ...) error
- type CouldNotMeetASGCapacityError
- type CredentialsError
- type EKSClusterNotReady
- type EKSClusterReadyTimeoutError
- type LookupError
- type MultipleLookupErrors
- type MultipleTerminateInstanceErrors
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 ¶
GetClusterByArn returns the EKS Cluster object that corresponds to the given ARN.
func GetClusterNameFromArn ¶
GetClusterNameFromArn extracts the EKS cluster name given the ARN for the cluster.
func GetRegionFromArn ¶
GetRegionFromArn extracts the AWS region that the EKS cluster is in from the ARN of the EKS cluster.
func NewAuthenticatedSession ¶
NewAuthenticatedSession gets an AWS Session, checking that the user has credentials properly configured in their environment.
func NewEksClient ¶
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:
- 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.
- Wait for the new nodes to be ready for Pod scheduling in Kubernetes.
- 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.
- Wait for all the pods to migrate off of the old EKS workers.
- 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 ¶
func (err CouldNotMeetASGCapacityError) Error() string
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 (err MultipleTerminateInstanceErrors) Error() string
func (MultipleTerminateInstanceErrors) IsEmpty ¶
func (err MultipleTerminateInstanceErrors) IsEmpty() bool