-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
team: connectPosit Connect related issuePosit Connect related issue
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"] |
Metadata
Metadata
Assignees
Labels
team: connectPosit Connect related issuePosit Connect related issue