tchiotludo / akhq

Kafka GUI for Apache Kafka to manage topics, topics data, consumers group, schema registry, connect and more...
https://akhq.io/
Apache License 2.0
3.42k stars 661 forks source link

Helm: Ingress with pathType ImplementationSpecific not working #1508

Open cinimins opened 1 year ago

cinimins commented 1 year ago

Hi,

the ingress in my cluster is not working. It forwards to /ui but then outputs No server is available to handle this request.

My values.yaml looks like this (I left out tls and cert-manager annotations):

ingress:
  enabled: true
  paths:
    - /
  hotsts:
    - my.host
  annotations:
    ncp/http-redirect: "true"

When modifying the ingress to use pathType: Prefix (instead of ImplementationSpecific), it works. My default ingressclass is nsx, but it also doesn't work with nginx.

My current workaround is to deploy my own ingress instead of using the one from the helm chart. Is there a cleaner way?

libo1987 commented 1 year ago

Try this

{{- if .Values.ingress.enabled -}}
{{- $fullName := include "akhq.fullname" . -}}
{{- $ingressPaths := .Values.ingress.paths -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    app.kubernetes.io/name: {{ include "akhq.name" . }}
    helm.sh/chart: {{ include "akhq.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
  {{- with .Values.ingress.annotations }}
  annotations:
    {{- tpl (toYaml .) $ | nindent 4 }}
  {{- end }}
spec:
  tls:
    - hosts:
      - {{ .Values.ingress.host }}
      secretName: {{ .Values.ingress.secretName }}
  ingressClassName: nginx
  rules:
    - host: {{ .Values.ingress.host }}
      http:
        paths:
        - path: /
          pathType: Prefix
          backend:
            service:
              name: {{ $fullName }}
              port:
                number: 8080
{{- end }}
cinimins commented 1 year ago

Maybe the ingress controllers in our kubernetes clusters have some weird configuration, I don't know. If it's just a rare corner case, I'm fine with my own ingress, but if not, I was wondering whether it wouldn't be better to make the ingress template a bit more customizable.

The way it is currently implemented with the loop over the ingressPaths, I don't see an elegant way to make the pathType customizable.

I'm happy to make a PR, I just don't know whether anyone else has the same issue.

tchiotludo commented 1 year ago

@cinimins you can provide a PR for sure, just try to be non breaking compatibility

cinimins commented 1 year ago

I didn't find time to look at this earlier. I don't think it's possible to extend the Helm chart without breaking backward compatibility. It might be related to #664 but I couldn't get that solution to work. I think we will stick with disabling the ingress in the helm chart and deploying a separate Ingress.

Feel free to close this issue, if noone else has this issue.