centrifugal / helm-charts

Official Centrifugo Helm chart for Kubernetes
MIT License
33 stars 29 forks source link

[bug] Incorrect formatting when using deploymentStrategy #66

Closed Ahmed-Sermani closed 1 year ago

Ahmed-Sermani commented 1 year ago

Describe the bug When making use of the 'deploymentStrategy' in a Helm chart for a Kubernetes deployment, the output format is incorrect. The 'strategy' and 'type' fields, under spec strategy, appear on the same line. Version of Helm and Kubernetes:

Helm Version:

$ helm version
version.BuildInfo{Version:"v3.12.3", GitCommit:"3a31588ad33fe3b89af5a2a54ee1d25bfe6eaa5e", GitTreeState:"clean", GoVersion:"go1.20.7"}

Kubernetes Version:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.1", GitCommit:"4c9411232e10168d7b050c49a1b59f6df9d7ea4b", GitTreeState:"clean", BuildDate:"202
3-04-14T13:14:41Z", GoVersion:"go1.20.3", Compiler:"gc", Platform:"darwin/arm64"}
Kustomize Version: v5.0.1
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.6", GitCommit:"b39bf148cd654599a52e867485c02c4f9d28b312", GitTreeState:"clean", BuildDate:"202
2-09-22T05:53:51Z", GoVersion:"go1.18.6", Compiler:"gc", Platform:"linux/arm64"}

Which version of the chart: latest centrifugo-11.0.1

What happened: When using deploymentStrategy, the resulting output had 'strategy' and 'type' on the same line under spec strategy. Which makes output invalid

spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: centrifugo
      app.kubernetes.io/instance: cent
  strategy:    type: RollingUpdate

What you expected to happen: I expected 'strategy' and 'type' to be on separate lines, like so:

spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: centrifugo
      app.kubernetes.io/instance: cent
  strategy:
    type: RollingUpdate

How to reproduce it:

  1. Create a new Helm chart or use an existing one
  2. Add deploymentStrategy to the values.yaml file
  3. Run the following command: helm template cent ./charts/centrifugo --set deploymentStrategy.type=RollingUpdate --debug
  4. Observe that 'strategy' and 'type' under spec strategy appear on the same line

Anything else we need to know:
The issue seems to be due to the use of 'indent' instead of 'nindent' in this piece of the Helm chart:

{{- if .Values.deploymentStrategy }}
strategy:
  {{- toYaml .Values.deploymentStrategy | indent 4 }}
{{- end }}