0

Im trying to write my 1st helm chart

thats my deployment in this part: containerPort: {{ .Values.port }} ... its work buy not work in this: value: {{ .Values.port | quote }} value: {{ .Value.logs | quote }} i dont understand why... and error nothing help me plz help

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-deployment
  labels:
    app: test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
        - name: test
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          ports:
            - name: http
              containerPort: {{ .Values.port }}
              protocol: TCP
        - env:
          - name: PORT
            value: {{ .Values.port | quote }}
          - name: LOGS
            value: {{ .Value.logs | quote }}
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http

this is my:

values.yaml

port: 8080
logs: "/logs/access.log"

replicaCount: 1

image:
  repository: #
  pullPolicy: IfNotPresent
  # Overrides the image tag whose default is the chart appVersion.
  tag: "develop"

lint or helm install gives an error message:

gitlab-runner:~$ helm install test ./test --dry-run --debug
install.go:173: [debug] Original chart version: ""
install.go:190: [debug] CHART PATH: /home/gitlab-runner/test

Error: template: test/templates/deployment.yaml:28:28: executing "test/templates/deployment.yaml" at <.Value.logs>: nil pointer evaluating interface {}.logs
helm.go:88: [debug] template: test/templates/deployment.yaml:28:28: executing "test/templates/deployment.yaml" at <.Value.logs>: nil pointer evaluating interface {}.logs


i dont understan what i do wrong and im sorry for my bad english ^^

Swarovsky
  • 5
  • 3

1 Answers1

0

plan 1

deployment.yaml

        - env:
          - name: PORT
            value: "{{ .Values.port }}"
          - name: LOGS
            value: "{{ .Value.logs }}"

values.yaml

port: 8080
logs: /logs/access.log

plan 2

deployment.yaml

        - env:
          - name: PORT
            value: {{ .Values.port | quote }}
          - name: LOGS
            value: {{ .Value.logs | quote }}

values.yaml

port: 8080
logs: /logs/access.log
z.x
  • 1,905
  • 7
  • 11