Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm override variables are limited to strings #2783

Open
Michael-Kruggel opened this issue Jul 29, 2024 · 4 comments
Open

helm override variables are limited to strings #2783

Michael-Kruggel opened this issue Jul 29, 2024 · 4 comments

Comments

@Michael-Kruggel
Copy link
Contributor

Steps to reproduce

  1. Add helm override variable to component
  2. Set that variable to something other than a string (e.g an array) in the zarf config
  3. Deploy package using said config

Expected result

Value of variable is set in chart values

Actual Result

No value is set, chart's default value is used

Visual Proof (screenshots, videos, text, etc)

Example zarf.yaml component:

components:
  - name: jenkins
    required: true
    charts:
      - name: jenkins
        namespace: jenkins
        url: https://charts.jenkins.io
        version: 5.4.3
        repoName: jenkins
        releaseName: jenkins
        valuesFiles:
          - ../values/common.yaml
        variables:
          - name: JENKINS_PLUGINS
            description: "List of plugins to install on Jenkins startup"
            path: controller.installPlugins

Example zarf-config.yaml:

package:
  deploy:
    components: 'jenkins'
    set:
      jenkins_plugins:
        - kubernetes:4238.v41b_3ef14a_5d8
        - workflow-aggregator:596.v8c21c963d92d
        - git:5.2.2
        - configuration-as-code:1810.v9b_c30a_249a_4c
        - oic-auth:4.269.va_7526f34f306
        - prometheus:773.v3b_62d8178eec
        - cloudbees-disk-usage-simple:203.v3f46a_7462b_1a_
        - saml:4.464.vea_cb_75d7f5e0

Values in k9s:
image

@Racer159
Copy link
Contributor

This is relatively simple to accomplish internally to Zarf by changing string to interface{} on the SetVariables field however the wall this is effectively blocked on (spf13/viper#1014) would need a workaround like what UDS CLI has done: https://github.com/defenseunicorns/uds-cli/blob/main/src/cmd/root.go#L151 (which as-written there only supports YAML) or would need to swap around libraries to something else.

@Racer159
Copy link
Contributor

The bright side is that Zarf does not process config files like this:

package:
  deploy:
    set:
      test:
        aT: thingT
        bT: to-beT

so it would be easier to stay away from making this a breaking change.

@mjnagel
Copy link
Contributor

mjnagel commented Sep 5, 2024

Tacking onto this existing issue - besides maps/lists there are also issues with passing boolean values in (they end up getting cast into strings which can cause issues in certain helm templates due to "false" being a truthy value).

@justinthelaw
Copy link

justinthelaw commented Sep 27, 2024

Multi-line strings are not rendered properly either: defenseunicorns/uds-k3d#112 (comment)

EDIT: disregard, there was a typo in the indent type for the helm template. (nindent vs. indent)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

5 participants