Documentation ¶
Index ¶
- Constants
- Variables
- func AddReleaseS3Objects(awsc *mocks.MockClients, release *Release)
- func MockAwsClients(release *Release) *mocks.MockClients
- func MockPrepareRelease(release *Release)
- func ValidateELB(service serviceIface, lb *elb.LoadBalancer) error
- func ValidateIAMProfile(service serviceIface, profile *iam.Profile) error
- func ValidateImage(service serviceIface, im *ami.Image) error
- func ValidatePrevASG(service serviceIface, as *asg.ASG) error
- func ValidateSecurityGroup(service serviceIface, sc *sg.SecurityGroup) error
- func ValidateSubnet(service serviceIface, subnet *subnet.Subnet) error
- func ValidateTargetGroup(service serviceIface, tg *alb.TargetGroup) error
- type AutoScalingConfig
- type DetachError
- type HaltError
- type HealthReport
- type LifeCycleHook
- func (lc *LifeCycleHook) FetchResources(iamc aws.IAMAPI, snsc aws.SNSAPI) error
- func (lc *LifeCycleHook) SetDefaults(region *string, accountID *string, name string)
- func (lc *LifeCycleHook) ToLifecycleHookSpecification() *autoscaling.LifecycleHookSpecification
- func (lc *LifeCycleHook) ValidateAttributes() error
- type Policy
- func (a *Policy) Cooldown() *int64
- func (a *Policy) Create(asgc aws.ASGAPI, cwc aws.CWAPI, asgName *string) error
- func (a *Policy) EvaluationPeriods() *int64
- func (a *Policy) Name() *string
- func (a *Policy) Period() *int64
- func (a *Policy) ScalingAdjustment() *int64
- func (a *Policy) SetDefaults(serviceID *string) error
- func (a *Policy) Threshold() *float64
- func (a *Policy) ValidateAttributes() error
- type Release
- func (release *Release) CreateResources(asgc aws.ASGAPI, cwc aws.CWAPI) error
- func (release *Release) DetachAllASGs(asgc aws.ASGAPI, asgs []*asg.ASG) error
- func (release *Release) DetachForFailure(asgc aws.ASGAPI) error
- func (release *Release) DetachForSuccess(asgc aws.ASGAPI) error
- func (release *Release) DownloadUserData(s3c aws.S3API) error
- func (release *Release) FetchResources(asgc aws.ASGAPI, ec2 aws.EC2API, elbc aws.ELBAPI, albc aws.ALBAPI, ...) (*ReleaseResources, error)
- func (release *Release) IsSkipDetachCheck() bool
- func (release *Release) IsSkipDetachStep() bool
- func (release *Release) ResetDesiredCapacity(asgc aws.ASGAPI) error
- func (release *Release) SetDefaults()
- func (release *Release) SetDefaultsWithUserData(s3c aws.S3API) error
- func (release *Release) SetUserData(userdata *string)
- func (release *Release) SuccessfulTearDown(asgc aws.ASGAPI, cwc aws.CWAPI) error
- func (release *Release) UnmarshalJSON(data []byte) error
- func (release *Release) UnsuccessfulTearDown(asgc aws.ASGAPI, cwc aws.CWAPI) error
- func (release *Release) UpdateHealthy(asgc aws.ASGAPI, elbc aws.ELBAPI, albc aws.ALBAPI) error
- func (release *Release) UpdateWithResources(resources *ReleaseResources)
- func (release *Release) UserData() *string
- func (release *Release) UserDataPath() *string
- func (release *Release) Validate(s3c aws.S3API) error
- func (release *Release) ValidateResources(resources *ReleaseResources) error
- func (release *Release) ValidateSafeRelease(s3c aws.S3API, resources *ReleaseResources) error
- func (release *Release) ValidateServices() error
- func (release *Release) ValidateUserDataSHA(s3c aws.S3API) error
- type ReleaseResources
- type SafeReleaseError
- type SafeReleaseServiceError
- type Service
- func (service *Service) ConfigName() *string
- func (service *Service) CreateResources(asgc aws.ASGAPI, cwc aws.CWAPI) error
- func (service *Service) CreatedAt() *time.Time
- func (service *Service) FetchResources(ec2 aws.EC2API, elbc aws.ELBAPI, albc aws.ALBAPI, iamc aws.IAMAPI) (*ServiceResources, error)
- func (service *Service) LifeCycleHookSpecs() []*autoscaling.LifecycleHookSpecification
- func (service *Service) LifeCycleHooks() map[string]*LifeCycleHook
- func (service *Service) Name() *string
- func (service *Service) ProjectName() *string
- func (service *Service) ReleaseID() *string
- func (service *Service) ReleaseUUID() *string
- func (service *Service) ResetDesiredCapacity(asgc aws.ASGAPI) error
- func (service *Service) SafeSetMinDesiredCapacity(asgc aws.ASGAPI, group *asg.ASG, minSize, desiredCapacity int64) error
- func (service *Service) ServiceID() *string
- func (service *Service) SetDefaults(release *Release, serviceName string)
- func (service *Service) SetMinDesiredCapacity(asgc aws.ASGAPI, minSize, desiredCapacity *int64) error
- func (service *Service) SetUserData(userdata *string)
- func (service *Service) SubnetIds() *string
- func (service *Service) Subnets() []*string
- func (service *Service) UpdateHealthy(asgc aws.ASGAPI, elbc aws.ELBAPI, albc aws.ALBAPI) error
- func (service *Service) UserData() *string
- func (service *Service) Validate() error
- func (service *Service) ValidateAttributes() error
- type ServiceResourceNames
- type ServiceResources
- type Strategy
- func (strategy *Strategy) CalculateMinDesired(instances aws.Instances) (int64, int64)
- func (strategy *Strategy) DesiredCapacity() int64
- func (strategy *Strategy) InitialDesiredCapacity() *int64
- func (strategy *Strategy) InitialMinSize() *int64
- func (strategy *Strategy) ReachedMaxTerminations(instances aws.Instances) bool
- func (strategy *Strategy) TargetCapacity() int64
- func (strategy *Strategy) TargetHealthy() int64
- type StrategyType
- type XRelease
- type XReleaseExceptions
Constants ¶
const ( AllAtOnce StrategyType = "AllAtOnce" Canary = "Canary" Percent = "Percent" Increment = "Increment" )
Variables ¶
var STRATEGIES = []string{
"AllAtOnce",
"OneThenAllWithCanary",
"25PercentStepRolloutNoCanary",
"10PercentStepRolloutNoCanary",
"10AtATimeNoCanary",
"20AtATimeNoCanary",
}
Functions ¶
func AddReleaseS3Objects ¶
func AddReleaseS3Objects(awsc *mocks.MockClients, release *Release)
func ValidateELB ¶
func ValidateELB(service serviceIface, lb *elb.LoadBalancer) error
ValidateELB returns
func ValidateIAMProfile ¶
ValidateIAMProfile returns
func ValidateImage ¶
ValidateImage returns
func ValidatePrevASG ¶
ValidatePrevASG returns
func ValidateSecurityGroup ¶
func ValidateSecurityGroup(service serviceIface, sc *sg.SecurityGroup) error
ValidateSecurityGroup returns
func ValidateSubnet ¶
ValidateSubnet returns
func ValidateTargetGroup ¶
func ValidateTargetGroup(service serviceIface, tg *alb.TargetGroup) error
ValidateTargetGroup returns
Types ¶
type AutoScalingConfig ¶
type AutoScalingConfig struct { MinSize *int64 `json:"min_size,omitempty"` MaxSize *int64 `json:"max_size,omitempty"` MaxTerminations *int64 `json:"max_terms,omitempty"` DefaultCooldown *int64 `json:"default_cooldown,omitempty"` HealthCheckGracePeriod *int64 `json:"health_check_grace_period,omitempty"` Spread *float64 `json:"spread,omitempty"` Policies []*Policy `json:"policies,omitempty"` Strategy *string `json:"strategy,omitempty"` }
AutoScalingConfig struct
func (*AutoScalingConfig) SetDefaults ¶
func (a *AutoScalingConfig) SetDefaults(serviceID *string, timeout *int) error
SetDefaults assigns values
func (*AutoScalingConfig) ValidateAttributes ¶
func (a *AutoScalingConfig) ValidateAttributes() error
ValidateAttributes validates attributes
type DetachError ¶
type DetachError struct {
Cause string
}
Errors
func (DetachError) Error ¶
func (e DetachError) Error() string
type HaltError ¶
type HaltError struct {
// contains filtered or unexported fields
}
HaltError error
type HealthReport ¶
type HealthReport struct { TargetHealthy *int64 `json:"target_healthy,omitempty"` // Number of instances aimed to to Launch TargetLaunched *int64 `json:"target_launched,omitempty"` // Number of instances aimed to to Launch Healthy *int `json:"healthy,omitempty"` // Number of instances that are healthy Launching *int `json:"launching,omitempty"` // Number of instances that have been created Terminating *int `json:"terminating,omitempty"` // Number of instances that are Terminating TerminatingIDs []string `json:"terminating_ids,omitempty"` // Instance IDs that are Terminating DesiredCapacity *int64 `json:"desired_capacity,omitempty"` // The current desired capacity goal MinSize *int64 `json:"min_size,omitempty"` // The current min size }
HealthReport is built to make log lines like: web: .....|. gray targets, red terminated, yellow unhealthy, green healthy
type LifeCycleHook ¶
type LifeCycleHook struct { Transistion *string `json:"transition,omitempty"` SNS *string `json:"sns,omitempty"` Role *string `json:"role,omitempty"` HeartbeatTimeout *int64 `json:"heartbeat_timeout,omitempty"` RoleARN *string `json:"role_arn,omitempty"` NotificationTargetARN *string `json:"notification_target_arn,omitempty"` Name *string `json:"name,omitempty"` }
LifeCycleHook struct
func (*LifeCycleHook) FetchResources ¶
FetchResources validates resources exist
func (*LifeCycleHook) SetDefaults ¶
func (lc *LifeCycleHook) SetDefaults(region *string, accountID *string, name string)
SetDefaults assigns default values
func (*LifeCycleHook) ToLifecycleHookSpecification ¶
func (lc *LifeCycleHook) ToLifecycleHookSpecification() *autoscaling.LifecycleHookSpecification
ToLifecycleHookSpecification returns Specification
func (*LifeCycleHook) ValidateAttributes ¶
func (lc *LifeCycleHook) ValidateAttributes() error
ValidateAttributes validates attributes
type Policy ¶
type Policy struct { NameVal *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` ScalingAdjustmentVal *int64 `json:"scaling_adjustment,omitempty"` ThresholdVal *float64 `json:"threshold,omitempty"` PeriodVal *int64 `json:"period,omitempty"` EvaluationPeriodsVal *int64 `json:"evaluation_periods,omitempty"` CooldownVal *int64 `json:"cooldown,omitempty"` // contains filtered or unexported fields }
Policy struct
func (*Policy) EvaluationPeriods ¶
EvaluationPeriods returns eval periods
func (*Policy) ScalingAdjustment ¶
ScalingAdjustment returns up or down adjustment
func (*Policy) SetDefaults ¶
SetDefaults assigns default values
func (*Policy) ValidateAttributes ¶
ValidateAttributes validates attributes
type Release ¶
type Release struct { bifrost.Release SafeRelease bool `json:"safe_release,omitempty"` Subnets []*string `json:"subnets,omitempty"` Image *string `json:"ami,omitempty"` UserDataSHA256 *string `json:"user_data_sha256,omitempty"` // LifeCycleHooks LifeCycleHooks map[string]*LifeCycleHook `json:"lifecycle,omitempty"` // Maintain a Log to look at what has happened Healthy *bool `json:"healthy,omitempty"` WaitForHealthy *int `json:"wait_for_healthy,omitempty"` // AWS Service is Downloaded Services map[string]*Service `json:"services,omitempty"` // Downloaded From S3 // DetachStrategy can be "Detach"(default) | "SkipDetach" || "SkipDetachCheck" DetachStrategy *string `json:"detach_strategy,omitempty"` WaitForDetach *int `json:"wait_for_detach,omitempty"` // contains filtered or unexported fields }
Release is the Data Structure passed between Client to Deployer
func (*Release) CreateResources ¶
CreateResources returns
func (*Release) DetachAllASGs ¶
func (*Release) DetachForFailure ¶
DetachForFailure detach new ASGs
func (*Release) DetachForSuccess ¶
Success
func (*Release) DownloadUserData ¶
DownloadUserData fetches and populates the User data from S3
func (*Release) FetchResources ¶
func (release *Release) FetchResources(asgc aws.ASGAPI, ec2 aws.EC2API, elbc aws.ELBAPI, albc aws.ALBAPI, iamc aws.IAMAPI, snsc aws.SNSAPI) (*ReleaseResources, error)
FetchResources checks the existence of all Resources references in this release and returns a struct of the resources
func (*Release) IsSkipDetachCheck ¶
IsSkipDetachStep returns true if we should skip all detach steps
func (*Release) IsSkipDetachStep ¶
IsSkipDetachStep returns true if we should skip all detach steps
func (*Release) ResetDesiredCapacity ¶
ResetDesiredCapacity resets the ASGs to the desired capacity that would exist without `spread` This is due to a situation where each successive deploy would ratchet up the desired capacity
func (*Release) SetDefaults ¶
func (release *Release) SetDefaults()
SetDefaults assigns default values
func (*Release) SetDefaultsWithUserData ¶
SetDefaultsWithUserData sets the default values including userdata fetched from S3
func (*Release) SetUserData ¶
SetUserData sets the User data
func (*Release) SuccessfulTearDown ¶
SuccessfulTearDown returns
func (*Release) UnmarshalJSON ¶
UnmarshalJSON should error if there is something unexpected
func (*Release) UnsuccessfulTearDown ¶
UnsuccessfulTearDown deletes the services we were trying to create because :(
func (*Release) UpdateHealthy ¶
UpdateHealthy will try set the Healthy attribute First Error is a Halting Error, Second Error is a Retry Error
func (*Release) UpdateWithResources ¶
func (release *Release) UpdateWithResources(resources *ReleaseResources)
UpdateWithResources returns
func (*Release) ValidateResources ¶
func (release *Release) ValidateResources(resources *ReleaseResources) error
ValidateResources returns
func (*Release) ValidateSafeRelease ¶
func (release *Release) ValidateSafeRelease(s3c aws.S3API, resources *ReleaseResources) error
ValidateSafeRelease will error if the currently deployed release has different: 1. Subnets, or Services Or any service has different: 2. Security Groups or Profile 3. ELBs or Target Groups 4. Instance Type or Autoscaling Preferences 5. EBS information 6. AssociatePublicIpAddress
func (*Release) ValidateServices ¶
ValidateServices returns
type ReleaseResources ¶
type SafeReleaseError ¶
type SafeReleaseError struct { Subnets error Timeout error AllServices error MissingService error Services map[string]*SafeReleaseServiceError }
func (*SafeReleaseError) Error ¶
func (sre *SafeReleaseError) Error() string
Prints the list of safe release errors
type SafeReleaseServiceError ¶
type SafeReleaseServiceError struct { SecurityGroups error Profile error ELBs error TargetGroups error EBSVolumeSize error EBSVolumeType error EBSDeviceName error AssociatePublicIpAddress error InstanceType error MinSize error MaxSize error MaxTerminations error DefaultCooldown error HealthCheckGracePeriod error Spread error }
type Service ¶
type Service struct { // Generated ServiceName *string `json:"service_name,omitempty"` // Find these Resources ELBs []*string `json:"elbs,omitempty"` Profile *string `json:"profile,omitempty"` TargetGroups []*string `json:"target_groups,omitempty"` SecurityGroups []*string `json:"security_groups,omitempty"` Tags map[string]*string `json:"tags,omitempty"` // Create Resources InstanceType *string `json:"instance_type,omitempty"` Autoscaling *AutoScalingConfig `json:"autoscaling,omitempty"` SpotPrice *string `json:"spot_price,omitempty"` // EBS EBSVolumeSize *int64 `json:"ebs_volume_size,omitempty"` EBSVolumeType *string `json:"ebs_volume_type,omitempty"` EBSDeviceName *string `json:"ebs_device_name,omitempty"` // Placement Group PlacementGroupName *string `json:"placement_group_name,omitempty"` PlacementGroupPartitionCount *int64 `json:"placement_group_partition_count,omitempty"` PlacementGroupStrategy *string `json:"placement_group_strategy,omitempty"` // Dedicated tenancy or neighbors allowed PlacementTenancy *string `json:"placement_tenancy,omitempty"` // Network AssociatePublicIpAddress *bool `json:"associate_public_ip_address,omitempty"` // Found Resources Resources *ServiceResourceNames `json:"resources,omitempty"` // Created Resources CreatedASG *string `json:"created_asg,omitempty"` PreviousDesiredCapacity *int64 `json:"previous_desired_capacity,omitempty"` // What is Healthy HealthReport *HealthReport `json:"healthy_report,omitempty"` Healthy bool // contains filtered or unexported fields }
Service struct
func (*Service) ConfigName ¶
ConfigName returns config name
func (*Service) CreateResources ¶
CreateResources creates the ASG and Launch configuration for the service
func (*Service) FetchResources ¶
func (service *Service) FetchResources(ec2 aws.EC2API, elbc aws.ELBAPI, albc aws.ALBAPI, iamc aws.IAMAPI) (*ServiceResources, error)
FetchResources attempts to retrieve all resources
func (*Service) LifeCycleHookSpecs ¶
func (service *Service) LifeCycleHookSpecs() []*autoscaling.LifecycleHookSpecification
LifeCycleHookSpecs returns
func (*Service) LifeCycleHooks ¶
func (service *Service) LifeCycleHooks() map[string]*LifeCycleHook
LifeCycleHooks returns
func (*Service) ProjectName ¶
ProjectName returns project name
func (*Service) ReleaseUUID ¶
ReleaseUUID returns release UUID
func (*Service) ResetDesiredCapacity ¶
ResetDesiredCapacity sets the min and desired capacities to their final values
func (*Service) SafeSetMinDesiredCapacity ¶
func (service *Service) SafeSetMinDesiredCapacity(asgc aws.ASGAPI, group *asg.ASG, minSize, desiredCapacity int64) error
SafeSetMinDesiredCapacity is a wrapper around SetMinDesiredCapacity which ensures that 1. minSize and desiredCapacity are never lower than the existing group 2. minSize is never higher than desiredCapacity 3. we don't do anything if the values dont change
func (*Service) SetDefaults ¶
SetDefaults assigns default values
func (*Service) SetMinDesiredCapacity ¶
func (*Service) SetUserData ¶
SetUserData sets the userdata
func (*Service) UpdateHealthy ¶
UpdateHealthy updates the health status of the service This might cause a Halt Error which will force the release to stop
func (*Service) ValidateAttributes ¶
ValidateAttributes validates attributes
type ServiceResourceNames ¶
type ServiceResourceNames struct { Image *string `json:"image,omitempty"` Profile *string `json:"profile_arn,omitempty"` PrevASG *string `json:"prev_asg_arn,omitempty"` SecurityGroups []*string `json:"security_groups,omitempty"` ELBs []*string `json:"elbs,omitempty"` TargetGroups []*string `json:"target_group_arns,omitempty"` Subnets []*string `json:"subnets,omitempty"` }
ServiceResourceNames struct
type ServiceResources ¶
type ServiceResources struct { Image *ami.Image Profile *iam.Profile PrevASG *asg.ASG SecurityGroups []*sg.SecurityGroup ELBs []*elb.LoadBalancer TargetGroups []*alb.TargetGroup Subnets []*subnet.Subnet }
ServiceResources struct
func (*ServiceResources) ToServiceResourceNames ¶
func (sr *ServiceResources) ToServiceResourceNames() *ServiceResourceNames
ToServiceResourceNames returns
func (*ServiceResources) Validate ¶
func (sr *ServiceResources) Validate(service *Service) error
Validate returns
type Strategy ¶
type Strategy struct {
// contains filtered or unexported fields
}
Strategy describes the way in which Odin brings up instances in an Autoscaling Group pulling it out into this struct helps isolate code from the rest of the service
func NewStrategy ¶
func NewStrategy(autoscaling *AutoScalingConfig, previousDesiredCapacity *int64) *Strategy
func (*Strategy) CalculateMinDesired ¶
func (*Strategy) DesiredCapacity ¶
DesiredCapacity is the REAL amount of instances we want. This is later altered for practicality by spread
func (*Strategy) InitialDesiredCapacity ¶
func (*Strategy) InitialMinSize ¶
func (*Strategy) ReachedMaxTerminations ¶
func (*Strategy) TargetCapacity ¶
TargetCapacity is the number of launched instances including the spread
func (*Strategy) TargetHealthy ¶
TargetHealthy is the number of instances the service needs to be Healthy
type StrategyType ¶
type StrategyType string
type XRelease ¶
type XRelease Release
The goal here is to raise an error if a key is sent that is not supported. This should stop many dangerous problems, like misspelling a parameter.
type XReleaseExceptions ¶
type XReleaseExceptions struct { XRelease Task *string // Do not include the Task because that can be implemented }
But the problem is that there are exceptions that we have