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
ac710981
Commit
ac710981
authored
Jan 28, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added task to get key
parent
6172a79f
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
52 deletions
+52
-52
application_example_provisioned.yaml
TOSCA/application_example_provisioned.yaml
+23
-46
create_k8s.yml
ansible_playbooks/create_k8s.yml
+14
-0
ansible_service.py
deployer/service/ansible_service.py
+7
-4
k8s_service.py
deployer/service/k8s_service.py
+8
-2
No files found.
TOSCA/application_example_provisioned.yaml
View file @
ac710981
This diff is collapsed.
Click to expand it.
ansible_playbooks/create_k8s.yml
View file @
ac710981
...
@@ -76,3 +76,17 @@
...
@@ -76,3 +76,17 @@
-
name
:
print nodes
-
name
:
print nodes
debug
:
debug
:
var
:
nodes_out
var
:
nodes_out
-
name
:
get api key
shell
:
kubectl describe secret $(kubectl get secrets | grep default | cut -f1 -d ' ') | grep -E '^token' | cut -f2 -d':' | tr -d '\t'
register
:
api_key
-
name
:
print api_key
debug
:
var
:
api_key
deployer/service/ansible_service.py
View file @
ac710981
...
@@ -65,6 +65,7 @@ def write_ansible_files(vms, interfaces, tmp_path):
...
@@ -65,6 +65,7 @@ def write_ansible_files(vms, interfaces, tmp_path):
print
(
'ansible_ssh_user='
+
ansible_ssh_user
,
file
=
k8s_hosts_file
)
print
(
'ansible_ssh_user='
+
ansible_ssh_user
,
file
=
k8s_hosts_file
)
image_url
=
interfaces
[
'Kubernetes'
][
'install'
][
'inputs'
][
'playbook'
]
image_url
=
interfaces
[
'Kubernetes'
][
'install'
][
'inputs'
][
'playbook'
]
r
=
requests
.
get
(
image_url
)
r
=
requests
.
get
(
image_url
)
with
open
(
tmp_path
+
"/install.yml"
,
'wb'
)
as
f
:
with
open
(
tmp_path
+
"/install.yml"
,
'wb'
)
as
f
:
f
.
write
(
r
.
content
)
f
.
write
(
r
.
content
)
...
@@ -90,11 +91,13 @@ def run(interfaces, vms):
...
@@ -90,11 +91,13 @@ def run(interfaces, vms):
p
=
Popen
([
"ansible-playbook"
,
"-i"
,
tmp_path
+
"/k8s_hosts"
,
tmp_path
+
"/create.yml"
],
stdin
=
PIPE
,
stdout
=
PIPE
,
p
=
Popen
([
"ansible-playbook"
,
"-i"
,
tmp_path
+
"/k8s_hosts"
,
tmp_path
+
"/create.yml"
],
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stderr
=
PIPE
)
output
,
err
=
p
.
communicate
()
output
,
err
=
p
.
communicate
()
print
(
output
.
decode
(
'utf-8'
))
out
=
output
.
decode
(
'utf-8'
)
print
(
err
.
decode
(
'utf-8'
))
err
=
err
.
decode
(
'utf-8'
)
print
(
out
)
print
(
err
)
rc
=
p
.
returncode
rc
=
p
.
returncode
api_key
=
out
return
tmp_path
return
api_key
def
execute_playbook
(
hosts
,
playbook_path
,
user
,
ssh_key_file
,
extra_vars
,
passwords
):
def
execute_playbook
(
hosts
,
playbook_path
,
user
,
ssh_key_file
,
extra_vars
,
passwords
):
...
...
deployer/service/k8s_service.py
View file @
ac710981
def
get_dockers
(
tosca_template_json
):
def
get_dockers
(
tosca_template_json
):
pass
dockers
=
[]
node_templates
=
tosca_template_json
[
'topology_template'
][
'node_templates'
]
for
node_name
in
node_templates
:
if
node_templates
[
node_name
][
'type'
]
==
'tosca.nodes.ARTICONF.Container.Application.Docker'
:
dockers
.
append
(
node_templates
[
node_name
])
return
dockers
def
write_k8s_files
(
dockers
):
def
write_k8s_files
(
dockers
):
pass
pass
def
run
(
tosca_template_json
):
def
run
(
tosca_template_json
):
dockers
=
get_dockers
(
tosca_template_json
)
dockers
=
get_dockers
(
tosca_template_json
)
tmp_dir
=
write_k8s_files
(
dockers
)
tmp_dir
=
write_k8s_files
(
dockers
)
return
None
return
tmp_dir
\ No newline at end of file
\ No newline at end of file
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