Adding dependencies, binary autostart
This commit is contained in:
32
opencloud/charts/loki/templates/write/_helpers-write.tpl
Normal file
32
opencloud/charts/loki/templates/write/_helpers-write.tpl
Normal file
@@ -0,0 +1,32 @@
|
||||
{{/*
|
||||
write fullname
|
||||
*/}}
|
||||
{{- define "loki.writeFullname" -}}
|
||||
{{ include "loki.name" . }}-write
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
write common labels
|
||||
*/}}
|
||||
{{- define "loki.writeLabels" -}}
|
||||
{{ include "loki.labels" . }}
|
||||
app.kubernetes.io/component: write
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
write selector labels
|
||||
*/}}
|
||||
{{- define "loki.writeSelectorLabels" -}}
|
||||
{{ include "loki.selectorLabels" . }}
|
||||
app.kubernetes.io/component: write
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
write priority class name
|
||||
*/}}
|
||||
{{- define "loki.writePriorityClassName" -}}
|
||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.write.priorityClassName -}}
|
||||
{{- if $pcn }}
|
||||
priorityClassName: {{ $pcn }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
51
opencloud/charts/loki/templates/write/hpa.yaml
Normal file
51
opencloud/charts/loki/templates/write/hpa.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
|
||||
{{- $autoscalingv2 := .Capabilities.APIVersions.Has "autoscaling/v2" -}}
|
||||
{{- if and $isSimpleScalable ( .Values.write.autoscaling.enabled ) }}
|
||||
{{- if $autoscalingv2 }}
|
||||
apiVersion: autoscaling/v2
|
||||
{{- else }}
|
||||
apiVersion: autoscaling/v2beta1
|
||||
{{- end }}
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "loki.writeFullname" . }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
labels:
|
||||
{{- include "loki.writeLabels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
name: {{ include "loki.writeFullname" . }}
|
||||
minReplicas: {{ .Values.write.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.write.autoscaling.maxReplicas }}
|
||||
{{- with .Values.write.autoscaling.behavior }}
|
||||
behavior:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
metrics:
|
||||
{{- with .Values.write.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
{{- if $autoscalingv2 }}
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ . }}
|
||||
{{- else }}
|
||||
targetAverageUtilization: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.write.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.write.replicas) 1) }}
|
||||
apiVersion: policy/v1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ include "loki.writeFullname" . }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
labels:
|
||||
{{- include "loki.writeLabels" . | nindent 4 }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "loki.writeSelectorLabels" . | 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.writeFullname" . }}-headless
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
labels:
|
||||
{{- include "loki.writeSelectorLabels" . | nindent 4 }}
|
||||
{{- with .Values.loki.serviceLabels }}
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
{{- with .Values.write.service.labels }}
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
variant: headless
|
||||
prometheus.io/service-monitor: "false"
|
||||
annotations:
|
||||
{{- with .Values.loki.serviceAnnotations }}
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
{{- with .Values.write.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.writeSelectorLabels" . | nindent 4 }}
|
||||
{{- end }}
|
||||
37
opencloud/charts/loki/templates/write/service-write.yaml
Normal file
37
opencloud/charts/loki/templates/write/service-write.yaml
Normal file
@@ -0,0 +1,37 @@
|
||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
|
||||
{{- if $isSimpleScalable }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "loki.writeFullname" . }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
labels:
|
||||
{{- include "loki.writeLabels" . | nindent 4 }}
|
||||
{{- with .Values.loki.serviceLabels }}
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
{{- with .Values.write.service.labels }}
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- with .Values.loki.serviceAnnotations }}
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
{{- with .Values.write.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.writeSelectorLabels" . | nindent 4 }}
|
||||
{{- end }}
|
||||
217
opencloud/charts/loki/templates/write/statefulset-write.yaml
Normal file
217
opencloud/charts/loki/templates/write/statefulset-write.yaml
Normal file
@@ -0,0 +1,217 @@
|
||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
|
||||
{{- if $isSimpleScalable }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "loki.writeFullname" . }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
labels:
|
||||
{{- include "loki.writeLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/part-of: memberlist
|
||||
{{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.backend.annotations))}}
|
||||
annotations:
|
||||
{{- with .Values.loki.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.write.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if not .Values.write.autoscaling.enabled }}
|
||||
{{- if eq .Values.deploymentMode "SingleBinary" }}
|
||||
replicas: 0
|
||||
{{- else }}
|
||||
replicas: {{ .Values.write.replicas }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
podManagementPolicy: {{ .Values.write.podManagementPolicy }}
|
||||
updateStrategy:
|
||||
rollingUpdate:
|
||||
partition: 0
|
||||
serviceName: {{ include "loki.writeFullname" . }}-headless
|
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
|
||||
{{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.write.persistence.enableStatefulSetAutoDeletePVC) (.Values.write.persistence.volumeClaimsEnabled) }}
|
||||
{{/*
|
||||
Data on the write 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.writeSelectorLabels" . | 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.write.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "loki.writeSelectorLabels" . | nindent 8 }}
|
||||
{{- with .Values.loki.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.write.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.write.selectorLabels }}
|
||||
{{- tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/part-of: memberlist
|
||||
spec:
|
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
|
||||
{{ include "loki.enableServiceLinks" . }}
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- include "loki.writePriorityClassName" . | nindent 6 }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }}
|
||||
terminationGracePeriodSeconds: {{ .Values.write.terminationGracePeriodSeconds }}
|
||||
{{- if .Values.write.initContainers }}
|
||||
initContainers:
|
||||
{{- with .Values.write.initContainers }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: loki
|
||||
image: {{ include "loki.image" . }}
|
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
|
||||
args:
|
||||
- -config.file=/etc/loki/config/config.yaml
|
||||
- -target={{ .Values.write.targetModule }}
|
||||
{{- with .Values.write.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.write.extraEnv }}
|
||||
env:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.write.extraEnvFrom }}
|
||||
envFrom:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
|
||||
readinessProbe:
|
||||
{{- toYaml .Values.loki.readinessProbe | nindent 12 }}
|
||||
{{- if .Values.write.lifecycle }}
|
||||
lifecycle:
|
||||
{{- toYaml .Values.write.lifecycle | nindent 12 }}
|
||||
{{- else if .Values.write.autoscaling.enabled }}
|
||||
lifecycle:
|
||||
preStop:
|
||||
httpGet:
|
||||
path: "/ingester/shutdown?terminate=false"
|
||||
port: http-metrics
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/loki/config
|
||||
- name: runtime-config
|
||||
mountPath: /etc/loki/runtime-config
|
||||
- name: data
|
||||
mountPath: /var/loki
|
||||
{{- if .Values.enterprise.enabled }}
|
||||
- name: license
|
||||
mountPath: /etc/loki/license
|
||||
{{- end }}
|
||||
{{- with .Values.write.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.write.resources | nindent 12 }}
|
||||
{{- with .Values.write.extraContainers }}
|
||||
{{- toYaml . | nindent 8}}
|
||||
{{- end }}
|
||||
{{- with .Values.write.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.write.dnsConfig }}
|
||||
dnsConfig:
|
||||
{{- tpl . $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.write.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.write.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.write.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if not .Values.write.persistence.volumeClaimsEnabled }}
|
||||
- name: data
|
||||
{{- toYaml .Values.write.persistence.dataVolumeParameters | nindent 10 }}
|
||||
{{- end}}
|
||||
- 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.write.extraVolumes }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.write.persistence.volumeClaimsEnabled }}
|
||||
volumeClaimTemplates:
|
||||
- apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: data
|
||||
{{- with .Values.write.persistence.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
{{- with .Values.write.persistence.storageClass }}
|
||||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.write.persistence.size | quote }}
|
||||
{{- with .Values.write.persistence.selector }}
|
||||
selector:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.write.extraVolumeClaimTemplates }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user