Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
8c12d5d8
Commit
8c12d5d8
authored
Jan 15, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set correct permissions
parent
b91005ed
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
48 additions
and
16 deletions
+48
-16
application_example_provisioned.yaml
TOSCA/application_example_provisioned.yaml
+2
-2
Converter.java
...rc/main/java/nl/uva/sne/drip/commons/utils/Converter.java
+0
-2
__main__.py
drip-deployer/__main__.py
+8
-7
ansible_service.cpython-38.pyc
...ployer/service/__pycache__/ansible_service.cpython-38.pyc
+0
-0
k8s_service.cpython-38.pyc
drip-deployer/service/__pycache__/k8s_service.cpython-38.pyc
+0
-0
tosca.cpython-38.pyc
drip-deployer/service/__pycache__/tosca.cpython-38.pyc
+0
-0
ansible_service.py
drip-deployer/service/ansible_service.py
+13
-2
k8s_service.py
drip-deployer/service/k8s_service.py
+12
-0
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+13
-3
No files found.
TOSCA/application_example_provisioned.yaml
View file @
8c12d5d8
...
...
@@ -18,7 +18,7 @@ topology_template:
keys
:
public_key
:
"
c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFBZ1FDVnlpOVNZWitKTnp0ZG9maUM5WXI4RkhHZWJDdHdPUGl0bTFXVmNTL1pPM05tQXhXbXg1RGRD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pFdi9LWTFUY0lhNWQ0MVJnZGtOMlNnWmFNNm54YTM5Q0RYTTYwbmU0cnhRSkFFVTg0CmY2RlVPaEdvMGNhOFNYWkpkMWNxQ0hpWVl3OWpnRldCQXd0SXdSYlJXZEsrcERwZ3RvREprM3VqVWhWVG9rR24KNG9zd2ZhZndZcFNFdkJGUGJ3SkFYeGlVcWpqbFA3eDVKMjhLeDZ6VmdDNk9mcStiQk5PYjVGYzkxbFZ6b3VHbwpFQW8wMkRHZ1l6UlZpT3MxUXN2czNSMUFiRHliNUY0WndNb0hFTWpwZmc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo="
public_ip
:
"
1
92.168.5.5
"
public_ip
:
"
1
72.17.0.2
"
role
:
"
master"
node_type
:
"
XOLarge"
root_key_pair
:
...
...
@@ -44,7 +44,7 @@ topology_template:
keys
:
public_key
:
"
c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFBZ1FDVnlpOVNZWitKTnp0ZG9maUM5WXI4RkhHZWJDdHdPUGl0bTFXVmNTL1pPM05tQXhXbXg1RGRDMUI4MU5GZEVWZEt2Nng2N0diSjI2SEplREhIMU9pMmt3aExDQzM5R0dZNmxPSjh4U0hKMjFJVXVydTRCaGk5STNGSlZ0Q1o0ckhIUGsvcjhkaUlCQ1BrNjc1SllkSERFN0ZUbWpUN0lnOGptdzk0dThYZFpRPT0gYXV0byBnZW5lcmF0ZWQgdXNlciBhY2NlZXMga2V5cwo="
private_key
:
"
LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDV3dJQkFBS0JnUUNWeWk5U1laK0pOenRkb2ZpQzlZcjhGSEdlYkN0d09QaXRtMVdWY1MvWk8zTm1BeFdtCng1RGRDMUI4MU5GZEVWZEt2Nng2N0diSjI2SEplREhIMU9pMmt3aExDQzM5R0dZNmxPSjh4U0hKMjFJVXVydTQKQmhpOUkzRkpWdENaNHJISFBrL3I4ZGlJQkNQazY3NUpZ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View file @
8c12d5d8
...
...
@@ -15,8 +15,6 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
utils
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
...
...
drip-deployer/__main__.py
View file @
8c12d5d8
...
...
@@ -11,10 +11,9 @@ import pika
import
yaml
import
sys
from
service
import
tosca
from
service
import
tosca
,
k8s_service
from
service
import
ansible_service
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -31,7 +30,7 @@ def init_chanel(args):
global
rabbitmq_host
if
len
(
args
)
>
1
:
rabbitmq_host
=
args
[
1
]
queue_name
=
args
[
2
]
# deployer
_qeue
queue_name
=
args
[
2
]
# deployer
else
:
rabbitmq_host
=
'127.0.0.1'
...
...
@@ -70,9 +69,11 @@ def handle_delivery(message):
tosca_file_name
=
'tosca_template'
tosca_template_json
=
parsed_json_message
[
'toscaTemplate'
]
input_current_milli_time
=
lambda
:
int
(
round
(
time
.
time
()
*
1000
))
interfaces
=
tosca
.
get_interfaces
(
tosca_template_json
)
vms
=
tosca
.
get_vms
(
tosca_template_json
)
ansible_service
.
run
(
interfaces
,
vms
)
k8s_service
.
run
(
tosca_template_json
)
template_dict
=
{}
logger
.
info
(
"template ----:
\n
"
+
yaml
.
dump
(
template_dict
))
...
...
@@ -98,8 +99,8 @@ if __name__ == "__main__":
interfaces
=
tosca
.
get_interfaces
(
tosca_template_json
)
vms
=
tosca
.
get_vms
(
tosca_template_json
)
ansible_service
.
run
(
interfaces
,
vms
)
ansible_service
.
run
(
interfaces
,
vms
)
k8s_service
.
run
(
tosca_template_json
)
...
...
drip-deployer/service/__pycache__/ansible_service.cpython-38.pyc
0 → 100644
View file @
8c12d5d8
File added
drip-deployer/service/__pycache__/k8s_service.cpython-38.pyc
0 → 100644
View file @
8c12d5d8
File added
drip-deployer/service/__pycache__/tosca.cpython-38.pyc
View file @
8c12d5d8
No preview for this file type
drip-deployer/service/ansible_service.py
View file @
8c12d5d8
...
...
@@ -4,6 +4,10 @@ import tempfile
import
shutil
from
stat
import
S_IREAD
import
requests
from
subprocess
import
Popen
,
PIPE
from
numpy.distutils.system_info
import
openblas64__info
def
write_ansible_files
(
vms
,
interfaces
,
tmp_path
):
workers
=
[]
...
...
@@ -37,8 +41,8 @@ def write_ansible_files(vms, interfaces, tmp_path):
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
(
'[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
)
...
...
@@ -56,4 +60,11 @@ def write_ansible_files(vms, interfaces, tmp_path):
def
run
(
interfaces
,
vms
):
tmp_path
=
tempfile
.
mkdtemp
()
write_ansible_files
(
vms
,
interfaces
,
tmp_path
)
p
=
Popen
([
"ansible-playbook"
,
"-i"
,
tmp_path
+
"/k8s_hosts"
,
tmp_path
+
"/playbook.yml"
],
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
PIPE
)
output
,
err
=
p
.
communicate
()
print
(
output
)
print
(
err
)
rc
=
p
.
returncode
return
tmp_path
drip-deployer/service/k8s_service.py
0 → 100644
View file @
8c12d5d8
def
get_dockers
(
tosca_template_json
):
pass
def
write_k8s_files
(
dockers
):
pass
def
run
(
tosca_template_json
):
dockers
=
get_dockers
(
tosca_template_json
)
tmp_dir
=
write_k8s_files
(
dockers
)
return
None
\ No newline at end of file
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
8c12d5d8
...
...
@@ -17,12 +17,17 @@ import com.jcraft.jsch.KeyPair;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.nio.file.attribute.PosixFilePermission
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.commons.utils.Converter
;
...
...
@@ -148,6 +153,11 @@ class CloudStormService {
kpair
.
writePrivateKey
(
tempInputDirPath
+
File
.
separator
+
userPrivateName
);
kpair
.
writePublicKey
(
tempInputDirPath
+
File
.
separator
+
userPublicKeyName
,
"auto generated user accees keys"
);
kpair
.
dispose
();
Set
<
PosixFilePermission
>
perms
=
new
HashSet
<>();
perms
.
add
(
PosixFilePermission
.
OWNER_READ
);
Files
.
setPosixFilePermissions
(
Paths
.
get
(
tempInputDirPath
+
File
.
separator
+
userPrivateName
),
perms
);
return
publicKeyPath
;
}
...
...
@@ -285,8 +295,8 @@ class CloudStormService {
private
ToscaTemplate
runCloudStorm
(
String
tempInputDirPath
)
throws
IOException
,
ApiException
{
String
[]
args
=
new
String
[]{
"run"
,
tempInputDirPath
};
//
standalone.MainAsTool.main(args);
tempInputDirPath
=
"/tmp/Input-174407085024744"
;
standalone
.
MainAsTool
.
main
(
args
);
//
tempInputDirPath = "/tmp/Input-174407085024744";
CloudsStormTopTopology
_top
=
objectMapper
.
readValue
(
new
File
(
tempInputDirPath
+
TOPOLOGY_RELATIVE_PATH
+
TOP_TOPOLOGY_FILE_NAME
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment