From 76592afe64eac4dd2e6d061b078cfe212a08f2c3 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Fri, 3 May 2024 08:37:08 +0200 Subject: [PATCH] [quickwit] New chart (#724) * feat(quickwit): new chart Signed-off-by: Nicolas Lamirault * fix(quickwit): typo Signed-off-by: Nicolas Lamirault --------- Signed-off-by: Nicolas Lamirault --- charts/quickwit/.helmignore | 23 + charts/quickwit/Chart.yaml | 39 ++ charts/quickwit/templates/NOTES.txt | 22 + charts/quickwit/templates/_helpers.tpl | 205 ++++++++ .../templates/configmap-bootstrap.yaml | 19 + charts/quickwit/templates/configmap.yaml | 40 ++ .../templates/control-plane-deployment.yaml | 108 ++++ charts/quickwit/templates/indexer-pdb.yaml | 14 + .../templates/indexer-statefulset.yaml | 125 +++++ charts/quickwit/templates/ingress.yaml | 61 +++ .../templates/janitor-deployment.yaml | 107 ++++ .../templates/job-create-indices.yaml | 72 +++ .../templates/job-create-sources.yaml | 74 +++ .../templates/metastore-deployment.yaml | 104 ++++ charts/quickwit/templates/prometheusrule.yaml | 18 + charts/quickwit/templates/searcher-pdb.yaml | 14 + .../templates/searcher-statefulset.yaml | 125 +++++ charts/quickwit/templates/secret.yaml | 21 + charts/quickwit/templates/service.yaml | 151 ++++++ charts/quickwit/templates/serviceaccount.yaml | 14 + charts/quickwit/templates/servicemonitor.yaml | 27 + charts/quickwit/values.yaml | 489 ++++++++++++++++++ 22 files changed, 1872 insertions(+) create mode 100644 charts/quickwit/.helmignore create mode 100644 charts/quickwit/Chart.yaml create mode 100644 charts/quickwit/templates/NOTES.txt create mode 100644 charts/quickwit/templates/_helpers.tpl create mode 100644 charts/quickwit/templates/configmap-bootstrap.yaml create mode 100644 charts/quickwit/templates/configmap.yaml create mode 100644 charts/quickwit/templates/control-plane-deployment.yaml create mode 100644 charts/quickwit/templates/indexer-pdb.yaml create mode 100644 charts/quickwit/templates/indexer-statefulset.yaml create mode 100644 charts/quickwit/templates/ingress.yaml create mode 100644 charts/quickwit/templates/janitor-deployment.yaml create mode 100644 charts/quickwit/templates/job-create-indices.yaml create mode 100644 charts/quickwit/templates/job-create-sources.yaml create mode 100644 charts/quickwit/templates/metastore-deployment.yaml create mode 100644 charts/quickwit/templates/prometheusrule.yaml create mode 100644 charts/quickwit/templates/searcher-pdb.yaml create mode 100644 charts/quickwit/templates/searcher-statefulset.yaml create mode 100644 charts/quickwit/templates/secret.yaml create mode 100644 charts/quickwit/templates/service.yaml create mode 100644 charts/quickwit/templates/serviceaccount.yaml create mode 100644 charts/quickwit/templates/servicemonitor.yaml create mode 100644 charts/quickwit/values.yaml diff --git a/charts/quickwit/.helmignore b/charts/quickwit/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/quickwit/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/quickwit/Chart.yaml b/charts/quickwit/Chart.yaml new file mode 100644 index 00000000..bc5bfdb3 --- /dev/null +++ b/charts/quickwit/Chart.yaml @@ -0,0 +1,39 @@ +--- +apiVersion: v2 +name: quickwit +description: Sub-second search & analytics engine on cloud storage. +type: application +version: 0.1.0 +appVersion: "v0.8.1" +keywords: + - quickwit + - search + - analytics + - tracing + - logs + - portefaix +home: https://quickwit.io/ +sources: + - https://github.com/nlamirault/portefaix-hub/tree/master/charts/quickwit +icon: https://avatars.githubusercontent.com/u/98504233?s=200&v=4 +maintainers: + - name: nlamirault + email: nicolas.lamirault@gmail.com + +# https://artifacthub.io/docs/topics/annotations/helm/ +annotations: + artifacthub.io/license: Apache-2.0 + artifacthub.io/links: | + - name: quickwit + url: https://quickwit.io/ + - name: Portefaix + url: https://portefaix.xyz + artifacthub.io/maintainers: | + - name: nlamirault + email: nicolas.lamirault@gmail.com + artifacthub.io/signKey: | + fingerprint: C39918B3EBDE35C23B8D0B8E5F99269A6FCA437C + url: https://keybase.io/nlamirault/pgp_keys.asc + artifacthub.io/changes: | + - kind: added + description: Quickwit deployment diff --git a/charts/quickwit/templates/NOTES.txt b/charts/quickwit/templates/NOTES.txt new file mode 100644 index 00000000..cf0d9452 --- /dev/null +++ b/charts/quickwit/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "quickwit.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "quickwit.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "quickwit.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "quickwit.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/charts/quickwit/templates/_helpers.tpl b/charts/quickwit/templates/_helpers.tpl new file mode 100644 index 00000000..228aae16 --- /dev/null +++ b/charts/quickwit/templates/_helpers.tpl @@ -0,0 +1,205 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "quickwit.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "quickwit.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "quickwit.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Custom labels +*/}} +{{- define "quickwit.additionalLabels" -}} +{{- if .Values.additionalLabels }} +{{ toYaml .Values.additionalLabels }} +{{- end }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "quickwit.labels" -}} +helm.sh/chart: {{ include "quickwit.chart" . }} +{{ include "quickwit.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +app.kubernetes.io/part-of: quickwit +{{ include "quickwit.additionalLabels" . }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "quickwit.selectorLabels" -}} +app.kubernetes.io/name: {{ include "quickwit.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Searcher Selector labels +*/}} +{{- define "quickwit.searcher.selectorLabels" -}} +app.kubernetes.io/component: searcher +{{- end }} + +{{/* +Janitor Selector labels +*/}} +{{- define "quickwit.janitor.selectorLabels" -}} +app.kubernetes.io/component: janitor +{{- end }} + +{{/* +Metastore Selector labels +*/}} +{{- define "quickwit.metastore.selectorLabels" -}} +app.kubernetes.io/component: metastore +{{- end }} + +{{/* +Control Plane Selector labels +*/}} +{{- define "quickwit.control_plane.selectorLabels" -}} +app.kubernetes.io/component: control-plane +{{- end }} + +{{/* +Indexer Selector labels +*/}} +{{- define "quickwit.indexer.selectorLabels" -}} +app.kubernetes.io/component: indexer +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "quickwit.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "quickwit.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Quickwit ports +*/}} +{{- define "quickwit.ports" -}} +- name: rest + containerPort: 7280 + protocol: TCP +- name: grpc + containerPort: 7281 + protocol: TCP +- name: discovery + containerPort: 7282 + protocol: UDP +{{- end }} + + +{{/* +Quickwit environment +*/}} +{{- define "quickwit.environment" -}} +- name: NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace +- name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name +- name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP +- name: QW_CONFIG + value: node.yaml +- name: QW_CLUSTER_ID + value: {{ .Release.Namespace }}-{{ include "quickwit.fullname" . }} +{{- if ((.Values.config.storage).s3).access_key_id }} +- name: AWS_ACCESS_KEY_ID + value: {{ .Values.config.storage.s3.access_key_id }} +{{- end }} +{{- if ((.Values.config.storage).s3).secret_access_key }} +- name: AWS_SECRET_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ include "quickwit.fullname" $ }} + key: storage.s3.secret_access_key +{{- end }} +{{- if ((.Values.config.storage).azure).account }} +- name: QW_AZURE_STORAGE_ACCOUNT + value: {{ .Values.config.storage.azure.account }} +{{- end }} +{{- if ((.Values.config.storage).azure).access_key }} +- name: QW_AZURE_STORAGE_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ include "quickwit.fullname" $ }} + key: storage.azure.access_key +{{- end }} +- name: QW_NODE_ID + value: "$(POD_NAME)" +- name: QW_PEER_SEEDS + value: {{ include "quickwit.fullname" . }}-headless +- name: QW_ADVERTISE_ADDRESS + value: "$(POD_IP)" +{{- range $key, $value := .Values.environment }} +- name: "{{ $key }}" + value: "{{ $value }}" +{{- end }} +{{- end }} + +{{/* +Quickwit metastore environment +*/}} +{{- define "quickwit.metastore.environment" -}} +{{ include "quickwit.environment" . }} +{{- if .Values.config.metastore_uri }} +- name: QW_METASTORE_URI + value: {{ .Values.config.metastore_uri }} +{{- else if .Values.config.postgres }} +- name: POSTGRES_HOST + value: {{ required "A valid config.postgres.host is required!" .Values.config.postgres.host }} +- name: POSTGRES_PORT + value: {{ .Values.config.postgres.port | default 5432 | quote }} +- name: POSTGRES_DATABASE + value: {{ .Values.config.postgres.database | default "metastore" }} +- name: POSTGRES_USERNAME + value: {{ .Values.config.postgres.username | default "quickwit" }} +- name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "quickwit.fullname" . }} + key: postgres.password +- name: QW_METASTORE_URI + value: "postgres://$(POSTGRES_USERNAME):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DATABASE)" +{{- end }} +{{- end }} diff --git a/charts/quickwit/templates/configmap-bootstrap.yaml b/charts/quickwit/templates/configmap-bootstrap.yaml new file mode 100644 index 00000000..beda71dc --- /dev/null +++ b/charts/quickwit/templates/configmap-bootstrap.yaml @@ -0,0 +1,19 @@ +{{- if and (or .Values.config.sources .Values.config.indexes) .Values.bootstrap.enabled -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "quickwit.fullname" . }}-bootstrap + labels: + {{- include "quickwit.labels" . | nindent 4 }} + app.kubernetes.io/component: config +data: + {{- range .Values.config.indexes }} + {{ .index_id }}.yaml: |- + {{- toYaml . | nindent 4 }} + {{- end }} + {{- range .Values.config.sources }} + {{ .source.source_id }}.yaml: |- + {{- toYaml .source | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/quickwit/templates/configmap.yaml b/charts/quickwit/templates/configmap.yaml new file mode 100644 index 00000000..0d778372 --- /dev/null +++ b/charts/quickwit/templates/configmap.yaml @@ -0,0 +1,40 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "quickwit.fullname" . }} + labels: + {{- include "quickwit.labels" . | nindent 4 }} + app.kubernetes.io/component: config +data: + node.yaml: |- + version: 0.8 + listen_address: 0.0.0.0 + gossip_listen_port: 7282 + data_dir: /quickwit/qwdata + default_index_root_uri: {{ .Values.config.default_index_root_uri }} + {{- with .Values.config.indexer }} + indexer: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- with .Values.config.storage }} + storage: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- with .Values.config.ingest_api }} + ingest_api: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- with .Values.config.searcher }} + searcher: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- with .Values.config.jaeger }} + jaeger: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- if (.Values.config.postgres).max_num_connections }} + metastore: + postgres: + max_num_connections: {{ .Values.config.postgres.max_num_connections }} + {{- end }} diff --git a/charts/quickwit/templates/control-plane-deployment.yaml b/charts/quickwit/templates/control-plane-deployment.yaml new file mode 100644 index 00000000..965a0555 --- /dev/null +++ b/charts/quickwit/templates/control-plane-deployment.yaml @@ -0,0 +1,108 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "quickwit.fullname" . }}-control-plane + labels: + {{- include "quickwit.labels" . | nindent 4 }} + {{- include "quickwit.control_plane.selectorLabels" . | nindent 4 }} + annotations: + {{- with .Values.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.control_plane.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: 1 + selector: + matchLabels: + {{- include "quickwit.selectorLabels" . | nindent 6 }} + {{- include "quickwit.control_plane.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.control_plane.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "quickwit.labels" . | nindent 8 }} + {{- include "quickwit.control_plane.selectorLabels" . | nindent 8 }} + {{- include "quickwit.additionalLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "quickwit.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: ["run", "--service", "control_plane"] + env: + {{- include "quickwit.environment" . | nindent 12 }} + {{- range $key, $value := .Values.control_plane.extraEnv }} + - name: "{{ $key }}" + value: "{{ $value }}" + {{- end }} + {{- with .Values.control_plane.extraEnvFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + {{- include "quickwit.ports" . | nindent 12 }} + startupProbe: + {{- toYaml .Values.control_plane.startupProbe | nindent 12 }} + livenessProbe: + {{- toYaml .Values.control_plane.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.control_plane.readinessProbe | nindent 12 }} + volumeMounts: + - name: config + mountPath: /quickwit/node.yaml + subPath: node.yaml + - name: data + mountPath: /quickwit/qwdata + {{- range .Values.configMaps }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- end }} + resources: + {{- toYaml .Values.control_plane.resources | nindent 14 }} + volumes: + - name: config + configMap: + name: {{ template "quickwit.fullname" . }} + items: + - key: node.yaml + path: node.yaml + - name: data + emptyDir: {} + {{- range .Values.configMaps }} + - name: {{ .name }} + configMap: + name: {{ .name }} + {{- end }} + {{- with .Values.control_plane.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.control_plane.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.control_plane.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/quickwit/templates/indexer-pdb.yaml b/charts/quickwit/templates/indexer-pdb.yaml new file mode 100644 index 00000000..e9c27f20 --- /dev/null +++ b/charts/quickwit/templates/indexer-pdb.yaml @@ -0,0 +1,14 @@ +{{- if .Values.indexer.podDisruptionBudget -}} +--- +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "quickwit.fullname" . }}-indexer + labels: + {{- include "quickwit.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "quickwit.indexer.selectorLabels" . | nindent 6 }} + {{- toYaml .Values.indexer.podDisruptionBudget | nindent 2 }} +{{- end -}} diff --git a/charts/quickwit/templates/indexer-statefulset.yaml b/charts/quickwit/templates/indexer-statefulset.yaml new file mode 100644 index 00000000..a4a49884 --- /dev/null +++ b/charts/quickwit/templates/indexer-statefulset.yaml @@ -0,0 +1,125 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "quickwit.fullname" . }}-indexer + labels: + {{- include "quickwit.labels" . | nindent 4 }} + annotations: + {{- with .Values.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.indexer.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.indexer.replicaCount }} + serviceName: {{ include "quickwit.fullname" . }}-headless + {{- if .Values.searcher.podManagementPolicy }} + podManagementPolicy: {{ .Values.indexer.podManagementPolicy }} + {{- end }} + selector: + matchLabels: + {{- include "quickwit.indexer.selectorLabels" . | nindent 6 }} + updateStrategy: + {{- toYaml .Values.indexer.updateStrategy | nindent 4 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.indexer.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "quickwit.additionalLabels" . | nindent 8 }} + {{- include "quickwit.indexer.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "quickwit.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- include "quickwit.environment" . | nindent 12 }} + {{- range $key, $value := .Values.indexer.extraEnv }} + - name: "{{ $key }}" + value: "{{ $value }}" + {{- end }} + {{- with .Values.indexer.extraEnvFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["run", "--service", "indexer"] + ports: + {{- include "quickwit.ports" . | nindent 12 }} + startupProbe: + {{- toYaml .Values.indexer.startupProbe | nindent 12 }} + livenessProbe: + {{- toYaml .Values.indexer.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.indexer.readinessProbe | nindent 12 }} + volumeMounts: + - name: config + mountPath: /quickwit/node.yaml + subPath: node.yaml + - name: data + mountPath: /quickwit/qwdata + {{- range .Values.configMaps }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- end }} + resources: + {{- toYaml .Values.indexer.resources | nindent 12 }} + volumes: + - name: config + configMap: + name: {{ template "quickwit.fullname" . }} + items: + - key: node.yaml + path: node.yaml + {{- if ne .Values.indexer.persistentVolume.enabled true }} + - name: data + emptyDir: {} + {{- end }} + {{- range .Values.configMaps }} + - name: {{ .name }} + configMap: + name: {{ .name }} + {{- end }} + {{- with .Values.indexer.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.indexer.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.indexer.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.indexer.persistentVolume.enabled }} + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: "{{ .Values.indexer.persistentVolume.storage }}" + {{- if .Values.indexer.persistentVolume.storageClass }} + storageClassName: "{{ .Values.indexer.persistentVolume.storageClass }}" + {{- end }} + {{- end }} diff --git a/charts/quickwit/templates/ingress.yaml b/charts/quickwit/templates/ingress.yaml new file mode 100644 index 00000000..7bc2c9ad --- /dev/null +++ b/charts/quickwit/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "quickwit.fullname" . -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +--- +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "quickwit.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }}-searcher + port: + name: rest + {{- else }} + serviceName: {{ $fullName }}-searcher + serviceport: rest + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/quickwit/templates/janitor-deployment.yaml b/charts/quickwit/templates/janitor-deployment.yaml new file mode 100644 index 00000000..58b1caed --- /dev/null +++ b/charts/quickwit/templates/janitor-deployment.yaml @@ -0,0 +1,107 @@ +{{- if .Values.janitor.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "quickwit.fullname" . }}-janitor + labels: + {{- include "quickwit.labels" . | nindent 4 }} + annotations: + {{- with .Values.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.janitor.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: 1 + selector: + matchLabels: + {{- include "quickwit.janitor.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.janitor.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "quickwit.additionalLabels" . | nindent 8 }} + {{- include "quickwit.janitor.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "quickwit.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: ["run", "--service", "janitor"] + env: + {{- include "quickwit.environment" . | nindent 12 }} + {{- range $key, $value := .Values.janitor.extraEnv }} + - name: "{{ $key }}" + value: "{{ $value }}" + {{- end }} + {{- with .Values.janitor.extraEnvFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + {{- include "quickwit.ports" . | nindent 12 }} + startupProbe: + {{- toYaml .Values.janitor.startupProbe | nindent 12 }} + livenessProbe: + {{- toYaml .Values.janitor.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.janitor.readinessProbe | nindent 12 }} + volumeMounts: + - name: config + mountPath: /quickwit/node.yaml + subPath: node.yaml + - name: data + mountPath: /quickwit/qwdata + {{- range .Values.configMaps }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- end }} + resources: + {{- toYaml .Values.janitor.resources | nindent 14 }} + volumes: + - name: config + configMap: + name: {{ template "quickwit.fullname" . }} + items: + - key: node.yaml + path: node.yaml + - name: data + emptyDir: {} + {{- range .Values.configMaps }} + - name: {{ .name }} + configMap: + name: {{ .name }} + {{- end }} + {{- with .Values.janitor.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.janitor.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.janitor.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/quickwit/templates/job-create-indices.yaml b/charts/quickwit/templates/job-create-indices.yaml new file mode 100644 index 00000000..039c468f --- /dev/null +++ b/charts/quickwit/templates/job-create-indices.yaml @@ -0,0 +1,72 @@ +{{- if .Values.bootstrap.enabled -}} +{{- range .Values.config.indexes }} +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ printf "%s-index-%s" (include "quickwit.fullname" $ | trunc 47) .index_id | trunc 63 | trimSuffix "-" }} + labels: + {{- include "quickwit.labels" $ | nindent 4 }} + annotations: + "helm.sh/hook": post-install,post-upgrade + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded + "helm.sh/hook-weight": "1" +spec: + template: + metadata: + name: "{{ $.Release.Name }}" + labels: + app.kubernetes.io/managed-by: {{ $.Release.Service | quote }} + app.kubernetes.io/instance: {{ $.Release.Name | quote }} + helm.sh/chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}" + spec: + {{- with $.Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml $.Values.podSecurityContext | nindent 8 }} + restartPolicy: Never + containers: + - name: {{ $.Chart.Name }} + securityContext: + {{- toYaml $.Values.securityContext | nindent 10 }} + image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Chart.AppVersion }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} + command: ["/bin/bash","-c","quickwit index describe --index {{ .index_id }} --endpoint ${QW_CLUSTER_ENDPOINT} || quickwit index create --index-config {{ .index_id }}.yaml --endpoint ${QW_CLUSTER_ENDPOINT}"] + env: + - name: QW_CLUSTER_ENDPOINT + value: http://{{ include "quickwit.fullname" $ }}-metastore.{{ $.Release.Namespace }}.svc.cluster.local:7280 + {{- include "quickwit.metastore.environment" $ | nindent 10 }} + {{- range $key, $value := $.Values.bootstrap.extraEnv }} + - name: "{{ $key }}" + value: "{{ $value }}" + {{- end }} + {{- with .Values.bootstrap.extraEnvFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: config + mountPath: /quickwit/node.yaml + subPath: node.yaml + - name: index + mountPath: /quickwit/{{ .index_id }}.yaml + subPath: {{ .index_id }}.yaml + resources: + {{- toYaml $.Values.bootstrap.resources | nindent 10 }} + volumes: + - name: config + configMap: + name: {{ template "quickwit.fullname" $ }} + items: + - key: node.yaml + path: node.yaml + - name: index + configMap: + name: {{ template "quickwit.fullname" $ }}-bootstrap + items: + - key: {{ .index_id }}.yaml + path: {{ .index_id }}.yaml +{{- end }} +{{- end }} diff --git a/charts/quickwit/templates/job-create-sources.yaml b/charts/quickwit/templates/job-create-sources.yaml new file mode 100644 index 00000000..eadecb22 --- /dev/null +++ b/charts/quickwit/templates/job-create-sources.yaml @@ -0,0 +1,74 @@ +{{- if .Values.bootstrap.enabled -}} +{{- range .Values.config.sources }} +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ printf "%s-source-%s" (include "quickwit.fullname" $ | trunc 46) .source.source_id | trunc 63 | trimSuffix "-" }} + labels: + {{- include "quickwit.labels" $ | nindent 4 }} + annotations: + "helm.sh/hook": post-install,post-upgrade + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded + "helm.sh/hook-weight": "2" +spec: + template: + metadata: + name: "{{ $.Release.Name }}" + labels: + app.kubernetes.io/managed-by: {{ $.Release.Service | quote }} + app.kubernetes.io/instance: {{ $.Release.Name | quote }} + helm.sh/chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}" + spec: + {{- with $.Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml $.Values.podSecurityContext | nindent 8 }} + restartPolicy: Never + containers: + - name: {{ $.Chart.Name }} + securityContext: + {{- toYaml $.Values.securityContext | nindent 10 }} + image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Chart.AppVersion }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} + command: ["/bin/bash","-c","quickwit source describe --index {{ .index }} --source {{ .source.source_id }} --endpoint ${QW_CLUSTER_ENDPOINT}|| quickwit source create --index {{ .index }} --source-config {{ .source.source_id }}.yaml --endpoint ${QW_CLUSTER_ENDPOINT}"] + env: + - name: QW_CLUSTER_ENDPOINT + value: http://{{ include "quickwit.fullname" $ }}-metastore.{{ $.Release.Namespace }}.svc.cluster.local:7280 + {{- include "quickwit.metastore.environment" $ | nindent 10 }} + {{- range $key, $value := $.Values.bootstrap.extraEnv }} + - name: "{{ $key }}" + value: "{{ $value }}" + {{- end }} + {{- with .Values.bootstrap.extraEnvFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: config + mountPath: /quickwit/node.yaml + subPath: node.yaml + {{- if $.Values.config.sources }} + - name: source + mountPath: /quickwit/{{ .source.source_id }}.yaml + subPath: {{ .source.source_id }}.yaml + {{- end }} + resources: + {{- toYaml $.Values.bootstrap.resources | nindent 10 }} + volumes: + - name: config + configMap: + name: {{ template "quickwit.fullname" $ }} + items: + - key: node.yaml + path: node.yaml + - name: source + configMap: + name: {{ template "quickwit.fullname" $ }}-bootstrap + items: + - key: {{ .source.source_id }}.yaml + path: {{ .source.source_id }}.yaml +{{- end }} +{{- end }} diff --git a/charts/quickwit/templates/metastore-deployment.yaml b/charts/quickwit/templates/metastore-deployment.yaml new file mode 100644 index 00000000..d1882b05 --- /dev/null +++ b/charts/quickwit/templates/metastore-deployment.yaml @@ -0,0 +1,104 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "quickwit.fullname" . }}-metastore + labels: + {{- include "quickwit.labels" . | nindent 4 }} + annotations: + {{- with .Values.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.metastore.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.metastore.replicaCount }} + selector: + matchLabels: + {{- include "quickwit.metastore.selectorLabels" . | nindent 6 }} + strategy: {{- toYaml .Values.metastore.strategy | nindent 4 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.metastore.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "quickwit.additionalLabels" . | nindent 8 }} + {{- include "quickwit.metastore.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "quickwit.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: ["run", "--service", "metastore"] + env: + {{- include "quickwit.metastore.environment" . | nindent 12 }} + {{- range $key, $value := .Values.metastore.extraEnv }} + - name: "{{ $key }}" + value: "{{ $value }}" + {{- end }} + {{- with .Values.metastore.extraEnvFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + {{- include "quickwit.ports" . | nindent 12 }} + startupProbe: + {{- toYaml .Values.metastore.startupProbe | nindent 12 }} + livenessProbe: + {{- toYaml .Values.metastore.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.metastore.readinessProbe | nindent 12 }} + volumeMounts: + - name: config + mountPath: /quickwit/node.yaml + subPath: node.yaml + - name: data + mountPath: /quickwit/qwdata + {{- range .Values.configMaps }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- end }} + resources: + {{- toYaml .Values.metastore.resources | nindent 14 }} + volumes: + - name: config + configMap: + name: {{ template "quickwit.fullname" . }} + items: + - key: node.yaml + path: node.yaml + - name: data + emptyDir: {} + {{- range .Values.configMaps }} + - name: {{ .name }} + configMap: + name: {{ .name }} + {{- end }} + {{- with .Values.metastore.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.metastore.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.metastore.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/quickwit/templates/prometheusrule.yaml b/charts/quickwit/templates/prometheusrule.yaml new file mode 100644 index 00000000..1d9d9f2c --- /dev/null +++ b/charts/quickwit/templates/prometheusrule.yaml @@ -0,0 +1,18 @@ +{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) .Values.prometheusRule.enabled }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: {{ include "quickwit.fullname" . }} + labels: + {{- include "quickwit.labels" . | nindent 4 }} + app.kubernetes.io/component: metrics + {{- with .Values.prometheusRule.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + groups: + - name: {{ include "quickwit.fullname" . }} + rules: + {{- toYaml .Values.prometheusRule.rules | nindent 8 }} +{{- end }} diff --git a/charts/quickwit/templates/searcher-pdb.yaml b/charts/quickwit/templates/searcher-pdb.yaml new file mode 100644 index 00000000..4bcffe71 --- /dev/null +++ b/charts/quickwit/templates/searcher-pdb.yaml @@ -0,0 +1,14 @@ +{{- if .Values.searcher.podDisruptionBudget -}} +--- +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "quickwit.fullname" . }}-searcher + labels: + {{- include "quickwit.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "quickwit.searcher.selectorLabels" . | nindent 6 }} + {{- toYaml .Values.searcher.podDisruptionBudget | nindent 2 }} +{{- end -}} diff --git a/charts/quickwit/templates/searcher-statefulset.yaml b/charts/quickwit/templates/searcher-statefulset.yaml new file mode 100644 index 00000000..6c56d788 --- /dev/null +++ b/charts/quickwit/templates/searcher-statefulset.yaml @@ -0,0 +1,125 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "quickwit.fullname" . }}-searcher + labels: + {{- include "quickwit.labels" . | nindent 4 }} + annotations: + {{- with .Values.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.searcher.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.searcher.replicaCount }} + serviceName: {{ include "quickwit.fullname" . }}-headless + {{- if .Values.searcher.podManagementPolicy }} + podManagementPolicy: {{ .Values.searcher.podManagementPolicy }} + {{- end }} + selector: + matchLabels: + {{- include "quickwit.searcher.selectorLabels" . | nindent 6 }} + updateStrategy: + {{- toYaml .Values.searcher.updateStrategy | nindent 4 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.searcher.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "quickwit.additionalLabels" . | nindent 8 }} + {{- include "quickwit.searcher.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "quickwit.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- include "quickwit.environment" . | nindent 12 }} + {{- range $key, $value := .Values.searcher.extraEnv }} + - name: "{{ $key }}" + value: "{{ $value }}" + {{- end }} + {{- with .Values.searcher.extraEnvFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["run", "--service", "searcher"] + ports: + {{- include "quickwit.ports" . | nindent 12 }} + startupProbe: + {{- toYaml .Values.searcher.startupProbe | nindent 12 }} + livenessProbe: + {{- toYaml .Values.searcher.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.searcher.readinessProbe | nindent 12 }} + volumeMounts: + - name: config + mountPath: /quickwit/node.yaml + subPath: node.yaml + - name: data + mountPath: /quickwit/qwdata + {{- range .Values.configMaps }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- end }} + resources: + {{- toYaml .Values.searcher.resources | nindent 14 }} + volumes: + - name: config + configMap: + name: {{ template "quickwit.fullname" . }} + items: + - key: node.yaml + path: node.yaml + {{- if not .Values.searcher.persistentVolume.enabled }} + - name: data + emptyDir: {} + {{- end }} + {{- range .Values.configMaps }} + - name: {{ .name }} + configMap: + name: {{ .name }} + {{- end }} + {{- with .Values.searcher.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.searcher.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.searcher.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.searcher.persistentVolume.enabled }} + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: "{{ .Values.searcher.persistentVolume.storage }}" + {{- if .Values.searcher.persistentVolume.storageClass }} + storageClassName: "{{ .Values.searcher.persistentVolume.storageClass }}" + {{- end }} + {{- end }} diff --git a/charts/quickwit/templates/secret.yaml b/charts/quickwit/templates/secret.yaml new file mode 100644 index 00000000..82113340 --- /dev/null +++ b/charts/quickwit/templates/secret.yaml @@ -0,0 +1,21 @@ +{{- if not .Values.existingSecretForConfig -}} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "quickwit.fullname" . }} + labels: + {{- include "quickwit.labels" . | nindent 4 }} + app.kubernetes.io/component: secret +type: Opaque +data: +{{- if .Values.config.postgres }} + postgres.password: {{ required "A valid config.postgres.password is required!" .Values.config.postgres.password | b64enc | quote }} +{{- end }} +{{- if ((.Values.config.storage).s3).secret_access_key }} + storage.s3.secret_access_key: {{ .Values.config.storage.s3.secret_access_key | b64enc | quote }} +{{- end }} +{{- if ((.Values.config.storage).azure).access_key }} + storage.azure.access_key: {{ .Values.config.storage.azure.access_key | b64enc | quote }} +{{- end }} +{{- end }} diff --git a/charts/quickwit/templates/service.yaml b/charts/quickwit/templates/service.yaml new file mode 100644 index 00000000..31ea3cf6 --- /dev/null +++ b/charts/quickwit/templates/service.yaml @@ -0,0 +1,151 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "quickwit.fullname" . }}-searcher + labels: + {{- include "quickwit.labels" . | nindent 4 }} + {{- include "quickwit.searcher.selectorLabels" . | nindent 4 }} + annotations: + {{- with .Values.service.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.searcher.serviceAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 7280 + targetPort: rest + protocol: TCP + name: rest + - port: 7281 + targetPort: grpc + name: grpc + selector: + {{- include "quickwit.searcher.selectorLabels" . | nindent 4 }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "quickwit.fullname" . }}-headless + labels: + {{- include "quickwit.labels" . | nindent 4 }} + annotations: + {{- with .Values.service.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: ClusterIP + clusterIP: None + publishNotReadyAddresses: true + ports: + # Needed by istio with mTLS mode set to STRICT. + # The port names must starts with "tcp-" or "udp-" to work... + # See https://istio.io/latest/docs/ops/common-problems/network-issues/#503-error-while-accessing-headless-services + - name: udp + port: 7282 + protocol: UDP + - name: tcp-http + port: 7280 + protocol: TCP + - name: tcp-grpc + port: 7281 + protocol: TCP + selector: + {{- include "quickwit.selectorLabels" . | nindent 4 }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "quickwit.fullname" . }}-indexer + labels: + {{- include "quickwit.labels" . | nindent 4 }} + {{- include "quickwit.indexer.selectorLabels" . | nindent 4 }} + annotations: + {{- with .Values.service.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.indexer.serviceAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 7280 + targetPort: rest + protocol: TCP + name: rest + - port: 7281 + targetPort: grpc + name: grpc + selector: + {{- include "quickwit.indexer.selectorLabels" . | nindent 4 }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "quickwit.fullname" . }}-metastore + labels: + {{- include "quickwit.labels" . | nindent 4 }} + {{- include "quickwit.metastore.selectorLabels" . | nindent 4 }} + annotations: + {{- with .Values.service.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.metastore.serviceAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 7280 + targetPort: rest + protocol: TCP + name: rest + - port: 7281 + targetPort: grpc + name: grpc + selector: + {{- include "quickwit.metastore.selectorLabels" . | nindent 4 }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "quickwit.fullname" . }}-control-plane + labels: + {{- include "quickwit.labels" . | nindent 4 }} + {{- include "quickwit.control_plane.selectorLabels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 7280 + targetPort: rest + protocol: TCP + name: rest + - port: 7281 + targetPort: grpc + name: grpc + selector: + {{- include "quickwit.control_plane.selectorLabels" . | nindent 4 }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "quickwit.fullname" . }}-janitor + labels: + {{- include "quickwit.labels" . | nindent 4 }} + {{- include "quickwit.janitor.selectorLabels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 7280 + targetPort: rest + protocol: TCP + name: rest + - port: 7281 + targetPort: grpc + name: grpc + selector: + {{- include "quickwit.janitor.selectorLabels" . | nindent 4 }} diff --git a/charts/quickwit/templates/serviceaccount.yaml b/charts/quickwit/templates/serviceaccount.yaml new file mode 100644 index 00000000..b5680d48 --- /dev/null +++ b/charts/quickwit/templates/serviceaccount.yaml @@ -0,0 +1,14 @@ +{{- if .Values.serviceAccount.create -}} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "quickwit.serviceAccountName" . }} + labels: + {{- include "quickwit.labels" . | nindent 4 -}} + app.kubernetes.io/component: rbac + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/quickwit/templates/servicemonitor.yaml b/charts/quickwit/templates/servicemonitor.yaml new file mode 100644 index 00000000..5267d8de --- /dev/null +++ b/charts/quickwit/templates/servicemonitor.yaml @@ -0,0 +1,27 @@ +{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) .Values.serviceMonitor.enabled }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "quickwit.fullname" . }} + labels: + {{- include "quickwit.labels" . | nindent 4 }} + app.kubernetes.io/component: metrics + {{- with .Values.serviceMonitor.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + endpoints: + - path: /metrics + port: rest + interval: {{ .Values.serviceMonitor.interval }} + scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} + metricRelabelings: + {{- toYaml .Values.serviceMonitor.metricRelabelings | nindent 8 }} + relabelings: + {{- toYaml .Values.serviceMonitor.relabelings | nindent 8 }} + jobLabel: app.kubernetes.io/instance + selector: + matchLabels: + {{- include "quickwit.selectorLabels" . | nindent 6 }} +{{- end }} diff --git a/charts/quickwit/values.yaml b/charts/quickwit/values.yaml new file mode 100644 index 00000000..d9cf55ee --- /dev/null +++ b/charts/quickwit/values.yaml @@ -0,0 +1,489 @@ +# Default values for quickwit. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + repository: quickwit/quickwit + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + # tag: v0.8.1 + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +# -- Additional labels to add to all resources +additionalLabels: {} + # app: quickwit + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +annotations: {} + +podAnnotations: {} + +podSecurityContext: + fsGroup: 1005 + +securityContext: + runAsNonRoot: true + runAsUser: 1005 + +# Additional global env +environment: {} + # KEY: VALUE + +# -- Specify an existing secret containing Quickwit configuration. +existingSecretForConfig: false + +configMaps: [] + # - name: configmap1 + # mountPath: /quickwit/configmaps/ + +searcher: + replicaCount: 3 + + # Extra env for searcher + extraEnv: {} + # KEY: VALUE + + # -- Environment variables from secrets or configmaps to add to the searcher + extraEnvFrom: [] + # - secretRef: + # name: quickwit-credentials + + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + ## Pod distruption budget + podDisruptionBudget: {} + # maxUnavailable: 1 + # minAvailable: 2 + + persistentVolume: + enabled: false + # storage: "1Gi" + # storageClass: "" + + updateStrategy: {} + # type: RollingUpdate + + startupProbe: + httpGet: + path: /health/livez + port: rest + failureThreshold: 12 + periodSeconds: 5 + + livenessProbe: + httpGet: + path: /health/livez + port: rest + + readinessProbe: + httpGet: + path: /health/readyz + port: rest + + annotations: {} + + podAnnotations: {} + + serviceAnnotations: {} + + nodeSelector: {} + + tolerations: [] + + affinity: {} + +indexer: + replicaCount: 1 + + # Extra env for indexer + extraEnv: {} + # KEY: VALUE + + # -- Environment variables from secrets or configmaps to add to the searcher + extraEnvFrom: [] + # - secretRef: + # name: quickwit-credentials + + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + ## Pod distruption budget + podDisruptionBudget: {} + # maxUnavailable: 1 + # minAvailable: 2 + + updateStrategy: {} + # type: RollingUpdate + + startupProbe: + httpGet: + path: /health/livez + port: rest + failureThreshold: 12 + periodSeconds: 5 + + livenessProbe: + httpGet: + path: /health/livez + port: rest + + readinessProbe: + httpGet: + path: /health/readyz + port: rest + + annotations: {} + + podAnnotations: {} + + serviceAnnotations: {} + + nodeSelector: {} + + tolerations: [] + + affinity: {} + + persistentVolume: + enabled: false + # storage: "1Gi" + # storageClass: "" + +metastore: + replicaCount: 1 + + # Extra env for metastore + extraEnv: {} + # KEY: VALUE + + # -- Environment variables from secrets or configmaps to add to the searcher + extraEnvFrom: [] + # - secretRef: + # name: quickwit-credentials + + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + updateStrategy: {} + # type: RollingUpdate + + startupProbe: + httpGet: + path: /health/livez + port: rest + failureThreshold: 12 + periodSeconds: 5 + + livenessProbe: + httpGet: + path: /health/livez + port: rest + + readinessProbe: + httpGet: + path: /health/readyz + port: rest + + annotations: {} + + podAnnotations: {} + + serviceAnnotations: {} + + nodeSelector: {} + + tolerations: [] + + affinity: {} + +control_plane: + # Extra env for control plane + extraEnv: {} + # KEY: VALUE + + # -- Environment variables from secrets or configmaps to add to the searcher + extraEnvFrom: [] + # - secretRef: + # name: quickwit-credentials + + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + startupProbe: + httpGet: + path: /health/livez + port: rest + failureThreshold: 12 + periodSeconds: 5 + + livenessProbe: + httpGet: + path: /health/livez + port: rest + + readinessProbe: + httpGet: + path: /health/readyz + port: rest + + annotations: {} + + podAnnotations: {} + + nodeSelector: {} + + tolerations: [] + + affinity: {} + +janitor: + # Enable Janitor service + enabled: true + + # Extra env for searcher + extraEnv: {} + # KEY: VALUE + + # -- Environment variables from secrets or configmaps to add to the searcher + extraEnvFrom: [] + # - secretRef: + # name: quickwit-credentials + + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + startupProbe: + httpGet: + path: /health/livez + port: rest + failureThreshold: 12 + periodSeconds: 5 + + livenessProbe: + httpGet: + path: /health/livez + port: rest + + readinessProbe: + httpGet: + path: /health/readyz + port: rest + + annotations: {} + + podAnnotations: {} + + nodeSelector: {} + + tolerations: [] + + affinity: {} + +# Deploy jobs to bootstrap creation of indexes and sources for quickwit clusters +bootstrap: + # Enable boostrap jobs + enabled: false + + # Extra env for boostrap jobs + extraEnv: {} + # KEY: VALUE + + # -- Environment variables from secrets or configmaps to add to the searcher + extraEnvFrom: [] + # - secretRef: + # name: quickwit-credentials + + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + nodeSelector: {} + + tolerations: [] + + affinity: {} + +# Quickwit configuration +config: + # Metastore configuration. + # Default to `qwdata/indexes` if not set. + # S3 metastore + # metastore_uri: s3://quickwit/indexes + # + # Postgres metastore + # postgres: + # host: "" + # port: 5432 + # database: metastore + # username: quickwit + # password: "" + # max_num_connections: 50 + + # Storage configuration. + # storage: + # s3: + # endpoint: "http://custom-s3-endpoint" + # region: eu-east-1 + # We recommend using IAM roles and permissions to access Amazon S3 resources, + # but you can specify a pair of access and secret keys if necessary. + # access_key_id: + # secret_access_key: + # azure: + # account: "my-azure-blob-account-name" + # access_key: "my-azure-blob-access-key" + + default_index_root_uri: s3://quickwit/indexes + + # Indexer settings + # indexer: + # split_store_max_num_bytes: 200G + # split_store_max_num_splits: 10000 + # Ingest API settings + # ingest_api: + # max_queue_memory_usage: 2GiB + # max_queue_disk_usage: 4GiB + # Searcher settings + # searcher: + # fast_field_cache_capacity: 10G + # split_footer_cache_capacity: 1G + # max_num_concurrent_split_streams: 100 + + indexes: [] + # - version: 0.8 + # index_id: my-index + # doc_mapping: + # field_mappings: + # - name: timestamp + # type: datetime + # fast: true + # input_formats: + # - unix_timestamp + # output_format: unix_timestamp_secs + # - name: body + # type: text + # timestamp_field: timestamp + # search_settings: + # default_search_fields: [body] + # indexing_settings: + # merge_policy: + # type: limit_merge + # max_merge_ops: 3 + # merge_factor: 10 + # max_merge_factor: 12 + + sources: [] + # - index: my-index + # source: + # version: 0.8 + # source_id: my-source + # source_type: kafka + # num_pipelines: 1 + # params: + # topic: quickwit-topic + # client_params: + # bootstrap.servers: kafka-server-endpoint1:9092,kafka-server-endpoint2:9092 + +# Prometheus metrics +serviceMonitor: + enabled: false + # -- Additional labels to add to monitoring resources + additionalLabels: {} + interval: 60s + scrapeTimeout: 10s + metricRelabelings: [] + # - action: replace + # regex: quickwit-(.*) + # replacement: $1 + # sourceLabels: [cluster] + # targetLabel: qw_cluster + # - action: labeldrop + # regex: (endpoint|cluster) + relabelings: [] + # - sourceLabels: [__meta_kubernetes_pod_node_name] + # targetLabel: instance + +# Prometheus Operator alertmanager alerts +prometheusRule: + enabled: false + # -- Additional labels to add to monitoring resources + additionalLabels: {} + rules: [] + # - alert: Example + # expr: metric == 1 + # for: 1m + # labels: + # severity: warning + +service: + type: ClusterIP + + annotations: {} + +ingress: + enabled: false + className: nginx + annotations: + nginx.ingress.kubernetes.io/proxy-body-size: 10m + hosts: + # hostname required here. + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi