profile_name = ksu_params.get("profile", {}).get("name")
age_public_key = ksu_params.get("profile", {}).get("age_pubkey")
target_ns = oka_params.get("namespace", "default")
- substitute_environment = oka_params.get("substitute_environment", "false")
- substitution_filter = oka_params.get("substitution_filter", "")
- custom_env_vars = oka_params.get("custom_env_vars", "")
- if custom_env_vars:
- custom_env_vars = "|\n" + "\n".join(
- [" " * 10 + f"{k}={v}" for k, v in custom_env_vars.items()]
- )
- else:
- custom_env_vars = '""'
+ substitute_environment = oka_params.get("substitute_environment", "true").lower()
+ custom_env_vars = oka_params.get("custom_env_vars", {})
+ if "APPNAME" not in custom_env_vars:
+ custom_env_vars["APPNAME"] = ksu_name
+ if "TARGET_NS" not in custom_env_vars:
+ custom_env_vars["TARGET_NS"] = target_ns
+ custom_env_vars_str = "|\n"
+ substitution_filter_list = []
+ for k, v in custom_env_vars.items():
+ custom_env_vars_str += " " * 10 + f"{k}={v}\n"
+ substitution_filter_list.append(f"${k}")
+ substitution_filter = ",".join(substitution_filter_list)
+ # TODO: add additional substitution filters
+ # substitution_filter = (
+ # f"{substitution_filter},{oka_params.get('substitution_filter', '')}".strip(",")
+ # )
inline_values = oka_params.get("inline_values", "")
if inline_values:
yaml_string = yaml.safe_dump(
templates_path=oka_path,
substitute_environment=substitute_environment,
substitution_filter=substitution_filter,
- custom_env_vars=custom_env_vars,
+ custom_env_vars=custom_env_vars_str,
kustomization_name=kustomization_name,
helmrelease_name=helmrelease_name,
inline_values=inline_values,
profile_name = ksu_params.get("profile", {}).get("name")
age_public_key = ksu_params.get("profile", {}).get("age_pubkey")
target_ns = oka_params.get("namespace", "default")
- substitute_environment = oka_params.get("substitute_environment", "false")
- substitution_filter = oka_params.get("substitution_filter", "")
- custom_env_vars = oka_params.get("custom_env_vars", "")
- if custom_env_vars:
- custom_env_vars = "|\n" + "\n".join(
- [" " * 10 + f"{k}={v}" for k, v in custom_env_vars.items()]
- )
- else:
- custom_env_vars = '""'
+ substitute_environment = oka_params.get("substitute_environment", "true").lower()
+ custom_env_vars = oka_params.get("custom_env_vars", {})
+ if "APPNAME" not in custom_env_vars:
+ custom_env_vars["APPNAME"] = ksu_name
+ if "TARGET_NS" not in custom_env_vars:
+ custom_env_vars["TARGET_NS"] = target_ns
+ custom_env_vars_str = "|\n"
+ substitution_filter_list = []
+ for k, v in custom_env_vars.items():
+ custom_env_vars_str += " " * 10 + f"{k}={v}\n"
+ substitution_filter_list.append(f"${k}")
+ substitution_filter = ",".join(substitution_filter_list)
+ # TODO: add additional substitution filters
+ # substitution_filter = (
+ # f"{substitution_filter},{oka_params.get('substitution_filter', '')}".strip(",")
+ # )
inline_values = oka_params.get("inline_values", "")
if inline_values:
yaml_string = yaml.safe_dump(
templates_path=oka_path,
substitute_environment=substitute_environment,
substitution_filter=substitution_filter,
- custom_env_vars=custom_env_vars,
+ custom_env_vars=custom_env_vars_str,
kustomization_name=kustomization_name,
helmrelease_name=helmrelease_name,
inline_values=inline_values,