-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathaws-blueprint.yaml
272 lines (248 loc) · 8.07 KB
/
aws-blueprint.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
tosca_definitions_version: cloudify_dsl_1_3
description: >
This blueprint creates a Kubernetes Cluster.
imports:
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/4.1/resources/rest-service/cloudify/types/types.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-aws-plugin/1.5/plugin.yaml
- https://raw.githubusercontent.com/cloudify-incubator/cloudify-utilities-plugin/1.2.5/plugin.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-diamond-plugin/1.3.5/plugin.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-fabric-plugin/1.5/plugin.yaml
- types/kubernetes-types.yaml
- imports/kubernetes.yaml
- imports/cloud-config.yaml
inputs:
ami:
description: >
An AWS AMI. Tested with a Centos 7.0 image.
default: { get_secret: centos_core_image }
instance_type:
description: >
The AWS instance_type. Tested with m3.medium, although that is unnecessarily large.
default: t2.medium
agent_user:
description: >
The username of the agent running on the instance created from the image.
default: ec2-user
dsl_definitions:
aws_config: &aws_config
aws_access_key_id: { get_secret: aws_access_key_id }
aws_secret_access_key: { get_secret: aws_secret_access_key }
ec2_region_name: { get_secret: ec2_region_name }
ec2_region_endpoint: { get_secret: ec2_region_endpoint }
node_templates:
kubernetes_master_host:
type: cloudify.aws.nodes.Instance
properties:
agent_config:
install_method: remote
user: { get_input: agent_user }
port: 22
key: { get_secret: agent_key_private }
aws_config: *aws_config
image_id: { get_input: ami }
instance_type: { get_input: instance_type }
interfaces:
cloudify.interfaces.lifecycle:
create:
implementation: aws.cloudify_aws.ec2.instance.create
inputs:
args:
placement: { get_secret: availability_zone }
user_data: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
relationships:
- type: cloudify.aws.relationships.instance_connected_to_subnet
target: public_subnet
- type: cloudify.aws.relationships.instance_connected_to_security_group
target: ssh_group
- type: cloudify.aws.relationships.instance_connected_to_security_group
target: kubernetes_security_group
- type: cloudify.aws.relationships.instance_connected_to_elastic_ip
target: kubernetes_master_ip
- type: cloudify.relationships.depends_on
target: cloudify_host_cloud_config
kubernetes_node_host:
type: cloudify.aws.nodes.Instance
capabilities:
scalable:
properties:
default_instances: 1
properties:
agent_config:
install_method: remote
user: { get_input: agent_user }
port: 22
key: { get_secret: agent_key_private }
aws_config: *aws_config
image_id: { get_input: ami }
instance_type: { get_input: instance_type }
relationships:
- type: cloudify.aws.relationships.instance_connected_to_eni
target: kubernetes_node_nic
interfaces:
cloudify.interfaces.lifecycle:
create:
implementation: aws.cloudify_aws.ec2.instance.create
inputs:
args:
placement: { get_secret: availability_zone }
user_data: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
cloudify.interfaces.monitoring_agent:
install:
implementation: diamond.diamond_agent.tasks.install
inputs:
diamond_config:
interval: 1
start: diamond.diamond_agent.tasks.start
stop: diamond.diamond_agent.tasks.stop
uninstall: diamond.diamond_agent.tasks.uninstall
cloudify.interfaces.monitoring:
start:
implementation: diamond.diamond_agent.tasks.add_collectors
inputs:
collectors_config:
ProcessResourcesCollector:
config:
enabled: true
unit: B
measure_collector_time: true
cpu_interval: 0.5
process:
hyperkube:
name: hyperkube
kubernetes_node_nic:
type: cloudify.aws.nodes.Interface
properties:
aws_config: *aws_config
relationships:
- type: cloudify.aws.relationships.connected_to_subnet
target: private_subnet
- type: cloudify.aws.relationships.connected_to_security_group
target: ssh_group
- type: cloudify.aws.relationships.connected_to_security_group
target: kubernetes_security_group
kubernetes_security_group:
type: cloudify.aws.nodes.SecurityGroup
properties:
aws_config: *aws_config
description: Security group for Kubernetes Cluster
rules:
- ip_protocol: tcp
from_port: 53
to_port: 53
cidr_ip: 0.0.0.0/0
- ip_protocol: udp
from_port: 53
to_port: 53
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 80
to_port: 80
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 443
to_port: 443
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 2379
to_port: 2379
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 4001
to_port: 4001
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 4789
to_port: 4789
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 6443
to_port: 6443
cidr_ip: 0.0.0.0/0
- ip_protocol: udp
from_port: 6443
to_port: 6443
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 6783
to_port: 6784
cidr_ip: 0.0.0.0/0
- ip_protocol: udp
from_port: 6783
to_port: 6784
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 8080
to_port: 8080
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 9090
to_port: 9090
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 10250
to_port: 10250
cidr_ip: 0.0.0.0/0
relationships:
- type: cloudify.aws.relationships.security_group_contained_in_vpc
target: vpc
ssh_group:
type: cloudify.aws.nodes.SecurityGroup
properties:
aws_config: *aws_config
description: SSH Group
rules:
- ip_protocol: tcp
from_port: 22
to_port: 22
cidr_ip: 0.0.0.0/0
relationships:
- type: cloudify.aws.relationships.security_group_contained_in_vpc
target: vpc
kubernetes_master_ip:
type: cloudify.aws.nodes.ElasticIP
properties:
aws_config: *aws_config
domain: vpc
public_subnet:
type: cloudify.aws.nodes.Subnet
properties:
aws_config: *aws_config
use_external_resource: true
resource_id: { get_secret: public_subnet_id }
cidr_block: N/A
availability_zone: N/A
relationships:
- type: cloudify.aws.relationships.subnet_contained_in_vpc
target: vpc
private_subnet:
type: cloudify.aws.nodes.Subnet
properties:
aws_config: *aws_config
use_external_resource: true
resource_id: { get_secret: private_subnet_id }
cidr_block: N/A
availability_zone: N/A
relationships:
- type: cloudify.aws.relationships.subnet_contained_in_vpc
target: vpc
vpc:
type: cloudify.aws.nodes.VPC
properties:
aws_config: *aws_config
use_external_resource: true
resource_id: { get_secret: vpc_id }
cidr_block: N/A
groups:
k8s_node_group:
members:
- kubernetes_node_host
- kubernetes_node_nic
policies:
kubernetes_node_vms_scaling_policy:
type: cloudify.policies.scaling
properties:
default_instances: 2
targets: [k8s_node_group]
outputs:
kubernetes_master_public_ip:
value: { get_attribute: [ kubernetes_master_ip, aws_resource_id ] }