<p>I am trying to deploy helm chart in local vritual box on minikube using helm command shown below. </p>

<p>I am referring livenessProbe , readinessProbe configuration directly from values.yam in the deployment.yaml as shown below. However following this approach gives me the error specified below , if i change this to refer each attribute value independently i see the chart is getting installed , pod deploys successfully. </p>

<pre><code>      livenessProbe:
        - {{ .Values.monitorConfig.liveness }}
      readinessProbe:
        - {{ .Values.monitorConfig.readiness }}
</code></pre>

<p><strong><em>Can anyone please let me know what can be done to avoid the error and why??</em></strong> </p>

<p>Thank you.</p>

<h2>Helm Command</h2>

<p>helm install --debug -n pspk ./pkg/helm/my-service/</p>

<h2>Error</h2>

<blockquote>
  <p>Error: release pspk failed: Deployment in version "v1beta1" cannot be
  handled as a Deployment: v1beta1.Deployment.Spec:
  v1beta1.DeploymentSpec.Template: v1.PodTemplateSpec.Spec:
  v1.PodSpec.Containers: []v1.Container: v1.Container.LivenessProbe:
  readObjectStart: expect { or n, but found [, error found in #10 byte
  of ...|ssProbe":["map[failu|..., bigger context
  ...|"imagePullPolicy":"IfNotPresent","livenessProbe":["map[failureThreshold:3
  httpGet:map[path:/greeting|...</p>
</blockquote>

<h2>deployment.yaml</h2>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: {{ template "fullname" . }}
  labels:
    app: {{ template "fullname" .}}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
    release: "{{ .Release.Name }}"
spec:
  replicas: {{ .Values.replicaCount }}
  template:
    metadata:
      labels:
        app: {{ template "fullname" . }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: 50443
              protocol: TCP
            - name: grpc
              containerPort: 50051
              protocol: TCP
          livenessProbe:
            - {{ .Values.monitorConfig.liveness }}
          readinessProbe:
            - {{ .Values.monitorConfig.readiness }}
          resources:
{{ toYaml .Values.resources | indent 12 }}
</code></pre>

<h2>values.yaml</h2>

<pre><code>replicaCount: 2

application:
  track: stable

image:
  repository: test/go-k8s
  tag: 0.1.1
  pullPolicy: IfNotPresent

# SQL migration scripts

service:
  enabled: false
  type: NodePort
  port: 80
  grpc_port: 50051

env:
  # POSTGRES_HOST  
  postgresHost: localhost
  # POSTGRES_PORT
  postgresPort: "5432"
  # POSTGRES_SSL_MODE
  postgresSSLMode: "disable"
  # POSTGRES_DB
  postgresDB: test
  # POSTGRES_USER
  postgresUser: test
  # POSTGRES_PASSWORD
  postgresPassword: "test"


monitorConfig:
  liveness:
    httpGet:
      path: "/greeting"
      port: 50443
    periodSeconds: 2
    timeoutSeconds: 10
    initialDelaySeconds: 5
    failureThreshold: 3
    successThreshold: 1
  readiness:
    httpGet:
      path: "/greeting"
      port: 50443
    periodSeconds: 2
    timeoutSeconds: 10
    initialDelaySeconds: 5
    failureThreshold: 3
    successThreshold: 1

resources: {}

nodeSelector: {}

tolerations: []

affinity: {}
</code></pre>

Mozhi
<p>You need to do two things to make this work correctly: explicitly serialize the value as YAML, and make the indentation correct.  This tends to look something like</p>

<pre><code>livenessProbe:
  - {{ .Values.monitorConfig.liveness | toYaml | indent 8 | trim }}
</code></pre>

<p>The default serialization will be a Go-native dump format, which isn't YAML and leads to the weird <code>map[failureThreshold:1]</code> output; <code>toYaml</code> fixes this.  <code>indent 8</code> puts spaces at the front of every line in the resulting block (you will need to adjust the "8").  <code>trim</code> removes leading and trailing spaces.  (<code>toYaml</code> is Helm-specific and isn't documented well; the other two functions come from the <a href="http://masterminds.github.io/sprig/" rel="nofollow noreferrer">Sprig</a> support library.)</p>

<p>You should double-check this output with</p>

<pre><code>helm template -n pspk ./pkg/helm/my-service/
</code></pre>

<p>and if it doesn't look like valid YAML, adjust it further.</p>
