Skip to content

Commit

Permalink
fix: properly indent service annotations (#25388)
Browse files Browse the repository at this point in the history
When then was more than 1 annotation on the service, it would not be
properly indented.

```
$ cat test-values.yaml 
serviceAnnotations:
  foo: bar
  bar: baz
  baz: qux
$ helm template fleet . -f test-values.yaml --show-only templates/service.yaml
---
# Source: fleet/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  labels:
    app: fleet
    chart: fleet
    heritage: Helm
    release: fleet
  annotations:
    bar: baz
    baz: qux
    foo: bar
  name: fleet-service
  namespace: fleet
spec:
  selector:
    app: fleet
    chart: fleet
    heritage: Helm
    release: fleet
  ports:
  - name: fleet
    port: 8080
    targetPort: 8080
```

before:

```
$ git checkout main
$ helm template fleet . -f test-values.yaml --show-only templates/service.yaml
---
# Source: fleet/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  labels:
    app: fleet
    chart: fleet
    heritage: Helm
    release: fleet
  annotations:
    bar: baz
  baz: qux
  foo: bar
  name: fleet-service
  namespace: fleet
spec:
  selector:
    app: fleet
    chart: fleet
    heritage: Helm
    release: fleet
  ports:
  - name: fleet
    port: 8080
    targetPort: 8080
  • Loading branch information
duboisf authored Jan 15, 2025
1 parent 39466cb commit 239db41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion charts/fleet/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
{{- if .Values.serviceAnnotations }}
annotations:
{{- with .Values.serviceAnnotations}}
{{ toYaml . | trim | indent 2}}
{{- toYaml . | trim | nindent 4}}
{{- end }}
{{- end }}
name: {{ $serviceName }}
Expand Down

0 comments on commit 239db41

Please sign in to comment.