cockroachdb / helm-charts

Helm charts for cockroachdb
Apache License 2.0
83 stars 150 forks source link

ValidationError(Certificate.spec): unknown field "organization" in io.cert-manager.v1.Certificate.spec #158

Open aries1980 opened 3 years ago

aries1980 commented 3 years ago

When I install the Helm chart with the values:

      - tls:
          enabled: true
          certs:
            certManager: true
            certManagerIssuer:
              name: letsencrypt-prod
              kind: ClusterIssuer
              group: cert-manager.io
            useCertManagerV1CRDs: true

I get the ValidationError(Certificate.spec): unknown field "organization" in io.cert-manager.v1.Certificate.spec error, probably because the organization section of the Certificate CRD is now under the subject property: https://cert-manager.io/docs/usage/certificate/ but in the Helm chart is straight under spec: https://github.com/cockroachdb/helm-charts/blob/3cd97971dc0effc4023eee7217609b883df14154/cockroachdb/templates/certificate.client.yaml#L35

Solution fix:

Just put it under subject for cert-manager.io/v1 at least and should work.

Versions:

Detailed error message:

Comparing release=cockroachdb, chart=cockroachdb/cockroachdb
in applications/cockroachdb/helmfile.yaml: command "/usr/sbin/helm" exited with non-zero status:

PATH:
  /usr/sbin/helm

ARGS:
  0: helm (4 bytes)
  1: diff (4 bytes)
  2: upgrade (7 bytes)
  3: --reset-values (14 bytes)
  4: --allow-unreleased (18 bytes)
  5: cockroachdb (11 bytes)
  6: cockroachdb/cockroachdb (23 bytes)
  7: --version (9 bytes)
  8: 6.0.8 (5 bytes)
  9: --namespace (11 bytes)
  10: kube-system (11 bytes)
  11: --values (8 bytes)
  12: /tmp/helmfile002135761/kube-system-cockroachdb-values-559d977b55 (64 bytes)
  13: --values (8 bytes)
  14: /tmp/helmfile103528956/kube-system-cockroachdb-values-58cccd9ddd (64 bytes)
  15: --values (8 bytes)
  16: /tmp/helmfile619607851/kube-system-cockroachdb-values-69975879d7 (64 bytes)
  17: --values (8 bytes)
  18: /tmp/helmfile188868750/kube-system-cockroachdb-values-d7bc9c658 (63 bytes)
  19: --values (8 bytes)
  20: /tmp/helmfile343799957/kube-system-cockroachdb-values-7b798f8444 (64 bytes)
  21: --detailed-exitcode (19 bytes)

ERROR:
  exit status 1

EXIT STATUS
  1

STDERR:
  Error: Failed to render chart: exit status 1: Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(Certificate.spec): unknown field "organization" in io.cert-manager.v1.Certificate.spec
  Error: plugin "diff" exited with error

COMBINED OUTPUT:
  Error: Failed to render chart: exit status 1: Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(Certificate.spec): unknown field "organization" in io.cert-manager.v1.Certificate.spec
  Error: plugin "diff" exited with error
wigeric commented 2 years ago

This issue could be easily fixed by changing

  organization:
    - Cockroach

into something like

{{- if .Values.tls.certs.useCertManagerV1CRDs }}
  subject:
    organizations:
      - Cockroach
{{ else }}
  organization:
    - Cockroach
{{ end }}

in templates/certificate.client.yaml and templates/certificate.node.yaml