benc-uk / kubeview

Kubernetes cluster visualiser and graphical explorer

Home Page:http://kubeview.benco.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add "ingressClassName" to the ingress template to take advantage of k8s api changes

sosukeinu opened this issue · comments

I was having a very difficult time assigning the ingressClassName for the ingress. I needed to use "public" here. I would like to suggest:

./kubeview/templates/ingress.yaml:

{{- if .Values.ingress.enabled -}}
{{- $fullName := include "kubeview.fullname" . -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
{{ include "kubeview.labels" . | indent 4 }}
  {{- with .Values.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
{{- if .Values.ingress.ingressClassName }}
  ingressClassName: {{ .Values.ingress.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:
        {{- range .paths }}
          - path: {{ . }}
            backend:
              serviceName: {{ $fullName }}
              servicePort: 80
        {{- end }}
  {{- end }}
{{- end }}

Then you would be able to configure your values with:

#
# If true install in single namespace mode
#
limitNamespace: false

image:
  repository: ghcr.io/benc-uk/kubeview
  tag: 0.1.19
  pullPolicy: Always

ingress:
  enabled: true
  annotations:
    cert-manager.io/cluster-issuer: mkcert-ca-issuer
  hosts:
    - host: kubeview.k8s.localhost
      paths:
        - /
  tls:
  - secretName: kubeview-cert
    hosts:
      - kubeview.k8s.localhost
  ingressClassName: public

Fixed in 0.1.20