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
65aa14d8
Commit
65aa14d8
authored
Mar 11, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added docker attributes
parent
41a9f95c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
2 deletions
+35
-2
nodes.yaml
TOSCA/types/nodes.yaml
+5
-0
__main__.py
deployer/__main__.py
+1
-2
k8s_service.py
deployer/service/k8s_service.py
+18
-0
tosca.py
deployer/service/tosca.py
+11
-0
No files found.
TOSCA/types/nodes.yaml
View file @
65aa14d8
...
...
@@ -34,6 +34,11 @@ node_types:
capability
:
tosca.capabilities.ARTICONF.docker.Orchestrator
node
:
tosca.nodes.ARTICONF.docker.Orchestrator
relationship
:
tosca.relationships.HostedOn
attributes
:
service_url
:
type
:
string
required
:
false
description
:
url of the service
tosca.nodes.ARTICONF.docker.Orchestrator
:
derived_from
:
tosca.nodes.ARTICONF.Root
...
...
deployer/__main__.py
View file @
65aa14d8
...
...
@@ -97,12 +97,11 @@ def handle_delivery(message):
ansible_playbook_path
=
k8s_service
.
write_ansible_k8s_files
(
tosca_template_dict
,
tmp_path
)
out
,
err
=
ansible_service
.
run
(
inventory_path
,
ansible_playbook_path
)
dashboard_token
=
ansible_service
.
parse_dashboard_tokens
(
out
.
decode
(
"utf-8"
))
tokens
[
'dashboard_token'
]
=
dashboard_token
tosca_template_dict
=
tosca
.
add_tokens
(
tokens
,
tosca_template_dict
)
tosca_template_dict
=
tosca
.
add_dashboard_url
(
k8s_service
.
get_dashboard_url
(
vms
),
tosca_template_dict
)
tosca_template_dict
=
tosca
.
add_service_url
(
k8s_service
.
get_service_urls
(
vms
,
tosca_template_dict
),
tosca_template_dict
)
response
=
{
'toscaTemplate'
:
tosca_template_dict
}
output_current_milli_time
=
int
(
round
(
time
.
time
()
*
1000
))
...
...
deployer/service/k8s_service.py
View file @
65aa14d8
...
...
@@ -222,3 +222,21 @@ def get_dashboard_url(vms):
k8_master
=
attributes
[
'public_ip'
]
url
=
'https://'
+
k8_master
+
':'
+
str
(
dashboard_port
)
return
url
def
get_service_urls
(
vms
,
tosca_template_json
):
dockers
=
get_dockers
(
tosca_template_json
)
for
vm_name
in
vms
:
attributes
=
vms
[
vm_name
][
'attributes'
]
role
=
attributes
[
'role'
]
if
role
==
'master'
:
k8_master
=
attributes
[
'public_ip'
]
break
urls
=
{}
for
docker
in
dockers
:
docker_name
=
next
(
iter
(
docker
))
docker_ports
=
docker
[
docker_name
][
'properties'
][
'ports'
][
0
]
.
split
(
':'
)
node_port
=
int
(
docker_ports
[
0
])
url
=
'https://'
+
k8_master
+
':'
+
str
(
node_port
)
urls
[
docker_name
]
=
url
return
urls
deployer/service/tosca.py
View file @
65aa14d8
...
...
@@ -45,3 +45,14 @@ def add_dashboard_url(dashboard_url, tosca_template_dict):
attributes
=
node_templates
[
node_name
][
'attributes'
]
attributes
[
'dashboard_url'
]
=
dashboard_url
return
tosca_template_dict
def
add_service_url
(
serviceurls_url
,
tosca_template_dict
):
node_templates
=
tosca_template_dict
[
'topology_template'
][
'node_templates'
]
for
node_name
in
node_templates
:
if
node_templates
[
node_name
][
'type'
]
==
'"tosca.nodes.ARTICONF.Container.Application.Docker'
:
if
'attributes'
not
in
node_templates
[
node_name
]:
node_templates
[
node_name
][
'attributes'
]
=
{}
attributes
=
node_templates
[
node_name
][
'attributes'
]
attributes
[
'service_url'
]
=
serviceurls_url
[
node_name
]
return
tosca_template_dict
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