-
Notifications
You must be signed in to change notification settings - Fork 169
/
Copy pathstack.yaml
105 lines (103 loc) · 3.63 KB
/
stack.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
AWSTemplateFormatVersion: 2010-09-09
Description: Kubernetes default master node pool
Metadata:
Tags:
InfrastructureComponent: "true"
application: "kubernetes"
component: "control-plane"
Mappings:
Images:
{{.Cluster.Region}}:
# Use the node pool's architecture to construct the config item name that we're using to get the AMI name.
MachineImage: '{{ index .NodePool.ConfigItems (print "kuberuntu_image_v1_31_" .NodePool.ConfigItems.kuberuntu_distro_master "_" .Values.InstanceInfo.Architecture) }}'
Resources:
AutoScalingGroup:
CreationPolicy:
ResourceSignal:
Count: '0'
Timeout: PT15M
Properties:
HealthCheckGracePeriod: 480
HealthCheckType: EC2
LaunchTemplate:
LaunchTemplateId: !Ref LaunchTemplate
Version: !GetAtt LaunchTemplate.LatestVersionNumber
MinSize: '{{ .NodePool.MinSize }}'
MaxSize: '{{ .NodePool.MaxSize }}'
Tags:
- Key: Name
PropagateAtLaunch: true
Value: "{{ .NodePool.Name }} ({{ .Cluster.ID }})"
- Key: node.kubernetes.io/role
PropagateAtLaunch: true
Value: master
- Key: zalando.org/pod-max-pids
PropagateAtLaunch: true
Value: "{{ .NodePool.ConfigItems.pod_max_pids }}"
VPCZoneIdentifier:
{{ with $values := .Values }}
{{ range $az := $values.availability_zones }}
- "{{ index $values.subnets $az }}"
{{ end }}
{{ end }}
TargetGroupARNs:
- !ImportValue '{{ .Cluster.ID }}:master-load-balancer-nlb-target-group'
{{- if or (eq .Cluster.ConfigItems.control_plane_load_balancer_internal "serving") (eq .Cluster.ConfigItems.control_plane_load_balancer_internal "active") }}
- !ImportValue '{{ .Cluster.ID }}:control-plane-internal-lb-target-group'
{{- end}}
Type: 'AWS::AutoScaling::AutoScalingGroup'
LaunchTemplate:
Properties:
LaunchTemplateName: '{{.Cluster.LocalID}}-{{ .NodePool.Name }}'
LaunchTemplateData:
MetadataOptions:
HttpTokens: required
TagSpecifications:
- ResourceType: "volume"
Tags:
- Key: application
Value: kubernetes
- Key: component
Value: control-plane
- ResourceType: "network-interface"
Tags:
- Key: application
Value: kubernetes
- Key: component
Value: control-plane
- Key: Name
Value: "{{ .NodePool.Name }} ({{ .Cluster.ID }})"
{{ if .Values.supports_t2_unlimited }}
CreditSpecification:
CpuCredits: unlimited
{{ end }}
BlockDeviceMappings:
- DeviceName: /dev/sda1
Ebs:
DeleteOnTermination: {{.NodePool.ConfigItems.ebs_root_volume_delete_on_termination}}
VolumeSize: {{.NodePool.ConfigItems.ebs_master_root_volume_size}}
VolumeType: gp3
NetworkInterfaces:
- DeviceIndex: 0
# {{ if eq .NodePool.ConfigItems.associate_public_ip_on_launch "true" }}
AssociatePublicIpAddress: true
# {{ end }}
Groups:
- !ImportValue '{{ .Cluster.ID }}:master-security-group'
EbsOptimized: false
IamInstanceProfile:
Name: !Ref AutoScalingInstanceProfile
InstanceInitiatedShutdownBehavior: terminate
ImageId: !FindInMap
- Images
- !Ref 'AWS::Region'
- MachineImage
InstanceType: "{{ index .NodePool.InstanceTypes 0 }}"
UserData: "{{ .Values.UserData }}"
Type: 'AWS::EC2::LaunchTemplate'
AutoScalingInstanceProfile:
Properties:
Path: /
Roles:
- !ImportValue '{{ .Cluster.ID }}:master-iam-role'
Type: 'AWS::IAM::InstanceProfile'