Skip to content

Ingress Template Fails When No Paths Are Defined #33

@luizjr

Description

@luizjr

Problem

The current Ingress template fails when paths is empty under hosts. This results in an invalid Ingress resource, causing Helm to throw an error.

Suggested Fix
Modify the template to ensure paths always has at least one entry, with a default value of / and pathType: Prefix, which is a common and functional default.

Additionally, the ingressClassName field should be explicitly included if .Values.ingress.className is set, as this is now a standard Kubernetes annotation.

Proposed Changes

  1. Update the values.yaml default configuration to ensure paths is never empty:
ingress:
  enabled: true
  hosts:
    - host: example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
    - hosts:
        - example.com
      secretName: example-tls
  1. Modify the Ingress template to include a default path and ingressClassName:
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "langflow.fullname" . -}}
{{- $svcPort := .Values.langflow.frontend.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    {{- include "langflow.labels" . | nindent 4 }}
  {{- with .Values.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  {{- with .Values.ingress.className }}
  ingressClassName: {{ . }}
  {{- end }}
  {{- if .Values.ingress.tls }}
  tls:
    {{- range .Values.ingress.tls }}
    - hosts:
        {{- range .hosts }}
        - {{ . | quote }}
        {{- end }}
      secretName: {{ .secretName }}
    {{- end }}
  {{- end }}
  rules:
    {{- range .Values.ingress.hosts }}
    - host: {{ .host | quote }}
      http:
        paths:
          {{- if .paths }}
          {{- range .paths }}
          - path: {{ .path | quote }}
            pathType: {{ .pathType | default "Prefix" | quote }}
            backend:
              service:
                name: {{ $fullName }}
                port: 
                  number: {{ $svcPort }}
          {{- end }}
          {{- else }}
          - path: "/"
            pathType: "Prefix"
            backend:
              service:
                name: {{ $fullName }}
                port:
                  number: {{ $svcPort }}
          {{- end }}
    {{- end }}
{{- end }}

This change ensures:

  • Ingress always has at least one path (/) to prevent Helm from failing.
  • ingressClassName is included when defined, improving compatibility with Kubernetes updates.

Would love to get this merged to improve reliability when deploying via Helm! 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions