Commit 6f681612 authored by Spiros Koulouzis's avatar Spiros Koulouzis

deployer works with playbooks. Missing the k8s dashboard

parent f07e3772
...@@ -124,6 +124,37 @@ topology_template: ...@@ -124,6 +124,37 @@ topology_template:
file: "alogo53/ws-pema-lifewatch" file: "alogo53/ws-pema-lifewatch"
repository: "docker_hub" repository: "docker_hub"
type: "tosca.artifacts.Deployment.Image.Container.Docker" type: "tosca.artifacts.Deployment.Image.Container.Docker"
interfaces:
Kubernetes:
type: tosca.interfaces.ARTICONF.Kubernetes
delete:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- delete_service.yml
create:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- create_service.yml
scale:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- scale_service.yml
replicas: 1
autoscale:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- autoscale_service.yml
horizontal_pod_autoscaler: horizontal_pod_autoscaler.yml
info:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- get_info_service.yml
description: "TOSCA example" description: "TOSCA example"
imports: imports:
- nodes: "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml" - nodes: "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"
......
...@@ -33,7 +33,37 @@ topology_template: ...@@ -33,7 +33,37 @@ topology_template:
image: image:
type: tosca.artifacts.Deployment.Image.Container.Docker type: tosca.artifacts.Deployment.Image.Container.Docker
file: mongo:3 file: mongo:3
repository: docker_hub repository: docker_hub
interfaces:
Kubernetes:
delete:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- delete_service.yml
create:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- create_service.yml
scale:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- scale_service.yml
replicas: 1
autoscale:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- autoscale_service.yml
horizontal_pod_autoscaler: horizontal_pod_autoscaler.yml
info:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- get_info_service.yml
policies: policies:
- scalability: - scalability:
......
...@@ -26,7 +26,36 @@ topology_template: ...@@ -26,7 +26,36 @@ topology_template:
image: image:
type: tosca.artifacts.Deployment.Image.Container.Docker type: tosca.artifacts.Deployment.Image.Container.Docker
file: alogo53/ws-pema-lifewatch file: alogo53/ws-pema-lifewatch
repository: docker_hub repository: docker_hub
interfaces:
Kubernetes:
delete:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- delete_service.yml
create:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- create_service.yml
scale:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- scale_service.yml
replicas: 1
autoscale:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- autoscale_service.yml
horizontal_pod_autoscaler: horizontal_pod_autoscaler.yml
info:
inputs:
repository: https://github.com/skoulouzis/playbooks.git
playbooks:
- get_info_service.yml
topology: topology:
......
...@@ -49,13 +49,6 @@ node_types: ...@@ -49,13 +49,6 @@ node_types:
type: string type: string
required: false required: false
description: url of the service description: url of the service
interfaces:
Kubernetes:
create:
implementation: image
inputs:
strategy:
type: Recreate
interfaces: interfaces:
Kubernetes: Kubernetes:
type: tosca.interfaces.ARTICONF.Kubernetes type: tosca.interfaces.ARTICONF.Kubernetes
...@@ -68,7 +61,7 @@ node_types: ...@@ -68,7 +61,7 @@ node_types:
inputs: inputs:
repository: https://github.com/skoulouzis/playbooks.git repository: https://github.com/skoulouzis/playbooks.git
playbooks: playbooks:
- create_service.yml - create_service.yml
scale: scale:
inputs: inputs:
repository: https://github.com/skoulouzis/playbooks.git repository: https://github.com/skoulouzis/playbooks.git
......
...@@ -11,4 +11,4 @@ six==1.14.0 ...@@ -11,4 +11,4 @@ six==1.14.0
python_dateutil==2.8.1 python_dateutil==2.8.1
setuptools==46.1.3 setuptools==46.1.3
urllib3==1.25.8 urllib3==1.25.8
kubernetes==11.0.0
\ No newline at end of file
...@@ -18,7 +18,11 @@ class DeployService: ...@@ -18,7 +18,11 @@ class DeployService:
source = nodes_pair[1] source = nodes_pair[1]
interface_types = tosca_helper.get_interface_types(source) interface_types = tosca_helper.get_interface_types(source)
if interface_types and 'Standard' in interface_types: if interface_types:
ansible_service = AnsibleService(self.semaphore_base_url,self.semaphore_username,self.semaphore_password) if 'Standard' in interface_types:
ansible_service.execute(nodes_pair) ansible_service = AnsibleService(self.semaphore_base_url,self.semaphore_username,self.semaphore_password)
ansible_service.execute(nodes_pair)
else:
print(interface_types)
return None return None
...@@ -20,7 +20,7 @@ services: ...@@ -20,7 +20,7 @@ services:
- "3306:3306" - "3306:3306"
semaphore: semaphore:
image: ansiblesemaphore/semaphore image: alogo53/docker_ansible_semaphore
environment: environment:
SEMAPHORE_DB_USER: semaphore SEMAPHORE_DB_USER: semaphore
SEMAPHORE_DB_PASS: semaphore SEMAPHORE_DB_PASS: semaphore
...@@ -61,7 +61,7 @@ services: ...@@ -61,7 +61,7 @@ services:
- rabbit - rabbit
- mongo - mongo
- sure-tosca - sure-tosca
image: manager:3.0.0 image: alogo53/manager:3.0.0 #manager:3.0.0
environment: environment:
RABBITMQ_HOST: rabbit RABBITMQ_HOST: rabbit
MONGO_HOST: mongo MONGO_HOST: mongo
...@@ -78,7 +78,7 @@ services: ...@@ -78,7 +78,7 @@ services:
depends_on: depends_on:
- rabbit - rabbit
- sure-tosca - sure-tosca
image: planner:3.0.0 image: alogo53/planner:3.0.0 #planner:3.0.0
environment: environment:
RABBITMQ_HOST: rabbit RABBITMQ_HOST: rabbit
...@@ -86,19 +86,19 @@ services: ...@@ -86,19 +86,19 @@ services:
depends_on: depends_on:
- rabbit - rabbit
- sure-tosca - sure-tosca
image: provisioner:3.0.0 image: alogo53/provisioner:3.0.0 #provisioner:3.0.0
environment: environment:
RABBITMQ_HOST: rabbit RABBITMQ_HOST: rabbit
SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0 SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
#deployer: deployer:
#depends_on: depends_on:
#- rabbit - rabbit
#- sure-tosca - sure-tosca
#image: deployer:3.0.0 image: alogo53/deployer:3.0.0 #deployer:3.0.0
#environment: environment:
#RABBITMQ_HOST: rabbit RABBITMQ_HOST: rabbit
#SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0 SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
#volumes: #volumes:
......
...@@ -158,6 +158,7 @@ class Planner: ...@@ -158,6 +158,7 @@ class Planner:
""" Resolve requirements. Go over all nodes and recursively resolve requirements till node has no """ Resolve requirements. Go over all nodes and recursively resolve requirements till node has no
requirements e.g. docker -> k8s -> cluster -> vm """ requirements e.g. docker -> k8s -> cluster -> vm """
for node in self.tosca_template.nodetemplates: for node in self.tosca_template.nodetemplates:
self.add_interfaces(node)
self.add_required_nodes(node) self.add_required_nodes(node)
return self.add_required_nodes_to_template(self.required_nodes) return self.add_required_nodes_to_template(self.required_nodes)
...@@ -295,3 +296,10 @@ class Planner: ...@@ -295,3 +296,10 @@ class Planner:
if parent_node_type_name == self.all_node_types[tosca_node_type]['derived_from']: if parent_node_type_name == self.all_node_types[tosca_node_type]['derived_from']:
child_nodes[tosca_node_type] = self.all_node_types[tosca_node_type] child_nodes[tosca_node_type] = self.all_node_types[tosca_node_type]
return child_nodes return child_nodes
def add_interfaces(self, node):
# node_type_interfaces = tosca_helper.get_node_type_interfaces(node)
# node_template_interfaces = tosca_helper.get_node_template_interfaces(node)
# if not node_template_interfaces and node_type_interfaces:
# tosca_helper.add_interfaces(node,node_type_interfaces)
return node
wheel==0.34.1 wheel==0.34.2
pika==1.1.0 pika==1.1.0
names==0.3.0 names==0.3.0
networkx==2.4 networkx==2.4
pyyaml==5.3 pyyaml==5.3.1
tosca-parser==1.7.0 tosca-parser==2.0.0
matplotlib==3.1.2 matplotlib==3.2.1
\ No newline at end of file \ No newline at end of file
...@@ -270,3 +270,18 @@ def get_node_template_dict(node_template): ...@@ -270,3 +270,18 @@ def get_node_template_dict(node_template):
# print(node_template.templates) # print(node_template.templates)
return node_template_dict return node_template_dict
def get_node_type_interfaces(node):
node_type_interfaces = node.type_definition.interfaces
return node_type_interfaces
def get_node_template_interfaces(node):
node_template_interfaces = node.interfaces
return node_template_interfaces
def add_interfaces(node,node_type_interfaces):
# node.interfaces = node_type_interfaces
return node
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment