danroux/sk8l-api

Error while installing helm chart from duplicate `runAsNonRoot`

Closed this issue · 4 comments

Hey thanks for this project. I was trying out the helm chart, and I'm currently getting this error:

Helm install failed for release default/sk8l with chart sk8l@0.10.0: error while running post render on files: map[string]interface {}(nil): yaml: unmarshal errors:
  line 30: mapping key "runAsNonRoot" already defined at line 29

With this as my values so far:

namespace:
  create: false
  name: default
  labels: []

I'll open a PR if I find the fix later on. Just wanted to open an issue. Thanks!

Hey! Thank you for taking a look and testing this project! I'm sorry to hear that you're having issues installing it via helm.

At 1st I thought the problem happened because of how short your values are but I tried to replicate the issue with the same values and so far I haven't been able to encounter this problem. I need more info to shine a light on the cause of this problem.

Could you please share the command you used to install the chart? And also knowing your helm version might be of help.

I used the following to install it on the default namespace as you are doing and it worked:

helm upgrade --install sk8l sk8l/sk8l -f values-issue.yaml --set serviceAccount.metadata.namespace=default 

I'm passing serviceAccount.metadata.namespace=default because sk8l is hardcoded in the values and I'm assuming every user would want to set their own.

I ran the command with 2 helm versions, both installed correctly:

version.BuildInfo{Version:"v3.13.0", GitCommit:"825e86f6a7a38cef1112bfa606e4127a706749b1", GitTreeState:"clean", GoVersion:"go1.21.3"}


version.BuildInfo{Version:"v3.14.3", GitCommit:"f03cc04caaa8f6d7c3e67cf918929150cf6f3f12", GitTreeState:"clean", GoVersion:"go1.21.3"}

Thank you and I'll keep an eye on this.

Nice, ok just tried with:

serviceAccount:
  metadata:
    name: default

And I get the error:

error while running post render on files: missing metadata.name in object {{v1 Namespace} {{ } map[] map[]}}

Which sounds like I need the namespace section defined, so I ran with:

namespace:
  create: false
  name: default
  labels: []
serviceAccount:
  metadata:
    name: default

And then I'm back to this error:

error while running post render on files: map[string]interface {}(nil): yaml: unmarshal errors:
  line 30: mapping key "runAsNonRoot" already defined at line 29

Oh and I'm using Flux to install it, not using helm directly. Here's what my HelmRepository and HelmRelease objects look like if you're curious... it's a pretty nice tool:

---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
  name: sk8l
  namespace: flux-system
spec:
  interval: 1m
  url: https://sk8l.io/charts
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: sk8l
  namespace: flux-system
spec:
  interval: 5m0s
  targetNamespace: default
  chart:
    spec:
      chart: sk8l
      version: "0.10.0"
      sourceRef:
        kind: HelmRepository
        name: sk8l
        namespace: flux-system
  # Default values:
  # https://github.com/danroux/sk8l-api/blob/main/charts/sk8l/values.yaml
  values:
    namespace:
      create: false
      name: default
      labels: []
    serviceAccount:
      metadata:
        name: default

I'm not attached to the default namespace though. I'll be back online to experiment more on this later on in the day.

I think other charts I've used follow a different pattern for the namespace. I think they reference the namespace passed to helm at install time (like helm install --namespace foo). It looks like you can then reference it with {{ Release.Namespace }}.

This is speaking out of inexperience a little bit, as I haven't maintained a helm chart before, only have used them so far.

Ah wait, I think I see the issue. I templated it out locally:

helm template sk8l sk8l/sk8l | less

And searched for runAsNonRoot, and there's a duplicate:

image

Going to make a PR for this real quick...