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
e61a9a8e
Commit
e61a9a8e
authored
Sep 24, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
send k8s deployment and service files
parent
7b7ed666
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
60 deletions
+49
-60
DeployService.java
.../main/java/nl/uva/sne/drip/api/service/DeployService.java
+18
-5
TOSCAUtils.java
...c/main/java/nl/uva/sne/drip/commons/utils/TOSCAUtils.java
+4
-8
admin.conf
drip-deployer/admin.conf
+0
-19
docker_kubernetes.py
drip-deployer/docker_kubernetes.py
+1
-1
docker_kubernetes.sh
drip-deployer/docker_kubernetes.sh
+14
-16
rpc_server.py
drip-deployer/rpc_server.py
+12
-8
workspace.xml
drip_planner2/.idea/workspace.xml
+0
-3
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/service/DeployService.java
View file @
e61a9a8e
...
@@ -214,10 +214,23 @@ public class DeployService {
...
@@ -214,10 +214,23 @@ public class DeployService {
MessageParameter
managerTypeParameter
=
createManagerTypeParameter
(
"kubernetes"
);
MessageParameter
managerTypeParameter
=
createManagerTypeParameter
(
"kubernetes"
);
parameters
.
add
(
managerTypeParameter
);
parameters
.
add
(
managerTypeParameter
);
List
<
Map
<
String
,
Object
>>
deployments
=
TOSCAUtils
.
tosca2KubernetesDeployment
(
toscaProvisonMap
);
List
<
Map
<
String
,
Object
>>
k8sFiles
=
TOSCAUtils
.
tosca2KubernetesDeployment
(
toscaProvisonMap
);
// String deploymentEncoded = new String(Base64.getDecoder().decode(Converter.map2YmlString(deployments)));
int
count
=
0
;
// MessageParameter confParam = createConfigurationParameter(deploymentEncoded, "kubernetes");
for
(
Map
<
String
,
Object
>
map
:
k8sFiles
)
{
// parameters.add(confParam);
String
deploymentEncoded
=
new
String
(
Base64
.
getEncoder
().
encode
(
Converter
.
map2YmlString
(
map
).
getBytes
()));
MessageParameter
confParam
=
createConfigurationParameter
(
deploymentEncoded
,
"k8s_deploymet"
+
count
);
parameters
.
add
(
confParam
);
count
++;
}
k8sFiles
=
TOSCAUtils
.
tosca2KubernetesService
(
toscaProvisonMap
);
count
=
0
;
for
(
Map
<
String
,
Object
>
map
:
k8sFiles
)
{
String
deploymentEncoded
=
new
String
(
Base64
.
getEncoder
().
encode
(
Converter
.
map2YmlString
(
map
).
getBytes
()));
MessageParameter
confParam
=
createConfigurationParameter
(
deploymentEncoded
,
"k8s_service"
+
count
);
parameters
.
add
(
confParam
);
count
++;
}
Message
deployInvokationMessage
=
new
Message
();
Message
deployInvokationMessage
=
new
Message
();
deployInvokationMessage
.
setParameters
(
parameters
);
deployInvokationMessage
.
setParameters
(
parameters
);
...
...
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/TOSCAUtils.java
View file @
e61a9a8e
...
@@ -156,6 +156,9 @@ public class TOSCAUtils {
...
@@ -156,6 +156,9 @@ public class TOSCAUtils {
}
}
Map
<
String
,
Object
>
image
=
(
Map
<
String
,
Object
>)
((
Map
<
String
,
Object
>)
dockerValues
.
get
(
"artifacts"
)).
get
(
"image"
);
Map
<
String
,
Object
>
image
=
(
Map
<
String
,
Object
>)
((
Map
<
String
,
Object
>)
dockerValues
.
get
(
"artifacts"
)).
get
(
"image"
);
if
(
image
==
null
)
{
image
=
(
Map
<
String
,
Object
>)
((
Map
<
String
,
Object
>)
dockerValues
.
get
(
"artifacts"
)).
get
(
"my_image"
);
}
String
imageFile
=
(
String
)
image
.
get
(
"file"
);
String
imageFile
=
(
String
)
image
.
get
(
"file"
);
Map
<
String
,
Object
>
container
=
new
HashMap
();
Map
<
String
,
Object
>
container
=
new
HashMap
();
container
.
put
(
"image"
,
imageFile
);
container
.
put
(
"image"
,
imageFile
);
...
@@ -184,13 +187,6 @@ public class TOSCAUtils {
...
@@ -184,13 +187,6 @@ public class TOSCAUtils {
deployment
.
put
(
"metadata"
,
metadata
);
deployment
.
put
(
"metadata"
,
metadata
);
deployment
.
put
(
"kind"
,
"Deployment"
);
deployment
.
put
(
"kind"
,
"Deployment"
);
deployment
.
put
(
"apiVersion"
,
"extensions/v1beta1"
);
deployment
.
put
(
"apiVersion"
,
"extensions/v1beta1"
);
//
// try {
// System.err.println(Converter.map2YmlString(deployment));
// System.err.println("----------------------------------");
// } catch (JSONException ex) {
// Logger.getLogger(TOSCAUtils.class.getName()).log(Level.SEVERE, null, ex);
// }
deployments
.
add
(
deployment
);
deployments
.
add
(
deployment
);
}
}
...
@@ -235,7 +231,7 @@ public class TOSCAUtils {
...
@@ -235,7 +231,7 @@ public class TOSCAUtils {
service
.
put
(
"metadata"
,
metadata
);
service
.
put
(
"metadata"
,
metadata
);
service
.
put
(
"kind"
,
"Service"
);
service
.
put
(
"kind"
,
"Service"
);
service
.
put
(
"apiVersion"
,
"v1"
);
service
.
put
(
"apiVersion"
,
"v1"
);
services
.
add
(
service
);
try
{
try
{
System
.
err
.
println
(
Converter
.
map2YmlString
(
service
));
System
.
err
.
println
(
Converter
.
map2YmlString
(
service
));
System
.
err
.
println
(
"----------------------------------"
);
System
.
err
.
println
(
"----------------------------------"
);
...
...
drip-deployer/admin.conf
View file @
e61a9a8e
apiVersion
:
v1
clusters
:
-
cluster
:
certificate
-
authority
-
data
:
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWU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b1BEVHM5ZXZPQlorcEQ1RUh0MU1ja1gyRTJybUNYN1ZKczNMdXBEY0hhckhhVWFiMjBvVndrdmdCNTBUd29abQpSYldJRXY1SHNjbloxMmRSVUR3dGZYMGpIWmdhc0ZVMFExbmc4SDhKYVZxU3YwNENzaWwva0hSOXlBWT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo
=
server
:
https
://
145
.
100
.
133
.
155
:
6443
name
:
kubernetes
contexts
:
-
context
:
cluster
:
kubernetes
user
:
kubernetes
-
admin
name
:
kubernetes
-
admin
@
kubernetes
current
-
context
:
kubernetes
-
admin
@
kubernetes
kind
:
Config
preferences
: {}
users
:
-
name
:
kubernetes
-
admin
user
:
client
-
certificate
-
data
:
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJYnFTZk4vRHNFYjh3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB4T1RBNU1Ua3hOVE0xTkRoYUZ3MHlNREE1TVRneE5UTTFOVEphTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXdxQWlhVGZlOWk2RHRNUzkKN0JqVCszeUR5UDhBdmVJNXdFaWQvVU9paUJDSHlEVndZTmJrSWo0a0NBRGZUekJ3cFZjUG5ZendKUGg1SjQxNgowM3djakdGSkR1RHg0U0IvbzNwMDlDZmNVcmxobUx0SjFPMFFrTWJKOHFOTUlDZFptdlVwNHIzSXVqbGNxcWtiCnRUMVRSLys4akZ6UE50QVlhaVBVbDY0L2lSUGY3V01GU0xBeGhHNFJKeHllZHhKVjhHR0EyVm4vZWN0LysrL3EKWklFbFFDTVg5bVRaMXlzVy90YXJYT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md
,
vm
):
try
:
try
:
logger
.
info
(
"Starting kubernetes slave installation on: "
+
(
vm
.
ip
))
logger
.
info
(
"Starting kubernetes slave installation on: "
+
(
vm
.
ip
))
logger
.
info
(
"User: "
+
(
vm
.
user
)
+
" key file: "
+
vm
.
key
)
logger
.
info
(
"User: "
+
vm
.
user
+
" key file: "
+
vm
.
key
)
ssh
=
paramiko
.
SSHClient
()
ssh
=
paramiko
.
SSHClient
()
ssh
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
ssh
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
ssh
.
connect
(
vm
.
ip
,
username
=
vm
.
user
,
key_filename
=
vm
.
key
,
timeout
=
30
)
ssh
.
connect
(
vm
.
ip
,
username
=
vm
.
user
,
key_filename
=
vm
.
key
,
timeout
=
30
)
...
...
drip-deployer/docker_kubernetes.sh
View file @
e61a9a8e
#! /bin/bash
#! /bin/bash
s
udo s
ed
-i
-re
's/([a-z]{2}\.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g'
/etc/apt/sources.list
sed
-i
-re
's/([a-z]{2}\.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g'
/etc/apt/sources.list
sudo
apt-get update
&&
sudo
apt-get
install
-y
apt-transport-https ca-certificates curl software-properties-common
apt-get update
&&
apt-get
install
-y
apt-transport-https ca-certificates curl software-properties-common
sudo
add-apt-repository
"deb [arch=amd64] https://download.docker.com/linux/ubuntu
$(
lsb_release
-cs
)
stable"
add-apt-repository
"deb [arch=amd64] https://download.docker.com/linux/ubuntu
$(
lsb_release
-cs
)
stable"
curl
-fsSL
https://download.docker.com/linux/ubuntu/gpg |
sudo
apt-key add -
curl
-fsSL
https://download.docker.com/linux/ubuntu/gpg | apt-key add -
sudo
apt-get update
&&
sudo
apt-get
install
-y
--allow-unauthenticated
docker-ce
=
18.06.2~ce~3-0~ubuntu
apt-get update
&&
apt-get
install
-y
--allow-unauthenticated
docker-ce
=
18.06.2~ce~3-0~ubuntu
sudo echo
-e
"{
\n
\"
exec-opts
\"
: [
\"
native.cgroupdriver=systemd
\"
],
\n
\"
log-driver
\"
:
\"
json-file
\"
,
\n
\"
log-opts
\"
: {
\"
max-size
\"
:
\"
100m
\"
},
\n
\"
storage-driver
\"
:
\"
overlay2
\"
\n
}"
>
sudo
/etc/docker/daemon.json
echo
-e
"{
\n
\"
exec-opts
\"
: [
\"
native.cgroupdriver=systemd
\"
],
\n
\"
log-driver
\"
:
\"
json-file
\"
,
\n
\"
log-opts
\"
: {
\"
max-size
\"
:
\"
100m
\"
},
\n
\"
storage-driver
\"
:
\"
overlay2
\"
\n
}"
>
/etc/docker/daemon.json
sudo
mkdir
-p
/etc/systemd/system/docker.service.d
mkdir
-p
/etc/systemd/system/docker.service.d
s
udo
s
ystemctl daemon-reload
systemctl daemon-reload
s
udo
s
ystemctl restart docker
systemctl restart docker
apt-get update
&&
apt-get
install
-y
apt-transport-https curl
curl
-s
https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
sudo
apt-get update
&&
sudo
apt-get
install
-y
apt-transport-https curl
echo
"deb https://apt.kubernetes.io/ kubernetes-xenial main"
|
tee
/etc/apt/sources.list.d/kubernetes.list
sudo
curl
-s
https://packages.cloud.google.com/apt/doc/apt-key.gpg |
sudo
apt-key add -
apt-get update
&&
apt-get
install
-y
kubelet kubeadm kubectl
echo
"deb https://apt.kubernetes.io/ kubernetes-xenial main"
|
sudo tee
/etc/apt/sources.list.d/kubernetes.list
apt-mark hold kubelet kubeadm kubectl
sudo
apt-get update
&&
sudo
apt-get
install
-y
kubelet kubeadm kubectl
sudo
apt-mark hold kubelet kubeadm kubectl
drip-deployer/rpc_server.py
View file @
e61a9a8e
...
@@ -12,7 +12,7 @@ from time import sleep
...
@@ -12,7 +12,7 @@ from time import sleep
import
pika
import
pika
import
ansible_playbook
#
import ansible_playbook
import
docker_check
import
docker_check
import
docker_compose
import
docker_compose
import
docker_engine
import
docker_engine
...
@@ -49,7 +49,7 @@ def threaded_function(args):
...
@@ -49,7 +49,7 @@ def threaded_function(args):
sleep
(
5
)
sleep
(
5
)
def
handle
D
elivery
(
message
):
def
handle
_d
elivery
(
message
):
parsed_json
=
json
.
loads
(
message
)
parsed_json
=
json
.
loads
(
message
)
owner
=
parsed_json
[
'owner'
]
owner
=
parsed_json
[
'owner'
]
params
=
parsed_json
[
"parameters"
]
params
=
parsed_json
[
"parameters"
]
...
@@ -76,7 +76,7 @@ def handleDelivery(message):
...
@@ -76,7 +76,7 @@ def handleDelivery(message):
user
=
param
[
"attributes"
][
"user"
]
user
=
param
[
"attributes"
][
"user"
]
role
=
param
[
"attributes"
][
"role"
]
role
=
param
[
"attributes"
][
"role"
]
node_num
+=
1
node_num
+=
1
key
=
path
+
"
%
d.txt"
%
(
node_num
)
key
=
path
+
"
%
d.txt"
%
node_num
fo
=
open
(
key
,
"w"
)
fo
=
open
(
key
,
"w"
)
fo
.
write
(
value
)
fo
.
write
(
value
)
...
@@ -87,10 +87,14 @@ def handleDelivery(message):
...
@@ -87,10 +87,14 @@ def handleDelivery(message):
vm
=
VmInfo
(
ip
,
user
,
key
,
role
)
vm
=
VmInfo
(
ip
,
user
,
key
,
role
)
vm_list
.
add
(
vm
)
vm_list
.
add
(
vm
)
elif
name
==
"deployment"
:
elif
name
.
startswith
(
'k8s_'
)
:
value
=
param
[
"value"
]
value
=
param
[
"value"
]
value
=
base64
.
b64decode
(
value
)
value
=
base64
.
b64decode
(
value
)
deployment_file
=
path
+
"deployment.yml"
k8s_folder
=
path
+
"/k8s/"
if
not
os
.
path
.
exists
(
k8s_folder
):
os
.
makedirs
(
k8s_folder
)
deployment_file
=
k8s_folder
+
name
+
".yml"
fo
=
open
(
deployment_file
,
"w"
)
fo
=
open
(
deployment_file
,
"w"
)
fo
.
write
(
value
)
fo
.
write
(
value
)
fo
.
close
()
fo
.
close
()
...
@@ -103,7 +107,7 @@ def handleDelivery(message):
...
@@ -103,7 +107,7 @@ def handleDelivery(message):
elif
name
==
"composer"
:
elif
name
==
"composer"
:
value
=
param
[
"value"
]
value
=
param
[
"value"
]
compose_file
=
path
+
"docker-compose.yml"
compose_file
=
path
+
"docker-compose.yml"
if
not
param
[
"attributes"
]
==
None
and
not
param
[
"attributes"
][
"name"
]
==
None
:
if
not
param
[
"attributes"
]
is
None
and
not
param
[
"attributes"
][
"name"
]
is
None
:
compose_name
=
param
[
"attributes"
][
"name"
]
compose_name
=
param
[
"attributes"
][
"name"
]
docker_login
=
{}
docker_login
=
{}
if
'docker_login'
in
param
[
"attributes"
]:
if
'docker_login'
in
param
[
"attributes"
]:
...
@@ -126,7 +130,7 @@ def handleDelivery(message):
...
@@ -126,7 +130,7 @@ def handleDelivery(message):
if
manager_type
==
"kubernetes"
:
if
manager_type
==
"kubernetes"
:
ret
=
docker_kubernetes
.
run
(
vm_list
,
rabbitmq_host
,
owner
)
ret
=
docker_kubernetes
.
run
(
vm_list
,
rabbitmq_host
,
owner
)
docker_kubernetes
.
deploy
(
vm_list
,
deployment_file
)
#
docker_kubernetes.deploy(vm_list, deployment_file)
return
ret
return
ret
elif
manager_type
==
"swarm"
:
elif
manager_type
==
"swarm"
:
ret
=
docker_engine
.
run
(
vm_list
,
rabbitmq_host
,
owner
)
ret
=
docker_engine
.
run
(
vm_list
,
rabbitmq_host
,
owner
)
...
@@ -151,7 +155,7 @@ def handleDelivery(message):
...
@@ -151,7 +155,7 @@ def handleDelivery(message):
def
on_request
(
ch
,
method
,
props
,
body
):
def
on_request
(
ch
,
method
,
props
,
body
):
ret
=
handle
D
elivery
(
body
)
ret
=
handle
_d
elivery
(
body
)
parsed_json
=
json
.
loads
(
body
)
parsed_json
=
json
.
loads
(
body
)
params
=
parsed_json
[
"parameters"
]
params
=
parsed_json
[
"parameters"
]
...
...
drip_planner2/.idea/workspace.xml
View file @
e61a9a8e
...
@@ -2,9 +2,6 @@
...
@@ -2,9 +2,6 @@
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"462ede19-adfe-472b-975e-fefefa973fe0"
name=
"Default Changelist"
comment=
"slolved cap error"
>
<list
default=
"true"
id=
"462ede19-adfe-472b-975e-fefefa973fe0"
name=
"Default Changelist"
comment=
"slolved cap error"
>
<change
beforePath=
"$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/TOSCAUtils.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/TOSCAUtils.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/planner/basic_planner.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/planner/basic_planner.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/easy-install.pth"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/easy-install.pth"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/prettytable.py"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/prettytable.py"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/pyparsing.py"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/pyparsing.py"
beforeDir=
"false"
/>
...
...
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