vmware-tanzu / kubeapps

A web-based UI for deploying and managing applications in Kubernetes clusters
Other
4.95k stars 706 forks source link

Helm release installation fails with fluxcd/helm-controller #6303

Open project-administrator opened 1 year ago

project-administrator commented 1 year ago

Describe the bug

An attempt to install the helm release with fluxcd/helm-controller fails because of the following errors:

  Warning  error   97s (x8 over 3m21s)  helm-controller  Helm install failed: error while running post render on files: map[string]interface {}(nil): yaml: unmarshal errors:
  line 103: mapping key "initialDelaySeconds" already defined at line 97
  line 112: mapping key "initialDelaySeconds" already defined at line 106

Basically, helm chart generates an invalid template with duplicate keys in YAML. fluxcd/helm-controller would not tolerate this, but command-line helm install would silently remove the duplicate keys. Same issue from the fluxcd/helm-controller project: https://github.com/fluxcd/helm-controller/issues/283

To Reproduce Steps to reproduce the behavior:

  1. Install fluxcd with helm-controller running in the K8S cluster
  2. Attempt to install the kubeapps with fluxcd/helm-controller e.g.:
    $ kubectl apply -f - <<EOF
    apiVersion: source.toolkit.fluxcd.io/v1beta2
    kind: HelmRepository
    metadata:
    name: bitnami-repo-oci
    namespace: default
    spec:
    interval: 6h
    url: oci://registry-1.docker.io/bitnamicharts
    type: oci
    ---
    apiVersion: helm.toolkit.fluxcd.io/v2beta1
    kind: HelmRelease
    metadata:
    name: kubeapps
    namespace: default
    spec:
    interval: 1h
    releaseName: kubeapps
    targetNamespace: default
    chart:
    spec:
      chart: kubeapps
      interval: 1m
      sourceRef:
        kind: HelmRepository
        name: bitnami-repo-oci
        namespace: default
    EOF
  3. Check the failed deployment status: kubectl describe helmrelease kubeapps

Expected behavior Helm chart should not generate duplicate keys in the resulting YAML. The deployment of the kubeapps helm chart should succeed with fluxcd/helm-controller.

absoludity commented 1 year ago

Thanks @project-administrator . Confirmed that simply templating the chart results in the following for the kubeapps-apis service (which has initialDelaySeconds duplicated).

          livenessProbe:
            failureThreshold: 6
            initialDelaySeconds: 60
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 5
            exec:
              command: ["grpc_health_probe", "-addr=:50051"]
            initialDelaySeconds: 10
          readinessProbe:
            failureThreshold: 6
            initialDelaySeconds: 0
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 5
            exec:
              command: ["grpc_health_probe", "-addr=:50051"]
            initialDelaySeconds: 5
absoludity commented 1 year ago

It'll be best to fix this upstream in the bitnami chart first, then we'll merge that change into our dev chart.