bjw-s / helm-charts

A collection of Helm charts
https://bjw-s.github.io/helm-charts/
Apache License 2.0
580 stars 106 forks source link

`configMapKeyRef` schema is incorrect in app-template chart 3.0.1 #286

Closed mikedougherty closed 6 months ago

mikedougherty commented 6 months ago

Details

configMapKeyRef does not appear to work anymore as an option for an env entry.

containers.*.env.*.configMapKeyRef incorrectly requires field secretKeyRef per the schema

Given this kustomization.yaml:

---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

helmCharts:
  - name: app-template
    namespace: logging
    releaseName: uptime-metrics
    repo: https://bjw-s.github.io/helm-charts/
    version: 3.0.1
    additionalValuesFiles:
      - values.yaml

values.yaml:

controllers:
  archive:
    type: cronjob
    cronjob:
      schedule: '0 18 * * *'
    containers:
      main:
        image:
          repository: kubectl
          tag: latest
        env:
          GKE_PROJECT_ID:
            configMapKeyRef:
              name: ml-k8s-cluster-info
              key:  GKE_PROJECT_ID

and then executing kustomize build:

$ kustomize build --enable-helm --load-restrictor=LoadRestrictionsNone .
Error: Error: values don't meet the specifications of the schema(s) in the following chart(s):
app-template:
- controllers.archive.containers.main.env: Must validate at least one schema (anyOf)
- controllers.archive.containers.main.env.GKE_PROJECT_ID: Must validate at least one schema (anyOf)
- controllers.archive.containers.main.env.GKE_PROJECT_ID: Must validate one and only one schema (oneOf)
- controllers.archive.containers.main.env.GKE_PROJECT_ID: secretKeyRef is required

helm and kustomize versions:

$ kustomize version
v5.2.1

$ helm version
version.BuildInfo{Version:"v3.14.2", GitCommit:"c309b6f0ff63856811846ce18f3bdc93d2b4d54b", GitTreeState:"clean", GoVersion:"go1.22.0"}

Anything else you would like to add:

Additional Information:

This seems like a simple schema fix; I am not sure how you generate the schema else I would try to submit a PR myself :)

Please let me know if there is any info I should have included.

Thank you for all the great work on this chart!

bjw-s commented 6 months ago

Thanks for pointing that out @mikedougherty ❤️ Copy/pasta strikes again 🫣 I've pushed a fix to the schema to remedy the issue (https://github.com/bjw-s/helm-charts/commit/25e5778dd22bf4e3be582b65ee67994016a93152), so as soon as caches clear and the schema redownloads things should be good to go.