question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Helm files incorrectly formatted with language mode 'helm-template'

See original GitHub issue

VS 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:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
thernstigcommented, Feb 10, 2021

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

0reactions
thernstigcommented, Feb 9, 2021

@bacongobbler Sure, do you think it is a problem with that extension? I can open a ticket there then.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found