diff --git a/docs/sources/setup/install/helm/reference.md b/docs/sources/setup/install/helm/reference.md index f9028da643849..31b3006a84eb9 100644 --- a/docs/sources/setup/install/helm/reference.md +++ b/docs/sources/setup/install/helm/reference.md @@ -1109,8 +1109,6 @@ null ], "enableStatefulSetAutoDeletePVC": false, "enabled": false, - "size": "10Gi", - "storageClass": null, "whenDeleted": "Retain", "whenScaled": "Retain" }, @@ -1295,6 +1293,15 @@ null List of the bloom-gateway PVCs
 
+
+ + + + bloomGateway.persistence.claims[0].size + string + Size of persistent disk +
+"10Gi"
 
@@ -1314,24 +1321,6 @@ false
 false
 
- - - - bloomGateway.persistence.size - string - Size of persistent disk -
-"10Gi"
-
- - - - bloomGateway.persistence.storageClass - string - Storage class to be used. If defined, storageClassName: . If set to "-", storageClassName: "", which disables dynamic provisioning. If empty or set to null, no storageClassName spec is set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack). -
-null
-
@@ -1492,11 +1481,15 @@ null "nodeSelector": {}, "persistence": { "annotations": {}, - "claims": [], + "claims": [ + { + "name": "data", + "size": "10Gi", + "storageClass": null + } + ], "enableStatefulSetAutoDeletePVC": false, "enabled": false, - "size": "10Gi", - "storageClass": null, "whenDeleted": "Retain", "whenScaled": "Retain" }, @@ -1680,7 +1673,16 @@ null list List of the bloom-planner PVCs
-[]
+
+
+ + + + bloomPlanner.persistence.claims[0].size + string + Size of persistent disk +
+"10Gi"
 
@@ -1700,24 +1702,6 @@ false
 false
 
