fix(helm): Filter out empty YAML documents from helm template output#1367
fix(helm): Filter out empty YAML documents from helm template output#1367Moep90 wants to merge 11 commits into
Conversation
## Summary
Filter out `None` values from `yaml.safe_load_all()` output in the Helm input type to prevent empty YAML document separators (`---`) in compiled output.
## Problem
When Helm charts have conditional templates (e.g., `{{- if .Values.ollama.enabled }}`), the `helm template` command outputs empty YAML documents between `---` separators for disabled features.
Currently, `yaml.safe_load_all()` parses these empty documents as `None` values in the list, and `yaml.dump_all()` in `write_yaml()` outputs them as empty documents with `---` separators.
**Example output with the bug:**
```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
...
---
---
---
---
...
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where empty YAML documents (represented as None by yaml.safe_load_all()) from Helm template output were being included in the compiled output, resulting in consecutive --- separators without content between them.
Key changes:
- Filter out
Nonevalues from parsed YAML documents in the Helm input compilation process
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@Moep90 is this ready to be merged? |
|
No, I wasn't able to verify the behavior change with tests yet. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ng in helm rendering
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| os.chdir("../../") | ||
| reset_cache() | ||
|
|
||
| def test_compile_helm_filters_empty_documents(self): |
There was a problem hiding this comment.
The test method name doesn't follow the naming convention of the other test methods in this file, which use test_compile_<feature> format (e.g., test_compile_fetch_http_chart, test_compile_kadet_helm_chart). Consider renaming to test_compile_helm_conditional_templates for consistency.
| def test_compile_helm_filters_empty_documents(self): | |
| def test_compile_helm_conditional_templates(self): |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…en-webui helm configuration
…ses and remove null annotations from controller service
Summary
Filter out
Nonevalues fromyaml.safe_load_all()output in the Helm input type to prevent empty YAML document separators (---) in compiled output.Problem
When Helm charts have conditional templates (e.g.,
{{- if .Values.ollama.enabled }}), thehelm templatecommand outputs empty YAML documents between---separators for disabled features.Currently,
yaml.safe_load_all()parses these empty documents asNonevalues in the list, andyaml.dump_all()inwrite_yaml()outputs them as empty documents with---separators.Example output with the bug: