Skip to content

Commit 407e8ce

Browse files
authored
Add standalone compactors flag and service charts (#171)
* Add standalone compactors flag and service charts * Volume mount labels
1 parent 802cc8a commit 407e8ce

6 files changed

Lines changed: 309 additions & 1 deletion

File tree

charts/quickwit/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: quickwit
33
description: Sub-second search & analytics engine on cloud storage.
44
type: application
5-
version: 0.8.7
5+
version: 0.8.8
66
appVersion: v0.8.2
77
keywords:
88
- quickwit

charts/quickwit/templates/_helpers.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ storage.k8s.io/v1beta1
127127
{{- end -}}
128128
{{- end }}
129129

130+
{{/*
131+
Compactor Selector labels
132+
*/}}
133+
{{- define "quickwit.compactor.selectorLabels" -}}
134+
{{ include "quickwit.selectorLabels" . }}
135+
app.kubernetes.io/component: compactor
136+
{{- end }}
137+
130138
{{/*
131139
Create the name of the service account to use
132140
*/}}
@@ -184,6 +192,10 @@ Quickwit environment
184192
value: "$(POD_IP)"
185193
- name: QW_CLUSTER_ENDPOINT
186194
value: http://{{ include "quickwit.fullname" $ }}-metastore.{{ $.Release.Namespace }}.svc.{{ .Values.clusterDomain }}:7280
195+
{{- if .Values.enableStandaloneCompactors }}
196+
- name: QW_ENABLE_STANDALONE_COMPACTORS
197+
value: "true"
198+
{{- end }}
187199
{{- with (include "quickwit.extraEnv" .Values.environment) }}
188200
{{ . }}
189201
{{- end }}
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{{- if .Values.enableStandaloneCompactors }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ include "quickwit.fullname" . }}-compactor
6+
labels:
7+
{{- include "quickwit.labels" . | nindent 4 }}
8+
annotations:
9+
{{- with .Values.annotations }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- with .Values.compactor.annotations }}
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
15+
spec:
16+
replicas: {{ .Values.compactor.replicaCount }}
17+
selector:
18+
matchLabels:
19+
{{- include "quickwit.compactor.selectorLabels" . | nindent 6 }}
20+
strategy: {{- toYaml .Values.compactor.strategy | nindent 4 }}
21+
template:
22+
metadata:
23+
annotations:
24+
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
25+
{{- with .Values.podAnnotations }}
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
{{- with .Values.compactor.podAnnotations }}
29+
{{- toYaml . | nindent 8 }}
30+
{{- end }}
31+
labels:
32+
{{- include "quickwit.additionalLabels" . | nindent 8 }}
33+
{{- include "quickwit.compactor.selectorLabels" . | nindent 8 }}
34+
spec:
35+
{{- with .Values.imagePullSecrets }}
36+
imagePullSecrets:
37+
{{- toYaml . | nindent 8 }}
38+
{{- end }}
39+
serviceAccountName: {{ include "quickwit.serviceAccountName" . }}
40+
securityContext:
41+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
42+
{{- with .Values.compactor.initContainers }}
43+
initContainers:
44+
{{- toYaml . | nindent 8 }}
45+
{{ end }}
46+
containers:
47+
- name: {{ .Chart.Name }}
48+
securityContext:
49+
{{- toYaml .Values.securityContext | nindent 12 }}
50+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
51+
imagePullPolicy: {{ .Values.image.pullPolicy }}
52+
{{- if $.Values.compactor.args }}
53+
args: {{- toYaml $.Values.compactor.args | nindent 10 }}
54+
{{- else }}
55+
args: ["run", "--service", "compactor"]
56+
{{- end }}
57+
env:
58+
{{- include "quickwit.environment" . | nindent 12 }}
59+
{{- with (include "quickwit.extraEnv" .Values.compactor.extraEnv) }}
60+
{{- . | nindent 12 }}
61+
{{- end }}
62+
{{- if or (.Values.environmentFrom) (.Values.compactor.extraEnvFrom) }}
63+
envFrom:
64+
{{- with .Values.environmentFrom }}
65+
{{- toYaml . | nindent 12 }}
66+
{{- end }}
67+
{{- with .Values.compactor.extraEnvFrom }}
68+
{{- toYaml . | nindent 12 }}
69+
{{- end }}
70+
{{- end }}
71+
ports:
72+
{{- include "quickwit.ports" . | nindent 12 }}
73+
startupProbe:
74+
{{- toYaml .Values.compactor.startupProbe | nindent 12 }}
75+
livenessProbe:
76+
{{- toYaml .Values.compactor.livenessProbe | nindent 12 }}
77+
readinessProbe:
78+
{{- toYaml .Values.compactor.readinessProbe | nindent 12 }}
79+
volumeMounts:
80+
- name: config
81+
mountPath: /quickwit/node.yaml
82+
subPath: node.yaml
83+
- name: data
84+
mountPath: /quickwit/qwdata
85+
{{- range .Values.configMaps }}
86+
- name: {{ .name }}
87+
mountPath: {{ .mountPath }}
88+
{{- end }}
89+
{{- with concat (.Values.volumeMounts | default list) (.Values.compactor.extraVolumeMounts | default list) }}
90+
{{- toYaml . | nindent 12 }}
91+
{{- end }}
92+
resources:
93+
{{- toYaml .Values.compactor.resources | nindent 12 }}
94+
{{- if .Values.compactor.lifecycleHooks }}
95+
lifecycle:
96+
{{- toYaml .Values.compactor.lifecycleHooks | nindent 12 }}
97+
{{- end }}
98+
terminationGracePeriodSeconds: {{ .Values.compactor.terminationGracePeriodSeconds }}
99+
volumes:
100+
- name: config
101+
configMap:
102+
name: {{ template "quickwit.fullname" . }}
103+
items:
104+
- key: node.yaml
105+
path: node.yaml
106+
- name: data
107+
emptyDir: {}
108+
{{- range .Values.configMaps }}
109+
- name: {{ .name }}
110+
configMap:
111+
name: {{ .name }}
112+
{{- end }}
113+
{{- with concat (.Values.volumes | default list) (.Values.compactor.extraVolumes | default list) }}
114+
{{- toYaml . | nindent 8 }}
115+
{{- end }}
116+
{{- with .Values.compactor.nodeSelector }}
117+
nodeSelector:
118+
{{- toYaml . | nindent 8 }}
119+
{{- end }}
120+
{{- with merge (dict) .Values.compactor.affinity .Values.affinity }}
121+
affinity:
122+
{{- toYaml . | nindent 8 }}
123+
{{- end }}
124+
{{- $tolerations := concat .Values.tolerations .Values.compactor.tolerations | compact | uniq }}
125+
tolerations:
126+
{{- toYaml $tolerations | nindent 8 }}
127+
{{- if .Values.compactor.runtimeClassName }}
128+
runtimeClassName: {{ .Values.compactor.runtimeClassName | quote }}
129+
{{- end }}
130+
{{- $tsc := concat .Values.topologySpreadConstraints .Values.compactor.topologySpreadConstraints | compact }}
131+
{{- if $tsc }}
132+
topologySpreadConstraints:
133+
{{- toYaml $tsc | nindent 8 }}
134+
{{- end }}
135+
{{- end }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if and .Values.enableStandaloneCompactors .Values.compactor.podDisruptionBudget -}}
2+
apiVersion: policy/v1
3+
kind: PodDisruptionBudget
4+
metadata:
5+
name: {{ include "quickwit.fullname" . }}-compactor
6+
labels:
7+
{{- include "quickwit.labels" . | nindent 4 }}
8+
spec:
9+
selector:
10+
matchLabels:
11+
{{- include "quickwit.compactor.selectorLabels" . | nindent 6 }}
12+
{{- toYaml .Values.compactor.podDisruptionBudget | nindent 2 }}
13+
{{- end -}}

charts/quickwit/templates/service.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,45 @@ spec:
241241
selector:
242242
{{- include "quickwit.janitor.selectorLabels" . | nindent 4 }}
243243
{{- end }}
244+
---
245+
{{- if .Values.enableStandaloneCompactors }}
246+
apiVersion: v1
247+
kind: Service
248+
metadata:
249+
name: {{ include "quickwit.fullname" . }}-compactor
250+
labels:
251+
{{- include "quickwit.labels" . | nindent 4 }}
252+
annotations:
253+
{{- with .Values.service.annotations }}
254+
{{- toYaml . | nindent 4 }}
255+
{{- end }}
256+
{{- with .Values.compactor.serviceAnnotations }}
257+
{{- toYaml . | nindent 4 }}
258+
{{- end }}
259+
spec:
260+
type: {{ .Values.compactor.serviceType | default .Values.service.type }}
261+
{{- if .Values.service.ipFamilyPolicy }}
262+
ipFamilyPolicy: {{ .Values.service.ipFamilyPolicy }}
263+
{{- end }}
264+
{{- if .Values.service.ipFamilies }}
265+
ipFamilies: {{ .Values.service.ipFamilies | toYaml | nindent 2 }}
266+
{{- end }}
267+
ports:
268+
- port: 7280
269+
targetPort: rest
270+
protocol: TCP
271+
name: rest
272+
{{- $type := .Values.compactor.serviceType | default .Values.service.type }}
273+
{{- if and (eq $type "NodePort") .Values.compactor.restNodePort }}
274+
nodePort: {{ .Values.compactor.restNodePort }}
275+
{{- end }}
276+
- port: 7281
277+
targetPort: grpc
278+
name: grpc
279+
{{- $type := .Values.compactor.serviceType | default .Values.service.type }}
280+
{{- if and (eq $type "NodePort") .Values.compactor.grpcNodePort }}
281+
nodePort: {{ .Values.compactor.grpcNodePort }}
282+
{{- end }}
283+
selector:
284+
{{- include "quickwit.compactor.selectorLabels" . | nindent 4 }}
285+
{{- end }}

charts/quickwit/values.yaml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,112 @@ janitor:
521521

522522
topologySpreadConstraints: []
523523

524+
# -- Enable the standalone compactor topology.
525+
#
526+
# This is a CLUSTER-WIDE switch, not a per-pod one. When `true`:
527+
# * `QW_ENABLE_STANDALONE_COMPACTORS=true` is injected into every Quickwit pod
528+
# (indexers stop merging locally, the janitor starts the compaction planner).
529+
# * the dedicated compactor Deployment / Service / PDB below are rendered.
530+
# When `false` (default), none of the compactor resources are created and merges
531+
# happen on the indexers exactly as before. Because the same value drives both
532+
# the env var and whether the workload is rendered, the compactor pods exist if
533+
# and only if this flag is true.
534+
enableStandaloneCompactors: false
535+
536+
# Dedicated compactor workers. Only deployed when `enableStandaloneCompactors` is
537+
# true (there is intentionally no separate `compactor.enabled` toggle).
538+
compactor:
539+
replicaCount: 1
540+
541+
# Extra env for compactor
542+
# Legacy map format (e.g. extraEnv: { KEY: VALUE }) is also supported for backward compatibility.
543+
extraEnv: []
544+
# - name: KEY
545+
# value: VALUE
546+
extraEnvFrom: []
547+
# - secretRef:
548+
# name: quickwit-compactor
549+
# - configMapRef:
550+
# name: quickwit-compactor
551+
552+
# extraVolumes -- Additional volumes to use with Pods.
553+
extraVolumes: []
554+
555+
# extraVolumeMounts -- Additional volumes to mount into Quickwit containers.
556+
extraVolumeMounts: []
557+
558+
resources: {}
559+
# limits:
560+
# cpu: 100m
561+
# memory: 128Mi
562+
# requests:
563+
# cpu: 100m
564+
# memory: 128Mi
565+
566+
## Pod distruption budget
567+
podDisruptionBudget: {}
568+
# maxUnavailable: 1
569+
# minAvailable: 2
570+
571+
strategy: {}
572+
# type: RollingUpdate
573+
574+
startupProbe:
575+
httpGet:
576+
path: /health/livez
577+
port: rest
578+
failureThreshold: 12
579+
periodSeconds: 5
580+
581+
livenessProbe:
582+
httpGet:
583+
path: /health/livez
584+
port: rest
585+
586+
readinessProbe:
587+
httpGet:
588+
path: /health/readyz
589+
port: rest
590+
591+
# Override args for starting container
592+
args: []
593+
594+
# initContainers -- Init containers to be added to the pods
595+
initContainers: []
596+
597+
annotations: {}
598+
599+
podAnnotations: {}
600+
601+
serviceAnnotations: {}
602+
603+
# serviceType: ClusterIP
604+
# restNodePort:
605+
# grpcNodePort:
606+
607+
nodeSelector: {}
608+
609+
tolerations: []
610+
611+
affinity: {}
612+
613+
lifecycleHooks: {}
614+
# preStop:
615+
# exec:
616+
# command:
617+
# - /bin/sh
618+
# - -c
619+
# - sleep 30
620+
621+
# Grace period to let in-flight merges finish publishing on shutdown. Unfinished
622+
# merges are simply rescheduled by the planner after a heartbeat timeout, so this
623+
# does not need to be as long as the indexer's.
624+
terminationGracePeriodSeconds: 60
625+
626+
runtimeClassName: ""
627+
628+
topologySpreadConstraints: []
629+
524630
# Deploy jobs to bootstrap creation of indexes and sources for quickwit clusters
525631
bootstrap:
526632
# Enable bootstrap jobs

0 commit comments

Comments
 (0)