-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add distributed mode to loki helm chart
- Loading branch information
1 parent
541b109
commit df50d2f
Showing
58 changed files
with
4,442 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
production/helm/loki/templates/compactor/_helpers-compactor.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{{/* | ||
compactor fullname | ||
*/}} | ||
{{- define "loki.compactorFullname" -}} | ||
{{ include "loki.fullname" . }}-compactor | ||
{{- end }} | ||
|
||
{{/* | ||
compactor common labels | ||
*/}} | ||
{{- define "loki.compactorLabels" -}} | ||
{{ include "loki.labels" . }} | ||
app.kubernetes.io/component: compactor | ||
{{- end }} | ||
|
||
{{/* | ||
compactor selector labels | ||
*/}} | ||
{{- define "loki.compactorSelectorLabels" -}} | ||
{{ include "loki.selectorLabels" . }} | ||
app.kubernetes.io/component: compactor | ||
{{- end }} | ||
|
||
{{/* | ||
compactor image | ||
*/}} | ||
{{- define "loki.compactorImage" -}} | ||
{{- $dict := dict "loki" .Values.loki.image "service" .Values.compactor.image "global" .Values.global.image "defaultVersion" .Chart.AppVersion -}} | ||
{{- include "loki.lokiImage" $dict -}} | ||
{{- end }} | ||
|
||
{{/* | ||
compactor readinessProbe | ||
*/}} | ||
{{- define "loki.compactor.readinessProbe" -}} | ||
{{- with .Values.compactor.readinessProbe }} | ||
readinessProbe: | ||
{{- toYaml . | nindent 2 }} | ||
{{- else }} | ||
{{- with .Values.loki.readinessProbe }} | ||
readinessProbe: | ||
{{- toYaml . | nindent 2 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{/* | ||
compactor livenessProbe | ||
*/}} | ||
{{- define "loki.compactor.livenessProbe" -}} | ||
{{- with .Values.compactor.livenessProbe }} | ||
livenessProbe: | ||
{{- toYaml . | nindent 2 }} | ||
{{- else }} | ||
{{- with .Values.loki.livenessProbe }} | ||
livenessProbe: | ||
{{- toYaml . | nindent 2 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{/* | ||
compactor priority class name | ||
*/}} | ||
{{- define "loki.compactorPriorityClassName" }} | ||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.compactor.priorityClassName -}} | ||
{{- if $pcn }} | ||
priorityClassName: {{ $pcn }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the compactor service account | ||
*/}} | ||
{{- define "loki.compactorServiceAccountName" -}} | ||
{{- if .Values.compactor.serviceAccount.create -}} | ||
{{ default (print (include "loki.serviceAccountName" .) "-compactor") .Values.compactor.serviceAccount.name }} | ||
{{- else -}} | ||
{{ default (include "loki.serviceAccountName" .) .Values.compactor.serviceAccount.name }} | ||
{{- end -}} | ||
{{- end -}} |
161 changes: 161 additions & 0 deletions
161
production/helm/loki/templates/compactor/deployment-compactor.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
{{/* {{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} */}} | ||
{{/* {{- if and $isDistributed .Values.compactor.enabled }} */}} | ||
{{- if eq .Values.compactor.kind "Deployment"}} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "loki.compactorFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "loki.compactorLabels" . | nindent 4 }} | ||
{{- with .Values.loki.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
replicas: 1 | ||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} | ||
strategy: | ||
type: Recreate | ||
selector: | ||
matchLabels: | ||
{{- include "loki.compactorSelectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
{{- include "loki.config.checksum" . | nindent 8 }} | ||
{{- with .Values.loki.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.compactor.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "loki.compactorSelectorLabels" . | nindent 8 }} | ||
app.kubernetes.io/part-of: memberlist | ||
{{- with .Values.loki.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.compactor.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ include "loki.serviceAccountName" . }} | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.compactor.hostAliases }} | ||
hostAliases: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- include "loki.compactorPriorityClassName" . | nindent 6 }} | ||
securityContext: | ||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} | ||
terminationGracePeriodSeconds: {{ .Values.compactor.terminationGracePeriodSeconds }} | ||
{{- with .Values.compactor.initContainers }} | ||
initContainers: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
containers: | ||
- name: compactor | ||
image: {{ include "loki.image" . }} | ||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} | ||
{{- if or .Values.loki.command .Values.compactor.command }} | ||
command: | ||
- {{ coalesce .Values.compactor.command .Values.loki.command | quote }} | ||
{{- end }} | ||
args: | ||
- -config.file=/etc/loki/config/config.yaml | ||
- -target=compactor | ||
- -boltdb.shipper.compactor.working-directory=/var/loki/compactor | ||
{{- with .Values.compactor.extraArgs }} | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
ports: | ||
- name: http | ||
containerPort: 3100 | ||
protocol: TCP | ||
- name: grpc | ||
containerPort: 9095 | ||
protocol: TCP | ||
- name: http-memberlist | ||
containerPort: 7946 | ||
protocol: TCP | ||
{{- with .Values.compactor.extraEnv }} | ||
env: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- with .Values.compactor.extraEnvFrom }} | ||
envFrom: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
securityContext: | ||
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} | ||
readinessProbe: | ||
{{- toYaml .Values.loki.readinessProbe | nindent 12 }} | ||
livenessProbe: | ||
{{- toYaml .Values.loki.livenessProbe | nindent 12 }} | ||
volumeMounts: | ||
- name: temp | ||
mountPath: /tmp | ||
- name: config | ||
mountPath: /etc/loki/config | ||
- name: runtime-config | ||
mountPath: /etc/loki/runtime-config | ||
- name: data | ||
mountPath: /var/loki | ||
{{- with .Values.compactor.extraVolumeMounts }} | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
resources: | ||
{{- toYaml .Values.compactor.resources | nindent 12 }} | ||
{{- if .Values.compactor.extraContainers }} | ||
{{- toYaml .Values.compactor.extraContainers | nindent 8}} | ||
{{- end }} | ||
{{- with .Values.compactor.affinity }} | ||
affinity: | ||
{{- tpl . $ | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.compactor.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.compactor.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
volumes: | ||
- name: temp | ||
emptyDir: {} | ||
- name: config | ||
{{- if .Values.loki.existingSecretForConfig }} | ||
secret: | ||
secretName: {{ .Values.loki.existingSecretForConfig }} | ||
{{- else }} | ||
{{- include "loki.configVolume" . | nindent 10 }} | ||
{{- end }} | ||
- name: runtime-config | ||
configMap: | ||
name: {{ template "loki.name" . }}-runtime | ||
{{- if .Values.enterprise.enabled }} | ||
- name: license | ||
secret: | ||
{{- if .Values.enterprise.useExternalLicense }} | ||
secretName: {{ .Values.enterprise.externalLicenseName }} | ||
{{- else }} | ||
secretName: enterprise-logs-license | ||
{{- end }} | ||
{{- end }} | ||
- name: data | ||
{{- if .Values.compactor.persistence.enabled }} | ||
persistentVolumeClaim: | ||
claimName: data-{{ include "loki.compactorFullname" . }} | ||
{{- else }} | ||
emptyDir: {} | ||
{{- end }} | ||
{{- with .Values.compactor.extraVolumes }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
{{/* {{- end }} */}} |
25 changes: 25 additions & 0 deletions
25
production/helm/loki/templates/compactor/persistentvolumeclaim-compactor.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} | ||
{{- if and $isDistributed .Values.compactor.enabled .Values.compactor.persistence.enabled }} | ||
{{- if eq .Values.compactor.kind "Deployment"}} | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-{{ include "loki.compactorFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "loki.compactorLabels" . | nindent 4 }} | ||
{{- with .Values.compactor.persistence.annotations }} | ||
annotations: | ||
{{- . | toYaml | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
{{- with .Values.compactor.persistence.storageClass }} | ||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} | ||
{{- end }} | ||
resources: | ||
requests: | ||
storage: "{{ .Values.compactor.persistence.size }}" | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.