Helm files incorrectly formatted with language mode 'helm-template'
See original GitHub issueVS Code version: 1.51.0 Kubernetes extension version: 1.2.1
Save the following in a charts/test/templates/service.yaml file:
apiVersion: v1
kind: Service
metadata:
name: test
labels:
app.kubernetes.io/name: test
app.kubernetes.io/version: test
app.kubernetes.io/instance: test
app.kubernetes.io/managed-by: test
annotations:
{{- include "test.test" . | nindent 4 }}
spec:
type: {{ .Values.type }}
ports:
- port: {{ .Values.port }}
targetPort: test
protocol: TCP
name: test
selector:
app.kubernetes.io/name: {{ include "test.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
Make sure that the file is interpreted as the language mode helm-template
. Save the file and it ends up looking like this:
apiVersion: v1
kind: Service
metadata:
name: test
labels:
app.kubernetes.io/name: test
app.kubernetes.io/version: test
app.kubernetes.io/instance: test
app.kubernetes.io/managed-by: test
annotations: { { - include "test.test" . | nindent 4 } }
spec:
type: { { .Values.type } }
ports:
- port: { { .Values.port } }
targetPort: test
protocol: TCP
name: test
selector:
app.kubernetes.io/name: { { include "test.name" . } }
app.kubernetes.io/instance: { { .Release.Name } }
Additional info I’ve also installed the latest version of the VS Code “Prettier” extension, if that is of importance.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Helm files incorrectly formatted with language mode ... - GitHub
Alt+Shift+F formats it incorrectly too. All the other template yaml files, like deployment.yaml , ingress.yaml etc are not affected. Is there ...
Read more >The Chart Template Developer's Guide - Helm V2
This guide provides an introduction to Helm's chart templates, with emphasis on the template language. Templates generate manifest files, which are YAML- ...
Read more >Template Function List - Helm
A list of template functions available in Helm. ... Returns a string based on a formatting string and the arguments to pass to...
Read more >Charts - Helm V2
Helm uses a packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources. A...
Read more >Appendix: YAML Techniques - Helm
Appendix: YAML Techniques. Most of this guide has been focused on writing the template language. Here, we'll look at the YAML format. YAML...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closed, because as you so correctly pointed out this is a Prettier issue and there is already an existing issue here https://github.com/prettier/prettier/issues/6517
@bacongobbler Sure, do you think it is a problem with that extension? I can open a ticket there then.