Created
March 19, 2019 18:26
-
-
Save tckb/4f93ca216af09e285a9df5601076bb34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Description: Tooling Cluster Worker Scaling Group Template | |
Parameters: | |
ClusterName: | |
Type: String | |
ClusterRegion: | |
Type: String | |
ClusterApiEndPoint: | |
Type: String | |
ClusterCAAuth: | |
Type: String | |
ClusterWorkerName: | |
Type: String | |
AvailabilityZones: | |
Type: CommaDelimitedList | |
VPCZoneIdentifier: | |
Type: List<AWS::EC2::Subnet::Id> | |
MaximumCapacity: | |
Type: String | |
MinimumCapacity: | |
Type: String | |
MaxBatchSize: | |
Type: String | |
UpdatePauseTime: | |
Type: String | |
NodeInstanceProfile: | |
Type: String | |
NodeImageId: | |
Type: String | |
NodeInstanceType: | |
Type: String | |
NodeSecurityGroup: | |
Type: String | |
MaxPodsPerNode: | |
Type: Number | |
Resources: | |
ClusterWorkerLC: | |
Type: AWS::AutoScaling::LaunchConfiguration | |
Properties: | |
AssociatePublicIpAddress: true | |
EbsOptimized: true | |
IamInstanceProfile: !Ref NodeInstanceProfile | |
ImageId: !Ref NodeImageId | |
InstanceType: !Ref NodeInstanceType | |
KeyName: 'tools-worker' | |
SecurityGroups: | |
- !Ref NodeSecurityGroup | |
UserData: | |
Fn::Base64: | |
!Sub | | |
#!/bin/bash | |
set -o xtrace | |
/etc/eks/bootstrap.sh \ | |
--use-max-pods ${MaxPodsPerNode} \ | |
--b64-cluster-ca ${ClusterCAAuth} \ | |
--apiserver-endpoint ${ClusterApiEndPoint} \ | |
${ClusterName} | |
/opt/aws/bin/cfn-signal --exit-code $? \ | |
--stack ${AWS::StackName} \ | |
--resource NodeGroup \ | |
--region ${ClusterRegion} | |
ClusterWorkerASG: | |
Type: AWS::AutoScaling::AutoScalingGroup | |
Properties: | |
AvailabilityZones: !Ref AvailabilityZones | |
LaunchConfigurationName: !Ref ClusterWorkerLC | |
MaxSize: !Ref MaximumCapacity | |
MinSize: !Ref MinimumCapacity | |
DesiredCapacity: !Ref MinimumCapacity | |
VPCZoneIdentifier: !Ref VPCZoneIdentifier | |
TerminationPolicies: | |
- OldestLaunchConfiguration | |
- OldestInstance | |
HealthCheckType: EC2 | |
HealthCheckGracePeriod: 300 | |
LifecycleHookSpecificationList: | |
- LifecycleTransition: 'autoscaling:EC2_INSTANCE_TERMINATING' | |
LifecycleHookName: 'WorkerNodeDrainingHook' | |
HeartbeatTimeout: 300 | |
DefaultResult: 'CONTINUE' | |
Tags: | |
- Key: Name | |
Value: !Ref ClusterWorkerName | |
PropagateAtLaunch: true | |
- Key: !Sub kubernetes.io/cluster/${ClusterName} | |
Value: owned | |
PropagateAtLaunch: true | |
UpdatePolicy: | |
AutoScalingRollingUpdate: | |
MinInstancesInService: !Ref MinimumCapacity | |
MaxBatchSize: !Ref MaxBatchSize | |
PauseTime: !Ref UpdatePauseTime | |
Outputs: | |
ClusterWorkerASG: | |
Description: The Cluster Workers Asg | |
Value: !Ref ClusterWorkerASG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment