unable to parse YAML: error converting YAML to JSON: yaml: line 46: did not find expected key with helm lint

Viewed 96

I just created a new Helm chart by adding curl command in liveness probe and readiness probe but when I run helm lint I get:

[ERROR] templates/deployment.yaml: unable to parse YAML: error converting YAML to JSON: yaml: line 46: did not find expected key

but when i do helm install of the same yaml it works fine its deployed successfully.

Problem is with helm lint when i run helm lint its throwing error.

And this is my yaml file.

Any help is much appreciated.

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "nodered.fullname" . }}-deployment
labels:
  app: {{ template "nodered.fullname" . }}
  chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
  release: "{{ .Release.Name }}"
  heritage: "{{ .Release.Service }}"
  tier: application
spec:
replicas: {{ .Values.nodered.replicaCount }}
selector:
  matchLabels:
    app: {{ template "nodered.fullname" . }}
    tier: application
template:
  metadata:
    labels:
      app: {{ template "nodered.fullname" . }}
      tier: application
      release: "{{ .Release.Name }}"
    annotations:
      timestamp: "{{ now }}"
{{- if .Values.nodered.istio.enabled }}
      sidecar.istio.io/inject: "true"
      traffic.sidecar.istio.io/excludeOutboundPorts: "7600,8889"
      traffic.sidecar.istio.io/excludeInboundPorts: "7600,8889"
{{- end }}
  spec:
    securityContext:
      runAsUser: 1000
      fsGroup: 1000
    containers:
      - name: kube-{{ template "nodered.fullname" . }}
        {{- if .Values.registry }}
        image: {{ .Values.registry}}/{{ .Values.nodered.image.name}}:{{ .Values.nodered.image.tag}}
        {{- else }}
        image: "{{ .Values.nodered.image.name}}:{{ .Values.nodered.image.tag}}"
        {{- end }}
        imagePullPolicy: {{ .Values.nodered.image.pullPolicy}}
        livenessProbe:
        {{- if .Values.nodered.istio.enabled }}
          exec:
            command:
            - curl
            - -f
            - http://127.0.0.1:1880/nodered/admin
        {{- else if .Values.nodered.securebackend.enabled }}
          httpGet:
            scheme: HTTPS
            port: 1880
            path: /nodered/admin
        {{- else }}
          httpGet:
            scheme: HTTP
            port: 1880
            path: /nodered/admin
        {{- end }}
{{ toYaml ( .Values.nodered.livenessProbeTimeouts ) | indent 12 }}
        readinessProbe:
        {{-  if .Values.nodered.istio.enabled }}
          exec:
            command:
            - curl
            - -f
            - http://127.0.0.1:1880/nodered/admin
          {{- else if .Values.nodered.securebackend.enabled }}
            httpGet:
              scheme: HTTPS
              port: 1880
              path: /nodered/admin
          {{- else }}
            httpGet:
              scheme: HTTP
              port: 1880
              path: /nodered/admin
          {{- end }}
{{ toYaml ( .Values.nodered.readinessProbeTimeouts ) | indent 12 }}
        env:
        {{- if hasKey .Values.nodered "dependencyWaitTimeoutInSeconds" }}
        - name: DEPENDENCY_WAIT_TIMEOUT_INSECONDS
          value: {{ .Values.nodered.dependencyWaitTimeoutInSeconds | quote }}
        {{- end }}
        - name: NODE_RED_BIND_ADDRESS
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        envFrom:
        - configMapRef:
            name: {{ template "nodered.fullname" . }}-config
        ports:
          - name: http
            containerPort: 1880
            protocol: TCP
          - name: https
            containerPort: 1880
            protocol: TCP
        volumeMounts:
            {{- if .Values.nodered.securebackend }}
            {{- if .Values.nodered.securebackend.enabled }}
          - mountPath: /usr/src/node-red/certificates/
            name: certificates
            readOnly: true
            {{- end }}
            {{- end }}
{{- with .Values.nodered.resources }}
        resources:
{{ toYaml . | indent 12 }}
{{- end }}
{{- if and .Values.nodered.istio.enabled (eq .Values.nodered.istio.enabled true) }}
    serviceAccountName: {{ template "-nodered.fullname" . }}-servicename
{{- end }}
    volumes:
        {{- if .Values.nodered.securebackend }}
        {{- if .Values.nodered.securebackend.enabled }}
      - name: certificates
        secret:
        {{- if .Values.nodered.securebackend.certificate }}
          secretName: {{ .Values.nodered.securebackend.certificate }}
        {{- else }}
          secretName: {{ template "nodered.fullname" . }}-secret-{{ (index .Values.tlsConfig 0).name | default 0 }}
        {{- end }}
        {{- end }}
        {{- end }}
  {{- if hasKey .Values.nodered.image "imagePullSecretName" }}
    imagePullSecrets:
      - name: {{ .Values.nodered.image.imagePullSecretName }}
  {{- end }}
{{- if hasKey .Values.nodered "nodeSelector" }}
{{- with .Values.nodered.nodeSelector }}
    nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}
{{- if hasKey .Values.nodered "affinity" }}
{{- with .Values.nodered.affinity }}
    affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}
{{- if hasKey .Values.nodered "tolerations" }}
{{- with .Values.nodered.tolerations }}
    tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}

The strange thing is when i run helm install of this yaml it works fine . but problem is with helm lint . when i run helm lint its throwing error.

0 Answers
Related