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