fluxcd / flux2

Open and extensible continuous delivery solution for Kubernetes. Powered by GitOps Toolkit.
https://fluxcd.io
Apache License 2.0
6.55k stars 606 forks source link

published crd schema helmrelease-helm-v2beta1.json incorrectly shows spec/chart as required #5050

Open nralbers opened 2 weeks ago

nralbers commented 2 weeks ago

Describe the bug

The published standalone schema for helmrelease-helm-v2beta1.json will flag a release using a chartRef instead of a chart as invalid.

Steps to reproduce

  1. Create Helmrelease using OCI repository as a chartref
  2. Run https://github.com/fluxcd/flux2-kustomize-helm-example/blob/main/scripts/validate.sh on cluster
  3. validation will fail on helmrelease stating that chart is a required property of spec

Example helmrelease

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: external-dns
  namespace: external-dns
spec:
  chartRef:
    kind: OCIRepository
    name: external-dns
    namespace: flux-system
  interval: 15m
  timeout: 5m
  releaseName: external-dns
  values: 
    ...

Expected behavior

validation json should allow either chart or chartref

So

"spec": {
  ...
   "required": [
            "chart",
            "interval"
          ],

} 

becomes

"spec": {
  ...
   "required": [
            "interval"
          ],
          "oneOf": [
              {
                  "required": [
                      "chart"
                  ]
              },
              {
                  "required":[
                      "chartRef"
                  ]
              }
          ],
} 

Screenshots and recordings

No response

OS / Distro

N/A

Flux version

v2.4.0

Flux check

N/A

Git provider

No response

Container Registry provider

No response

Additional context

No response

Code of Conduct

stefanprodan commented 2 weeks ago

The chartRef is only supposed in v2