Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csc: Add ability to update CSC defaults during upgrade/downgrade #2513

Merged
merged 7 commits into from
May 6, 2020
27 changes: 20 additions & 7 deletions charts/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#!jinja | metalk8s_kubernetes

{{%- from "metalk8s/repo/macro.sls" import build_image_name with context %}}
{csc_defaults}
{configlines}

{{% raw %}}
Expand Down Expand Up @@ -212,15 +213,27 @@ def main():
doc=doc
)
)
if args.service_configs:
import_csc_yaml = '\n'.join(
("{{% import_yaml 'metalk8s/addons/{0}/config/{1}.yaml' as "
"{1}_defaults with context %}}").format(
args.name, service_config[0]
) for service_config in args.service_configs
)

config = '\n'.join(
("{{%- set {} = salt.metalk8s_service_configuration"
".get_service_conf('{}', '{}') %}}").format(
service_config[0], args.namespace, service_config[1]
) for service_config in args.service_configs
) if args.service_configs else ''
config = '\n'.join(
("{{%- set {0} = salt.metalk8s_service_configuration"
".get_service_conf('{1}', '{2}', {0}_defaults) %}}").format(
service_config[0], args.namespace, service_config[1]
) for service_config in args.service_configs
)
else:
import_csc_yaml = ''
config = ''
Ebaneck marked this conversation as resolved.
Show resolved Hide resolved

sys.stdout.write(START_BLOCK.format(configlines=config).lstrip())
sys.stdout.write(START_BLOCK.format(
csc_defaults=import_csc_yaml, configlines=config).lstrip()
)
sys.stdout.write('\n')

stream = io.StringIO()
Expand Down