1 tosca_definitions_version: cloudify_dsl_1_3
4 This example deploys the OOM Message Router application. Each service/deployment pair is associated with a single Kubernetes node.
5 Node template naming convention: PROVISIONINGAPI_RESOURCETYPE_APPLICATIONCOMPONENT
6 The following resources are created:
8 - openstack_port_zookeeper - NIC that connects to the Openstack Server
9 - openstack_port_kafka - NIC that connects to the Openstack Server
10 - openstack_port_dmaap - NIC that connects to the Openstack Server
11 - openstack_server_zookeeper - a VM that a Kubernetes Node is installed on.
12 - openstack_server_kafka - a VM that a Kubernetes Node is installed on.
13 - openstack_server_dmaap - a VM that a Kubernetes Node is installed on.
14 - kubernetes_node_zookeeper - a Kubernetes node that will join the Kubernetes cluster.
15 - kubernetes_node_kafka - a Kubernetes node that will join the Kubernetes cluster.
16 - kubernetes_node_dmaap - a Kubernetes node that will join the Kubernetes cluster.
17 - kubernetes_deployment_zookeeper - a Kubernetes deployment.
18 - kubernetes_deployment_kafka - a Kubernetes deployment.
19 - kubernetes_deployment_dmaap - a Kubernetes deployment.
20 - kubernetes_service_zookeeper - a Kubernetes service.
21 - kubernetes_service_kafka - a Kubernetes service.
22 - kubernetes_service_dmaap - a Kubernetes service.
23 The following pre-setup steps are assumed, but not required:
24 - Create Cloudify Example Environment: https://github.com/cloudify-examples/cloudify-environment-setup.
25 - Create Kubernetes Cluster: https://github.com/cloudify-examples/simple-kubernetes-blueprint.
28 - https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/4.1/resources/rest-service/cloudify/types/types.yaml
29 # Plugin required: https://github.com/cloudify-cosmo/cloudify-openstack-plugin/releases/download/2.2.0/cloudify_openstack_plugin-2.2.0-py27-none-linux_x86_64-centos-Core.wgn
30 - https://raw.githubusercontent.com/cloudify-cosmo/cloudify-openstack-plugin/2.2.0/plugin.yaml
31 # Plugin required: https://github.com/cloudify-incubator/cloudify-utilities-plugin/releases/download/1.2.5/cloudify_utilities_plugin-1.2.5-py27-none-linux_x86_64-centos-Core.wgn
32 - https://raw.githubusercontent.com/cloudify-incubator/cloudify-utilities-plugin/1.2.5/plugin.yaml
33 # Plugin required: https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/releases/download/1.2.0/cloudify_kubernetes_plugin-1.2.0-py27-none-linux_x86_64-centos-Core.wgn
34 - https://raw.githubusercontent.com/cloudify-incubator/cloudify-kubernetes-plugin/1.2.0/plugin.yaml
35 # Plugin required: http://repository.cloudifysource.org/cloudify/wagons/cloudify-diamond-plugin/1.3.5/cloudify_diamond_plugin-1.3.5-py27-none-linux_x86_64-centos-Core.wgn
36 - https://raw.githubusercontent.com/cloudify-cosmo/cloudify-diamond-plugin/1.3.5/plugin.yaml
37 # Plugin required: http://repository.cloudifysource.org/cloudify/wagons/cloudify-fabric-plugin/1.5/cloudify_fabric_plugin-1.5-py27-none-linux_x86_64-centos-Core.wgn
38 - https://raw.githubusercontent.com/cloudify-cosmo/cloudify-fabric-plugin/1.5/plugin.yaml
39 - cloudify/types/kubernetes.yaml
43 configuration_file_content:
50 description: Image to be used when launching agent VMs
51 default: { get_secret: centos_core_image }
54 description: Flavor of the agent VMs
55 default: { get_secret: large_image_flavor }
59 User for connecting to agent VMs
63 default: message-router
66 default: { concat: [ 'secgrp_', { get_input: app_name } ] }
70 openstack_config: &openstack_config
71 username: { get_secret: keystone_username }
72 password: { get_secret: keystone_password }
73 tenant_name: { get_secret: keystone_tenant_name }
74 auth_url: { get_secret: keystone_url }
75 region: { get_secret: region }
79 openstack_server_port_group_zookeeper:
81 - openstack_server_zookeeper
82 - openstack_port_zookeeper
84 openstack_server_port_group_kafka:
86 - openstack_server_kafka
87 - openstack_port_kafka
89 openstack_server_port_group_dmaap:
91 - openstack_server_dmaap
92 - openstack_port_dmaap
96 openstack_server_port_policies_scaling:
97 type: cloudify.policies.scaling
101 - openstack_server_port_group_zookeeper
102 - openstack_server_port_group_kafka
103 - openstack_server_port_group_dmaap
107 kubernetes_service_zookeeper:
108 type: cloudify.kubernetes.resources.Service
125 - type: cloudify.kubernetes.relationships.managed_by_master
127 - type: cloudify.relationships.depends_on
128 target: kubernetes_deployment_zookeeper
130 kubernetes_deployment_zookeeper:
131 type: cloudify.kubernetes.resources.Deployment
135 resource_path: kubernetes/message-router/message-router-zookeeper.yaml
137 - type: cloudify.kubernetes.relationships.managed_by_master
139 - type: cloudify.relationships.depends_on
140 target: kubernetes_node_zookeeper
142 kubernetes_node_zookeeper:
143 type: cloudify.nodes.Kubernetes.Node
145 - type: cloudify.relationships.contained_in
146 target: openstack_server_zookeeper
148 cloudify.interfaces.lifecycle:
150 implementation: fabric.fabric_plugin.tasks.run_task
153 hostname: { get_attribute: [ SELF, hostname ] }
157 openstack_server_zookeeper:
158 type: cloudify.openstack.nodes.Server
159 properties: &openstack_server_properties
160 openstack_config: *openstack_config
162 user: { get_input: agent_user }
163 install_method: remote
165 key: { get_secret: agent_key_private }
170 management_network_name: { get_property: [ private_network, resource_id ] }
172 - type: cloudify.relationships.contained_in
173 target: k8s_node_scaling_tier
174 - target: openstack_port_zookeeper
175 type: cloudify.openstack.server_connected_to_port
176 - type: cloudify.relationships.depends_on
177 target: cloud_init_openstack_server
178 interfaces: &openstack_server_interfaces
179 cloudify.interfaces.lifecycle:
183 image: { get_input: image }
184 flavor: { get_input: flavor }
185 userdata: { get_attribute: [ cloud_init_openstack_server, cloud_config ] }
186 cloudify.interfaces.monitoring_agent:
188 implementation: diamond.diamond_agent.tasks.install
192 start: diamond.diamond_agent.tasks.start
193 stop: diamond.diamond_agent.tasks.stop
194 uninstall: diamond.diamond_agent.tasks.uninstall
195 cloudify.interfaces.monitoring:
197 implementation: diamond.diamond_agent.tasks.add_collectors
202 LoadAverageCollector: {}
205 devices: x?vd[a-z]+[0-9]*$
207 ProcessResourcesCollector:
211 measure_collector_time: true
217 openstack_port_zookeeper:
218 type: cloudify.openstack.nodes.Port
220 openstack_config: *openstack_config
221 relationships: &openstack_port_relationships
222 - type: cloudify.relationships.contained_in
223 target: k8s_node_scaling_tier
224 - type: cloudify.relationships.connected_to
225 target: private_network
226 - type: cloudify.relationships.depends_on
227 target: private_subnet
228 - type: cloudify.openstack.port_connected_to_security_group
229 target: security_group
231 kubernetes_service_kafka:
232 type: cloudify.kubernetes.resources.Service
249 - type: cloudify.kubernetes.relationships.managed_by_master
251 - type: cloudify.relationships.depends_on
252 target: kubernetes_deployment_kafka
254 kubernetes_deployment_kafka:
255 type: cloudify.kubernetes.resources.Deployment
259 resource_path: kubernetes/message-router/message-router-kafka.yaml
261 - type: cloudify.kubernetes.relationships.managed_by_master
263 - type: cloudify.relationships.depends_on
264 target: kubernetes_node_kafka
265 - type: cloudify.relationships.depends_on
266 target: kubernetes_deployment_zookeeper
268 kubernetes_node_kafka:
269 type: cloudify.nodes.Kubernetes.Node
271 - type: cloudify.relationships.contained_in
272 target: openstack_server_kafka
274 cloudify.interfaces.lifecycle:
276 implementation: fabric.fabric_plugin.tasks.run_task
279 hostname: { get_attribute: [ SELF, hostname ] }
283 openstack_server_kafka:
284 type: cloudify.openstack.nodes.Server
285 properties: *openstack_server_properties
287 - type: cloudify.relationships.contained_in
288 target: k8s_node_scaling_tier
289 - target: openstack_port_kafka
290 type: cloudify.openstack.server_connected_to_port
291 - type: cloudify.relationships.depends_on
292 target: cloud_init_openstack_server
293 interfaces: *openstack_server_interfaces
295 openstack_port_kafka:
296 type: cloudify.openstack.nodes.Port
298 openstack_config: *openstack_config
299 relationships: *openstack_port_relationships
301 kubernetes_service_dmaap:
302 type: cloudify.kubernetes.resources.Service
324 - type: cloudify.kubernetes.relationships.managed_by_master
326 - type: cloudify.relationships.depends_on
327 target: kubernetes_deployment_dmaap
329 kubernetes_deployment_dmaap:
330 type: cloudify.kubernetes.resources.Deployment
334 resource_path: kubernetes/message-router/message-router-dmaap.yaml
336 - type: cloudify.kubernetes.relationships.managed_by_master
338 - type: cloudify.relationships.depends_on
339 target: kubernetes_node_dmaap
340 - type: cloudify.relationships.depends_on
341 target: kubernetes_deployment_zookeeper
343 kubernetes_node_dmaap:
344 type: cloudify.nodes.Kubernetes.Node
346 - type: cloudify.relationships.contained_in
347 target: openstack_server_dmaap
349 cloudify.interfaces.lifecycle:
351 implementation: fabric.fabric_plugin.tasks.run_task
354 hostname: { get_attribute: [ SELF, hostname ] }
358 openstack_server_dmaap:
359 type: cloudify.openstack.nodes.Server
360 properties: *openstack_server_properties
362 - type: cloudify.relationships.contained_in
363 target: k8s_node_scaling_tier
364 - target: openstack_port_dmaap
365 type: cloudify.openstack.server_connected_to_port
366 - type: cloudify.relationships.depends_on
367 target: cloud_init_openstack_server
368 interfaces: *openstack_server_interfaces
370 openstack_port_dmaap:
371 type: cloudify.openstack.nodes.Port
373 openstack_config: *openstack_config
374 relationships: *openstack_port_relationships
377 type: cloudify.openstack.nodes.SecurityGroup
379 openstack_config: *openstack_config
381 name: { get_input: security_group }
382 description: kubernetes master security group
385 - remote_ip_prefix: 0.0.0.0/0
387 - remote_ip_prefix: 0.0.0.0/0
389 - remote_ip_prefix: 0.0.0.0/0
392 - remote_ip_prefix: 0.0.0.0/0
394 - remote_ip_prefix: 0.0.0.0/0
396 - remote_ip_prefix: 0.0.0.0/0
398 - remote_ip_prefix: 0.0.0.0/0
400 - remote_ip_prefix: 0.0.0.0/0
402 - remote_ip_prefix: 0.0.0.0/0
404 - remote_ip_prefix: 0.0.0.0/0
407 - remote_ip_prefix: 0.0.0.0/0
410 - remote_ip_prefix: 0.0.0.0/0
413 - remote_ip_prefix: 0.0.0.0/0
416 - remote_ip_prefix: 0.0.0.0/0
418 - remote_ip_prefix: 0.0.0.0/0
420 - remote_ip_prefix: 0.0.0.0/0
422 - remote_ip_prefix: 0.0.0.0/0
424 - remote_ip_prefix: 0.0.0.0/0
426 - remote_ip_prefix: 0.0.0.0/0
428 - remote_ip_prefix: 0.0.0.0/0
430 - remote_ip_prefix: 0.0.0.0/0
432 - remote_ip_prefix: 0.0.0.0/0
434 - remote_ip_prefix: 0.0.0.0/0
438 type: cloudify.openstack.nodes.Subnet
440 openstack_config: *openstack_config
441 use_external_resource: true
442 resource_id: { get_secret: private_subnet_name }
444 - target: private_network
445 type: cloudify.relationships.contained_in
448 type: cloudify.openstack.nodes.Network
450 openstack_config: *openstack_config
451 use_external_resource: true
452 resource_id: { get_secret: private_network_name }
455 type: cloudify.openstack.nodes.Network
457 openstack_config: *openstack_config
458 use_external_resource: true
459 resource_id: { get_secret: external_network_name }
461 cloud_init_openstack_server:
462 type: cloudify.nodes.CloudInit.CloudConfig
468 - name: { get_input: agent_user }
472 sudo: ['ALL=(ALL) NOPASSWD:ALL']
474 - { get_secret: agent_key_public }
476 - path: /etc/yum.repos.d/kubernetes.repo
480 # installed by cloud-init
483 baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
487 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
488 https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
494 - [python-setuptools]
498 - [docker, 1.12.6-28.git1398f24.el7.centos]
502 - [kubernetes-cni, 0.5.1-0]
506 - systemctl enable docker
507 - systemctl start docker
508 - systemctl enable kubelet
509 - systemctl start kubelet
510 - yum install -y python-pip
511 - pip install --upgrade pip
512 - pip install docker-compose
513 - pip install backports.ssl_match_hostname --upgrade
515 - git clone https://gerrit.onap.org/r/oom.git /tmp/oom
517 - chmod 755 /tmp/oom/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/deploy.sh
518 - sed -i -e "s/\.\/docker_files/\/tmp\/oom\/kubernetes\/config\/docker\/init\/src\/config\/message-router\/dcae-startup-vm-message-router\/docker_files/g" /tmp/oom/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/deploy.sh
519 - sed -i -e "s/\/opt\/docker\/docker-compose/\/bin\/docker-compose/g" /tmp/oom/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/deploy.sh
520 - mv /tmp/oom/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/__docker-compose.yml /tmp/oom/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/docker-compose.yml
521 - mv /tmp/oom/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/__MsgRtrApi.properties /tmp/oom/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/MsgRtrApi.properties
522 - sh -c /tmp/oom/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/deploy.sh
524 k8s_node_scaling_tier:
525 type: cloudify.nodes.Root
528 type: cloudify.kubernetes.nodes.Master
531 file_content: { get_input: configuration_file_content }