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
b8cda483
Commit
b8cda483
authored
Jul 01, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added @CrossOrigin(origins = "*")
parent
3cf42bfe
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
74 additions
and
478 deletions
+74
-478
__main__.py
deployer/__main__.py
+0
-2
__init__.py
deployer/build/lib/test/__init__.py
+0
-0
test_deployer.py
deployer/build/lib/test/test_deployer.py
+0
-82
semaphore_client-1.0.0-py3.6.egg
deployer/dist/semaphore_client-1.0.0-py3.6.egg
+0
-0
admin_cluster_role_binding.yaml
deployer/k8s/admin_cluster_role_binding.yaml
+0
-13
admin_service_account.yaml
deployer/k8s/admin_service_account.yaml
+0
-7
dashboard.yaml
deployer/k8s/dashboard.yaml
+0
-304
template-deployment.yaml
deployer/k8s/template-deployment.yaml
+0
-25
template-service.yaml
deployer/k8s/template-service.yaml
+0
-14
deploy_service.cpython-38.pyc
deployer/service/__pycache__/deploy_service.cpython-38.pyc
+0
-0
tosca_helper.cpython-38.pyc
deployer/service/__pycache__/tosca_helper.cpython-38.pyc
+0
-0
ansible_service.py
deployer/service/ansible_service.py
+11
-3
deploy_service.py
deployer/service/deploy_service.py
+7
-11
tosca_helper.py
deployer/service/tosca_helper.py
+0
-2
docker-compose-test.yml
docker-compose/docker-compose-test.yml
+33
-12
manager-service.yaml
k8s/CONF/manager-service.yaml
+9
-3
CredentialApiController.java
...ain/java/nl/uva/sne/drip/api/CredentialApiController.java
+2
-0
DeployerApiController.java
.../main/java/nl/uva/sne/drip/api/DeployerApiController.java
+2
-0
PlannerApiController.java
...c/main/java/nl/uva/sne/drip/api/PlannerApiController.java
+2
-0
ProvisionerApiController.java
...in/java/nl/uva/sne/drip/api/ProvisionerApiController.java
+2
-0
ScalerApiController.java
...rc/main/java/nl/uva/sne/drip/api/ScalerApiController.java
+2
-0
ToscaTemplateApiController.java
.../java/nl/uva/sne/drip/api/ToscaTemplateApiController.java
+2
-0
UserApiController.java
.../src/main/java/nl/uva/sne/drip/api/UserApiController.java
+2
-0
No files found.
deployer/__main__.py
View file @
b8cda483
...
@@ -91,8 +91,6 @@ def handle_delivery(message):
...
@@ -91,8 +91,6 @@ def handle_delivery(message):
try
:
try
:
for
node_pair
in
nodes_pairs
:
for
node_pair
in
nodes_pairs
:
updated_node
=
deployService
.
deploy
(
node_pair
)
updated_node
=
deployService
.
deploy
(
node_pair
)
if
not
updated_node
:
print
(
updated_node
)
if
isinstance
(
updated_node
,
list
):
if
isinstance
(
updated_node
,
list
):
for
node
in
updated_node
:
for
node
in
updated_node
:
tosca_template_dict
=
tosca_helper
.
set_node
(
node
,
tosca_template_dict
)
tosca_template_dict
=
tosca_helper
.
set_node
(
node
,
tosca_template_dict
)
...
...
deployer/build/lib/test/__init__.py
deleted
100644 → 0
View file @
3cf42bfe
deployer/build/lib/test/test_deployer.py
deleted
100644 → 0
View file @
3cf42bfe
import
copy
import
json
import
logging
import
os
import
os.path
import
tempfile
import
time
import
yaml
import
re
# noqa: F401
from
pathlib
import
Path
import
unittest
import
sure_tosca_client
from
sure_tosca_client
import
Configuration
,
ApiClient
from
sure_tosca_client.api
import
default_api
from
service.deploy_service
import
DeployService
from
service.tosca_helper
import
ToscaHelper
class
TestDeployer
(
unittest
.
TestCase
):
def
test
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
message_file_path
=
str
(
Path
.
home
())
+
'/Downloads/message_deploy_request.json'
if
os
.
path
.
isfile
(
message_file_path
):
with
open
(
message_file_path
,
'r'
)
as
stream
:
parsed_json_message
=
json
.
load
(
stream
)
# owner = parsed_json_message['owner']
tosca_file_name
=
'tosca_template'
tosca_template_dict
=
parsed_json_message
[
'toscaTemplate'
]
tmp_path
=
tempfile
.
mkdtemp
()
tosca_template_path
=
tmp_path
+
os
.
path
.
sep
+
'toscaTemplate.yml'
with
open
(
tosca_template_path
,
'w'
)
as
outfile
:
yaml
.
dump
(
tosca_template_dict
,
outfile
,
default_flow_style
=
False
)
sure_tosca_base_url
=
'http://127.0.0.1:8081/tosca-sure/1.0.0'
semaphore_base_url
=
'http://127.0.0.1:3000/api'
tosca_service_is_up
=
ToscaHelper
.
service_is_up
(
sure_tosca_base_url
)
semaphore_is_up
=
ToscaHelper
.
service_is_up
(
semaphore_base_url
)
if
tosca_service_is_up
and
semaphore_is_up
:
tosca_helper
=
ToscaHelper
(
sure_tosca_base_url
,
tosca_template_path
)
self
.
assertIsNotNone
(
tosca_helper
.
doc_id
)
nodes_to_deploy
=
tosca_helper
.
get_application_nodes
()
self
.
assertIsNotNone
(
nodes_to_deploy
)
nodes_pairs
=
tosca_helper
.
get_deployment_node_pairs
()
self
.
assertIsNotNone
(
nodes_pairs
)
username
=
'admin'
deployService
=
DeployService
(
polemarch_base_url
=
polemarch_base_url
,
polemarch_username
=
username
,
polemarch_password
=
'admin'
,
semaphore_base_url
=
semaphore_base_url
,
semaphore_username
=
username
,
semaphore_password
=
'password'
)
for
node_pair
in
nodes_pairs
:
deployService
.
deploy
(
node_pair
)
def
get_tosca_file
(
self
,
file_name
):
tosca_path
=
"../../TOSCA/"
input_tosca_file_path
=
tosca_path
+
'/'
+
file_name
if
not
os
.
path
.
exists
(
input_tosca_file_path
):
tosca_path
=
"../TOSCA/"
input_tosca_file_path
=
tosca_path
+
'/'
+
file_name
dir_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
self
.
assertEqual
(
True
,
os
.
path
.
exists
(
input_tosca_file_path
),
'Starting from: '
+
dir_path
+
' Input TOSCA file: '
+
input_tosca_file_path
+
' not found'
)
return
input_tosca_file_path
if
__name__
==
'__main__'
:
import
unittest
unittest
.
main
()
deployer/dist/semaphore_client-1.0.0-py3.6.egg
deleted
100644 → 0
View file @
3cf42bfe
File deleted
deployer/k8s/admin_cluster_role_binding.yaml
deleted
100644 → 0
View file @
3cf42bfe
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
ClusterRoleBinding
metadata
:
name
:
admin-user
roleRef
:
apiGroup
:
rbac.authorization.k8s.io
kind
:
ClusterRole
name
:
cluster-admin
subjects
:
-
kind
:
ServiceAccount
name
:
admin-user
#namespace: kubernetes-dashboard
namespace
:
default
deployer/k8s/admin_service_account.yaml
deleted
100644 → 0
View file @
3cf42bfe
apiVersion
:
v1
kind
:
ServiceAccount
metadata
:
name
:
admin-user
#namespace: kubernetes-dashboard
namespace
:
default
#kube-system
deployer/k8s/dashboard.yaml
deleted
100644 → 0
View file @
3cf42bfe
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion
:
v1
kind
:
Namespace
metadata
:
name
:
kubernetes-dashboard
---
apiVersion
:
v1
kind
:
ServiceAccount
metadata
:
labels
:
k8s-app
:
kubernetes-dashboard
name
:
kubernetes-dashboard
namespace
:
kubernetes-dashboard
---
kind
:
Service
apiVersion
:
v1
metadata
:
labels
:
k8s-app
:
kubernetes-dashboard
name
:
kubernetes-dashboard
namespace
:
kubernetes-dashboard
spec
:
type
:
NodePort
ports
:
-
port
:
8443
nodePort
:
30443
selector
:
k8s-app
:
kubernetes-dashboard
---
apiVersion
:
v1
kind
:
Secret
metadata
:
labels
:
k8s-app
:
kubernetes-dashboard
name
:
kubernetes-dashboard-certs
namespace
:
kubernetes-dashboard
type
:
Opaque
---
apiVersion
:
v1
kind
:
Secret
metadata
:
labels
:
k8s-app
:
kubernetes-dashboard
name
:
kubernetes-dashboard-csrf
namespace
:
kubernetes-dashboard
type
:
Opaque
data
:
csrf
:
"
"
---
apiVersion
:
v1
kind
:
Secret
metadata
:
labels
:
k8s-app
:
kubernetes-dashboard
name
:
kubernetes-dashboard-key-holder
namespace
:
kubernetes-dashboard
type
:
Opaque
---
kind
:
ConfigMap
apiVersion
:
v1
metadata
:
labels
:
k8s-app
:
kubernetes-dashboard
name
:
kubernetes-dashboard-settings
namespace
:
kubernetes-dashboard
---
kind
:
Role
apiVersion
:
rbac.authorization.k8s.io/v1
metadata
:
labels
:
k8s-app
:
kubernetes-dashboard
name
:
kubernetes-dashboard
namespace
:
kubernetes-dashboard
rules
:
# Allow Dashboard to get, update and delete Dashboard exclusive secrets.
-
apiGroups
:
[
"
"
]
resources
:
[
"
secrets"
]
resourceNames
:
[
"
kubernetes-dashboard-key-holder"
,
"
kubernetes-dashboard-certs"
,
"
kubernetes-dashboard-csrf"
]
verbs
:
[
"
get"
,
"
update"
,
"
delete"
]
# Allow Dashboard to get and update 'kubernetes-dashboard-settings' config map.
-
apiGroups
:
[
"
"
]
resources
:
[
"
configmaps"
]
resourceNames
:
[
"
kubernetes-dashboard-settings"
]
verbs
:
[
"
get"
,
"
update"
]
# Allow Dashboard to get metrics.
-
apiGroups
:
[
"
"
]
resources
:
[
"
services"
]
resourceNames
:
[
"
heapster"
,
"
dashboard-metrics-scraper"
]
verbs
:
[
"
proxy"
]
-
apiGroups
:
[
"
"
]
resources
:
[
"
services/proxy"
]
resourceNames
:
[
"
heapster"
,
"
http:heapster:"
,
"
https:heapster:"
,
"
dashboard-metrics-scraper"
,
"
http:dashboard-metrics-scraper"
]
verbs
:
[
"
get"
]
---
kind
:
ClusterRole
apiVersion
:
rbac.authorization.k8s.io/v1
metadata
:
labels
:
k8s-app
:
kubernetes-dashboard
name
:
kubernetes-dashboard
rules
:
# Allow Metrics Scraper to get metrics from the Metrics server
-
apiGroups
:
[
"
metrics.k8s.io"
]
resources
:
[
"
pods"
,
"
nodes"
]
verbs
:
[
"
get"
,
"
list"
,
"
watch"
]
---
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
RoleBinding
metadata
:
labels
:
k8s-app
:
kubernetes-dashboard
name
:
kubernetes-dashboard
namespace
:
kubernetes-dashboard
roleRef
:
apiGroup
:
rbac.authorization.k8s.io
kind
:
Role
name
:
kubernetes-dashboard
subjects
:
-
kind
:
ServiceAccount
name
:
kubernetes-dashboard
namespace
:
kubernetes-dashboard
---
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
ClusterRoleBinding
metadata
:
name
:
kubernetes-dashboard
roleRef
:
apiGroup
:
rbac.authorization.k8s.io
kind
:
ClusterRole
name
:
kubernetes-dashboard
subjects
:
-
kind
:
ServiceAccount
name
:
kubernetes-dashboard
namespace
:
kubernetes-dashboard
---
kind
:
Deployment
apiVersion
:
apps/v1
metadata
:
labels
:
k8s-app
:
kubernetes-dashboard
name
:
kubernetes-dashboard
namespace
:
kubernetes-dashboard
spec
:
replicas
:
1
revisionHistoryLimit
:
10
selector
:
matchLabels
:
k8s-app
:
kubernetes-dashboard
template
:
metadata
:
labels
:
k8s-app
:
kubernetes-dashboard
spec
:
containers
:
-
name
:
kubernetes-dashboard
image
:
kubernetesui/dashboard:v2.0.0-rc3
imagePullPolicy
:
Always
ports
:
-
containerPort
:
8443
protocol
:
TCP
args
:
-
--auto-generate-certificates
-
--namespace=kubernetes-dashboard
# Uncomment the following line to manually specify Kubernetes API server Host
# If not specified, Dashboard will attempt to auto discover the API server and connect
# to it. Uncomment only if the default does not work.
# - --apiserver-host=http://my-address:port
volumeMounts
:
-
name
:
kubernetes-dashboard-certs
mountPath
:
/certs
# Create on-disk volume to store exec logs
-
mountPath
:
/tmp
name
:
tmp-volume
livenessProbe
:
httpGet
:
scheme
:
HTTPS
path
:
/
port
:
8443
initialDelaySeconds
:
30
timeoutSeconds
:
30
securityContext
:
allowPrivilegeEscalation
:
false
readOnlyRootFilesystem
:
true
runAsUser
:
1001
runAsGroup
:
2001
volumes
:
-
name
:
kubernetes-dashboard-certs
secret
:
secretName
:
kubernetes-dashboard-certs
-
name
:
tmp-volume
emptyDir
:
{}
serviceAccountName
:
kubernetes-dashboard
nodeSelector
:
"
beta.kubernetes.io/os"
:
linux
# Comment the following tolerations if Dashboard must not be deployed on master
tolerations
:
-
key
:
node-role.kubernetes.io/master
effect
:
NoSchedule
---
kind
:
Service
apiVersion
:
v1
metadata
:
labels
:
k8s-app
:
dashboard-metrics-scraper
name
:
dashboard-metrics-scraper
namespace
:
kubernetes-dashboard
spec
:
ports
:
-
port
:
8000
targetPort
:
8000
selector
:
k8s-app
:
dashboard-metrics-scraper
---
kind
:
Deployment
apiVersion
:
apps/v1
metadata
:
labels
:
k8s-app
:
dashboard-metrics-scraper
name
:
dashboard-metrics-scraper
namespace
:
kubernetes-dashboard
spec
:
replicas
:
1
revisionHistoryLimit
:
10
selector
:
matchLabels
:
k8s-app
:
dashboard-metrics-scraper
template
:
metadata
:
labels
:
k8s-app
:
dashboard-metrics-scraper
annotations
:
seccomp.security.alpha.kubernetes.io/pod
:
'
runtime/default'
spec
:
containers
:
-
name
:
dashboard-metrics-scraper
image
:
kubernetesui/metrics-scraper:v1.0.3
ports
:
-
containerPort
:
8000
protocol
:
TCP
livenessProbe
:
httpGet
:
scheme
:
HTTP
path
:
/
port
:
8000
initialDelaySeconds
:
30
timeoutSeconds
:
30
volumeMounts
:
-
mountPath
:
/tmp
name
:
tmp-volume
securityContext
:
allowPrivilegeEscalation
:
false
readOnlyRootFilesystem
:
true
runAsUser
:
1001
runAsGroup
:
2001
serviceAccountName
:
kubernetes-dashboard
nodeSelector
:
"
beta.kubernetes.io/os"
:
linux
# Comment the following tolerations if Dashboard must not be deployed on master
tolerations
:
-
key
:
node-role.kubernetes.io/master
effect
:
NoSchedule
volumes
:
-
name
:
tmp-volume
emptyDir
:
{}
deployer/k8s/template-deployment.yaml
deleted
100644 → 0
View file @
3cf42bfe
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
labels
:
app
:
NAME
name
:
NAME
namespace
:
default
spec
:
selector
:
matchLabels
:
app
:
NAME
replicas
:
1
template
:
metadata
:
labels
:
app
:
NAME
spec
:
containers
:
-
image
:
IMAGE_NAME
name
:
NAME
ports
:
-
containerPort
:
PORT
env
:
-
name
:
ENV_NAME
value
:
ENV_VAL
deployer/k8s/template-service.yaml
deleted
100644 → 0
View file @
3cf42bfe
apiVersion
:
v1
kind
:
Service
metadata
:
labels
:
app
:
NAME
name
:
NAME
namespace
:
default
spec
:
type
:
NodePort
ports
:
-
port
:
CONTAINER_PORT
nodePort
:
NODE_PORT
selector
:
app
:
NAME
deployer/service/__pycache__/deploy_service.cpython-38.pyc
deleted
100644 → 0
View file @
3cf42bfe
File deleted
deployer/service/__pycache__/tosca_helper.cpython-38.pyc
deleted
100644 → 0
View file @
3cf42bfe
File deleted
deployer/service/ansible_service.py
View file @
b8cda483
...
@@ -61,8 +61,11 @@ class AnsibleService:
...
@@ -61,8 +61,11 @@ class AnsibleService:
task_id
=
self
.
run_task
(
name
,
project_id
,
key_id
,
git_url
,
inventory_id
,
playbook_name
,
task_id
=
self
.
run_task
(
name
,
project_id
,
key_id
,
git_url
,
inventory_id
,
playbook_name
,
environment_id
=
environment_id
)
environment_id
=
environment_id
)
if
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
!=
'success'
:
if
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
!=
'success'
:
break
msg
=
''
# logger.info('playbook: ' + playbook_name + ' task_id: ' + str(task_id))
for
out
in
self
.
semaphore_helper
.
get_task_outputs
(
project_id
,
task_id
):
msg
=
msg
+
out
.
output
raise
Exception
(
'Task: '
+
playbook_name
+
' failed. '
+
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
+
' Output: '
+
msg
)
tasks_outputs
[
task_id
]
=
self
.
semaphore_helper
.
get_task_outputs
(
project_id
,
task_id
)
tasks_outputs
[
task_id
]
=
self
.
semaphore_helper
.
get_task_outputs
(
project_id
,
task_id
)
if
'configure'
in
interface
and
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
==
'success'
:
if
'configure'
in
interface
and
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
==
'success'
:
...
@@ -77,7 +80,12 @@ class AnsibleService:
...
@@ -77,7 +80,12 @@ class AnsibleService:
task_id
=
self
.
run_task
(
name
,
project_id
,
key_id
,
git_url
,
inventory_id
,
playbook_name
,
task_id
=
self
.
run_task
(
name
,
project_id
,
key_id
,
git_url
,
inventory_id
,
playbook_name
,
environment_id
=
environment_id
)
environment_id
=
environment_id
)
if
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
!=
'success'
:
if
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
!=
'success'
:
break
msg
=
''
for
out
in
self
.
semaphore_helper
.
get_task_outputs
(
project_id
,
task_id
):
msg
=
msg
+
out
.
output
raise
Exception
(
'Task: '
+
playbook_name
+
' failed. '
+
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
+
' Output: '
+
msg
)
# logger.info('playbook: ' + playbook_name + ' task_id: ' + str(task_id))
# logger.info('playbook: ' + playbook_name + ' task_id: ' + str(task_id))
tasks_outputs
[
task_id
]
=
self
.
semaphore_helper
.
get_task_outputs
(
project_id
,
task_id
)
tasks_outputs
[
task_id
]
=
self
.
semaphore_helper
.
get_task_outputs
(
project_id
,
task_id
)
return
tasks_outputs
return
tasks_outputs
...
...
deployer/service/deploy_service.py
View file @
b8cda483
...
@@ -32,8 +32,6 @@ class DeployService:
...
@@ -32,8 +32,6 @@ class DeployService:
def
deploy
(
self
,
nodes_pair
):
def
deploy
(
self
,
nodes_pair
):
target
=
nodes_pair
[
0
]
target
=
nodes_pair
[
0
]
source
=
nodes_pair
[
1
]
source
=
nodes_pair
[
1
]
if
source
.
name
==
'mongo'
:
print
(
source
)
interface_types
=
tosca_helper
.
get_interface_types
(
source
)
interface_types
=
tosca_helper
.
get_interface_types
(
source
)
if
interface_types
:
if
interface_types
:
ansible_service
=
AnsibleService
(
self
.
semaphore_base_url
,
self
.
semaphore_username
,
self
.
semaphore_password
)
ansible_service
=
AnsibleService
(
self
.
semaphore_base_url
,
self
.
semaphore_username
,
self
.
semaphore_password
)
...
@@ -44,10 +42,6 @@ class DeployService:
...
@@ -44,10 +42,6 @@ class DeployService:
if
'Kubernetes'
in
interface_types
:
if
'Kubernetes'
in
interface_types
:
task_outputs
=
ansible_service
.
execute
(
nodes_pair
,
'Kubernetes'
,
self
.
vms
,
env_vars
=
env_vars
)
task_outputs
=
ansible_service
.
execute
(
nodes_pair
,
'Kubernetes'
,
self
.
vms
,
env_vars
=
env_vars
)
source
=
self
.
set_attributes
(
task_outputs
,
source
)
source
=
self
.
set_attributes
(
task_outputs
,
source
)
if
not
source
:
print
(
source
)
if
not
source
:
print
(
source
)
return
source
return
source
def
get_env_vars
(
self
,
nodes_pair
):
def
get_env_vars
(
self
,
nodes_pair
):
...
@@ -57,15 +51,16 @@ class DeployService:
...
@@ -57,15 +51,16 @@ class DeployService:
if
source
.
node_template
.
type
==
'tosca.nodes.QC.Container.Application.Docker'
:
if
source
.
node_template
.
type
==
'tosca.nodes.QC.Container.Application.Docker'
:
env_vars
[
'DOCKER_IMAGE'
]
=
source
.
node_template
.
artifacts
[
'image'
][
'file'
]
env_vars
[
'DOCKER_IMAGE'
]
=
source
.
node_template
.
artifacts
[
'image'
][
'file'
]
env_vars
[
'DOCKER_SERVICE_NAME'
]
=
source
.
name
env_vars
[
'DOCKER_SERVICE_NAME'
]
=
source
.
name
env_vars
[
'CONTAINER_PORT'
]
=
'80'
if
'ports'
in
source
.
node_template
.
properties
:
if
'ports'
in
source
.
node_template
.
properties
:
env_vars
[
'CONTAINER_PORT'
]
=
source
.
node_template
.
properties
[
'ports'
][
0
]
.
split
(
':'
)[
1
]
env_vars
[
'CONTAINER_PORT'
]
=
source
.
node_template
.
properties
[
'ports'
][
0
]
.
split
(
':'
)[
1
]
if
'environment'
in
source
.
node_template
.
properties
:
env_vars
[
'DOCKER_ENV_VARIABLES'
]
=
source
.
node_template
.
properties
[
'environment'
]
return
env_vars
return
env_vars
def
set_attributes
(
self
,
task_outputs
,
source
):
def
set_attributes
(
self
,
task_outputs
,
source
):
# target = nodes_pair[0]
# target = nodes_pair[0]
# source = nodes_pair[1]
# source = nodes_pair[1]
if
not
source
:
print
(
source
)
if
source
.
node_template
.
type
==
'tosca.nodes.QC.docker.Orchestrator.Kubernetes'
:
if
source
.
node_template
.
type
==
'tosca.nodes.QC.docker.Orchestrator.Kubernetes'
:
source
=
self
.
set_kubernetes_attributes
(
source
=
source
,
task_outputs
=
task_outputs
)
source
=
self
.
set_kubernetes_attributes
(
source
=
source
,
task_outputs
=
task_outputs
)
if
source
.
node_template
.
type
==
'tosca.nodes.QC.Container.Application.Docker'
:
if
source
.
node_template
.
type
==
'tosca.nodes.QC.Container.Application.Docker'
:
...
@@ -73,8 +68,6 @@ class DeployService:
...
@@ -73,8 +68,6 @@ class DeployService:
# lst = list(nodes_pair)
# lst = list(nodes_pair)
# lst[1] = source
# lst[1] = source
# nodes_pair = tuple(lst)
# nodes_pair = tuple(lst)
if
not
source
:
print
(
source
)
return
source
return
source
...
@@ -164,6 +157,9 @@ class DeployService:
...
@@ -164,6 +157,9 @@ class DeployService:
attributes
[
'dashboard_url'
]
=
dashboard_url
attributes
[
'dashboard_url'
]
=
dashboard_url
logger
.
info
(
'source.node_template.attributes: '
+
str
(
attributes
))
logger
.
info
(
'source.node_template.attributes: '
+
str
(
attributes
))
return
source
return
source
raise
Exception
(
'Did not find k8s_services and/or k8s_dashboard_token'
)
return
None
def
set_docker_attributes
(
self
,
source
,
task_outputs
):
def
set_docker_attributes
(
self
,
source
,
task_outputs
):
attributes
=
source
.
node_template
.
attributes
attributes
=
source
.
node_template
.
attributes
...
...
deployer/service/tosca_helper.py
View file @
b8cda483
...
@@ -76,8 +76,6 @@ class ToscaHelper:
...
@@ -76,8 +76,6 @@ class ToscaHelper:
def
set_node
(
self
,
updated_node
,
tosca_template_dict
):
def
set_node
(
self
,
updated_node
,
tosca_template_dict
):
node_templates
=
tosca_template_dict
[
'topology_template'
][
'node_templates'
]
node_templates
=
tosca_template_dict
[
'topology_template'
][
'node_templates'
]
for
node_name
in
node_templates
:
for
node_name
in
node_templates
:
if
not
hasattr
(
updated_node
,
'name'
):
print
(
updated_node
)
if
node_name
==
updated_node
.
name
:
if
node_name
==
updated_node
.
name
:
node_templates
[
node_name
]
=
updated_node
.
node_template
.
to_dict
()
node_templates
[
node_name
]
=
updated_node
.
node_template
.
to_dict
()
return
tosca_template_dict
return
tosca_template_dict
...
...
docker-compose/docker-compose-test.yml
View file @
b8cda483
version
:
'
3'
version
:
'
3'
services
:
services
:
nginx
:
image
:
nginx
volumes
:
-
./nginx.conf:/etc/nginx/nginx.conf
-
./cert.pem:/etc/nginx/cert.pem
-
./privkey.pem:/etc/nginx/privkey.pem
#- ./www:/data/www
ports
:
-
"
80:80"
-
"
443:443"
rabbit
:
rabbit
:
image
:
rabbitmq:3.8-management
image
:
rabbitmq:3.8-management
ports
:
ports
:
...
@@ -9,11 +20,6 @@ services:
...
@@ -9,11 +20,6 @@ services:
-
"
4369:4369"
-
"
4369:4369"
-
"
15671:15671"
-
"
15671:15671"
mongo
:
image
:
mongo:4
ports
:
-
"
27017:27017"
mysql
:
mysql
:
image
:
mysql:5.6
image
:
mysql:5.6
environment
:
environment
:
...
@@ -21,8 +27,8 @@ services:
...
@@ -21,8 +27,8 @@ services:
MYSQL_DATABASE
:
semaphore
MYSQL_DATABASE
:
semaphore
MYSQL_USER
:
semaphore
MYSQL_USER
:
semaphore
MYSQL_PASSWORD
:
semaphore
MYSQL_PASSWORD
:
semaphore
ports
:
#
ports:
-
"
3306:3306"
#
- "3306:3306"
semaphore
:
semaphore
:
image
:
qcdis/docker_ansible_semaphore
image
:
qcdis/docker_ansible_semaphore
...
@@ -37,13 +43,28 @@ services:
...
@@ -37,13 +43,28 @@ services:
SEMAPHORE_ADMIN_NAME
:
"
Developer"
SEMAPHORE_ADMIN_NAME
:
"
Developer"
SEMAPHORE_ADMIN_EMAIL
:
admin@localhost
SEMAPHORE_ADMIN_EMAIL
:
admin@localhost
SEMAPHORE_ADMIN
:
admin
SEMAPHORE_ADMIN
:
admin
SEMAPHORE_WEB_ROOT
:
http://0.0.0.0:3000
/semaphore
SEMAPHORE_WEB_ROOT
:
http://0.0.0.0:3000
ports
:
ports
:
-
"
300
0
:3000"
-
"
300
1
:3000"
depends_on
:
depends_on
:
-
mysql
-
mysql
mongo
:
image
:
mongo:4
ports
:
-
"
27017:27017"
sure-tosca
:
sure-tosca
:
image
:
qcdis/sure-tosca
:3.0.0
image
:
qcdis/sure-tosca
ports
:
ports
:
-
"
8081:8081"
-
"
8081:8081"
k8s/CONF/manager-service.yaml
View file @
b8cda483
...
@@ -10,10 +10,16 @@ metadata:
...
@@ -10,10 +10,16 @@ metadata:
io.kompose.service
:
manager
io.kompose.service
:
manager
name
:
manager
name
:
manager
spec
:
spec
:
type
:
NodePort
ports
:
ports
:
-
name
:
"
8080"
-
port
:
8080
port
:
8080
nodePort
:
30000
targetPort
:
8080
protocol
:
TCP
name
:
http
#ports:
#- name: "8080"
#port: 8080
#targetPort: 8080
selector
:
selector
:
io.kompose.service
:
manager
io.kompose.service
:
manager
status
:
status
:
...
...
manager/src/main/java/nl/uva/sne/drip/api/CredentialApiController.java
View file @
b8cda483
...
@@ -21,9 +21,11 @@ import javax.crypto.IllegalBlockSizeException;
...
@@ -21,9 +21,11 @@ import javax.crypto.IllegalBlockSizeException;
import
javax.crypto.NoSuchPaddingException
;
import
javax.crypto.NoSuchPaddingException
;
import
nl.uva.sne.drip.service.CredentialService
;
import
nl.uva.sne.drip.service.CredentialService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@CrossOrigin
(
origins
=
"*"
)
@Controller
@Controller
public
class
CredentialApiController
implements
CredentialApi
{
public
class
CredentialApiController
implements
CredentialApi
{
...
...
manager/src/main/java/nl/uva/sne/drip/api/DeployerApiController.java
View file @
b8cda483
...
@@ -12,10 +12,12 @@ import org.springframework.web.bind.annotation.PathVariable;
...
@@ -12,10 +12,12 @@ import org.springframework.web.bind.annotation.PathVariable;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
nl.uva.sne.drip.service.DRIPService
;
import
nl.uva.sne.drip.service.DRIPService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@Controller
@Controller
@CrossOrigin
(
origins
=
"*"
)
public
class
DeployerApiController
implements
DeployerApi
{
public
class
DeployerApiController
implements
DeployerApi
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
DeployerApiController
.
class
);
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
DeployerApiController
.
class
);
...
...
manager/src/main/java/nl/uva/sne/drip/api/PlannerApiController.java
View file @
b8cda483
...
@@ -15,8 +15,10 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -15,8 +15,10 @@ import javax.servlet.http.HttpServletRequest;
import
nl.uva.sne.drip.service.DRIPService
;
import
nl.uva.sne.drip.service.DRIPService
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
@Controller
@Controller
@CrossOrigin
(
origins
=
"*"
)
public
class
PlannerApiController
implements
PlannerApi
{
public
class
PlannerApiController
implements
PlannerApi
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
PlannerApiController
.
class
);
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
PlannerApiController
.
class
);
...
...
manager/src/main/java/nl/uva/sne/drip/api/ProvisionerApiController.java
View file @
b8cda483
...
@@ -18,10 +18,12 @@ import nl.uva.sne.drip.model.Exceptions.TypeExeption;
...
@@ -18,10 +18,12 @@ import nl.uva.sne.drip.model.Exceptions.TypeExeption;
import
nl.uva.sne.drip.service.DRIPService
;
import
nl.uva.sne.drip.service.DRIPService
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@Controller
@Controller
@CrossOrigin
(
origins
=
"*"
)
public
class
ProvisionerApiController
implements
ProvisionerApi
{
public
class
ProvisionerApiController
implements
ProvisionerApi
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ProvisionerApiController
.
class
);
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ProvisionerApiController
.
class
);
...
...
manager/src/main/java/nl/uva/sne/drip/api/ScalerApiController.java
View file @
b8cda483
...
@@ -14,12 +14,14 @@ import nl.uva.sne.drip.service.ToscaTemplateService;
...
@@ -14,12 +14,14 @@ import nl.uva.sne.drip.service.ToscaTemplateService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@Controller
@Controller
@CrossOrigin
(
origins
=
"*"
)
public
class
ScalerApiController
implements
ScalerApi
{
public
class
ScalerApiController
implements
ScalerApi
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ScalerApiController
.
class
);
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ScalerApiController
.
class
);
...
...
manager/src/main/java/nl/uva/sne/drip/api/ToscaTemplateApiController.java
View file @
b8cda483
...
@@ -23,11 +23,13 @@ import nl.uva.sne.drip.service.DRIPService;
...
@@ -23,11 +23,13 @@ import nl.uva.sne.drip.service.DRIPService;
import
nl.uva.sne.drip.service.ToscaTemplateService
;
import
nl.uva.sne.drip.service.ToscaTemplateService
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@Controller
@Controller
@CrossOrigin
(
origins
=
"*"
)
public
class
ToscaTemplateApiController
implements
ToscaTemplateApi
{
public
class
ToscaTemplateApiController
implements
ToscaTemplateApi
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ToscaTemplateApiController
.
class
);
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ToscaTemplateApiController
.
class
);
...
...
manager/src/main/java/nl/uva/sne/drip/api/UserApiController.java
View file @
b8cda483
...
@@ -17,10 +17,12 @@ import javax.validation.Valid;
...
@@ -17,10 +17,12 @@ import javax.validation.Valid;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
@Controller
@Controller
@CrossOrigin
(
origins
=
"*"
)
public
class
UserApiController
implements
UserApi
{
public
class
UserApiController
implements
UserApi
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
UserApiController
.
class
);
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
UserApiController
.
class
);
...
...
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