diff --git a/stack_orchestrator/deploy/k8s/helm/chart_generator.py b/stack_orchestrator/deploy/k8s/helm/chart_generator.py index 5964d755..0289244e 100644 --- a/stack_orchestrator/deploy/k8s/helm/chart_generator.py +++ b/stack_orchestrator/deploy/k8s/helm/chart_generator.py @@ -13,13 +13,11 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -import shutil from pathlib import Path from stack_orchestrator import constants from stack_orchestrator.opts import opts from stack_orchestrator.util import ( - get_stack_path, get_parsed_stack_config, get_pod_list, get_pod_file_path, @@ -59,7 +57,11 @@ def _wrap_job_templates_with_conditionals(chart_dir: Path, jobs: list) -> None: # Wrap with conditional (default false) # Use 'index' function to handle job names with dashes # Provide default dict for .Values.jobs to handle case where it doesn't exist - wrapped_content = f"""{{{{- if (index (.Values.jobs | default dict) "{job_name}" | default dict).enabled | default false }}}} + condition = ( + f"{{{{- if (index (.Values.jobs | default dict) " + f'"{job_name}" | default dict).enabled | default false }}}}' + ) + wrapped_content = f"""{condition} {content}{{{{- end }}}} """ @@ -351,10 +353,10 @@ Edit the generated template files in `templates/` to customize: print(" 2. Review generated templates:") print(" ls templates/") print("") - print(f" 3. Install to Kubernetes:") + print(" 3. Install to Kubernetes:") print(f" helm install {chart_name} {chart_dir}") print("") - print(f" # Or use your own release name") + print(" # Or use your own release name") print(f" helm install {chart_dir}") print("") print(" 4. Check deployment:")