Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
Helm-Automation-Script
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
harshavardhan.c
Helm-Automation-Script
Commits
aa4ec3f3
Commit
aa4ec3f3
authored
Oct 19, 2022
by
harshavardhan.c
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: code fixes while registering new helm_template.
parent
afc35f18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
scripts/core/helm_handler.py
scripts/core/helm_handler.py
+8
-8
No files found.
scripts/core/helm_handler.py
View file @
aa4ec3f3
...
@@ -25,12 +25,10 @@ class HelmHandler:
...
@@ -25,12 +25,10 @@ class HelmHandler:
existing_env_variables
=
{
_v
[
'name'
]:
_v
for
_v
in
existing_env_variables
=
{
_v
[
'name'
]:
_v
for
_v
in
existing_data
.
get
(
'deployment'
,
{})
.
get
(
'environmentVar'
,
[])}
existing_data
.
get
(
'deployment'
,
{})
.
get
(
'environmentVar'
,
[])}
diff_keys
=
list
(
set
(
existing_env_variables
.
keys
())
.
symmetric_difference
(
set
(
module_env_variables
.
keys
())))
diff_keys
=
list
(
set
(
existing_env_variables
.
keys
())
.
symmetric_difference
(
set
(
module_env_variables
.
keys
())))
module_port
=
''
for
_each
in
diff_keys
:
for
_each
in
diff_keys
:
if
_each
.
lower
()
in
{
'port'
,
'service_port'
,
'module_port'
,
'node_port'
}
and
module_env_variables
.
get
(
if
_each
.
lower
()
in
{
'port'
,
'service_port'
,
'module_port'
}
and
module_env_variables
.
get
(
_each
)
and
\
_each
)
and
\
module_env_variables
[
_each
]
.
get
(
"value"
):
module_env_variables
[
_each
]
.
get
(
"value"
):
module_port
=
module_env_variables
[
_each
][
"value"
]
global_config_vars
[
"SERVICE_PORT"
]
=
module_env_variables
[
_each
][
"value"
]
continue
continue
if
module_env_variables
.
get
(
_each
):
if
module_env_variables
.
get
(
_each
):
existing_data
[
'deployment'
][
'environmentVar'
]
.
append
(
module_env_variables
[
_each
])
existing_data
[
'deployment'
][
'environmentVar'
]
.
append
(
module_env_variables
[
_each
])
...
@@ -39,7 +37,7 @@ class HelmHandler:
...
@@ -39,7 +37,7 @@ class HelmHandler:
self
.
common_utils
.
convert_json_to_yaml
(
json_data
=
existing_data
,
output_file_path
=
template_file
)
self
.
common_utils
.
convert_json_to_yaml
(
json_data
=
existing_data
,
output_file_path
=
template_file
)
self
.
render_helm_chart
(
data_dict
=
global_config_vars
,
helm_template_file
=
f
'{module_name}.yml'
,
self
.
render_helm_chart
(
data_dict
=
global_config_vars
,
helm_template_file
=
f
'{module_name}.yml'
,
outfile_path
=
helm_out_file_path
,
template_path
=
template_path
,
outfile_path
=
helm_out_file_path
,
template_path
=
template_path
,
service_type
=
service_type
,
module_port
=
module_port
)
service_type
=
service_type
)
return
True
return
True
except
Exception
as
e
:
except
Exception
as
e
:
logging
.
exception
(
f
'Exception occurred while preparing the helm deployment file {e.args}'
)
logging
.
exception
(
f
'Exception occurred while preparing the helm deployment file {e.args}'
)
...
@@ -66,12 +64,13 @@ class HelmHandler:
...
@@ -66,12 +64,13 @@ class HelmHandler:
logging
.
debug
(
f
"{template_yml_path} not found!! Skipping Helm File Preparation"
)
logging
.
debug
(
f
"{template_yml_path} not found!! Skipping Helm File Preparation"
)
return
False
return
False
global_config_vars
=
global_config_data
.
get
(
'data'
,
{})
global_config_vars
=
global_config_data
.
get
(
'data'
,
{})
module_port
=
node_port
=
''
for
k
,
v
in
module_env_variables
.
items
():
for
k
,
v
in
module_env_variables
.
items
():
if
k
.
lower
()
in
{
'port'
,
'service_port'
,
'module_port'
}
and
v
:
if
k
.
lower
()
in
{
'port'
,
'service_port'
,
'module_port'
}
and
v
:
if
'module_port'
not
in
global_config_vars
:
if
'module_port'
not
in
global_config_vars
:
global_config_vars
[
"module_port"
]
=
v
module_port
=
v
if
'node_port'
not
in
global_config_vars
:
if
'node_port'
not
in
global_config_vars
:
global_config_vars
[
"node_port"
]
=
v
node_port
=
v
continue
continue
if
global_config_vars
.
get
(
k
):
if
global_config_vars
.
get
(
k
):
continue
continue
...
@@ -80,7 +79,8 @@ class HelmHandler:
...
@@ -80,7 +79,8 @@ class HelmHandler:
self
.
render_helm_chart
(
data_dict
=
{},
helm_template_file
=
f
'{module_name}.yml'
,
self
.
render_helm_chart
(
data_dict
=
{},
helm_template_file
=
f
'{module_name}.yml'
,
outfile_path
=
helm_out_file_path
,
template_path
=
"templates"
,
outfile_path
=
helm_out_file_path
,
template_path
=
"templates"
,
service_type
=
service_type
,
image_url
=
image_tag
,
variables
=
global_config_vars
)
service_type
=
service_type
,
image_url
=
image_tag
,
variables
=
global_config_vars
,
module_port
=
module_port
,
node_port
=
node_port
)
return
True
return
True
except
Exception
as
e
:
except
Exception
as
e
:
logging
.
exception
(
f
'Exception occurred while preparing the helm deployment file {e.args}'
)
logging
.
exception
(
f
'Exception occurred while preparing the helm deployment file {e.args}'
)
...
...
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