1 # ============LICENSE_START==========================================
2 # ===================================================================
3 # Copyright (c) 2017 AT&T
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #============LICENSE_END============================================
18 tosca_definitions_version: cloudify_dsl_1_3
21 This blueprint creates a Kubernetes Cluster.
22 It is based on this documentation: https://kubernetes.io/docs/getting-started-guides/kubeadm/
25 - https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/4.1/resources/rest-service/cloudify/types/types.yaml
26 - https://raw.githubusercontent.com/cloudify-cosmo/cloudify-openstack-plugin/2.2.0/plugin.yaml
27 - https://raw.githubusercontent.com/cloudify-incubator/cloudify-utilities-plugin/1.2.5/plugin.yaml
28 - https://raw.githubusercontent.com/cloudify-cosmo/cloudify-fabric-plugin/1.5/plugin.yaml
29 - https://raw.githubusercontent.com/cloudify-cosmo/cloudify-diamond-plugin/1.3.5/plugin.yaml
30 - imports/cloud-config.yaml
31 - imports/kubernetes.yaml
36 description: Image to be used when launching agent VMs
37 default: { get_secret: centos_core_image }
40 description: Flavor of the agent VMs
41 default: { get_secret: large_image_flavor }
45 User for connecting to agent VMs
49 description: helm version to be installed
54 openstack_config: &openstack_config
55 username: { get_secret: keystone_username }
56 password: { get_secret: keystone_password }
57 tenant_name: { get_secret: keystone_tenant_name }
58 auth_url: { get_secret: keystone_url }
59 region: { get_secret: region }
64 type: cloudify.nodes.SoftwareComponent
67 cloudify.interfaces.lifecycle:
69 implementation: fabric.fabric_plugin.tasks.run_script
71 script_path: scripts/nfs.sh
76 host_string: { get_attribute: [ kubernetes_master_host, ip ] }
77 user: { get_input: agent_user }
78 key: { get_secret: agent_key_private }
80 - type: cloudify.relationships.contained_in
81 target: kubernetes_master_host
84 type: cloudify.nodes.SoftwareComponent
87 cloudify.interfaces.lifecycle:
89 implementation: fabric.fabric_plugin.tasks.run_script
91 script_path: scripts/k8s_tools.sh
93 args: [{ get_input: helm_version }]
95 host_string: { get_attribute: [ kubernetes_master_host, ip ] }
96 user: { get_input: agent_user }
97 key: { get_secret: agent_key_private }
99 - type: cloudify.relationships.contained_in
100 target: kubernetes_master
102 kubernetes_master_host:
103 type: cloudify.openstack.nodes.Server
105 openstack_config: *openstack_config
107 user: { get_input: agent_user }
108 install_method: remote
110 key: { get_secret: agent_key_private }
115 management_network_name: { get_property: [ public_network, resource_id ] }
117 cloudify.interfaces.lifecycle:
121 image: { get_input: image }
122 flavor: { get_input: flavor }
123 userdata: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
125 - target: kubernetes_master_port
126 type: cloudify.openstack.server_connected_to_port
127 - type: cloudify.relationships.depends_on
128 target: cloudify_host_cloud_config
130 kubernetes_node_host:
131 type: cloudify.openstack.nodes.Server
133 openstack_config: *openstack_config
135 user: { get_input: agent_user }
136 install_method: remote
138 key: { get_secret: agent_key_private }
143 management_network_name: { get_property: [ private_network, resource_id ] }
145 - type: cloudify.relationships.contained_in
146 target: k8s_node_scaling_tier
147 - target: kubernetes_node_port
148 type: cloudify.openstack.server_connected_to_port
150 cloudify.interfaces.lifecycle:
154 image: { get_input: image }
155 flavor: { get_input: flavor }
156 userdata: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
157 cloudify.interfaces.monitoring_agent:
159 implementation: diamond.diamond_agent.tasks.install
163 start: diamond.diamond_agent.tasks.start
164 stop: diamond.diamond_agent.tasks.stop
165 uninstall: diamond.diamond_agent.tasks.uninstall
166 cloudify.interfaces.monitoring:
168 implementation: diamond.diamond_agent.tasks.add_collectors
173 LoadAverageCollector: {}
176 devices: x?vd[a-z]+[0-9]*$
178 ProcessResourcesCollector:
182 measure_collector_time: true
188 kubernetes_security_group:
189 type: cloudify.openstack.nodes.SecurityGroup
191 openstack_config: *openstack_config
193 name: kubernetes_security_group
194 description: kubernetes master security group
196 - remote_ip_prefix: 0.0.0.0/0
198 port_range_max: 65535
202 - remote_ip_prefix: 0.0.0.0/0
204 port_range_max: 65535
208 - remote_ip_prefix: 0.0.0.0/0
210 port_range_max: 65535
214 - remote_ip_prefix: 0.0.0.0/0
216 port_range_max: 65535
221 kubernetes_master_port:
222 type: cloudify.openstack.nodes.Port
224 openstack_config: *openstack_config
226 - type: cloudify.relationships.contained_in
227 target: public_network
228 - type: cloudify.relationships.depends_on
229 target: public_subnet
230 - type: cloudify.openstack.port_connected_to_security_group
231 target: kubernetes_security_group
232 - type: cloudify.openstack.port_connected_to_floating_ip
233 target: kubernetes_master_ip
235 kubernetes_node_port:
236 type: cloudify.openstack.nodes.Port
238 openstack_config: *openstack_config
240 - type: cloudify.relationships.contained_in
241 target: k8s_node_scaling_tier
242 - type: cloudify.relationships.connected_to
243 target: private_network
244 - type: cloudify.relationships.depends_on
245 target: private_subnet
246 - type: cloudify.openstack.port_connected_to_security_group
247 target: kubernetes_security_group
250 type: cloudify.openstack.nodes.Subnet
252 openstack_config: *openstack_config
253 use_external_resource: true
254 resource_id: { get_secret: private_subnet_name }
256 - target: private_network
257 type: cloudify.relationships.contained_in
260 type: cloudify.openstack.nodes.Network
262 openstack_config: *openstack_config
263 use_external_resource: true
264 resource_id: { get_secret: private_network_name }
267 type: cloudify.openstack.nodes.Subnet
269 openstack_config: *openstack_config
270 use_external_resource: true
271 resource_id: { get_secret: public_subnet_name }
273 - target: public_network
274 type: cloudify.relationships.contained_in
276 type: cloudify.openstack.subnet_connected_to_router
279 type: cloudify.openstack.nodes.Network
281 openstack_config: *openstack_config
282 use_external_resource: true
283 resource_id: { get_secret: public_network_name }
286 type: cloudify.openstack.nodes.Router
288 openstack_config: *openstack_config
289 use_external_resource: true
290 resource_id: { get_secret: router_name }
292 - target: external_network
293 type: cloudify.relationships.connected_to
296 type: cloudify.openstack.nodes.Network
298 openstack_config: *openstack_config
299 use_external_resource: true
300 resource_id: { get_secret: external_network_name }
302 k8s_node_scaling_tier:
303 type: cloudify.nodes.Root
305 kubernetes_master_ip:
306 type: cloudify.openstack.nodes.FloatingIP
308 openstack_config: *openstack_config
310 floating_network_name: { get_property: [ external_network, resource_id ] }
316 - kubernetes_node_host
317 - kubernetes_node_port
321 kubernetes_node_vms_scaling_policy:
322 type: cloudify.policies.scaling
325 targets: [k8s_node_group]
329 kubernetes_master_public_ip:
330 value: { get_attribute: [ kubernetes_master_ip, floating_ip_address ] }