Problem with definition of Kubernetes Ingress in helm

10/19/2018

I'm trying to deploy the following Ingress with helm:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    io.ctl.cd/ssl: "ui.releasename"
  name: ui
  labels:
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
spec:
  rules:
    {{ if eq .Values.nodeSelector.location "minikube" }}
    - host: ui.{{ .Release.Namespace  }}.minikube.test
    {{ else }}
    - host: ui.{{ .Release.Namespace  }}.devhost
    {{ end }}
      http:
        paths:
        - backend:
            serviceName: api
            servicePort: {{ .Values.api.service.port }}
          path: /

And I'm getting the following error Error: release x-**** failed: Ingress in version "v1beta1" cannot be handled as a Ingress: only encoded map or array can be decoded into a struct

I have a very similar ingress that is working fine, I don't don't want is happening with this one.

-- Carabes
docker
kubernetes
kubernetes-helm

1 Answer

10/19/2018

I think problem in this string:

chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"

For test, try:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    io.ctl.cd/ssl: "ui.releasename"
  name: ui
  labels:
    chart: "{{ .Chart.Name }}"
spec:
  rules:
    {{ if eq .Values.nodeSelector.location "minikube" }}
    - host: ui.{{ .Release.Namespace  }}.minikube.test
    {{ else }}
    - host: ui.{{ .Release.Namespace  }}.devhost
    {{ end }}
      http:
        paths:
        - backend:
            serviceName: api
            servicePort: {{ .Values.api.service.port }}
          path: /
-- Arslanbekov
Source: StackOverflow