rstudio / helm

Helm Resources for RStudio Products
MIT License
32 stars 28 forks source link

Workbench: `notifications.conf` does not template correctly #442

Open SamEdwardes opened 9 months ago

SamEdwardes commented 9 months ago

Reprex

values.yaml:

config:
  session:
    notifications.conf:
      - StartTime: 2023-11-20 12:00:00 -5:00
        EndTime: 2023-12-27 20:00:00 -05:00
        Message: Please remember to shut down your computers at the end of the day.

Output:

$ helm template posit-workbench rstudio/rstudio-workbench --values values.yaml | grep -C 5 notifications.conf
coalesce.go:286: warning: cannot overwrite table with non table for rstudio-workbench.config.session.notifications.conf (map[])
coalesce.go:286: warning: cannot overwrite table with non table for rstudio-workbench.config.session.notifications.conf (map[])
metadata:
  name: posit-workbench-rstudio-workbench-session
  namespace: samedwardes-posit-team
data:

  notifications.conf: |
    EndTime=2023-12-27 20:00:00 -05:00
    Message=Please remember to shut down your computers at the end of the day.
    StartTime=2023-11-20 12:00:00 -5:00

  rsession.conf: |

Expected output:

data:

  notifications.conf: |
    EndTime: 2023-12-27 20:00:00 -05:00
    Message: Please remember to shut down your computers at the end of the day.
    StartTime: 2023-11-20 12:00:00 -5:00

The issue is that the notifications.conf format should use : instead of =: https://docs.posit.co/ide/server-pro/rstudio_pro_sessions/notifications.html

Temporary fix

If users are running into this issue, they can pass the entire notifications.conf as a string instead of a YAML object:

config:
  session:
    notifications.conf: |
      StartTime: 2023-11-20 12:00:00 -5:00
      EndTime: 2023-12-27 20:00:00 -05:00
      Message: Please remember to shut down your computers at the end of the day.

Long term fix

We should update the templating so that when notifications.yaml gets a yaml object we use : instead of = in the output.

tnederlof commented 8 months ago

Another file where this happens: https://github.com/rstudio/helm/issues/437