Commit 07160902 authored by Spiros Koulouzis's avatar Spiros Koulouzis

changed interfaces

parent aa0d2e03
...@@ -73,15 +73,14 @@ interface_types: ...@@ -73,15 +73,14 @@ interface_types:
playbook: playbook:
type: string type: string
required: false required: false
default: https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/ansible_playbooks/install_k8s.yml scale:
install:
description: install Kubernetes
k8s_scale:
description: Set the number of replicas for a Deployment, ReplicaSet, or Replication Controller, or the parallelism attribute of a Job. description: Set the number of replicas for a Deployment, ReplicaSet, or Replication Controller, or the parallelism attribute of a Job.
k8s_create: create:
description: create deployment on a k8s cluster description: create deployment on a k8s cluster
k8s_delete: delete:
description: delete deployment on a k8s cluster description: delete deployment on a k8s cluster
k8s_info: autoscale:
description: horizontal_pod_autoscaler
info:
description: get information on pods,services or deployments description: get information on pods,services or deployments
...@@ -49,6 +49,36 @@ node_types: ...@@ -49,6 +49,36 @@ 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:
Kubernetes:
type: tosca.interfaces.ARTICONF.Kubernetes
delete:
inputs:
playbook: https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/delete_service.yml
create:
inputs:
playbook: https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/create_service.yml
scale:
inputs:
playbook: https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/scale_service.yml
replicas:1
autoscale:
inputs:
playbook: https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/autoscale_service.yml
horizontal_pod_autoscaler: https://raw.githubusercontent.com/skoulouzis/CONF/develop/k8s/horizontal_pod_autoscaler.yml
info:
inputs:
playbook: https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/get_info_service.yml
tosca.nodes.ARTICONF.docker.Orchestrator: tosca.nodes.ARTICONF.docker.Orchestrator:
derived_from: tosca.nodes.ARTICONF.Application derived_from: tosca.nodes.ARTICONF.Application
...@@ -95,8 +125,7 @@ node_types: ...@@ -95,8 +125,7 @@ node_types:
required: false required: false
description: the dashboard access url description: the dashboard access url
interfaces: interfaces:
Kubernetes: Standard:
type: tosca.interfaces.ARTICONF.Kubernetes
install: install:
inputs: inputs:
playbook: https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/install_k8s.yml playbook: https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/install_k8s.yml
......
tosca_definitions_version: tosca_simple_yaml_1_0
workflow_types:
def get_interface_types(target):
print(target.node_template.interfaces)
interface_types = []
for interface in target.node_template.interfaces:
interface_types.append(interface)
return interface_types
def deploy(nodes_pair):
target = nodes_pair[0]
source = nodes_pair[1]
interface_types = get_interface_types(source)
if 'Kubernetes' in interface_types:
kubernetes_service.deploy(nodes_pair)
elif 'Kubernetes' in interface_types:
print(source)
print(target)
return None
...@@ -13,6 +13,8 @@ import sure_tosca_client ...@@ -13,6 +13,8 @@ import sure_tosca_client
from sure_tosca_client import Configuration, ApiClient from sure_tosca_client import Configuration, ApiClient
from sure_tosca_client.api import default_api from sure_tosca_client.api import default_api
from service.deploy_service import deploy
class TestDeployer(unittest.TestCase): class TestDeployer(unittest.TestCase):
...@@ -54,13 +56,22 @@ class TestDeployer(unittest.TestCase): ...@@ -54,13 +56,22 @@ class TestDeployer(unittest.TestCase):
doc_id = self.upload_tosca_template(tosca_template_path,tosca_client) doc_id = self.upload_tosca_template(tosca_template_path,tosca_client)
self.assertIsNotNone(doc_id) self.assertIsNotNone(doc_id)
nodes_to_deploy = tosca_client.get_node_templates(doc_id,type_name='tosca.nodes.ARTICONF.Application') nodes_to_deploy = tosca_client.get_node_templates(doc_id,type_name='tosca.nodes.ARTICONF.Application')
self.assertIsNotNone(nodes_to_deploy) self.assertIsNotNone(nodes_to_deploy)
nodes_to_deploy_ordered = [] nodes_pairs = []
infrastructure_nodes = []
for node in nodes_to_deploy: for node in nodes_to_deploy:
related_nodes = tosca_client.get_related_nodes(doc_id,node.name) related_nodes = tosca_client.get_related_nodes(doc_id,node.name)
for related_node in related_nodes: for related_node in related_nodes:
print(related_node) # if related_node in nodes_to_deploy:
pair = (related_node, node)
nodes_pairs.append(pair)
for node_pair in nodes_pairs:
deploy(node_pair)
# tmp_path = tempfile.mkdtemp() # tmp_path = tempfile.mkdtemp()
# vms = tosca.get_vms(tosca_template_dict) # vms = tosca.get_vms(tosca_template_dict)
# inventory_path = ansible_service.write_inventory_file(tmp_path, vms) # inventory_path = ansible_service.write_inventory_file(tmp_path, vms)
......
...@@ -59,23 +59,23 @@ services: ...@@ -59,23 +59,23 @@ services:
- "27017:27017" - "27017:27017"
#manager: manager:
#depends_on: depends_on:
#- rabbit - rabbit
#- mongo - mongo
#- sure-tosca - sure-tosca
#image: manager:3.0.0 image: manager:3.0.0
#environment: environment:
#RABBITMQ_HOST: rabbit RABBITMQ_HOST: rabbit
#MONGO_HOST: mongo MONGO_HOST: mongo
#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
#ports: ports:
#- "30000:8080" - "30000:8080"
sure-tosca: #sure-tosca:
image: sure-tosca:3.0.0 #image: sure-tosca:3.0.0
ports: #ports:
- "8081:8081" #- "8081:8081"
planner: planner:
depends_on: depends_on:
......
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