- - - - bloomPlanner.persistence.size - string - Size of persistent disk -
-"10Gi"
-
- - - - bloomPlanner.persistence.storageClass - string - Storage class to be used. If defined, storageClassName: . If set to "-", storageClassName: "", which disables dynamic provisioning. If empty or set to null, no storageClassName spec is set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack). -
-null
-
@@ -6146,6 +6130,9 @@ null Additional storage config
 {
+  "bloom_shipper": {
+    "working_directory": "/var/loki/data/bloomshipper"
+  },
   "boltdb_shipper": {
     "index_gateway_client": {
       "server_address": "{{ include \"loki.indexGatewayAddress\" . }}"
diff --git a/production/helm/loki/CHANGELOG.md b/production/helm/loki/CHANGELOG.md
index eeab991040f42..6052b517068ae 100644
--- a/production/helm/loki/CHANGELOG.md
+++ b/production/helm/loki/CHANGELOG.md
@@ -16,6 +16,9 @@ Entries should include a reference to the pull request that introduced the chang
 ## 6.13.0
 
 - [CHANGE] Correctly wrap ClusterRoleBinding around `rbac/namespaced` conditional.
+- [FIX] Do not create bloom planner, bloom builder, bloom gateway Deployment/Statefulset if their replica count is 0.
+- [FIX] Configure (ephemeral) storage for bloom builder working directory
+- [ENHANCEMENT] Automatically configure bloom planner address for bloom builders and bloom gateway addresses for bloom gateway clients.
 
 ## 6.12.0
 
diff --git a/production/helm/loki/templates/_helpers.tpl b/production/helm/loki/templates/_helpers.tpl
index 4ec80d2b4db29..9a4ab135db922 100644
--- a/production/helm/loki/templates/_helpers.tpl
+++ b/production/helm/loki/templates/_helpers.tpl
@@ -1047,6 +1047,34 @@ enableServiceLinks: false
 {{- printf "%s" $idxGatewayAddress }}
 {{- end }}
 
+{{/* Determine bloom-planner address */}}
+{{- define "loki.bloomPlannerAddress" -}}
+{{- $bloomPlannerAddress := ""}}
+{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
+{{- $isScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
+{{- if $isDistributed -}}
+{{- $bloomPlannerAddress = printf "%s-headless.%s.svc.%s:%s" (include "loki.bloomPlannerFullname" .) .Release.Namespace .Values.global.clusterDomain (.Values.loki.server.grpc_listen_port | toString) -}}
+{{- end -}}
+{{- if $isScalable -}}
+{{- $bloomPlannerAddress = printf "%s-headless.%s.svc.%s:%s" (include "loki.backendFullname" .) .Release.Namespace .Values.global.clusterDomain (.Values.loki.server.grpc_listen_port | toString) -}}
+{{- end -}}
+{{- printf "%s" $bloomPlannerAddress}}
+{{- end }}
+
+{{/* Determine bloom-gateway address */}}
+{{- define "loki.bloomGatewayAddresses" -}}
+{{- $bloomGatewayAddresses := ""}}
+{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
+{{- $isScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
+{{- if $isDistributed -}}
+{{- $bloomGatewayAddresses = printf "dnssrvnoa+_grpc._tcp.%s-headless.%s.svc.%s" (include "loki.bloomGatewayFullname" .) .Release.Namespace .Values.global.clusterDomain -}}
+{{- end -}}
+{{- if $isScalable -}}
+{{- $bloomGatewayAddresses = printf "dnssrvnoa+_grpc._tcp.%s-headless.%s.svc.%s" (include "loki.backendFullname" .) .Release.Namespace .Values.global.clusterDomain -}}
+{{- end -}}
+{{- printf "%s" $bloomGatewayAddresses}}
+{{- end }}
+
 {{- define "loki.config.checksum" -}}
 checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }}
 {{- end -}}
diff --git a/production/helm/loki/templates/bloom-builder/deployment-bloom-builder.yaml b/production/helm/loki/templates/bloom-builder/deployment-bloom-builder.yaml
index 5735de5da23d4..c04b3ae5ae255 100644
--- a/production/helm/loki/templates/bloom-builder/deployment-bloom-builder.yaml
+++ b/production/helm/loki/templates/bloom-builder/deployment-bloom-builder.yaml
@@ -1,5 +1,5 @@
 {{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
-{{- if $isDistributed -}}
+{{- if (and $isDistributed (gt (int .Values.bloomPlanner.replicas) 0)) -}}
 apiVersion: apps/v1
 kind: Deployment
 metadata:
@@ -101,6 +101,10 @@ spec:
             - name: license
               mountPath: /etc/loki/license
             {{- end }}
+            - name: temp
+              mountPath: /tmp
+            - name: data
+              mountPath: /var/loki
             {{- with .Values.bloomBuilder.extraVolumeMounts }}
             {{- toYaml . | nindent 12 }}
             {{- end }}
@@ -136,6 +140,10 @@ spec:
             secretName: enterprise-logs-license
           {{- end }}
         {{- end }}
+        - name: temp
+          emptyDir: {}
+        - name: data
+          emptyDir: {}
         {{- with .Values.bloomBuilder.extraVolumes }}
         {{- toYaml . | nindent 8 }}
         {{- end }}
diff --git a/production/helm/loki/templates/bloom-builder/service-bloom-builder-headless.yaml b/production/helm/loki/templates/bloom-builder/service-bloom-builder-headless.yaml
index e089d4d2de40c..e863a2c27866c 100644
--- a/production/helm/loki/templates/bloom-builder/service-bloom-builder-headless.yaml
+++ b/production/helm/loki/templates/bloom-builder/service-bloom-builder-headless.yaml
@@ -1,5 +1,5 @@
 {{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
-{{- if $isDistributed -}}
+{{- if (and $isDistributed (or (gt (int .Values.bloomBuilder.replicas) 0)) .Values.bloomBuilder.autoscaling.enabled) -}}
 apiVersion: v1
 kind: Service
 metadata:
diff --git a/production/helm/loki/templates/bloom-builder/service-bloom-builder.yaml b/production/helm/loki/templates/bloom-builder/service-bloom-builder.yaml
index aab082d72293f..6351bbdae5664 100644
--- a/production/helm/loki/templates/bloom-builder/service-bloom-builder.yaml
+++ b/production/helm/loki/templates/bloom-builder/service-bloom-builder.yaml
@@ -1,5 +1,5 @@
 {{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
-{{- if $isDistributed -}}
+{{- if (and $isDistributed (gt (int .Values.bloomBuilder.replicas) 0)) -}}
 apiVersion: v1
 kind: Service
 metadata:
diff --git a/production/helm/loki/templates/bloom-gateway/statefulset-bloom-gateway.yaml b/production/helm/loki/templates/bloom-gateway/statefulset-bloom-gateway.yaml
index e2ceefbeafb5d..7e97b8e93ece8 100644
--- a/production/helm/loki/templates/bloom-gateway/statefulset-bloom-gateway.yaml
+++ b/production/helm/loki/templates/bloom-gateway/statefulset-bloom-gateway.yaml
@@ -1,6 +1,5 @@
 {{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
-{{- if $isDistributed }}
-{{- if (gt (int .Values.bloomGateway.replicas) 0) -}}
+{{- if (and $isDistributed (gt (int .Values.bloomGateway.replicas) 0)) -}}
 apiVersion: apps/v1
 kind: StatefulSet
 metadata:
@@ -180,4 +179,3 @@ spec:
   {{- end }}
   {{- end }}
 {{- end -}}
-{{- end -}}
\ No newline at end of file
diff --git a/production/helm/loki/templates/bloom-planner/service-bloom-planner-headless.yaml b/production/helm/loki/templates/bloom-planner/service-bloom-planner-headless.yaml
index fd02c64acd502..1ad970746226a 100644
--- a/production/helm/loki/templates/bloom-planner/service-bloom-planner-headless.yaml
+++ b/production/helm/loki/templates/bloom-planner/service-bloom-planner-headless.yaml
@@ -1,6 +1,5 @@
 {{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
-{{- if $isDistributed -}}
-{{- if (gt (int .Values.bloomPlanner.replicas) 0) -}}
+{{- if (and $isDistributed (gt (int .Values.bloomPlanner.replicas) 0)) -}}
 apiVersion: v1
 kind: Service
 metadata:
@@ -33,4 +32,3 @@ spec:
   selector:
     {{- include "loki.bloomPlannerSelectorLabels" . | nindent 4 }}
 {{- end -}}
-{{- end -}}
diff --git a/production/helm/loki/templates/bloom-planner/statefulset-bloom-planner.yaml b/production/helm/loki/templates/bloom-planner/statefulset-bloom-planner.yaml
index 8d9a9f23998a5..8406542dabaa4 100644
--- a/production/helm/loki/templates/bloom-planner/statefulset-bloom-planner.yaml
+++ b/production/helm/loki/templates/bloom-planner/statefulset-bloom-planner.yaml
@@ -1,6 +1,5 @@
 {{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
-{{- if $isDistributed }}
-{{- if (gt (int .Values.bloomPlanner.replicas) 0) -}}
+{{- if (and $isDistributed (gt (int .Values.bloomPlanner.replicas) 0)) -}}
 apiVersion: apps/v1
 kind: StatefulSet
 metadata:
@@ -180,4 +179,3 @@ spec:
   {{- end }}
   {{- end }}
 {{- end -}}
-{{- end -}}
diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml
index ed65339cb33ad..0f0e4e2afd18c 100644
--- a/production/helm/loki/values.yaml
+++ b/production/helm/loki/values.yaml
@@ -279,6 +279,16 @@ loki:
 
     tracing:
       enabled: {{ .Values.loki.tracing.enabled }}
+
+    {{- with .Values.loki.bloom_build }}
+    bloom_build:
+      {{- tpl (. | toYaml) $ | nindent 4 }}
+    {{- end }}
+
+    {{- with .Values.loki.bloom_gateway }}
+    bloom_gateway:
+      {{- tpl (. | toYaml) $ | nindent 4 }}
+    {{- end }}
   # Should authentication be enabled
   auth_enabled: true
   # -- memberlist configuration (overrides embedded default)
@@ -410,6 +420,8 @@ loki:
     tsdb_shipper:
       index_gateway_client:
         server_address: '{{ include "loki.indexGatewayAddress" . }}'
+    bloom_shipper:
+      working_directory: /var/loki/data/bloomshipper
     hedging:
       at: "250ms"
       max_per_second: 20
@@ -442,8 +454,12 @@ loki:
     enabled: false
   bloom_build:
     enabled: false
+    builder:
+      planner_address: '{{ include "loki.bloomPlannerAddress" . }}'
   bloom_gateway:
     enabled: false
+    client:
+      addresses: '{{ include "loki.bloomGatewayAddresses" . }}'
 ######################################################################################################################
 #
 # Enterprise Loki Configs
@@ -2447,20 +2463,13 @@ bloomGateway:
   persistence:
     # -- Enable creating PVCs for the bloom-gateway
     enabled: false
-    # -- Size of persistent disk
-    size: 10Gi
-    # -- Storage class to be used.
-    # If defined, storageClassName: .
-    # If set to "-", storageClassName: "", which disables dynamic provisioning.
-    # If empty or set to null, no storageClassName spec is
-    # set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack).
-    storageClass: null
     # -- Annotations for bloom-gateway PVCs
     annotations: {}
     # -- List of the bloom-gateway PVCs
     # @notationType -- list
     claims:
       - name: data
+        # -- Size of persistent disk
         size: 10Gi
         #   -- Storage class to be used.
         #   If defined, storageClassName: .
@@ -2468,8 +2477,6 @@ bloomGateway:
         #   If empty or set to null, no storageClassName spec is
         #   set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack).
         storageClass: null
-        # - name: wal
-        #   size: 150Gi
     # -- Enable StatefulSetAutoDeletePVC feature
     enableStatefulSetAutoDeletePVC: false
     whenDeleted: Retain
@@ -2553,19 +2560,20 @@ bloomPlanner:
   persistence:
     # -- Enable creating PVCs for the bloom-planner
     enabled: false
-    # -- Size of persistent disk
-    size: 10Gi
-    # -- Storage class to be used.
-    # If defined, storageClassName: .
-    # If set to "-", storageClassName: "", which disables dynamic provisioning.
-    # If empty or set to null, no storageClassName spec is
-    # set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack).
-    storageClass: null
     # -- Annotations for bloom-planner PVCs
     annotations: {}
     # -- List of the bloom-planner PVCs
     # @notationType -- list
-    claims: []
+    claims:
+      - name: data
+        # -- Size of persistent disk
+        size: 10Gi
+        #   -- Storage class to be used.
+        #   If defined, storageClassName: .
+        #   If set to "-", storageClassName: "", which disables dynamic provisioning.
+        #   If empty or set to null, no storageClassName spec is
+        #   set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack).
+        storageClass: null
     # -- Enable StatefulSetAutoDeletePVC feature
     enableStatefulSetAutoDeletePVC: false
     whenDeleted: Retain