Skip to content

Commit

Permalink
fix(helm): Various fixes and enhancements for bloom components (#14128)
Browse files Browse the repository at this point in the history
* Fix: Do not create bloom Deployment/Statefulset if replicas=0 (fixes #14090)
* Fix: Configure PV claims for bloom gateway and bloom builder correctly (fixes #14082)
* Fix: Configure emphemeral storage for bloom builder working directory (fixes #14084)
* Add required configuration for bloom builder and bloom gateway

---

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
  • Loading branch information
chaudum authored Sep 23, 2024
1 parent 47b9075 commit dc0cbd4
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 73 deletions.
71 changes: 29 additions & 42 deletions docs/sources/setup/install/helm/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1109,8 +1109,6 @@ null
],
"enableStatefulSetAutoDeletePVC": false,
"enabled": false,
"size": "10Gi",
"storageClass": null,
"whenDeleted": "Retain",
"whenScaled": "Retain"
},
Expand Down Expand Up @@ -1295,6 +1293,15 @@ null
<td>List of the bloom-gateway PVCs</td>
<td><pre lang="list">

</pre>
</td>
</tr>
<tr>
<td>bloomGateway.persistence.claims[0].size</td>
<td>string</td>
<td>Size of persistent disk</td>
<td><pre lang="json">
"10Gi"
</pre>
</td>
</tr>
Expand All @@ -1314,24 +1321,6 @@ false
<td><pre lang="json">
false
</pre>
</td>
</tr>
<tr>
<td>bloomGateway.persistence.size</td>
<td>string</td>
<td>Size of persistent disk</td>
<td><pre lang="json">
"10Gi"
</pre>
</td>
</tr>
<tr>
<td>bloomGateway.persistence.storageClass</td>
<td>string</td>
<td>Storage class to be used. If defined, storageClassName: <storageClass>. 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).</td>
<td><pre lang="json">
null
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -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"
},
Expand Down Expand Up @@ -1680,7 +1673,16 @@ null
<td>list</td>
<td>List of the bloom-planner PVCs</td>
<td><pre lang="list">
[]

</pre>
</td>
</tr>
<tr>
<td>bloomPlanner.persistence.claims[0].size</td>
<td>string</td>
<td>Size of persistent disk</td>
<td><pre lang="json">
"10Gi"
</pre>
</td>
</tr>
Expand All @@ -1700,24 +1702,6 @@ false
<td><pre lang="json">
false
</pre>
</td>
</tr>
<tr>
<td>bloomPlanner.persistence.size</td>
<td>string</td>
<td>Size of persistent disk</td>
<td><pre lang="json">
"10Gi"
</pre>
</td>
</tr>
<tr>
<td>bloomPlanner.persistence.storageClass</td>
<td>string</td>
<td>Storage class to be used. If defined, storageClassName: <storageClass>. 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).</td>
<td><pre lang="json">
null
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -6146,6 +6130,9 @@ null
<td>Additional storage config</td>
<td><pre lang="json">
{
"bloom_shipper": {
"working_directory": "/var/loki/data/bloomshipper"
},
"boltdb_shipper": {
"index_gateway_client": {
"server_address": "{{ include \"loki.indexGatewayAddress\" . }}"
Expand Down
3 changes: 3 additions & 0 deletions production/helm/loki/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 28 additions & 0 deletions production/helm/loki/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -180,4 +179,3 @@ spec:
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -33,4 +32,3 @@ spec:
selector:
{{- include "loki.bloomPlannerSelectorLabels" . | nindent 4 }}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -180,4 +179,3 @@ spec:
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
46 changes: 27 additions & 19 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2447,29 +2463,20 @@ 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: <storageClass>.
# 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: <storageClass>.
# 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
# - name: wal
# size: 150Gi
# -- Enable StatefulSetAutoDeletePVC feature
enableStatefulSetAutoDeletePVC: false
whenDeleted: Retain
Expand Down Expand Up @@ -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: <storageClass>.
# 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: <storageClass>.
# 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
Expand Down

0 comments on commit dc0cbd4

Please sign in to comment.