Adding dependencies, binary autostart

This commit is contained in:
plm
2024-12-16 14:55:43 +01:00
parent 5e1503f0bc
commit 10b01fdc40
318 changed files with 47355 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
{{/*
query-scheduler fullname
*/}}
{{- define "loki.querySchedulerFullname" -}}
{{ include "loki.fullname" . }}-query-scheduler
{{- end }}
{{/*
query-scheduler common labels
*/}}
{{- define "loki.querySchedulerLabels" -}}
{{ include "loki.labels" . }}
app.kubernetes.io/component: query-scheduler
{{- end }}
{{/*
query-scheduler selector labels
*/}}
{{- define "loki.querySchedulerSelectorLabels" -}}
{{ include "loki.selectorLabels" . }}
app.kubernetes.io/component: query-scheduler
{{- end }}
{{/*
query-scheduler image
*/}}
{{- define "loki.querySchedulerImage" -}}
{{- $dict := dict "loki" .Values.loki.image "service" .Values.queryScheduler.image "global" .Values.global.image "defaultVersion" .Chart.AppVersion -}}
{{- include "loki.lokiImage" $dict -}}
{{- end }}
{{/*
query-scheduler priority class name
*/}}
{{- define "loki.querySchedulerPriorityClassName" -}}
{{- $pcn := coalesce .Values.global.priorityClassName .Values.queryScheduler.priorityClassName -}}
{{- if $pcn }}
priorityClassName: {{ $pcn }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,146 @@
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
{{- if $isDistributed }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "loki.querySchedulerFullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "loki.querySchedulerLabels" . | nindent 4 }}
{{- with .Values.loki.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.queryScheduler.replicas }}
strategy:
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
selector:
matchLabels:
{{- include "loki.querySchedulerSelectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- include "loki.config.checksum" . | nindent 8 }}
{{- with .Values.loki.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.queryScheduler.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "loki.querySchedulerSelectorLabels" . | nindent 8 }}
{{- with .Values.loki.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.queryScheduler.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
app.kubernetes.io/part-of: memberlist
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.queryScheduler.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
serviceAccountName: {{ include "loki.serviceAccountName" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.queryScheduler.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "loki.querySchedulerPriorityClassName" . | nindent 6 }}
securityContext:
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }}
terminationGracePeriodSeconds: {{ .Values.queryScheduler.terminationGracePeriodSeconds }}
containers:
- name: query-scheduler
image: {{ include "loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
args:
- -config.file=/etc/loki/config/config.yaml
- -target=query-scheduler
{{- with .Values.queryScheduler.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http-metrics
containerPort: 3100
protocol: TCP
- name: grpc
containerPort: 9095
protocol: TCP
- name: http-memberlist
containerPort: 7946
protocol: TCP
{{- with .Values.queryScheduler.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.queryScheduler.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: config
mountPath: /etc/loki/config
- name: runtime-config
mountPath: /etc/loki/runtime-config
{{- if .Values.enterprise.enabled }}
- name: license
mountPath: /etc/loki/license
{{- end }}
{{- with .Values.queryScheduler.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.queryScheduler.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.queryScheduler.extraContainers }}
{{- toYaml .Values.queryScheduler.extraContainers | nindent 8}}
{{- end }}
{{- with .Values.queryScheduler.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.queryScheduler.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.queryScheduler.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
{{- include "loki.configVolume" . | nindent 10 }}
- 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 }}
{{- with .Values.queryScheduler.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,21 @@
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
{{- if and $isDistributed (gt (int .Values.queryScheduler.replicas) 1) }}
{{- if kindIs "invalid" .Values.queryScheduler.maxUnavailable }}
{{- fail "`.Values.queryScheduler.maxUnavailable` must be set when `.Values.queryScheduler.replicas` is greater than 1." }}
{{- else }}
apiVersion: {{ include "loki.pdb.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ include "loki.querySchedulerFullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "loki.querySchedulerLabels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "loki.querySchedulerSelectorLabels" . | nindent 6 }}
{{- with .Values.queryScheduler.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,38 @@
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
{{- if $isDistributed }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "loki.querySchedulerFullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "loki.querySchedulerLabels" . | nindent 4 }}
{{- with .Values.queryScheduler.serviceLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- with .Values.loki.serviceAnnotations }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.queryScheduler.serviceAnnotations }}
{{- toYaml . | nindent 4}}
{{- end }}
spec:
type: ClusterIP
clusterIP: None
publishNotReadyAddresses: true
ports:
- name: http-metrics
port: 3100
targetPort: http-metrics
protocol: TCP
- name: grpclb
port: 9095
targetPort: grpc
protocol: TCP
{{- with .Values.queryScheduler.appProtocol.grpc }}
appProtocol: {{ . }}
{{- end }}
selector:
{{- include "loki.querySchedulerSelectorLabels" . | nindent 4 }}
{{- end }}