Adding dependencies, binary autostart
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
{{/*
|
||||
distributor fullname
|
||||
*/}}
|
||||
{{- define "loki.distributorFullname" -}}
|
||||
{{ include "loki.fullname" . }}-distributor
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
distributor common labels
|
||||
*/}}
|
||||
{{- define "loki.distributorLabels" -}}
|
||||
{{ include "loki.labels" . }}
|
||||
app.kubernetes.io/component: distributor
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
distributor selector labels
|
||||
*/}}
|
||||
{{- define "loki.distributorSelectorLabels" -}}
|
||||
{{ include "loki.selectorLabels" . }}
|
||||
app.kubernetes.io/component: distributor
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
distributor priority class name
|
||||
*/}}
|
||||
{{- define "loki.distributorPriorityClassName" -}}
|
||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.distributor.priorityClassName -}}
|
||||
{{- if $pcn }}
|
||||
priorityClassName: {{ $pcn }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,158 @@
|
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
|
||||
{{- if $isDistributed -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "loki.distributorFullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "loki.distributorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/part-of: memberlist
|
||||
{{- with .Values.loki.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if not .Values.distributor.autoscaling.enabled }}
|
||||
replicas: {{ .Values.distributor.replicas }}
|
||||
{{- end }}
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: {{ .Values.distributor.maxSurge }}
|
||||
maxUnavailable: 1
|
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "loki.distributorSelectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- include "loki.config.checksum" . | nindent 8 }}
|
||||
{{- with .Values.loki.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "loki.distributorSelectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/part-of: memberlist
|
||||
{{- with .Values.loki.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
|
||||
{{- with .Values.distributor.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }}
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.hostAliases }}
|
||||
hostAliases:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- include "loki.distributorPriorityClassName" . | nindent 6 }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }}
|
||||
terminationGracePeriodSeconds: {{ .Values.distributor.terminationGracePeriodSeconds }}
|
||||
containers:
|
||||
- name: distributor
|
||||
image: {{ include "loki.image" . }}
|
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
|
||||
{{- if or .Values.loki.command .Values.distributor.command }}
|
||||
command:
|
||||
- {{ coalesce .Values.distributor.command .Values.loki.command | quote }}
|
||||
{{- end }}
|
||||
args:
|
||||
- -config.file=/etc/loki/config/config.yaml
|
||||
- -target=distributor
|
||||
{{- if .Values.ingester.zoneAwareReplication.enabled }}
|
||||
{{- if and (.Values.ingester.zoneAwareReplication.migration.enabled) (not .Values.ingester.zoneAwareReplication.migration.writePath) }}
|
||||
- -distributor.zone-awareness-enabled=false
|
||||
{{- else }}
|
||||
- -distributor.zone-awareness-enabled=true
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.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.distributor.extraEnv }}
|
||||
env:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.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.distributor.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.distributor.resources | nindent 12 }}
|
||||
{{- if .Values.distributor.extraContainers }}
|
||||
{{- toYaml .Values.distributor.extraContainers | nindent 8}}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.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.distributor.extraVolumes }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
54
opencloud/charts/loki/templates/distributor/hpa.yaml
Normal file
54
opencloud/charts/loki/templates/distributor/hpa.yaml
Normal file
@@ -0,0 +1,54 @@
|
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
|
||||
{{- if and $isDistributed .Values.distributor.autoscaling.enabled }}
|
||||
{{- $apiVersion := include "loki.hpa.apiVersion" . -}}
|
||||
apiVersion: {{ $apiVersion }}
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "loki.distributorFullname" . }}
|
||||
labels:
|
||||
{{- include "loki.distributorLabels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "loki.distributorFullname" . }}
|
||||
minReplicas: {{ .Values.distributor.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.distributor.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- with .Values.distributor.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
{{- if (eq $apiVersion "autoscaling/v2") }}
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ . }}
|
||||
{{- else }}
|
||||
targetAverageUtilization: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
{{- if (eq $apiVersion "autoscaling/v2") }}
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ . }}
|
||||
{{- else }}
|
||||
targetAverageUtilization: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.autoscaling.customMetrics }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.distributor.autoscaling.behavior.enabled }}
|
||||
behavior:
|
||||
{{- with .Values.distributor.autoscaling.behavior.scaleDown }}
|
||||
scaleDown: {{ toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.autoscaling.behavior.scaleUp }}
|
||||
scaleUp: {{ toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
|
||||
{{- if and $isDistributed (gt (int .Values.distributor.replicas) 1) }}
|
||||
{{- if kindIs "invalid" .Values.distributor.maxUnavailable }}
|
||||
{{- fail "`.Values.distributor.maxUnavailable` must be set when `.Values.distributor.replicas` is greater than 1." }}
|
||||
{{- else }}
|
||||
apiVersion: {{ include "loki.pdb.apiVersion" . }}
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ include "loki.distributorFullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "loki.distributorLabels" . | nindent 4 }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "loki.distributorSelectorLabels" . | nindent 6 }}
|
||||
{{- with .Values.distributor.maxUnavailable }}
|
||||
maxUnavailable: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,39 @@
|
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
|
||||
{{- if $isDistributed -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "loki.distributorFullname" . }}-headless
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "loki.distributorSelectorLabels" . | nindent 4 }}
|
||||
{{- with .Values.distributor.serviceLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
variant: headless
|
||||
prometheus.io/service-monitor: "false"
|
||||
annotations:
|
||||
{{- with .Values.loki.serviceAnnotations }}
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.serviceAnnotations }}
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
ports:
|
||||
- name: http-metrics
|
||||
port: 3100
|
||||
targetPort: http-metrics
|
||||
protocol: TCP
|
||||
- name: grpc
|
||||
port: 9095
|
||||
targetPort: grpc
|
||||
protocol: TCP
|
||||
{{- if .Values.distributor.appProtocol.grpc }}
|
||||
appProtocol: {{ .Values.distributor.appProtocol.grpc }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "loki.distributorSelectorLabels" . | nindent 4 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,36 @@
|
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
|
||||
{{- if $isDistributed -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "loki.distributorFullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "loki.distributorLabels" . | nindent 4 }}
|
||||
{{- with .Values.distributor.serviceLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- with .Values.loki.serviceAnnotations }}
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
{{- with .Values.distributor.serviceAnnotations }}
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: http-metrics
|
||||
port: 3100
|
||||
targetPort: http-metrics
|
||||
protocol: TCP
|
||||
- name: grpc
|
||||
port: 9095
|
||||
targetPort: grpc
|
||||
protocol: TCP
|
||||
{{- if .Values.distributor.appProtocol.grpc }}
|
||||
appProtocol: {{ .Values.distributor.appProtocol.grpc }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "loki.distributorSelectorLabels" . | nindent 4 }}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user