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
50 openstack_config: &openstack_config
51 username: { get_secret: keystone_username }
52 password: { get_secret: keystone_password }
53 tenant_name: { get_secret: keystone_tenant_name }
54 auth_url: { get_secret: keystone_url }
55 region: { get_secret: region }
60 type: cloudify.nodes.SoftwareComponent
63 cloudify.interfaces.lifecycle:
65 implementation: fabric.fabric_plugin.tasks.run_script
67 script_path: scripts/nfs.sh
72 host_string: { get_attribute: [ kubernetes_master_host, ip ] }
73 user: { get_input: agent_user }
74 key: { get_secret: agent_key_private }
76 - type: cloudify.relationships.contained_in
77 target: kubernetes_master_host
79 kubernetes_master_host:
80 type: cloudify.openstack.nodes.Server
82 openstack_config: *openstack_config
84 user: { get_input: agent_user }
85 install_method: remote
87 key: { get_secret: agent_key_private }
92 management_network_name: { get_property: [ public_network, resource_id ] }
94 cloudify.interfaces.lifecycle:
98 image: { get_input: image }
99 flavor: { get_input: flavor }
100 userdata: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
102 - target: kubernetes_master_port
103 type: cloudify.openstack.server_connected_to_port
104 - type: cloudify.relationships.depends_on
105 target: cloudify_host_cloud_config
107 kubernetes_node_host:
108 type: cloudify.openstack.nodes.Server
110 openstack_config: *openstack_config
112 user: { get_input: agent_user }
113 install_method: remote
115 key: { get_secret: agent_key_private }
120 management_network_name: { get_property: [ private_network, resource_id ] }
122 - type: cloudify.relationships.contained_in
123 target: k8s_node_scaling_tier
124 - target: kubernetes_node_port
125 type: cloudify.openstack.server_connected_to_port
127 cloudify.interfaces.lifecycle:
131 image: { get_input: image }
132 flavor: { get_input: flavor }
133 userdata: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
134 cloudify.interfaces.monitoring_agent:
136 implementation: diamond.diamond_agent.tasks.install
140 start: diamond.diamond_agent.tasks.start
141 stop: diamond.diamond_agent.tasks.stop
142 uninstall: diamond.diamond_agent.tasks.uninstall
143 cloudify.interfaces.monitoring:
145 implementation: diamond.diamond_agent.tasks.add_collectors
150 LoadAverageCollector: {}
153 devices: x?vd[a-z]+[0-9]*$
155 ProcessResourcesCollector:
159 measure_collector_time: true
165 kubernetes_security_group:
166 type: cloudify.openstack.nodes.SecurityGroup
168 openstack_config: *openstack_config
170 name: kubernetes_security_group
171 description: kubernetes master security group
173 - remote_ip_prefix: 0.0.0.0/0
175 port_range_max: 65535
179 - remote_ip_prefix: 0.0.0.0/0
181 port_range_max: 65535
185 - remote_ip_prefix: 0.0.0.0/0
187 port_range_max: 65535
191 - remote_ip_prefix: 0.0.0.0/0
193 port_range_max: 65535
198 kubernetes_master_port:
199 type: cloudify.openstack.nodes.Port
201 openstack_config: *openstack_config
203 - type: cloudify.relationships.contained_in
204 target: public_network
205 - type: cloudify.relationships.depends_on
206 target: public_subnet
207 - type: cloudify.openstack.port_connected_to_security_group
208 target: kubernetes_security_group
209 - type: cloudify.openstack.port_connected_to_floating_ip
210 target: kubernetes_master_ip
212 kubernetes_node_port:
213 type: cloudify.openstack.nodes.Port
215 openstack_config: *openstack_config
217 - type: cloudify.relationships.contained_in
218 target: k8s_node_scaling_tier
219 - type: cloudify.relationships.connected_to
220 target: private_network
221 - type: cloudify.relationships.depends_on
222 target: private_subnet
223 - type: cloudify.openstack.port_connected_to_security_group
224 target: kubernetes_security_group
227 type: cloudify.openstack.nodes.Subnet
229 openstack_config: *openstack_config
230 use_external_resource: true
231 resource_id: { get_secret: private_subnet_name }
233 - target: private_network
234 type: cloudify.relationships.contained_in
237 type: cloudify.openstack.nodes.Network
239 openstack_config: *openstack_config
240 use_external_resource: true
241 resource_id: { get_secret: private_network_name }
244 type: cloudify.openstack.nodes.Subnet
246 openstack_config: *openstack_config
247 use_external_resource: true
248 resource_id: { get_secret: public_subnet_name }
250 - target: public_network
251 type: cloudify.relationships.contained_in
253 type: cloudify.openstack.subnet_connected_to_router
256 type: cloudify.openstack.nodes.Network
258 openstack_config: *openstack_config
259 use_external_resource: true
260 resource_id: { get_secret: public_network_name }
263 type: cloudify.openstack.nodes.Router
265 openstack_config: *openstack_config
266 use_external_resource: true
267 resource_id: { get_secret: router_name }
269 - target: external_network
270 type: cloudify.relationships.connected_to
273 type: cloudify.openstack.nodes.Network
275 openstack_config: *openstack_config
276 use_external_resource: true
277 resource_id: { get_secret: external_network_name }
279 k8s_node_scaling_tier:
280 type: cloudify.nodes.Root
282 kubernetes_master_ip:
283 type: cloudify.openstack.nodes.FloatingIP
285 openstack_config: *openstack_config
287 floating_network_name: { get_property: [ external_network, resource_id ] }
293 - kubernetes_node_host
294 - kubernetes_node_port
298 kubernetes_node_vms_scaling_policy:
299 type: cloudify.policies.scaling
302 targets: [k8s_node_group]
306 kubernetes_master_public_ip:
307 value: { get_attribute: [ kubernetes_master_ip, floating_ip_address ] }