templates: Support Nested YAML for GCFG Configuration
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 46
- Forks
- 40
- Avg merge
- 4h 3m
- Merged PRs (30d)
- 6
Description
Enhancement: Support Nested YAML for GCFG Configuration
1. Problem Statement
Currently, our rstudio-library.config.gcfg template only supports a "flat" map structure. To generate configuration headers with subsections—such as [OTLPEndpoint "default"]—users are forced to use escaped string keys in their values.yaml:
'OTLPEndpoint "default"':
Endpoint: http://localhost:4318
or how we show here in our docs
This is error-prone, difficult to read, and breaks standard Helm nesting conventions, which makes deep-merging or using --set flags difficult.
2. Proposed Solution
Update the gcfg helper template to detect the data type of the section values.
- If the value is a Map, it should automatically render a nested header:
[Section "Subsection"]. - If the value is a Simple Type (string/bool), it should continue to render the legacy flat header:
[Section].
3. Implementation Plan
Introduce a "Hybrid" template logic using kindIs "map" to differentiate between the two input styles.
Proposed Template Logic:
{{- define "rstudio-library.config.gcfg" -}}
{{- range $section, $content := . -}}
{{/* Determine if this section contains subsections or just key-values */}}
{{- $isNested := false -}}
{{- range $k, $v := $content -}}
{{- if kindIs "map" $v -}}
{{- $isNested = true -}}
{{- end -}}
{{- end -}}
{{- if $isNested -}}
{{/* New Way: Supports nested YAML maps */}}
{{- range $sub, $vals := $content }}
[{{ $section }} "{{ $sub }}"]
{{- range $k, $v := $vals }}
{{ $k }} = {{ $v }}
{{- end }}
{{- end }}
{{- else -}}
{{/* Legacy Way: Supports flat keys with manual quotes */}}
[{{ $section }}]
{{- range $k, $v := $content }}
{{ $k }} = {{ $v }}
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
4. Backwards Compatibility
This change is non-breaking:
- Existing configurations using
'Section "Sub"':will still enter theelseblock and render exactly as they do today. - New configurations can use the cleaner nested syntax, which is more "Helm-native."
5. Example Comparison
| Input Style | values.yaml Syntax |
Rendered .gcfg Output |
|---|---|---|
| Legacy | 'OTLPEndpoint "default"': { Logs: true } |
[OTLPEndpoint "default"] |
| New | OTLPEndpoint: { default: { Logs: true } } |
[OTLPEndpoint "default"] |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the rstudio-library.config.gcfg helper and compare its current flat rendering with the nested values.yaml examples in the issue. Verify that both legacy quoted section keys and nested map input render the expected GCFG headers and key-value lines, including the documented OTLPEndpoint example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- helm, yaml
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100