grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
23.39k stars 3.39k forks source link

[helm chart] Ingress points to the wrong service name #8032

Open blezoray opened 1 year ago

blezoray commented 1 year ago

Hello,

I use the helm chart 3.8.0 with the following values.yaml. My release name is monitoring

ingress:
  enabled: true
  hosts:
    - loki-shared-monitoring.apps.tech.com

It generates this ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: monitoring-loki
  labels:
    helm.sh/chart: loki-3.8.0
    app.kubernetes.io/name: loki
    app.kubernetes.io/instance: monitoring
    app.kubernetes.io/version: "2.7.0"
    app.kubernetes.io/managed-by: Helm
spec:
  rules:
    - host: "loki-shared-monitoring.apps.fr01.paas.tech.orange"
      http:
        paths:
          - path: /api/prom/push
            pathType: Prefix
            backend:
              service:
                name: monitoring-loki
                port:
                  number: 3100
          - path: /loki/api/v1/push
            pathType: Prefix
            backend:
              service:
                name: monitoring-loki
                port:
                  number: 3100
...

But the service name is lokiand not monitoring-loki

Could you verify this issue in the ingress or service ?

Rgds.

blezoray commented 1 year ago

I think the issue is in the _helpers.tpl file, here. It should be loki.name instead of loki.fullname.

{{/*
Ingress service name helper function
Params:
  ctx = . context
  svcName = service name without the "loki.fullname" part (ie. read, write)
*/}}
{{- define "loki.ingress.serviceName" -}}
{{- if (eq .svcName "singleBinary") }}
{{- printf "%s" (include "loki.name" .ctx) }}
{{- else }}
{{- printf "%s-%s" (include "loki.name" .ctx) .svcName }}
{{- end -}}
{{- end -}}
mickutz commented 1 year ago

:sob: still an issue!

r4j4h commented 1 year ago

still an issue :(

r4j4h commented 1 year ago

However, with Flux a postRenderer can be used to get around it:


  postRenderers:
    - kustomize:
        patchesJson6902:
          - target:
              kind: Ingress
              name: <your generated ingress name>
            patch:
              - op: replace
                path: /spec/rules/0/http/paths/0/backend/service/name
                value: loki-read
              - op: replace
                path: /spec/rules/0/http/paths/1/backend/service/name
                value: loki-read
              - op: replace
                path: /spec/rules/0/http/paths/2/backend/service/name
                value: loki-read
              - op: replace
                path: /spec/rules/0/http/paths/3/backend/service/name
                value: loki-read
              - op: replace
                path: /spec/rules/0/http/paths/4/backend/service/name
                value: loki-read
              - op: replace
                path: /spec/rules/0/http/paths/5/backend/service/name
                value: loki-read
              - op: replace
                path: /spec/rules/0/http/paths/6/backend/service/name
                value: loki-read
              - op: replace
                path: /spec/rules/0/http/paths/7/backend/service/name
                value: loki-write
              - op: replace
                path: /spec/rules/0/http/paths/8/backend/service/name
                value: loki-write
kimtore commented 1 year ago

Still broken in 5.8.4 after two major releases and six months. We managed to work around the issue using fullnameOverride: loki in values.yaml.