grafana / helm-charts

Apache License 2.0
1.62k stars 2.24k forks source link

Loki-Stack: Custom values for subcharts #2161

Open hutger opened 1 year ago

hutger commented 1 year ago

Hi There,

Maybe a silly question, but I deploying Loki using Loki-Stack helm chart (https://artifacthub.io/packages/helm/grafana/loki-stack), which bundles Loki and Promtail.

I'm looking for a way to pass custom values for Loki, as you can see below, but Helm is ignoring the write and read definitions.

How can pass those values settings to Loki downstream chart?

---
apiVersion: v2
name: loki-stack
version: 1.0.0
dependencies:
  - name: loki-stack
    version: 2.8.9
    repository: https://grafana.github.io/helm-charts

---
loki-stack:
  loki:
    enable: true
    # The value below "config" must be a string instead of a map
    config:
      existingSecret: loki

  write:
    replicas: 2
    autoscaling:
      enabled: true
      minReplicas: 2
      maxReplicas: 3
      targetCPUUtilizationPercentage: 60
      targetMemoryUtilizationPercentage: 80
    persistence:
      size: 5Gi
      storageClass: longhorn
    resources:
      limits:
        #cpu: 400m
        memory: 1200Mi 
      requests:
        cpu: 35m
        memory: 300Mi

  read:
    replicas: 2
    autoscaling:
      enabled: true
      minReplicas: 2
      maxReplicas: 3
      targetCPUUtilizationPercentage: 60
      targetMemoryUtilizationPercentage: 80
    persistence:
      size: 1Gi
      storageClass: longhorn
    resources:
      limits:
        #cpu: 400m
        memory: 150Mi
      requests:
        cpu: 50m
        memory: 75Mi

  serviceMonitor:
    enabled: true
bdols commented 1 year ago

I'm not a project maintainer, but you need to look at charts/loki/values.yaml inside the loki-stack chart to see what the default values are. 'read' and 'write' aren't defined. did you copy these values in from a different chart?

JossWhittle commented 10 months ago

@hutger Did you find a solution to this. I am in the same situation with any values nested under the loki subchart not being recognized.

loki.enabled: false does disable the subchart dependency as expected. And loki.isDefault also gets propagated through to the config map it adjusts, but this value is handled by the loki-stack chart, not passed through to the loki subchart.

But any values that are meant to be passed to the loki subchart itself do not seem to be getting applied properly.

I'm at my wits end. Any help would be greatly appreciated, even if it's just to say "this is a broken nightmare and I ended up installing the loki and promtail charts separately". At least then I would feel somewhat justified in giving up here... 🙃

igloo12 commented 10 months ago

@JossWhittle I am having this same problem it looks like the values are in the configmap but I am not sure how to update or add to the map

hutger commented 10 months ago

@JossWhittle I just gave up trying and installed Loki and Promtail separately. Ultimately, it turned out to be a better choice as I could manage each individually.

JossWhittle commented 10 months ago

I think the loki-stack chart is fundamentally broken at the moment if you want to pass any values through to the underlying loki chart. You can customize the values sent to the promtail subchart, but not those sent to loki.

loki:
  # Used by loki-stack to enable/disable the loki subchart
  enabled: true
  # Used by loki-stack to deploy a configmap
  isDefault: false

  # Should be getting forwarded to the loki subchart as .Values.loki but isn't.
  loki:
    commonConfig:
      replication_factor: 1
    auth_enabled: false
    storage:
      type: 'filesystem'

  # Should be getting forwarded to the loki subchart as .Values.singleBinary but isn't.
  singleBinary:
    persistence:
      enabled: true
      storageClass: "ceph-filesystem"
      size: 20Gi
      volumeClaimsEnabled: true
      enableStatefulSetAutoDeletePVC: false

  # Should be getting forwarded to the loki subchart as .Values.test but isn't.
  test:
    enabled: false

promtail:
  # Used by loki-stack to enable/disable the promtail subchart
  enabled: true

  # Everything else that follows within this top level promtail key is correctly forwarded to the 
  # promtail subchart as .Values.serviceMonitor and similar.
  serviceMonitor:
    enabled: true
ShadowJonathan commented 10 months ago

I'm having the same problem; i want to enable storage, but it doesn't seem to properly work

aleph-whip commented 9 months ago

I can confirm that also in my experience customising loki subchart looks broken; by setting

persistence:
enabled: true
storageClass: longhorn
size: 80Gi

the storageClass is ignored and the default class is used.