Adding dependencies, binary autostart
This commit is contained in:
		
							
								
								
									
										32
									
								
								opencloud/charts/loki/templates/read/_helpers-read.tpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								opencloud/charts/loki/templates/read/_helpers-read.tpl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
{{/*
 | 
			
		||||
read fullname
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "loki.readFullname" -}}
 | 
			
		||||
{{ include "loki.name" . }}-read
 | 
			
		||||
{{- end }}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
read common labels
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "loki.readLabels" -}}
 | 
			
		||||
{{ include "loki.labels" . }}
 | 
			
		||||
app.kubernetes.io/component: read
 | 
			
		||||
{{- end }}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
read selector labels
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "loki.readSelectorLabels" -}}
 | 
			
		||||
{{ include "loki.selectorLabels" . }}
 | 
			
		||||
app.kubernetes.io/component: read
 | 
			
		||||
{{- end }}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
read priority class name
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "loki.readPriorityClassName" -}}
 | 
			
		||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.read.priorityClassName -}}
 | 
			
		||||
{{- if $pcn }}
 | 
			
		||||
priorityClassName: {{ $pcn }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
							
								
								
									
										163
									
								
								opencloud/charts/loki/templates/read/deployment-read.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										163
									
								
								opencloud/charts/loki/templates/read/deployment-read.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,163 @@
 | 
			
		||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
 | 
			
		||||
{{- if and $isSimpleScalable (not .Values.read.legacyReadTarget ) }}
 | 
			
		||||
---
 | 
			
		||||
apiVersion: apps/v1
 | 
			
		||||
kind: Deployment
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.readFullname" . }}
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    app.kubernetes.io/part-of: memberlist
 | 
			
		||||
    {{- include "loki.readLabels" . | nindent 4 }}
 | 
			
		||||
  {{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.backend.annotations))}}
 | 
			
		||||
  annotations:
 | 
			
		||||
    {{- with .Values.loki.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    {{- with .Values.read.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
spec:
 | 
			
		||||
  {{- if not .Values.read.autoscaling.enabled }}
 | 
			
		||||
  replicas: {{ .Values.read.replicas }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
  strategy:
 | 
			
		||||
    rollingUpdate:
 | 
			
		||||
      maxSurge: 0
 | 
			
		||||
      maxUnavailable: 1
 | 
			
		||||
  revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
 | 
			
		||||
  selector:
 | 
			
		||||
    matchLabels:
 | 
			
		||||
      {{- include "loki.readSelectorLabels" . | nindent 6 }}
 | 
			
		||||
  template:
 | 
			
		||||
    metadata:
 | 
			
		||||
      annotations:
 | 
			
		||||
        checksum/config: {{ include "loki.configMapOrSecretContentHash" (dict "ctx" . "name" "/config.yaml") }}
 | 
			
		||||
        {{- with .Values.loki.podAnnotations }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        {{- with .Values.read.podAnnotations }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
      labels:
 | 
			
		||||
        app.kubernetes.io/part-of: memberlist
 | 
			
		||||
        {{- include "loki.readSelectorLabels" . | nindent 8 }}
 | 
			
		||||
        {{- with .Values.loki.podLabels }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        {{- with .Values.read.podLabels }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        {{- with .Values.read.selectorLabels }}
 | 
			
		||||
        {{- tpl (toYaml .) $ | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
    spec:
 | 
			
		||||
      serviceAccountName: {{ include "loki.serviceAccountName" . }}
 | 
			
		||||
      automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
 | 
			
		||||
      {{- with .Values.imagePullSecrets }}
 | 
			
		||||
      imagePullSecrets:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- include "loki.readPriorityClassName" . | nindent 6 }}
 | 
			
		||||
      securityContext:
 | 
			
		||||
        {{- toYaml .Values.loki.podSecurityContext | nindent 8 }}
 | 
			
		||||
      terminationGracePeriodSeconds: {{ .Values.read.terminationGracePeriodSeconds }}
 | 
			
		||||
      containers:
 | 
			
		||||
        - name: loki
 | 
			
		||||
          image: {{ include "loki.image" . }}
 | 
			
		||||
          imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
 | 
			
		||||
          args:
 | 
			
		||||
            - -config.file=/etc/loki/config/config.yaml
 | 
			
		||||
            - -target={{ .Values.read.targetModule }}
 | 
			
		||||
            - -legacy-read-mode=false
 | 
			
		||||
            - -common.compactor-grpc-address={{ include "loki.backendFullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:{{ .Values.loki.server.grpc_listen_port }}
 | 
			
		||||
            {{- with .Values.read.extraArgs }}
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
          ports:
 | 
			
		||||
            - name: http-metrics
 | 
			
		||||
              containerPort: {{ .Values.loki.server.http_listen_port }}
 | 
			
		||||
              protocol: TCP
 | 
			
		||||
            - name: grpc
 | 
			
		||||
              containerPort: {{ .Values.loki.server.grpc_listen_port }}
 | 
			
		||||
              protocol: TCP
 | 
			
		||||
            - name: http-memberlist
 | 
			
		||||
              containerPort: 7946
 | 
			
		||||
              protocol: TCP
 | 
			
		||||
          {{- with .Values.read.extraEnv }}
 | 
			
		||||
          env:
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
          {{- end }}
 | 
			
		||||
          {{- with .Values.read.extraEnvFrom }}
 | 
			
		||||
          envFrom:
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
          {{- end }}
 | 
			
		||||
          securityContext:
 | 
			
		||||
            {{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
 | 
			
		||||
          readinessProbe:
 | 
			
		||||
            {{- toYaml .Values.loki.readinessProbe | nindent 12 }}
 | 
			
		||||
          volumeMounts:
 | 
			
		||||
            - name: config
 | 
			
		||||
              mountPath: /etc/loki/config
 | 
			
		||||
            - name: runtime-config
 | 
			
		||||
              mountPath: /etc/loki/runtime-config
 | 
			
		||||
            - name: tmp
 | 
			
		||||
              mountPath: /tmp
 | 
			
		||||
            - name: data
 | 
			
		||||
              mountPath: /var/loki
 | 
			
		||||
            {{- if .Values.enterprise.enabled }}
 | 
			
		||||
            - name: license
 | 
			
		||||
              mountPath: /etc/loki/license
 | 
			
		||||
            {{- end}}
 | 
			
		||||
            {{- with .Values.read.extraVolumeMounts }}
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
          resources:
 | 
			
		||||
            {{- toYaml .Values.read.resources | nindent 12 }}
 | 
			
		||||
        {{- with .Values.read.extraContainers }}
 | 
			
		||||
        {{- toYaml . | nindent 8}}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
      {{- with .Values.read.affinity }}
 | 
			
		||||
      affinity:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.read.dnsConfig }}
 | 
			
		||||
      dnsConfig:
 | 
			
		||||
        {{- tpl . $ | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.read.nodeSelector }}
 | 
			
		||||
      nodeSelector:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.read.topologySpreadConstraints }}
 | 
			
		||||
      topologySpreadConstraints:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.read.tolerations }}
 | 
			
		||||
      tolerations:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      volumes:
 | 
			
		||||
        - name: tmp
 | 
			
		||||
          emptyDir: {}
 | 
			
		||||
        - name: data
 | 
			
		||||
          emptyDir: {}
 | 
			
		||||
        - 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.read.extraVolumes }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
							
								
								
									
										55
									
								
								opencloud/charts/loki/templates/read/hpa.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								opencloud/charts/loki/templates/read/hpa.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,55 @@
 | 
			
		||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
 | 
			
		||||
{{- $autoscalingv2 := .Capabilities.APIVersions.Has "autoscaling/v2" -}}
 | 
			
		||||
{{- if and $isSimpleScalable ( .Values.read.autoscaling.enabled ) }}
 | 
			
		||||
{{- if $autoscalingv2 }}
 | 
			
		||||
apiVersion: autoscaling/v2
 | 
			
		||||
{{- else }}
 | 
			
		||||
apiVersion: autoscaling/v2beta1
 | 
			
		||||
{{- end }}
 | 
			
		||||
kind: HorizontalPodAutoscaler
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.readFullname" . }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.readLabels" . | nindent 4 }}
 | 
			
		||||
spec:
 | 
			
		||||
  scaleTargetRef:
 | 
			
		||||
    apiVersion: apps/v1
 | 
			
		||||
{{- if and $isSimpleScalable (not .Values.read.legacyReadTarget ) }}
 | 
			
		||||
    kind: Deployment
 | 
			
		||||
    name: {{ include "loki.readFullname" . }}
 | 
			
		||||
{{- else }}
 | 
			
		||||
    kind: StatefulSet
 | 
			
		||||
    name: {{ include "loki.readFullname" . }}   
 | 
			
		||||
{{- end }}
 | 
			
		||||
  minReplicas: {{ .Values.read.autoscaling.minReplicas }}
 | 
			
		||||
  maxReplicas: {{ .Values.read.autoscaling.maxReplicas }}
 | 
			
		||||
  {{- with .Values.read.autoscaling.behavior }}
 | 
			
		||||
  behavior:
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
  metrics:
 | 
			
		||||
  {{- with .Values.read.autoscaling.targetMemoryUtilizationPercentage }}
 | 
			
		||||
    - type: Resource
 | 
			
		||||
      resource:
 | 
			
		||||
        name: memory
 | 
			
		||||
        {{- if $autoscalingv2 }}
 | 
			
		||||
        target:
 | 
			
		||||
          type: Utilization
 | 
			
		||||
          averageUtilization: {{ . }}
 | 
			
		||||
        {{- else }}
 | 
			
		||||
        targetAverageUtilization: {{ . }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
  {{- with .Values.read.autoscaling.targetCPUUtilizationPercentage }}
 | 
			
		||||
    - type: Resource
 | 
			
		||||
      resource:
 | 
			
		||||
        name: cpu
 | 
			
		||||
        {{- if $autoscalingv2 }}
 | 
			
		||||
        target:
 | 
			
		||||
          type: Utilization
 | 
			
		||||
          averageUtilization: {{ . }}
 | 
			
		||||
        {{- else }}
 | 
			
		||||
        targetAverageUtilization: {{ . }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
@@ -0,0 +1,15 @@
 | 
			
		||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
 | 
			
		||||
{{- if and $isSimpleScalable (gt (int .Values.read.replicas) 1) }}
 | 
			
		||||
apiVersion: policy/v1
 | 
			
		||||
kind: PodDisruptionBudget
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.readFullname" . }}
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.readLabels" . | nindent 4 }}
 | 
			
		||||
spec:
 | 
			
		||||
  selector:
 | 
			
		||||
    matchLabels:
 | 
			
		||||
      {{- include "loki.readSelectorLabels" . | nindent 6 }}
 | 
			
		||||
  maxUnavailable: 1
 | 
			
		||||
{{- end }}
 | 
			
		||||
@@ -0,0 +1,41 @@
 | 
			
		||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
 | 
			
		||||
{{ if $isSimpleScalable }}
 | 
			
		||||
---
 | 
			
		||||
apiVersion: v1
 | 
			
		||||
kind: Service
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.readFullname" . }}-headless
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.readSelectorLabels" . | nindent 4 }}
 | 
			
		||||
    {{- with .Values.loki.serviceLabels }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    {{- with .Values.read.service.labels }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    variant: headless
 | 
			
		||||
    prometheus.io/service-monitor: "false"
 | 
			
		||||
  annotations:
 | 
			
		||||
    {{- with .Values.loki.serviceAnnotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    {{- with .Values.read.service.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
spec:
 | 
			
		||||
  type: ClusterIP
 | 
			
		||||
  clusterIP: None
 | 
			
		||||
  ports:
 | 
			
		||||
    - name: http-metrics
 | 
			
		||||
      port: {{ .Values.loki.server.http_listen_port }}
 | 
			
		||||
      targetPort: http-metrics
 | 
			
		||||
      protocol: TCP
 | 
			
		||||
    - name: grpc
 | 
			
		||||
      port: {{ .Values.loki.server.grpc_listen_port }}
 | 
			
		||||
      targetPort: grpc
 | 
			
		||||
      protocol: TCP
 | 
			
		||||
      appProtocol: tcp
 | 
			
		||||
  selector:
 | 
			
		||||
    {{- include "loki.readSelectorLabels" . | nindent 4 }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
							
								
								
									
										37
									
								
								opencloud/charts/loki/templates/read/service-read.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								opencloud/charts/loki/templates/read/service-read.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
 | 
			
		||||
{{- if $isSimpleScalable }}
 | 
			
		||||
---
 | 
			
		||||
apiVersion: v1
 | 
			
		||||
kind: Service
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.readFullname" . }}
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "loki.readLabels" . | nindent 4 }}
 | 
			
		||||
    {{- with .Values.loki.serviceLabels }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    {{- with .Values.read.service.labels }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  annotations:
 | 
			
		||||
    {{- with .Values.loki.serviceAnnotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    {{- with .Values.read.service.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4}}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
spec:
 | 
			
		||||
  type: ClusterIP
 | 
			
		||||
  ports:
 | 
			
		||||
    - name: http-metrics
 | 
			
		||||
      port: {{ .Values.loki.server.http_listen_port }}
 | 
			
		||||
      targetPort: http-metrics
 | 
			
		||||
      protocol: TCP
 | 
			
		||||
    - name: grpc
 | 
			
		||||
      port: {{ .Values.loki.server.grpc_listen_port }}
 | 
			
		||||
      targetPort: grpc
 | 
			
		||||
      protocol: TCP
 | 
			
		||||
  selector:
 | 
			
		||||
    {{- include "loki.readSelectorLabels" . | nindent 4 }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
							
								
								
									
										200
									
								
								opencloud/charts/loki/templates/read/statefulset-read.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								opencloud/charts/loki/templates/read/statefulset-read.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,200 @@
 | 
			
		||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
 | 
			
		||||
{{- if and $isSimpleScalable (.Values.read.legacyReadTarget ) }}
 | 
			
		||||
---
 | 
			
		||||
apiVersion: apps/v1
 | 
			
		||||
kind: StatefulSet
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "loki.readFullname" . }}
 | 
			
		||||
  namespace: {{ $.Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    app.kubernetes.io/part-of: memberlist
 | 
			
		||||
    {{- include "loki.readLabels" . | nindent 4 }}
 | 
			
		||||
  {{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.read.annotations))}}
 | 
			
		||||
  annotations:
 | 
			
		||||
    {{- with .Values.loki.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    {{- with .Values.read.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
spec:
 | 
			
		||||
{{- if not .Values.read.autoscaling.enabled }}
 | 
			
		||||
  {{- if eq .Values.deploymentMode "SingleBinary" }}
 | 
			
		||||
  replicas: 0
 | 
			
		||||
  {{- else }}
 | 
			
		||||
  replicas: {{ .Values.read.replicas }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
  podManagementPolicy: {{ .Values.read.podManagementPolicy }}
 | 
			
		||||
  updateStrategy:
 | 
			
		||||
    rollingUpdate:
 | 
			
		||||
      partition: 0
 | 
			
		||||
  serviceName: {{ printf "%s-headless" (include "loki.readFullname" .) }}
 | 
			
		||||
  revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
 | 
			
		||||
  {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.read.persistence.enableStatefulSetAutoDeletePVC)  }}
 | 
			
		||||
  {{/*
 | 
			
		||||
    Data on the read nodes is easy to replace, so we want to always delete PVCs to make
 | 
			
		||||
    operation easier, and will rely on re-fetching data when needed.
 | 
			
		||||
  */}}
 | 
			
		||||
  persistentVolumeClaimRetentionPolicy:
 | 
			
		||||
    whenDeleted: Delete
 | 
			
		||||
    whenScaled: Delete
 | 
			
		||||
  {{- end }}
 | 
			
		||||
  selector:
 | 
			
		||||
    matchLabels:
 | 
			
		||||
      {{- include "loki.readSelectorLabels" . | nindent 6 }}
 | 
			
		||||
  template:
 | 
			
		||||
    metadata:
 | 
			
		||||
      annotations:
 | 
			
		||||
        checksum/config: {{ include "loki.configMapOrSecretContentHash" (dict "ctx" . "name" "/config.yaml") }}
 | 
			
		||||
        {{- with .Values.loki.podAnnotations }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        {{- with .Values.read.podAnnotations }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
      labels:
 | 
			
		||||
        app.kubernetes.io/part-of: memberlist
 | 
			
		||||
        {{- include "loki.readSelectorLabels" . | nindent 8 }}
 | 
			
		||||
        {{- with .Values.loki.podLabels }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        {{- with .Values.read.podLabels }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        {{- with .Values.read.selectorLabels }}
 | 
			
		||||
        {{- tpl (toYaml .) $ | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
    spec:
 | 
			
		||||
      serviceAccountName: {{ include "loki.serviceAccountName" . }}
 | 
			
		||||
      automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
 | 
			
		||||
      {{ include "loki.enableServiceLinks" . }}
 | 
			
		||||
      {{- with .Values.imagePullSecrets }}
 | 
			
		||||
      imagePullSecrets:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- include "loki.readPriorityClassName" . | nindent 6 }}
 | 
			
		||||
      securityContext:
 | 
			
		||||
        {{- toYaml .Values.loki.podSecurityContext | nindent 8 }}
 | 
			
		||||
      terminationGracePeriodSeconds: {{ .Values.read.terminationGracePeriodSeconds }}
 | 
			
		||||
      containers:
 | 
			
		||||
        - name: loki
 | 
			
		||||
          image: {{ include "loki.image" . }}
 | 
			
		||||
          imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
 | 
			
		||||
          args:
 | 
			
		||||
            - -config.file=/etc/loki/config/config.yaml
 | 
			
		||||
            - -target={{ .Values.read.targetModule }}
 | 
			
		||||
            {{- with .Values.read.extraArgs }}
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
          ports:
 | 
			
		||||
            - name: http-metrics
 | 
			
		||||
              containerPort: {{ .Values.loki.server.http_listen_port }}
 | 
			
		||||
              protocol: TCP
 | 
			
		||||
            - name: grpc
 | 
			
		||||
              containerPort: {{ .Values.loki.server.grpc_listen_port }}
 | 
			
		||||
              protocol: TCP
 | 
			
		||||
            - name: http-memberlist
 | 
			
		||||
              containerPort: 7946
 | 
			
		||||
              protocol: TCP
 | 
			
		||||
          {{- with .Values.read.extraEnv }}
 | 
			
		||||
          env:
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
          {{- end }}
 | 
			
		||||
          {{- with .Values.read.extraEnvFrom }}
 | 
			
		||||
          envFrom:
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
          {{- end }}
 | 
			
		||||
          securityContext:
 | 
			
		||||
            {{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
 | 
			
		||||
          readinessProbe:
 | 
			
		||||
            {{- toYaml .Values.loki.readinessProbe | nindent 12 }}
 | 
			
		||||
          {{- with .Values.read.lifecycle }}
 | 
			
		||||
          lifecycle:
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
          {{- end }}
 | 
			
		||||
          volumeMounts:
 | 
			
		||||
            - name: config
 | 
			
		||||
              mountPath: /etc/loki/config
 | 
			
		||||
            - name: runtime-config
 | 
			
		||||
              mountPath: /etc/loki/runtime-config
 | 
			
		||||
            - name: tmp
 | 
			
		||||
              mountPath: /tmp
 | 
			
		||||
            - name: data
 | 
			
		||||
              mountPath: /var/loki
 | 
			
		||||
            {{- if .Values.enterprise.enabled }}
 | 
			
		||||
            - name: license
 | 
			
		||||
              mountPath: /etc/loki/license
 | 
			
		||||
            {{- end}}
 | 
			
		||||
            {{- with .Values.read.extraVolumeMounts }}
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
          resources:
 | 
			
		||||
            {{- toYaml .Values.read.resources | nindent 12 }}
 | 
			
		||||
        {{- with .Values.read.extraContainers }}
 | 
			
		||||
        {{- toYaml . | nindent 8}}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
      {{- with .Values.read.affinity }}
 | 
			
		||||
      affinity:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.read.dnsConfig }}
 | 
			
		||||
      dnsConfig:
 | 
			
		||||
        {{- tpl . $ | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.read.nodeSelector }}
 | 
			
		||||
      nodeSelector:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.read.topologySpreadConstraints }}
 | 
			
		||||
      topologySpreadConstraints:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.read.tolerations }}
 | 
			
		||||
      tolerations:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      volumes:
 | 
			
		||||
        - name: tmp
 | 
			
		||||
          emptyDir: {}
 | 
			
		||||
        - 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.read.extraVolumes }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
  volumeClaimTemplates:
 | 
			
		||||
    - apiVersion: v1
 | 
			
		||||
      kind: PersistentVolumeClaim
 | 
			
		||||
      metadata:
 | 
			
		||||
        name: data
 | 
			
		||||
        {{- with .Values.read.persistence.annotations }}
 | 
			
		||||
        annotations:
 | 
			
		||||
          {{- toYaml . | nindent 10 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
      spec:
 | 
			
		||||
        accessModes:
 | 
			
		||||
          - ReadWriteOnce
 | 
			
		||||
        {{- with .Values.read.persistence.storageClass }}
 | 
			
		||||
        storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        resources:
 | 
			
		||||
          requests:
 | 
			
		||||
            storage: {{ .Values.read.persistence.size | quote }}
 | 
			
		||||
        {{- with .Values.read.persistence.selector }}
 | 
			
		||||
        selector:
 | 
			
		||||
          {{- toYaml . | nindent 10 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
		Reference in New Issue
	
	Block a user