kubernetes-retired / service-catalog

Consume services in Kubernetes using the Open Service Broker API
https://svc-cat.io
Apache License 2.0
1.05k stars 387 forks source link

Upgrade "catalog" failed on pre-upgrade #2910

Closed Maellooou closed 2 years ago

Maellooou commented 2 years ago

Bug Report

What happened:

I deployed catalog 0.3.1 with helm3 and I can't upgrade it.

How to reproduce it (as minimally and precisely as possible): I want to change the parameter "enablePrometheusScrape" to "true". So I update my values.yaml and run helm3 upgrade catalog svc-cat/catalog --namespace catalog --values values.yaml --debug

But I have the following issue :

upgrade.go:121: [debug] preparing upgrade for catalog upgrade.go:129: [debug] performing update for catalog upgrade.go:308: [debug] creating upgraded release for catalog client.go:258: [debug] Starting delete for "catalog-catalog-migration-storage" PersistentVolumeClaim client.go:108: [debug] creating 1 resource(s) upgrade.go:367: [debug] warning: Upgrade "catalog" failed: pre-upgrade hooks failed: warning: Hook pre-upgrade catalog/templates/pre-migration-job.yaml failed: PersistentVolumeClaim in version "v1" cannot be handled as a PersistentVolumeClaim: v1.PersistentVolumeClaim.Spec: v1.PersistentVolumeClaimSpec.Resources: v1.ResourceRequirements.Requests: unmarshalerDecoder: quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$', error found in #10 byte of ...|:"sata-0b"}}}} |..., bigger context ...|s":{"storage":"200Mi","storageClassName":"sata-0b"}}}} |... Error: UPGRADE FAILED: pre-upgrade hooks failed: warning: Hook pre-upgrade catalog/templates/pre-migration-job.yaml failed: PersistentVolumeClaim in version "v1" cannot be handled as a PersistentVolumeClaim: v1.PersistentVolumeClaim.Spec: v1.PersistentVolumeClaimSpec.Resources: v1.ResourceRequirements.Requests: unmarshalerDecoder: quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$', error found in #10 byte of ...|:"sata-0b"}}}} |..., bigger context ...|s":{"storage":"200Mi","storageClassName":"sata-0b"}}}} |... helm.go:84: [debug] pre-upgrade hooks failed: warning: Hook pre-upgrade catalog/templates/pre-migration-job.yaml failed: PersistentVolumeClaim in version "v1" cannot be handled as a PersistentVolumeClaim: v1.PersistentVolumeClaim.Spec: v1.PersistentVolumeClaimSpec.Resources: v1.ResourceRequirements.Requests: unmarshalerDecoder: quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$', error found in #10 byte of ...|:"sata-0b"}}}} |..., bigger context ...|s":{"storage":"200Mi","storageClassName":"sata-0b"}}}} |... UPGRADE FAILED main.newUpgradeCmd.func1 /home/circleci/helm.sh/helm/cmd/helm/upgrade.go:146 github.com/spf13/cobra.(*Command).execute /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842 github.com/spf13/cobra.(*Command).ExecuteC /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 github.com/spf13/cobra.(*Command).Execute /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887 main.main /home/circleci/helm.sh/helm/cmd/helm/helm.go:83 runtime.main /usr/local/go/src/runtime/proc.go:203 runtime.goexit /usr/local/go/src/runtime/asm_amd64.s:1357

My storage class well exists : kubectl get storageclass NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE sata-0a kubernetes.io/cinder Delete Immediate false 6d20h sata-0b kubernetes.io/cinder Delete Immediate false 6d20h ssd-0a kubernetes.io/cinder Delete Immediate false 6d20h ssd-0b kubernetes.io/cinder Delete Immediate false 6d20h

Anything else we need to know?:

If I don't set a storageClassName on the values.yaml, I have a timeout waiting condition error during the upgrade

Environment:

Maellooou commented 2 years ago

After more investigation, the issue is linked to the wrong identation on pre-migration-job.yaml

`

spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 200Mi
{{- if .Values.persistence.storageClass }}
  {{- if (eq "-" .Values.persistence.storageClass) }}
      storageClassName: ""
  {{- else }}
      storageClassName: "{{ .Values.persistence.storageClass }}"
  {{- end }}
{{- end }}

`

The storageClassName is on the same level than storage but should be on ressources level :

`

spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 200Mi
{{- if .Values.persistence.storageClass }}
  {{- if (eq "-" .Values.persistence.storageClass) }}
  storageClassName: ""
  {{- else }}
  storageClassName: "{{ .Values.persistence.storageClass }}"
  {{- end }}
{{- end }}

`

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

mrbobbytables commented 2 years ago

This project is being archived, closing open issues and PRs. Please see this PR for more information: https://github.com/kubernetes/community/pull/6632