Skip to content

Commit

Permalink
[quickwit] New chart (#724)
Browse files Browse the repository at this point in the history
* feat(quickwit): new chart

Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>

* fix(quickwit): typo

Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>

---------

Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
  • Loading branch information
nlamirault committed May 3, 2024
1 parent c52c50f commit 76592af
Show file tree
Hide file tree
Showing 22 changed files with 1,872 additions and 0 deletions.
23 changes: 23 additions & 0 deletions 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/
39 changes: 39 additions & 0 deletions 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
22 changes: 22 additions & 0 deletions 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 }}
205 changes: 205 additions & 0 deletions 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 }}
19 changes: 19 additions & 0 deletions 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 }}
40 changes: 40 additions & 0 deletions 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 }}

0 comments on commit 76592af

Please sign in to comment.