Commit b91005ed authored by Spiros Koulouzis's avatar Spiros Koulouzis

write simple deployer

parent ea3cfc1e
......@@ -16,28 +16,43 @@ topology_template:
user_key_pair:
protocol: "ssh"
keys:
public_key: "c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFBZ1FDVnlpOVNZWitKTnp0ZG9maUM5WXI4RkhHZWJDdHdPUGl0bTFXVmNTL1pPM05tQXhXbXg1RGRDMUI4MU5GZEVWZEt2Nng2N0diSjI2SEplREhIMU9pMmt3aExDQzM5R0dZNmxPSjh4U0hKMjFJVXVydTRCaGk5STNGSlZ0Q1o0ckhIUGsvcjhkaQ1BrNjc1SllkSERFN0ZUbWpUN0lnOGptdzk0dThYZFpRPT0gYXV0byBnZW5lcmF0ZWQgdXNlciBhY2NlZXMga2V5cwo="
private_key: "LS0tLS1CRUdJTiBSU0EgUFJJVkUkzRkpWdENaNHJISFBrL3I4ZGlJQkNQazY3NUpZZEhERTdGVG1qVDdJZzhqbXc5NHU4WGRaUUlEQVFBQgpBb0dBYXVhazV6SnMzVXpodlcwL0lwZUMzV3pwdVpxUlZjSVRHRE5uM1FPdWxtWnJjVDU2VVZEVC9pMTQvOTRTCm5VMG04MTNnQnNwNGdVK1NJMnI0ZkJsakN2RjNEYU9KN1VCUTR5OGpEbW5aUGdrK2ljTUQ2dC9SYnNLZzNPRjgKZ0pFeVN3NFF6UGtTZEJ3Z0JIUnZ3bnA4Z1BtUGxmYWRRCBSU0EgUFJJVkFURSBLRVktLS0tLQo="
public_ip: "XXX.XXX.XXX.XXX"
public_key: "c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFBZ1FDVnlpOVNZWitKTnp0ZG9maUM5WXI4RkhHZWJDdHdPUGl0bTFXVmNTL1pPM05tQXhXbXg1RGRDMUI4MU5GZEVWZEt2Nng2N0diSjI2SEplREhIMU9pMmt3aExDQzM5R0dZNmxPSjh4U0hKMjFJVXVydTRCaGk5STNGSlZ0Q1o0ckhIUG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Vl3OWpnRldCQXd0SXdSYlJXZEsrcERwZ3RvREprM3VqVWhWVG9rR24KNG9zd2ZhZndZcFNFdkJGUGJ3SkFYeGlVcWpqbFA3eDVKMjhLeDZ6VmdDNk9mcStiQk5PYjVGYzkxbFZ6b3VHbwpFQW8wMkRHZ1l6UlZpT3MxUXN2czNSMUFiRHliNUY0WndNb0hFTWpwZmc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo="
public_ip: "192.168.5.5"
role: "master"
node_type: "XOLarge"
root_key_pair:
protocol: "ssh"
keys:
public_key: "c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJDWmRRN2JvQ05VNkhWTndRPT0ga2V5UGFpci1iNWUxYTRjMC01ZjA5LTQyMGMtODQ1Yi04YTIyYmJjOWUxMGIK"
private_key: "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDWEFJQkFBS0JnUUNDV04vM3ZVaDVreHhDNnBJZnhuUWE3V3VmWUplbmswbkxKYjFGQU1pN0gzOE1VYnBKCkE3UERwck9SbGhiTEU5ZVVsY1MwakE3Qmp1NXdsVkxlWi8rSjIzK2Z2UHdvb2FIQ0kvVXNiZ3ZFc05sZVhwdmwQ5ODF3dTNlTFB1WnBpWjNKCk93am1TR0pMQWtFQXFQWFJUMzVlU2kzQXBQRFlWQllYZnQ0NlByYWVHOGNSdkpTMFhYSS9vZWhuYmxZRngwZGsKWVQrUjcwajBSQk1TQ0YrVVdSaUlKdlVRR1lXSTBTa29vd0pCQUo0Slo1aXRwNGRtNzUxZlF5K2JsUEp6MjZzUQTlljZkN3R2NubGIrNnVWdQplY2R6dHRianBrbjBzTXdmdGwvL3kyNXl2L3JSdlpmWHRCMzUvNW9ZNUdrPQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo="
host_name: "vm1"
public_key: "c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFBZ1FDQ1dOLzN2VWg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VdSaUlKdlVRR1lXSTBTa29vd0pCQUo0Slo1aXRwNGRtNzUxZlF5K2JsUEp6MjZzUQowbVU4eEpsaHhUM29sdHVkZlk2UUwxd1o0V29aSDkzdE40UkJiM0VsWW56WHdaTjBYd0gzTHFEd0RVOENRQ1dGCmdaZ2Z2aHpIRUZNUTBWbkxGaWlzZlU3VUMwU3I3cnBzWTZtazU1Q3pKZFVROFhPUjNTN2ppU3NVam5wWHFkZUcKTWxHZTZ3Mkx1cW1RU0JQN0NmVUNRQzU3K2o1YVV1M0tIYUJpczVJdzhnVnhlVlczTlljZkN3R2NubGIrNnVWdQplY2R6dHRianBrbjBzTXdmdGwvL3kyNXl2L3JSdlpmWHRCMzUvNW9ZNUdrPQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo="
host_name: "vm0"
compute_1:
properties:
disk_size: "50000 MB"
mem_size: "6000 MB"
num_cores: 2
num_cores: 2.0
os: "Ubuntu 18.04"
user_name: "vm_user"
interfaces:
Standard:
create: "dumy.yaml"
type: "tosca.nodes.ARTICONF.VM.Compute"
attributes:
user_key_pair:
protocol: "ssh"
keys:
public_key: "c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFBZ1FDVnlpOVNZWitKTnp0ZG9maUM5WXI4RkhHZWJDdHdPUGl0bTFXVmNTL1pPM05tQXhXbXg1RGRDMUI4MU5GZEVWZEt2Nng2N0diSjI2SEplREhIMU9pMmt3aExDQzM5R0dZNmxPSjh4U0hKMjFJVXVydTRCaGk5STNGSlZ0Q1o0ckhIUGsvcjhkaUlCQ1BrNjc1SllkSERFN0ZUbWpUN0lnOGptdzk0dThYZFpRPT0gYXV0byBnZW5lcmF0ZWQgdXNlciBhY2NlZXMga2V5cwo="
private_key: "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDV3dJQkFBS0JnUUNWeWk5U1laK0pOenRkb2ZpQzlZcjhGSEdlYkN0d09QaXRtMVdWY1MvWk8zT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V0lhUmU4UjQ5ODF3dTNlTFB1WnBpWjNKCk93am1TR0pMQWtFQXFQWFJUMzVlU2kzQXBQRFlWQllYZnQ0NlByYWVHOGNSdkpTMFhYSS9vZWhuYmxZRngwZGsKWVQrUjcwajBSQk1TQ0YrVVdSaUlKdlVRR1lXSTBTa29vd0pCQUo0Slo1aXRwNGRtNzUxZlF5K2JsUEp6MjZzUQowbVU4eEpsaHhUM29sdHVkZlk2UUwxd1o0V29aSDkzdE40UkJiM0VsWW56WHdaTjBYd0gzTHFEd0RVOENRQ1dGCmdaZ2Z2aHpIRUZNUTBWbkxGaWlzZlU3VUMwU3I3cnBzWTZtazU1Q3pKZFVROFhPUjNTN2ppU3NVam5wWHFkZUcKTWxHZTZ3Mkx1cW1RU0JQN0NmVUNRQzU3K2o1YVV1M0tIYUJpczVJdzhnVnhlVlczTlljZkN3R2NubGIrNnVWdQplY2R6dHRianBrbjBzTXdmdGwvL3kyNXl2L3JSdlpmWHRCMzUvNW9ZNUdrPQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo="
host_name: "vm1"
kubernetes:
properties:
min_masters_num: 1
......@@ -120,7 +135,7 @@ topology_template:
credential:
cloud_provider_name: "ExoGENI"
keys:
keystore: "/u3+7QAAAAIAAAABAAAAAQAEZ2VuaQAAAWt5eo+WAAAFAzCCBP8wDgYKKwYBBAEqAhEBAQUABIIE6+QI4jVyvo+477on8OaF0nwbPvG5QFgYpQDTzX0RDKG5egGch+rxMOHpWerYCmsS5XlHMnUBvqE6lr/H8VieuqwSH97mMwEcwvIdj52nQIuroQsTZampoxYu01"
keystore: "vDxqtcGQaEapBgwFjEUMBIGA1UEAxMLY2guZ2VuaS5uZXSCAQMwOwYDVR0lBDQwMgYIKwYBBQUHAwEGCCsGAQUFBwMCBggrBgEFBQcDCAYIKwYBBQUHAwMGCCsGAQUFBwMEMAkGA1UdEwQCMAAweAYDVR0RBHEwb4EScy5rb3Vsb3V6aXNAdXZhLm5ship1cm46cHVibGljaWQ6SUROK2NoLmdlbmkubmV0K3VzZXIrc2tvdWxvMDGGLXVybjp1dWlkOjg2N2M5NmE3LWU3YTktNDY5Yi05N2RlLWZjNjYxNmIyZWE5NDANBgkqhkiG9w0BAQsFAAOCAQEAJF+4nJ2bqOBYmY9ZmkcH47WJwWHNz/KFrn5tIZ0xODEwMTcyMDU1MjdaFw0yMzEwMjIyMDU1MjdaMIGJMRQwEgYDVQQKDAtjaC5nZW5pLm5ldDESMBAGA1UECwwJYXV0aG9yaXR5MQswCQYDVQQLDAJtYTEtMCsGA1UEAwwkMzFjMG"
token: "password"
token_type: "password"
user: "user"
......
......@@ -122,7 +122,7 @@ node_types:
required: false
description: The coordinates of the domain
attributes:
credential:
ssh_keys:
type: tosca.datatypes.ARTICONF.Credential
required: false
status:
......
pika==1.1.0
names==0.3.0
networkx==2.4
requests=2.22.0
ansible==2.9.2
\ No newline at end of file
def write_invenory_file(vms):
try:
tosca_folder_path = os.path.join(tempfile.gettempdir(), "ansible_files", str(input_current_milli_time()))
except NameError:
import sys
millis = int(round(time.time() * 1000))
tosca_folder_path = os.path.dirname(os.path.abspath(sys.argv[0])) + os.path.join(tempfile.gettempdir(),
"planner_files",
str(millis))
import base64
import os
import tempfile
import shutil
from stat import S_IREAD
import requests
pass
def write_ansible_files(vms, interfaces, tmp_path):
workers = []
k8_master = None
ansible_ssh_private_key_file_path = None
ansible_ssh_user = None
for vm_name in vms:
attributes = vms[vm_name]['attributes']
role = attributes['role']
if role == 'master':
k8_master = attributes['public_ip']
else:
workers.append(attributes['public_ip'])
if ansible_ssh_private_key_file_path is None:
ansible_ssh_private_key_encoded = attributes['user_key_pair']['keys']['private_key']
ansible_ssh_private_key = base64.b64decode(ansible_ssh_private_key_encoded)
ansible_ssh_private_key_file_path = tmp_path + "/id_rsa"
def run(interfaces,vms):
write_invenory_file(vms)
return None
\ No newline at end of file
with open(ansible_ssh_private_key_file_path, "w") as ansible_ssh_private_key_file:
print(ansible_ssh_private_key, file=ansible_ssh_private_key_file)
os.chmod(ansible_ssh_private_key_file_path, S_IREAD)
if ansible_ssh_user == None:
ansible_ssh_user = vms[vm_name]['properties']['user_name']
k8s_hosts_path = tmp_path + "/k8s_hosts"
with open(k8s_hosts_path, "w") as k8s_hosts_file:
print('[k8-master]', file=k8s_hosts_file)
print(k8_master, file=k8s_hosts_file)
print('\n', file=k8s_hosts_file)
print('[worker]', file=k8s_hosts_file)
for worker in workers:
print(worker, file=k8s_hosts_file)
print('\n', file=k8s_hosts_file)
print('[cluster: children]', file=k8s_hosts_file)
print('k8 - master', file=k8s_hosts_file)
print('worker', file=k8s_hosts_file)
print('\n', file=k8s_hosts_file)
print('[cluster:vars]', file=k8s_hosts_file)
print('ansible_ssh_private_key_file=' + ansible_ssh_private_key_file_path, file=k8s_hosts_file)
print('ansible_ssh_common_args=\'-o StrictHostKeyChecking=no\'', file=k8s_hosts_file)
print('ansible_ssh_user=' + ansible_ssh_user, file=k8s_hosts_file)
image_url = interfaces['Standard']['create']['inputs']['playbook']
r = requests.get(image_url)
with open(tmp_path+"/playbook.yml", 'wb') as f:
f.write(r.content)
return tmp_path
def run(interfaces, vms):
tmp_path = tempfile.mkdtemp()
write_ansible_files(vms, interfaces, tmp_path)
return tmp_path
......@@ -115,16 +115,12 @@ public class DRIPService {
}
public String plan(String id) throws ApiException, Exception {
String ymlToscaTemplate = toscaTemplateService.findByID(id);
ToscaTemplate toscaTemplate = toscaTemplateService.getYaml2ToscaTemplate(ymlToscaTemplate);
helper.uploadToscaTemplate(toscaTemplate);
ToscaTemplate toscaTemplate = initExecution(id);
return execute(toscaTemplate);
}
public String provision(String id) throws JsonProcessingException, NotFoundException, IOException, Exception {
String ymlToscaTemplate = toscaTemplateService.findByID(id);
ToscaTemplate toscaTemplate = toscaTemplateService.getYaml2ToscaTemplate(ymlToscaTemplate);
helper.uploadToscaTemplate(toscaTemplate);
ToscaTemplate toscaTemplate = initExecution(id);
toscaTemplate = addCredentials(toscaTemplate);
toscaTemplate = setProvisionOperation(toscaTemplate, OPERATION_PROVISION);
return execute(toscaTemplate);
......@@ -157,8 +153,16 @@ public class DRIPService {
}
}
public String deploy(String id) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
public String deploy(String id) throws JsonProcessingException, NotFoundException, IOException, ApiException, Exception {
ToscaTemplate toscaTemplate = initExecution(id);
return execute(toscaTemplate);
}
private ToscaTemplate initExecution(String id) throws JsonProcessingException, NotFoundException, IOException, ApiException {
String ymlToscaTemplate = toscaTemplateService.findByID(id);
ToscaTemplate toscaTemplate = toscaTemplateService.getYaml2ToscaTemplate(ymlToscaTemplate);
helper.uploadToscaTemplate(toscaTemplate);
return toscaTemplate;
}
}
......@@ -342,6 +342,7 @@ class CloudStormService {
}
vmAttributes.put("node_type", vm.getNodeType());
vmAttributes.put("host_name", vm.getName());
vmAttributes.put("root_key_pair", rootKeyPairCredential);
vmAttributes.put("user_key_pair", userKeyPairCredential);
vmTemplateMap.getNodeTemplate().setAttributes(vmAttributes);
......
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