rstudio / rstudio/helm

templates: Support Nested YAML for GCFG Configuration

Open
#769 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

team: connect
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:

  1. Existing configurations using 'Section "Sub"': will still enter the else block and render exactly as they do today.
  2. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.