Skip to content

Commit

Permalink
[jaeger] Add badger support for AllInOne deployment (#550)
Browse files Browse the repository at this point in the history
* Allow badger as a storage type for allInOne deployments

Signed-off-by: twobiers <22715034+twobiers@users.noreply.github.com>

* Make badger persistence configurable

Signed-off-by: twobiers <22715034+twobiers@users.noreply.github.com>

* Bump chart version to 2.1.0

Signed-off-by: twobiers <22715034+twobiers@users.noreply.github.com>

---------

Signed-off-by: twobiers <22715034+twobiers@users.noreply.github.com>
  • Loading branch information
twobiers committed Apr 9, 2024
1 parent 047a76c commit 0240058
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/jaeger/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: 1.53.0
description: A Jaeger Helm chart for Kubernetes
name: jaeger
type: application
version: 2.0.1
version: 2.1.0
# CronJobs require v1.21
kubeVersion: ">= 1.21-0"
keywords:
Expand Down
43 changes: 42 additions & 1 deletion charts/jaeger/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,44 @@ grpcPlugin related environment variables
{{- end -}}

{{/*
Cassandra, Elasticsearch, or grpc-plugin related environment variables depending on which is used
badger related environment variables
*/}}
{{- define "badger.env" -}}
- name: BADGER_EPHEMERAL
value: {{ .Values.storage.badger.ephemeral | quote }}
{{- if not .Values.storage.badger.ephemeral }}
- name: BADGER_DIRECTORY_VALUE
value: {{ print .Values.storage.badger.persistence.mountPath "/badger/data" | quote }}
- name: BADGER_DIRECTORY_KEY
value: {{ print .Values.storage.badger.persistence.mountPath "/badger/key" | quote }}
{{- end }}
{{- if .Values.storage.badger.extraEnv }}
{{- toYaml .Values.storage.badger.extraEnv }}
{{- end }}
{{- end -}}

{{/*
memory related environment variables
*/}}
{{- define "memory.env" -}}
{{- if .Values.storage.memory.extraEnv }}
{{- toYaml .Values.storage.memory.extraEnv }}
{{- end }}
{{- end -}}

{{/*
allInOne currently only supports memory/badger storage type.
*/}}
{{- define "allInOne.storage.type" -}}
{{ $type := .Values.storage.type }}
{{- if or (eq $type "memory") (eq $type "badger") -}}
{{ .Values.storage.type }}
{{- end -}}
{{- end -}}


{{/*
Cassandra, Elasticsearch, or grpc-plugin, badger, memory related environment variables depending on which is used
*/}}
{{- define "storage.env" -}}
{{- if eq .Values.storage.type "cassandra" -}}
Expand All @@ -392,6 +429,10 @@ Cassandra, Elasticsearch, or grpc-plugin related environment variables depending
{{ include "elasticsearch.env" . }}
{{- else if eq .Values.storage.type "grpc-plugin" -}}
{{ include "grpcPlugin.env" . }}
{{- else if eq .Values.storage.type "badger" -}}
{{ include "badger.env" . }}
{{- else if eq .Values.storage.type "memory" -}}
{{ include "memory.env" . }}
{{- end -}}
{{- end -}}

Expand Down
16 changes: 15 additions & 1 deletion charts/jaeger/templates/allinone-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ spec:
{{- toYaml .Values.allInOne.extraEnv | nindent 12 }}
{{- end }}
- name: SPAN_STORAGE_TYPE
value: memory
value: {{ include "allInOne.storage.type" . | required "Invalid storage type provided. Use either badger or memory for allInOne" }}
{{- include "storage.env" . | nindent 12 }}
- name: COLLECTOR_ZIPKIN_HOST_PORT
value: :9411
- name: JAEGER_DISABLED
Expand Down Expand Up @@ -102,6 +103,10 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- if not .Values.storage.badger.ephemeral }}
- name: badger-data
mountPath: {{ .Values.storage.badger.persistence.mountPath }}
{{- end }}
{{- if .Values.allInOne.samplingConfig}}
- name: strategies
mountPath: /etc/conf/
Expand All @@ -112,8 +117,17 @@ spec:
subPath: {{ .subPath }}
readOnly: {{ .readOnly }}
{{- end }}
securityContext:
runAsUser: 10001
runAsGroup: 10001
fsGroup: 10001
serviceAccountName: {{ template "jaeger.fullname" . }}
volumes:
{{- if not .Values.storage.badger.ephemeral }}
- name: badger-data
persistentVolumeClaim:
claimName: {{ .Values.storage.badger.persistence.useExistingPvcName | required "Using badger persistence it is required to set an existing PVC" }}
{{- end }}
{{- if .Values.allInOne.samplingConfig}}
- name: strategies
configMap:
Expand Down
10 changes: 9 additions & 1 deletion charts/jaeger/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ allInOne:
nodeSelector: {}

storage:
# allowed values (cassandra, elasticsearch)
# allowed values (cassandra, elasticsearch, grpc-plugin, badger, memory)
type: cassandra
cassandra:
host: cassandra
Expand Down Expand Up @@ -167,6 +167,14 @@ storage:
extraEnv: []
grpcPlugin:
extraEnv: []
badger:
ephemeral: true
persistence:
mountPath: /mnt/data
useExistingPvcName: ""
extraEnv: []
memory:
extraEnv: []

# Begin: Override values on the Cassandra subchart to customize for Jaeger
cassandra:
Expand Down

0 comments on commit 0240058

Please sign in to comment.