mirror of https://github.com/grafana/loki
feat!: update helm chart to support distributed mode and 3.0 (#12067)
Signed-off-by: Edward Welch <edward.welch@grafana.com> Co-authored-by: Trevor Whitney <trevorjwhitney@gmail.com> Co-authored-by: Dylan Guedes <djmgguedes@gmail.com> Co-authored-by: J Stickler <julie.stickler@grafana.com>pull/12522/head^2 helm-loki-6.0.0
parent
1c5a736641
commit
79b876b65d
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,89 @@ |
||||
--- |
||||
title: Upgrade the Helm chart to 6.0 |
||||
menuTitle: Upgrade the Helm chart to 6.0 |
||||
description: Upgrade the Helm chart from 5.x to 6.0. |
||||
weight: 800 |
||||
keywords: |
||||
- upgrade |
||||
--- |
||||
|
||||
## Upgrading to v6.x |
||||
|
||||
v6.x of this chart introduces distributed mode but also introduces breaking changes from v5x. |
||||
|
||||
### Changes |
||||
|
||||
#### BREAKING: `deploymentMode` setting |
||||
|
||||
This only breaks you if you are running the chart in Single Binary mode, you will need to set |
||||
|
||||
``` |
||||
deploymentMode: SingleBinary |
||||
``` |
||||
|
||||
#### BREAKING: `lokiCanary` section was moved |
||||
|
||||
This section was moved from within the `monitoring` section to the root level of the values file. |
||||
|
||||
#### BREAKING: `topologySpreadConstraints` and `podAffinity` converted to objects |
||||
|
||||
Previously they were strings which were passed through `tpl` now they are normal objects which will be added to deployments. |
||||
|
||||
Also we removed the soft constraint on zone. |
||||
|
||||
#### BREAKING: `externalConfigSecretName` was removed and replaced. |
||||
|
||||
Instead you can now provide `configObjectName` which is used by Loki components for loading the config. |
||||
|
||||
`generatedConfigObjectName` also can be used to control the name of the config object created by the chart. |
||||
|
||||
This gives greater flexibility in using the chart to still generate a config object but allowing for another process to load and mutate this config into a new object which can be loaded by Loki and `configObjectName` |
||||
|
||||
#### Monitoring |
||||
|
||||
After some consideration of how this chart works with other charts provided by Grafana, we decided to deprecate the monitoring sections of this chart and take a new approach entirely to monitoring Loki, Mimir and Tempo with the [Meta Monitoring Chart](https://github.com/grafana/meta-monitoring-chart). |
||||
|
||||
Reasons: |
||||
* There were conflicts with this chart and the Mimir chart both installing the Agent Operator. |
||||
* The Agent Operator is deprecated. |
||||
* The dependency on the Prometheus operator is not one we are able to support well. |
||||
|
||||
The [Meta Monitoring Chart](https://github.com/grafana/meta-monitoring-chart) is an improvement over the the previous approach because it allows for installing a clustered Grafana Agent which can send metrics, logs, and traces to Grafana Cloud, or letting you install a monitoring-only local installation of Loki, Mimir, Tempo, and Grafana. |
||||
|
||||
The monitoring sections of this chart still exist but are disabled by default. |
||||
|
||||
If you wish to continue using the self monitoring features you should use the following configuration, but please do note a future version of this chart will remove this capability completely: |
||||
|
||||
``` |
||||
monitoring: |
||||
enabled: true |
||||
selfMonitoring: |
||||
enabled: true |
||||
grafanaAgent: |
||||
installOperator: true |
||||
``` |
||||
|
||||
#### Memcached is included and enabled by default |
||||
|
||||
Caching is crucial to the proper operation of Loki and Memcached is now included in this chart and enabled by default for the `chunksCache` and `resultsCache`. |
||||
|
||||
If you are already running Memcached separately you can remove your existing installation and use the Memcached deployments built into this chart. |
||||
|
||||
##### Single Binary |
||||
|
||||
Memcached also deploys for the Single Binary, but this may not be desired in resource constrained environments. |
||||
|
||||
You can disable it with the following configuration: |
||||
|
||||
``` |
||||
chunksCache: |
||||
enabled: false |
||||
resultsCache: |
||||
enabled: false |
||||
``` |
||||
|
||||
With these caches disabled, Loki will return to defaults which enables an in-memory results and chunks cache, so you will still get some caching. |
||||
|
||||
#### Distributed mode |
||||
|
||||
This chart introduces the ability to run Loki in distributed, or [microservices mode](https://grafana.com/docs/loki/latest/get-started/deployment-modes/#microservices-mode). Separate instructions on how to enable this as well as how to migrate from the existing community chart will be coming shortly. |
||||
@ -0,0 +1,14 @@ |
||||
--- |
||||
loki: |
||||
commonConfig: |
||||
replication_factor: 1 |
||||
useTestSchema: true |
||||
deploymentMode: SingleBinary |
||||
singleBinary: |
||||
replicas: 1 |
||||
read: |
||||
replicas: 0 |
||||
write: |
||||
replicas: 0 |
||||
backend: |
||||
replicas: 0 |
||||
@ -0,0 +1,32 @@ |
||||
--- |
||||
loki: |
||||
commonConfig: |
||||
replication_factor: 1 |
||||
useTestSchema: true |
||||
deploymentMode: Distributed |
||||
backend: |
||||
replicas: 0 |
||||
read: |
||||
replicas: 0 |
||||
write: |
||||
replicas: 0 |
||||
ingester: |
||||
replicas: 3 # Kind seems to be a single node for testing so the anti-affinity rules fail here with zone awareness |
||||
querier: |
||||
replicas: 1 |
||||
queryFrontend: |
||||
replicas: 1 |
||||
queryScheduler: |
||||
replicas: 1 |
||||
distributor: |
||||
replicas: 1 |
||||
compactor: |
||||
replicas: 1 |
||||
indexGateway: |
||||
replicas: 1 |
||||
bloomCompactor: |
||||
replicas: 0 |
||||
bloomGateway: |
||||
replicas: 0 |
||||
minio: |
||||
enabled: true |
||||
@ -0,0 +1,22 @@ |
||||
--- |
||||
loki: |
||||
commonConfig: |
||||
replication_factor: 1 |
||||
useTestSchema: true |
||||
read: |
||||
replicas: 1 |
||||
write: |
||||
replicas: 1 |
||||
backend: |
||||
replicas: 1 |
||||
monitoring: |
||||
enabled: true |
||||
selfMonitoring: |
||||
enabled: true |
||||
grafanaAgent: |
||||
installOperator: true |
||||
serviceMonitor: |
||||
labels: |
||||
release: "prometheus" |
||||
test: |
||||
prometheusAddress: "http://prometheus-kube-prometheus-prometheus.prometheus.svc.cluster.local.:9090" |
||||
@ -0,0 +1,70 @@ |
||||
--- |
||||
loki: |
||||
schemaConfig: |
||||
configs: |
||||
- from: 2024-04-01 |
||||
store: tsdb |
||||
object_store: s3 |
||||
schema: v13 |
||||
index: |
||||
prefix: loki_index_ |
||||
period: 24h |
||||
ingester: |
||||
chunk_encoding: snappy |
||||
tracing: |
||||
enabled: true |
||||
querier: |
||||
# Default is 4, if you have enough memory and CPU you can increase, reduce if OOMing |
||||
max_concurrent: 4 |
||||
|
||||
#gateway: |
||||
# ingress: |
||||
# enabled: true |
||||
# hosts: |
||||
# - host: FIXME |
||||
# paths: |
||||
# - path: / |
||||
# pathType: Prefix |
||||
|
||||
deploymentMode: Distributed |
||||
|
||||
ingester: |
||||
replicas: 3 |
||||
querier: |
||||
replicas: 3 |
||||
maxUnavailable: 2 |
||||
queryFrontend: |
||||
replicas: 2 |
||||
maxUnavailable: 1 |
||||
queryScheduler: |
||||
replicas: 2 |
||||
distributor: |
||||
replicas: 3 |
||||
maxUnavailable: 2 |
||||
compactor: |
||||
replicas: 1 |
||||
indexGateway: |
||||
replicas: 2 |
||||
maxUnavailable: 1 |
||||
|
||||
bloomCompactor: |
||||
replicas: 0 |
||||
bloomGateway: |
||||
replicas: 0 |
||||
|
||||
# Enable minio for storage |
||||
minio: |
||||
enabled: true |
||||
|
||||
# Zero out replica counts of other deployment modes |
||||
backend: |
||||
replicas: 0 |
||||
read: |
||||
replicas: 0 |
||||
write: |
||||
replicas: 0 |
||||
|
||||
singleBinary: |
||||
replicas: 0 |
||||
|
||||
|
||||
@ -0,0 +1,63 @@ |
||||
--- |
||||
loki: |
||||
schemaConfig: |
||||
configs: |
||||
- from: 2024-04-01 |
||||
store: tsdb |
||||
object_store: s3 |
||||
schema: v13 |
||||
index: |
||||
prefix: loki_index_ |
||||
period: 24h |
||||
ingester: |
||||
chunk_encoding: snappy |
||||
tracing: |
||||
enabled: true |
||||
querier: |
||||
# Default is 4, if you have enough memory and CPU you can increase, reduce if OOMing |
||||
max_concurrent: 4 |
||||
|
||||
#gateway: |
||||
# ingress: |
||||
# enabled: true |
||||
# hosts: |
||||
# - host: FIXME |
||||
# paths: |
||||
# - path: / |
||||
# pathType: Prefix |
||||
|
||||
deploymentMode: SimpleScalable |
||||
|
||||
backend: |
||||
replicas: 3 |
||||
read: |
||||
replicas: 3 |
||||
write: |
||||
replicas: 3 |
||||
|
||||
# Enable minio for storage |
||||
minio: |
||||
enabled: true |
||||
|
||||
# Zero out replica counts of other deployment modes |
||||
singleBinary: |
||||
replicas: 0 |
||||
|
||||
ingester: |
||||
replicas: 0 |
||||
querier: |
||||
replicas: 0 |
||||
queryFrontend: |
||||
replicas: 0 |
||||
queryScheduler: |
||||
replicas: 0 |
||||
distributor: |
||||
replicas: 0 |
||||
compactor: |
||||
replicas: 0 |
||||
indexGateway: |
||||
replicas: 0 |
||||
bloomCompactor: |
||||
replicas: 0 |
||||
bloomGateway: |
||||
replicas: 0 |
||||
@ -0,0 +1,79 @@ |
||||
--- |
||||
loki: |
||||
commonConfig: |
||||
replication_factor: 1 |
||||
schemaConfig: |
||||
configs: |
||||
- from: 2024-04-01 |
||||
store: tsdb |
||||
object_store: s3 |
||||
schema: v13 |
||||
index: |
||||
prefix: loki_index_ |
||||
period: 24h |
||||
ingester: |
||||
chunk_encoding: snappy |
||||
tracing: |
||||
enabled: true |
||||
querier: |
||||
# Default is 4, if you have enough memory and CPU you can increase, reduce if OOMing |
||||
max_concurrent: 2 |
||||
|
||||
#gateway: |
||||
# ingress: |
||||
# enabled: true |
||||
# hosts: |
||||
# - host: FIXME |
||||
# paths: |
||||
# - path: / |
||||
# pathType: Prefix |
||||
|
||||
deploymentMode: SingleBinary |
||||
singleBinary: |
||||
replicas: 1 |
||||
resources: |
||||
limits: |
||||
cpu: 3 |
||||
memory: 4Gi |
||||
requests: |
||||
cpu: 2 |
||||
memory: 2Gi |
||||
extraEnv: |
||||
# Keep a little bit lower than memory limits |
||||
- name: GOMEMLIMIT |
||||
value: 3750MiB |
||||
|
||||
chunksCache: |
||||
# default is 500MB, with limited memory keep this smaller |
||||
writebackSizeLimit: 10MB |
||||
|
||||
# Enable minio for storage |
||||
minio: |
||||
enabled: true |
||||
|
||||
# Zero out replica counts of other deployment modes |
||||
backend: |
||||
replicas: 0 |
||||
read: |
||||
replicas: 0 |
||||
write: |
||||
replicas: 0 |
||||
|
||||
ingester: |
||||
replicas: 0 |
||||
querier: |
||||
replicas: 0 |
||||
queryFrontend: |
||||
replicas: 0 |
||||
queryScheduler: |
||||
replicas: 0 |
||||
distributor: |
||||
replicas: 0 |
||||
compactor: |
||||
replicas: 0 |
||||
indexGateway: |
||||
replicas: 0 |
||||
bloomCompactor: |
||||
replicas: 0 |
||||
bloomGateway: |
||||
replicas: 0 |
||||
@ -0,0 +1,24 @@ |
||||
{{/* |
||||
adminApi fullname |
||||
*/}} |
||||
{{- define "enterprise-logs.adminApiFullname" -}} |
||||
{{ include "loki.fullname" . }}-admin-api |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
adminApi common labels |
||||
*/}} |
||||
{{- define "enterprise-logs.adminApiLabels" -}} |
||||
{{ include "loki.labels" . }} |
||||
app.kubernetes.io/component: admin-api |
||||
target: admin-api |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
adminApi selector labels |
||||
*/}} |
||||
{{- define "enterprise-logs.adminApiSelectorLabels" -}} |
||||
{{ include "loki.selectorLabels" . }} |
||||
app.kubernetes.io/component: admin-api |
||||
target: admin-api |
||||
{{- end }} |
||||
@ -0,0 +1,168 @@ |
||||
{{- if .Values.enterprise.enabled }} |
||||
apiVersion: apps/v1 |
||||
kind: Deployment |
||||
metadata: |
||||
name: {{ template "enterprise-logs.adminApiFullname" . }} |
||||
labels: |
||||
{{- include "enterprise-logs.adminApiLabels" . | nindent 4 }} |
||||
{{- with .Values.adminApi.labels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
annotations: |
||||
{{- with .Values.adminApi.annotations }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
replicas: {{ .Values.adminApi.replicas }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "enterprise-logs.adminApiSelectorLabels" . | nindent 6 }} |
||||
strategy: |
||||
{{- toYaml .Values.adminApi.strategy | nindent 4 }} |
||||
template: |
||||
metadata: |
||||
labels: |
||||
{{- include "enterprise-logs.adminApiSelectorLabels" . | nindent 8 }} |
||||
{{- with .Values.adminApi.labels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
annotations: |
||||
{{- if .Values.useExternalConfig }} |
||||
checksum/config: {{ .Values.externalConfigVersion }} |
||||
{{- else }} |
||||
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} |
||||
{{- end}} |
||||
{{- with .Values.adminApi.annotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
serviceAccountName: {{ template "loki.serviceAccountName" . }} |
||||
{{- if .Values.adminApi.priorityClassName }} |
||||
priorityClassName: {{ .Values.adminApi.priorityClassName }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml .Values.adminApi.podSecurityContext | nindent 8 }} |
||||
initContainers: |
||||
# Taken from |
||||
# https://github.com/minio/charts/blob/a5c84bcbad884728bff5c9c23541f936d57a13b3/minio/templates/post-install-create-bucket-job.yaml |
||||
{{- if .Values.minio.enabled }} |
||||
- name: minio-mc |
||||
image: "{{ .Values.minio.mcImage.repository }}:{{ .Values.minio.mcImage.tag }}" |
||||
imagePullPolicy: {{ .Values.minio.mcImage.pullPolicy }} |
||||
command: ["/bin/sh", "/config/initialize"] |
||||
env: |
||||
- name: MINIO_ENDPOINT |
||||
value: {{ .Release.Name }}-minio |
||||
- name: MINIO_PORT |
||||
value: {{ .Values.minio.service.port | quote }} |
||||
volumeMounts: |
||||
- name: minio-configuration |
||||
mountPath: /config |
||||
{{- if .Values.minio.tls.enabled }} |
||||
- name: cert-secret-volume-mc |
||||
mountPath: {{ .Values.minio.configPathmc }}certs |
||||
{{ end }} |
||||
{{- end }} |
||||
{{- if .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- range .Values.imagePullSecrets }} |
||||
- name: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- with .Values.adminApi.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: admin-api |
||||
image: "{{ template "loki.image" . }}" |
||||
imagePullPolicy: {{ .Values.enterprise.image.pullPolicy }} |
||||
args: |
||||
- -target=admin-api |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
{{- if .Values.minio.enabled }} |
||||
- -admin.client.backend-type=s3 |
||||
- -admin.client.s3.endpoint={{ template "loki.minio" . }} |
||||
- -admin.client.s3.bucket-name=enterprise-logs-admin |
||||
- -admin.client.s3.access-key-id={{ .Values.minio.accessKey }} |
||||
- -admin.client.s3.secret-access-key={{ .Values.minio.secretKey }} |
||||
- -admin.client.s3.insecure=true |
||||
{{- end }} |
||||
{{- range $key, $value := .Values.adminApi.extraArgs }} |
||||
- "-{{ $key }}={{ $value }}" |
||||
{{- end }} |
||||
volumeMounts: |
||||
- name: config |
||||
mountPath: /etc/loki/config |
||||
- name: license |
||||
mountPath: /etc/loki/license |
||||
- name: storage |
||||
mountPath: /data |
||||
{{- if .Values.adminApi.extraVolumeMounts }} |
||||
{{ toYaml .Values.adminApi.extraVolumeMounts | nindent 12 }} |
||||
{{- end }} |
||||
ports: |
||||
- name: http-metrics |
||||
containerPort: 3100 |
||||
protocol: TCP |
||||
- name: grpc |
||||
containerPort: 9095 |
||||
protocol: TCP |
||||
- name: http-memberlist |
||||
containerPort: 7946 |
||||
protocol: TCP |
||||
readinessProbe: |
||||
{{- toYaml .Values.adminApi.readinessProbe | nindent 12 }} |
||||
resources: |
||||
{{- toYaml .Values.adminApi.resources | nindent 12 }} |
||||
securityContext: |
||||
{{- toYaml .Values.adminApi.containerSecurityContext | nindent 12 }} |
||||
env: |
||||
{{- if .Values.adminApi.env }} |
||||
{{ toYaml .Values.adminApi.env | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.adminApi.extraContainers }} |
||||
{{ toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
nodeSelector: |
||||
{{- toYaml .Values.adminApi.nodeSelector | nindent 8 }} |
||||
affinity: |
||||
{{- toYaml .Values.adminApi.affinity | nindent 8 }} |
||||
tolerations: |
||||
{{- toYaml .Values.adminApi.tolerations | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.adminApi.terminationGracePeriodSeconds }} |
||||
volumes: |
||||
- name: config |
||||
{{- include "loki.configVolume" . | nindent 10 }} |
||||
- name: license |
||||
secret: |
||||
{{- if .Values.enterprise.useExternalLicense }} |
||||
secretName: {{ .Values.enterprise.externalLicenseName }} |
||||
{{- else }} |
||||
secretName: enterprise-logs-license |
||||
{{- end }} |
||||
- name: storage |
||||
emptyDir: {} |
||||
{{- if .Values.adminApi.extraVolumes }} |
||||
{{ toYaml .Values.adminApi.extraVolumes | nindent 8 }} |
||||
{{- end }} |
||||
{{- if .Values.minio.enabled }} |
||||
- name: minio-configuration |
||||
projected: |
||||
sources: |
||||
- configMap: |
||||
name: {{ .Release.Name }}-minio |
||||
- secret: |
||||
name: {{ .Release.Name }}-minio |
||||
{{- if .Values.minio.tls.enabled }} |
||||
- name: cert-secret-volume-mc |
||||
secret: |
||||
secretName: {{ .Values.minio.tls.certSecret }} |
||||
items: |
||||
- key: {{ .Values.minio.tls.publicCrt }} |
||||
path: CAs/public.crt |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,28 @@ |
||||
{{- if .Values.enterprise.enabled }} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ template "enterprise-logs.adminApiFullname" . }} |
||||
labels: |
||||
{{- include "enterprise-logs.adminApiLabels" . | nindent 4 }} |
||||
{{- with .Values.adminApi.service.labels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
annotations: |
||||
{{- with .Values.adminApi.service.annotations }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
type: ClusterIP |
||||
ports: |
||||
- name: http-metrics |
||||
port: 3100 |
||||
protocol: TCP |
||||
targetPort: http-metrics |
||||
- name: grpc |
||||
port: 9095 |
||||
protocol: TCP |
||||
targetPort: grpc |
||||
selector: |
||||
{{- include "enterprise-logs.adminApiSelectorLabels" . | nindent 4 }} |
||||
{{- end }} |
||||
@ -0,0 +1,58 @@ |
||||
{{/* |
||||
bloom compactor fullname |
||||
*/}} |
||||
{{- define "loki.bloomCompactorFullname" -}} |
||||
{{ include "loki.fullname" . }}-bloom-compactor |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
bloom compactor common labels |
||||
*/}} |
||||
{{- define "loki.bloomCompactorLabels" -}} |
||||
{{ include "loki.labels" . }} |
||||
app.kubernetes.io/component: bloom-compactor |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
bloom compactor selector labels |
||||
*/}} |
||||
{{- define "loki.bloomCompactorSelectorLabels" -}} |
||||
{{ include "loki.selectorLabels" . }} |
||||
app.kubernetes.io/component: bloom-compactor |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
bloom compactor readinessProbe |
||||
*/}} |
||||
{{- define "loki.bloomCompactor.readinessProbe" -}} |
||||
{{- with .Values.bloomCompactor.readinessProbe }} |
||||
readinessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- else }} |
||||
{{- with .Values.loki.readinessProbe }} |
||||
readinessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end -}} |
||||
|
||||
{{/* |
||||
bloom compactor priority class name |
||||
*/}} |
||||
{{- define "loki.bloomCompactorPriorityClassName" }} |
||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.bloomCompactor.priorityClassName -}} |
||||
{{- if $pcn }} |
||||
priorityClassName: {{ $pcn }} |
||||
{{- end }} |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
Create the name of the bloom compactor service account |
||||
*/}} |
||||
{{- define "loki.bloomCompactorServiceAccountName" -}} |
||||
{{- if .Values.bloomCompactor.serviceAccount.create -}} |
||||
{{ default (print (include "loki.serviceAccountName" .) "-bloom-compactor") .Values.bloomCompactor.serviceAccount.name }} |
||||
{{- else -}} |
||||
{{ default (include "loki.serviceAccountName" .) .Values.bloomCompactor.serviceAccount.name }} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
@ -0,0 +1,179 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if $isDistributed }} |
||||
{{- if (gt (int .Values.bloomCompactor.replicas) 0) -}} |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
metadata: |
||||
name: {{ include "loki.bloomCompactorFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.bloomCompactorLabels" . | nindent 4 }} |
||||
{{- with .Values.loki.annotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
replicas: {{ .Values.bloomCompactor.replicas }} |
||||
podManagementPolicy: Parallel |
||||
updateStrategy: |
||||
rollingUpdate: |
||||
partition: 0 |
||||
serviceName: {{ include "loki.bloomCompactorFullname" . }}-headless |
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.bloomCompactor.persistence.enableStatefulSetAutoDeletePVC) }} |
||||
persistentVolumeClaimRetentionPolicy: |
||||
whenDeleted: {{ .Values.bloomCompactor.persistence.whenDeleted }} |
||||
whenScaled: {{ .Values.bloomCompactor.persistence.whenScaled }} |
||||
{{- end }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.bloomCompactorSelectorLabels" . | nindent 6 }} |
||||
template: |
||||
metadata: |
||||
annotations: |
||||
{{- include "loki.config.checksum" . | nindent 8 }} |
||||
{{- with .Values.loki.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomCompactor.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
labels: |
||||
{{- include "loki.bloomCompactorSelectorLabels" . | nindent 8 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- with .Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomCompactor.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||
{{- with .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomCompactor.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- include "loki.bloomCompactorPriorityClassName" . | nindent 6 }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.bloomCompactor.terminationGracePeriodSeconds }} |
||||
{{- with .Values.bloomCompactor.initContainers }} |
||||
initContainers: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: bloom-compactor |
||||
image: {{ include "loki.image" . }} |
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||
{{- if or .Values.loki.command .Values.bloomCompactor.command }} |
||||
command: |
||||
- {{ coalesce .Values.bloomCompactor.command .Values.loki.command | quote }} |
||||
{{- end }} |
||||
args: |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
- -target=bloom-compactor |
||||
{{- with .Values.bloomCompactor.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.bloomCompactor.extraEnv }} |
||||
env: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomCompactor.extraEnvFrom }} |
||||
envFrom: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} |
||||
{{- include "loki.bloomCompactor.readinessProbe" . | nindent 10 }} |
||||
volumeMounts: |
||||
- name: temp |
||||
mountPath: /tmp |
||||
- 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.bloomCompactor.extraVolumeMounts }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomCompactor.resources }} |
||||
resources: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- if .Values.bloomCompactor.extraContainers }} |
||||
{{- toYaml .Values.bloomCompactor.extraContainers | nindent 8}} |
||||
{{- end }} |
||||
{{- with .Values.bloomCompactor.affinity }} |
||||
affinity: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomCompactor.nodeSelector }} |
||||
nodeSelector: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
volumes: |
||||
- name: temp |
||||
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 }} |
||||
{{- if not .Values.bloomCompactor.persistence.enabled }} |
||||
- name: data |
||||
emptyDir: {} |
||||
{{- end }} |
||||
{{- with .Values.bloomCompactor.extraVolumes }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- if .Values.bloomCompactor.persistence.enabled }} |
||||
volumeClaimTemplates: |
||||
{{- range .Values.bloomCompactor.persistence.claims }} |
||||
- metadata: |
||||
name: {{ .name }} |
||||
{{- with .annotations }} |
||||
annotations: |
||||
{{- . | toYaml | nindent 10 }} |
||||
{{- end }} |
||||
spec: |
||||
accessModes: |
||||
- ReadWriteOnce |
||||
{{- with .storageClass }} |
||||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} |
||||
{{- end }} |
||||
resources: |
||||
requests: |
||||
storage: {{ .size | quote }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
@ -0,0 +1,58 @@ |
||||
{{/* |
||||
bloom gateway fullname |
||||
*/}} |
||||
{{- define "loki.bloomGatewayFullname" -}} |
||||
{{ include "loki.fullname" . }}-bloom-gateway |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
bloom gateway common labels |
||||
*/}} |
||||
{{- define "loki.bloomGatewayLabels" -}} |
||||
{{ include "loki.labels" . }} |
||||
app.kubernetes.io/component: bloom-gateway |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
bloom gateway selector labels |
||||
*/}} |
||||
{{- define "loki.bloomGatewaySelectorLabels" -}} |
||||
{{ include "loki.selectorLabels" . }} |
||||
app.kubernetes.io/component: bloom-gateway |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
bloom gateway readinessProbe |
||||
*/}} |
||||
{{- define "loki.bloomGateway.readinessProbe" -}} |
||||
{{- with .Values.bloomGateway.readinessProbe }} |
||||
readinessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- else }} |
||||
{{- with .Values.loki.readinessProbe }} |
||||
readinessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end -}} |
||||
|
||||
{{/* |
||||
bloom gateway priority class name |
||||
*/}} |
||||
{{- define "loki.bloomGatewayPriorityClassName" }} |
||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.bloomGateway.priorityClassName -}} |
||||
{{- if $pcn }} |
||||
priorityClassName: {{ $pcn }} |
||||
{{- end }} |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
Create the name of the bloom gateway service account |
||||
*/}} |
||||
{{- define "loki.bloomGatewayServiceAccountName" -}} |
||||
{{- if .Values.bloomGateway.serviceAccount.create -}} |
||||
{{ default (print (include "loki.serviceAccountName" .) "-bloom-gateway") .Values.bloomGateway.serviceAccount.name }} |
||||
{{- else -}} |
||||
{{ default (include "loki.serviceAccountName" .) .Values.bloomGateway.serviceAccount.name }} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
@ -0,0 +1,179 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if $isDistributed }} |
||||
{{- if (gt (int .Values.bloomGateway.replicas) 0) -}} |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
metadata: |
||||
name: {{ include "loki.bloomGatewayFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.bloomGatewayLabels" . | nindent 4 }} |
||||
{{- with .Values.loki.annotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
replicas: {{ .Values.bloomGateway.replicas }} |
||||
podManagementPolicy: Parallel |
||||
updateStrategy: |
||||
rollingUpdate: |
||||
partition: 0 |
||||
serviceName: {{ include "loki.bloomGatewayFullname" . }}-headless |
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.bloomGateway.persistence.enableStatefulSetAutoDeletePVC) }} |
||||
persistentVolumeClaimRetentionPolicy: |
||||
whenDeleted: {{ .Values.bloomGateway.persistence.whenDeleted }} |
||||
whenScaled: {{ .Values.bloomGateway.persistence.whenScaled }} |
||||
{{- end }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.bloomGatewaySelectorLabels" . | nindent 6 }} |
||||
template: |
||||
metadata: |
||||
annotations: |
||||
{{- include "loki.config.checksum" . | nindent 8 }} |
||||
{{- with .Values.loki.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomGateway.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
labels: |
||||
{{- include "loki.bloomGatewaySelectorLabels" . | nindent 8 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- with .Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomGateway.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||
{{- with .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomGateway.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- include "loki.bloomGatewayPriorityClassName" . | nindent 6 }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.bloomGateway.terminationGracePeriodSeconds }} |
||||
{{- with .Values.bloomGateway.initContainers }} |
||||
initContainers: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: bloom-gateway |
||||
image: {{ include "loki.image" . }} |
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||
{{- if or .Values.loki.command .Values.bloomGateway.command }} |
||||
command: |
||||
- {{ coalesce .Values.bloomGateway.command .Values.loki.command | quote }} |
||||
{{- end }} |
||||
args: |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
- -target=bloom-gateway |
||||
{{- with .Values.bloomGateway.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.bloomGateway.extraEnv }} |
||||
env: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomGateway.extraEnvFrom }} |
||||
envFrom: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} |
||||
{{- include "loki.bloomGateway.readinessProbe" . | nindent 10 }} |
||||
volumeMounts: |
||||
- name: temp |
||||
mountPath: /tmp |
||||
- 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.bloomGateway.extraVolumeMounts }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomGateway.resources }} |
||||
resources: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- if .Values.bloomGateway.extraContainers }} |
||||
{{- toYaml .Values.bloomGateway.extraContainers | nindent 8}} |
||||
{{- end }} |
||||
{{- with .Values.bloomGateway.affinity }} |
||||
affinity: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.bloomGateway.nodeSelector }} |
||||
nodeSelector: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
volumes: |
||||
- name: temp |
||||
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 }} |
||||
{{- if not .Values.bloomGateway.persistence.enabled }} |
||||
- name: data |
||||
emptyDir: {} |
||||
{{- end }} |
||||
{{- with .Values.bloomGateway.extraVolumes }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- if .Values.bloomGateway.persistence.enabled }} |
||||
volumeClaimTemplates: |
||||
{{- range .Values.bloomGateway.persistence.claims }} |
||||
- metadata: |
||||
name: {{ .name }} |
||||
{{- with .annotations }} |
||||
annotations: |
||||
{{- . | toYaml | nindent 10 }} |
||||
{{- end }} |
||||
spec: |
||||
accessModes: |
||||
- ReadWriteOnce |
||||
{{- with .storageClass }} |
||||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} |
||||
{{- end }} |
||||
resources: |
||||
requests: |
||||
storage: {{ .size | quote }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
@ -0,0 +1,16 @@ |
||||
{{- if .Values.chunksCache.enabled }} |
||||
apiVersion: {{ include "loki.pdb.apiVersion" . }} |
||||
kind: PodDisruptionBudget |
||||
metadata: |
||||
name: {{ include "loki.fullname" . }}-memcached-chunks-cache |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.selectorLabels" . | nindent 4 }} |
||||
app.kubernetes.io/component: memcached-chunks-cache |
||||
spec: |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.selectorLabels" . | nindent 6 }} |
||||
app.kubernetes.io/component: memcached-chunks-cache |
||||
maxUnavailable: 1 |
||||
{{- end -}} |
||||
@ -0,0 +1 @@ |
||||
{{- include "loki.memcached.service" (dict "ctx" $ "valuesSection" "chunksCache" "component" "chunks-cache" ) }} |
||||
@ -0,0 +1 @@ |
||||
{{- include "loki.memcached.statefulSet" (dict "ctx" $ "valuesSection" "chunksCache" "component" "chunks-cache" ) }} |
||||
@ -0,0 +1,81 @@ |
||||
{{/* |
||||
compactor fullname |
||||
*/}} |
||||
{{- define "loki.compactorFullname" -}} |
||||
{{ include "loki.fullname" . }}-compactor |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
compactor common labels |
||||
*/}} |
||||
{{- define "loki.compactorLabels" -}} |
||||
{{ include "loki.labels" . }} |
||||
app.kubernetes.io/component: compactor |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
compactor selector labels |
||||
*/}} |
||||
{{- define "loki.compactorSelectorLabels" -}} |
||||
{{ include "loki.selectorLabels" . }} |
||||
app.kubernetes.io/component: compactor |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
compactor image |
||||
*/}} |
||||
{{- define "loki.compactorImage" -}} |
||||
{{- $dict := dict "loki" .Values.loki.image "service" .Values.compactor.image "global" .Values.global.image "defaultVersion" .Chart.AppVersion -}} |
||||
{{- include "loki.lokiImage" $dict -}} |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
compactor readinessProbe |
||||
*/}} |
||||
{{- define "loki.compactor.readinessProbe" -}} |
||||
{{- with .Values.compactor.readinessProbe }} |
||||
readinessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- else }} |
||||
{{- with .Values.loki.readinessProbe }} |
||||
readinessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end -}} |
||||
|
||||
{{/* |
||||
compactor livenessProbe |
||||
*/}} |
||||
{{- define "loki.compactor.livenessProbe" -}} |
||||
{{- with .Values.compactor.livenessProbe }} |
||||
livenessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- else }} |
||||
{{- with .Values.loki.livenessProbe }} |
||||
livenessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end -}} |
||||
|
||||
{{/* |
||||
compactor priority class name |
||||
*/}} |
||||
{{- define "loki.compactorPriorityClassName" }} |
||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.compactor.priorityClassName -}} |
||||
{{- if $pcn }} |
||||
priorityClassName: {{ $pcn }} |
||||
{{- end }} |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
Create the name of the compactor service account |
||||
*/}} |
||||
{{- define "loki.compactorServiceAccountName" -}} |
||||
{{- if .Values.compactor.serviceAccount.create -}} |
||||
{{ default (print (include "loki.serviceAccountName" .) "-compactor") .Values.compactor.serviceAccount.name }} |
||||
{{- else -}} |
||||
{{ default (include "loki.serviceAccountName" .) .Values.compactor.serviceAccount.name }} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
@ -0,0 +1,35 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if $isDistributed }} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ include "loki.compactorFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.labels" . | nindent 4 }} |
||||
{{- with .Values.compactor.serviceLabels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
app.kubernetes.io/component: compactor |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- 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.compactor.appProtocol.grpc }} |
||||
appProtocol: {{ .Values.compactor.appProtocol.grpc }} |
||||
{{- end }} |
||||
selector: |
||||
{{- include "loki.selectorLabels" . | nindent 4 }} |
||||
app.kubernetes.io/component: compactor |
||||
{{- end }} |
||||
@ -0,0 +1,193 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if $isDistributed }} |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
metadata: |
||||
name: {{ include "loki.compactorFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.compactorLabels" . | nindent 4 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- with .Values.loki.annotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
replicas: {{ .Values.compactor.replicas }} |
||||
podManagementPolicy: Parallel |
||||
updateStrategy: |
||||
rollingUpdate: |
||||
partition: 0 |
||||
serviceName: {{ include "loki.compactorFullname" . }}-headless |
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.compactor.persistence.enableStatefulSetAutoDeletePVC) }} |
||||
persistentVolumeClaimRetentionPolicy: |
||||
whenDeleted: {{ .Values.compactor.persistence.whenDeleted }} |
||||
whenScaled: {{ .Values.compactor.persistence.whenScaled }} |
||||
{{- end }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.compactorSelectorLabels" . | nindent 6 }} |
||||
template: |
||||
metadata: |
||||
annotations: |
||||
{{- include "loki.config.checksum" . | nindent 8 }} |
||||
{{- with .Values.loki.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.compactor.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
labels: |
||||
{{- include "loki.compactorSelectorLabels" . | nindent 8 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- with .Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.compactor.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} |
||||
{{- with .Values.compactor.topologySpreadConstraints }} |
||||
topologySpreadConstraints: |
||||
{{- tpl . $ | nindent 8 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||
{{- with .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.compactor.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- include "loki.compactorPriorityClassName" . | nindent 6 }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.compactor.terminationGracePeriodSeconds }} |
||||
{{- with .Values.compactor.initContainers }} |
||||
initContainers: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: compactor |
||||
image: {{ include "loki.image" . }} |
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||
{{- if or .Values.loki.command .Values.compactor.command }} |
||||
command: |
||||
- {{ coalesce .Values.compactor.command .Values.loki.command | quote }} |
||||
{{- end }} |
||||
args: |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
- -target=compactor |
||||
{{- with .Values.compactor.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.compactor.extraEnv }} |
||||
env: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.compactor.extraEnvFrom }} |
||||
envFrom: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} |
||||
{{- include "loki.compactor.readinessProbe" . | nindent 10 }} |
||||
{{- include "loki.compactor.livenessProbe" . | nindent 10 }} |
||||
volumeMounts: |
||||
- name: temp |
||||
mountPath: /tmp |
||||
- 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.compactor.extraVolumeMounts }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.compactor.resources }} |
||||
resources: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.compactor.lifecycle }} |
||||
lifecycle: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- if .Values.compactor.extraContainers }} |
||||
{{- toYaml .Values.compactor.extraContainers | nindent 8}} |
||||
{{- end }} |
||||
{{- with .Values.compactor.affinity }} |
||||
affinity: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.compactor.nodeSelector }} |
||||
nodeSelector: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.compactor.tolerations }} |
||||
tolerations: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
volumes: |
||||
- name: temp |
||||
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 }} |
||||
{{- if not .Values.compactor.persistence.enabled }} |
||||
- name: data |
||||
emptyDir: {} |
||||
{{- end }} |
||||
{{- with .Values.compactor.extraVolumes }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- if .Values.compactor.persistence.enabled }} |
||||
volumeClaimTemplates: |
||||
{{- range .Values.compactor.persistence.claims }} |
||||
- metadata: |
||||
name: {{ .name }} |
||||
{{- with .annotations }} |
||||
annotations: |
||||
{{- . | toYaml | nindent 10 }} |
||||
{{- end }} |
||||
spec: |
||||
accessModes: |
||||
- ReadWriteOnce |
||||
{{- with .storageClass }} |
||||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} |
||||
{{- end }} |
||||
resources: |
||||
requests: |
||||
storage: {{ .size | quote }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -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,152 @@ |
||||
{{- $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: |
||||
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 -}} |
||||
@ -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,36 @@ |
||||
{{- $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" |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- 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,33 @@ |
||||
{{- $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 }} |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- 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 -}} |
||||
@ -0,0 +1,132 @@ |
||||
{{- if and .Values.gateway.enabled .Values.enterprise.enabled .Values.enterprise.gelGateway }} |
||||
apiVersion: apps/v1 |
||||
kind: Deployment |
||||
metadata: |
||||
name: {{ template "loki.gatewayFullname" . }} |
||||
labels: |
||||
{{- include "loki.gatewayLabels" . | nindent 4 }} |
||||
{{- with .Values.enterpriseGateway.labels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
annotations: |
||||
{{- with .Values.enterpriseGateway.annotations }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
replicas: {{ .Values.enterpriseGateway.replicas }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.gatewaySelectorLabels" . | nindent 6 }} |
||||
strategy: |
||||
{{- toYaml .Values.enterpriseGateway.strategy | nindent 4 }} |
||||
template: |
||||
metadata: |
||||
labels: |
||||
{{- include "loki.gatewaySelectorLabels" . | nindent 8 }} |
||||
{{- with .Values.enterpriseGateway.labels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
annotations: |
||||
{{- if .Values.useExternalConfig }} |
||||
checksum/config: {{ .Values.externalConfigVersion }} |
||||
{{- else }} |
||||
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} |
||||
{{- end}} |
||||
{{- with .Values.enterpriseGateway.annotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
serviceAccountName: {{ template "loki.serviceAccountName" . }} |
||||
{{- if .Values.enterpriseGateway.priorityClassName }} |
||||
priorityClassName: {{ .Values.enterpriseGateway.priorityClassName }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml .Values.enterpriseGateway.podSecurityContext | nindent 8 }} |
||||
initContainers: |
||||
{{- toYaml .Values.enterpriseGateway.initContainers | nindent 8 }} |
||||
{{- if .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- range .Values.imagePullSecrets }} |
||||
- name: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- with .Values.enterpriseGateway.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: gateway |
||||
image: "{{ template "loki.image" . }}" |
||||
imagePullPolicy: {{ .Values.enterprise.image.pullPolicy }} |
||||
args: |
||||
- -target=gateway |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
{{- if .Values.minio.enabled }} |
||||
- -admin.client.backend-type=s3 |
||||
- -admin.client.s3.endpoint={{ template "loki.minio" . }} |
||||
- -admin.client.s3.bucket-name=enterprise-logs-admin |
||||
- -admin.client.s3.access-key-id={{ .Values.minio.accessKey }} |
||||
- -admin.client.s3.secret-access-key={{ .Values.minio.secretKey }} |
||||
- -admin.client.s3.insecure=true |
||||
{{- end }} |
||||
{{- if .Values.enterpriseGateway.useDefaultProxyURLs }} |
||||
- -gateway.proxy.default.url=http://{{ template "loki.fullname" . }}-admin-api.{{ .Release.Namespace }}.svc:3100 |
||||
- -gateway.proxy.admin-api.url=http://{{ template "loki.fullname" . }}-admin-api.{{ .Release.Namespace }}.svc:3100 |
||||
- -gateway.proxy.distributor.url=dns:///{{ template "loki.fullname" . }}-distributor-headless.{{ .Release.Namespace }}.svc:9095 |
||||
- -gateway.proxy.ingester.url=http://{{ template "loki.fullname" . }}-ingester.{{ .Release.Namespace }}.svc:3100 |
||||
- -gateway.proxy.query-frontend.url=http://{{ template "loki.fullname" . }}-query-frontend.{{ .Release.Namespace }}.svc:3100 |
||||
- -gateway.proxy.ruler.url=http://{{ template "loki.fullname" . }}-ruler.{{ .Release.Namespace }}.svc:3100 |
||||
{{- end }} |
||||
{{- range $key, $value := .Values.enterpriseGateway.extraArgs }} |
||||
- "-{{ $key }}={{ $value }}" |
||||
{{- end }} |
||||
volumeMounts: |
||||
- name: config |
||||
mountPath: /etc/loki/config |
||||
- name: license |
||||
mountPath: /etc/loki/license |
||||
- name: storage |
||||
mountPath: /data |
||||
{{- if .Values.enterpriseGateway.extraVolumeMounts }} |
||||
{{ toYaml .Values.enterpriseGateway.extraVolumeMounts | nindent 12 }} |
||||
{{- end }} |
||||
ports: |
||||
- name: http-metrics |
||||
containerPort: 3100 |
||||
protocol: TCP |
||||
readinessProbe: |
||||
{{- toYaml .Values.enterpriseGateway.readinessProbe | nindent 12 }} |
||||
resources: |
||||
{{- toYaml .Values.enterpriseGateway.resources | nindent 12 }} |
||||
securityContext: |
||||
{{- toYaml .Values.enterpriseGateway.containerSecurityContext | nindent 12 }} |
||||
env: |
||||
{{- if .Values.enterpriseGateway.env }} |
||||
{{ toYaml .Values.enterpriseGateway.env | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.enterpriseGateway.extraContainers }} |
||||
{{ toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
nodeSelector: |
||||
{{- toYaml .Values.enterpriseGateway.nodeSelector | nindent 8 }} |
||||
affinity: |
||||
{{- toYaml .Values.enterpriseGateway.affinity | nindent 8 }} |
||||
tolerations: |
||||
{{- toYaml .Values.enterpriseGateway.tolerations | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.enterpriseGateway.terminationGracePeriodSeconds }} |
||||
volumes: |
||||
- name: config |
||||
{{- include "loki.configVolume" . | nindent 10 }} |
||||
- name: license |
||||
secret: |
||||
{{- if .Values.enterprise.useExternalLicense }} |
||||
secretName: {{ .Values.enterprise.externalLicenseName }} |
||||
{{- else }} |
||||
secretName: enterprise-logs-license |
||||
{{- end }} |
||||
- name: storage |
||||
emptyDir: {} |
||||
{{- if .Values.enterpriseGateway.extraVolumes }} |
||||
{{ toYaml .Values.enterpriseGateway.extraVolumes | nindent 8 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,40 @@ |
||||
{{/* |
||||
index-gateway fullname |
||||
*/}} |
||||
{{- define "loki.indexGatewayFullname" -}} |
||||
{{ include "loki.fullname" . }}-index-gateway |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
index-gateway common labels |
||||
*/}} |
||||
{{- define "loki.indexGatewayLabels" -}} |
||||
{{ include "loki.labels" . }} |
||||
app.kubernetes.io/component: index-gateway |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
index-gateway selector labels |
||||
*/}} |
||||
{{- define "loki.indexGatewaySelectorLabels" -}} |
||||
{{ include "loki.selectorLabels" . }} |
||||
app.kubernetes.io/component: index-gateway |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
index-gateway image |
||||
*/}} |
||||
{{- define "loki.indexGatewayImage" -}} |
||||
{{- $dict := dict "loki" .Values.loki.image "service" .Values.indexGateway.image "global" .Values.global.image "defaultVersion" .Chart.AppVersion -}} |
||||
{{- include "loki.lokiImage" $dict -}} |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
index-gateway priority class name |
||||
*/}} |
||||
{{- define "loki.indexGatewayPriorityClassName" -}} |
||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.indexGateway.priorityClassName -}} |
||||
{{- if $pcn }} |
||||
priorityClassName: {{ $pcn }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,20 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed (gt (int .Values.indexGateway.replicas) 1) }} |
||||
{{- if kindIs "invalid" .Values.indexGateway.maxUnavailable }} |
||||
{{- fail "`.Values.indexGateway.maxUnavailable` must be set when `.Values.indexGateway.replicas` is greater than 1." }} |
||||
{{- else }} |
||||
apiVersion: {{ include "loki.pdb.apiVersion" . }} |
||||
kind: PodDisruptionBudget |
||||
metadata: |
||||
name: {{ include "loki.indexGatewayFullname" . }} |
||||
labels: |
||||
{{- include "loki.indexGatewayLabels" . | nindent 4 }} |
||||
spec: |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.indexGatewaySelectorLabels" . | nindent 6 }} |
||||
{{- with .Values.indexGateway.maxUnavailable }} |
||||
maxUnavailable: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,27 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if $isDistributed }} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ include "loki.indexGatewayFullname" . }}-headless |
||||
labels: |
||||
{{- include "loki.indexGatewaySelectorLabels" . | nindent 4 }} |
||||
prometheus.io/service-monitor: "false" |
||||
spec: |
||||
type: ClusterIP |
||||
clusterIP: None |
||||
ports: |
||||
- name: http-metrics |
||||
port: 3100 |
||||
targetPort: http-metrics |
||||
protocol: TCP |
||||
- name: grpc |
||||
port: 9095 |
||||
targetPort: grpc |
||||
protocol: TCP |
||||
{{- with .Values.indexGateway.appProtocol.grpc }} |
||||
appProtocol: {{ . }} |
||||
{{- end }} |
||||
selector: |
||||
{{- include "loki.indexGatewaySelectorLabels" . | nindent 4 }} |
||||
{{- end }} |
||||
@ -0,0 +1,32 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if $isDistributed }} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ include "loki.indexGatewayFullname" . }} |
||||
labels: |
||||
{{- include "loki.indexGatewayLabels" . | nindent 4 }} |
||||
{{- with .Values.indexGateway.serviceLabels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- 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 |
||||
{{- with .Values.indexGateway.appProtocol.grpc }} |
||||
appProtocol: {{ . }} |
||||
{{- end }} |
||||
selector: |
||||
{{- include "loki.indexGatewaySelectorLabels" . | nindent 4 }} |
||||
{{- end }} |
||||
@ -0,0 +1,186 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if $isDistributed }} |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
metadata: |
||||
name: {{ include "loki.indexGatewayFullname" . }} |
||||
labels: |
||||
{{- include "loki.indexGatewayLabels" . | nindent 4 }} |
||||
{{- with .Values.loki.annotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
replicas: {{ .Values.indexGateway.replicas }} |
||||
updateStrategy: |
||||
rollingUpdate: |
||||
partition: 0 |
||||
serviceName: {{ include "loki.indexGatewayFullname" . }}-headless |
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.indexGateway.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: {{ .Values.indexGateway.persistence.whenDeleted }} |
||||
whenScaled: {{ .Values.indexGateway.persistence.whenScaled }} |
||||
{{- end }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.indexGatewaySelectorLabels" . | nindent 6 }} |
||||
template: |
||||
metadata: |
||||
annotations: |
||||
{{- include "loki.config.checksum" . | nindent 8 }} |
||||
{{- with .Values.loki.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.indexGateway.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
labels: |
||||
{{- include "loki.indexGatewaySelectorLabels" . | nindent 8 }} |
||||
{{- with .Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.indexGateway.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- if .Values.indexGateway.joinMemberlist }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- end }} |
||||
spec: |
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||
{{- with .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.indexGateway.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- include "loki.indexGatewayPriorityClassName" . | nindent 6 }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.indexGateway.terminationGracePeriodSeconds }} |
||||
{{- with .Values.indexGateway.initContainers }} |
||||
initContainers: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: index-gateway |
||||
image: {{ include "loki.image" . }} |
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||
args: |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
- -target=index-gateway |
||||
{{- with .Values.indexGateway.extraArgs }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
ports: |
||||
- name: http-metrics |
||||
containerPort: 3100 |
||||
protocol: TCP |
||||
- name: grpc |
||||
containerPort: 9095 |
||||
protocol: TCP |
||||
{{- if .Values.indexGateway.joinMemberlist }} |
||||
- name: http-memberlist |
||||
containerPort: 7946 |
||||
protocol: TCP |
||||
{{- end }} |
||||
{{- with .Values.indexGateway.extraEnv }} |
||||
env: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.indexGateway.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 |
||||
- name: data |
||||
mountPath: /var/loki |
||||
{{- if .Values.enterprise.enabled }} |
||||
- name: license |
||||
mountPath: /etc/loki/license |
||||
{{- end }} |
||||
{{- with .Values.indexGateway.extraVolumeMounts }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
resources: |
||||
{{- toYaml .Values.indexGateway.resources | nindent 12 }} |
||||
{{- if .Values.indexGateway.extraContainers }} |
||||
{{- toYaml .Values.indexGateway.extraContainers | nindent 8}} |
||||
{{- end }} |
||||
{{- with .Values.indexGateway.affinity }} |
||||
affinity: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.indexGateway.nodeSelector }} |
||||
nodeSelector: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.indexGateway.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.indexGateway.extraVolumes }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- if not .Values.indexGateway.persistence.enabled }} |
||||
- name: data |
||||
emptyDir: {} |
||||
{{- else if .Values.indexGateway.persistence.inMemory }} |
||||
- name: data |
||||
{{- if .Values.indexGateway.persistence.inMemory }} |
||||
emptyDir: |
||||
medium: Memory |
||||
{{- end }} |
||||
{{- if .Values.indexGateway.persistence.size }} |
||||
sizeLimit: {{ .Values.indexGateway.persistence.size }} |
||||
{{- end }} |
||||
{{- else }} |
||||
volumeClaimTemplates: |
||||
- metadata: |
||||
name: data |
||||
{{- with .Values.indexGateway.persistence.annotations }} |
||||
annotations: |
||||
{{- . | toYaml | nindent 10 }} |
||||
{{- end }} |
||||
spec: |
||||
accessModes: |
||||
- ReadWriteOnce |
||||
{{- with .Values.indexGateway.persistence.storageClass }} |
||||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} |
||||
{{- end }} |
||||
resources: |
||||
requests: |
||||
storage: {{ .Values.indexGateway.persistence.size | quote }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,74 @@ |
||||
{{/* |
||||
ingester fullname |
||||
*/}} |
||||
{{- define "loki.ingesterFullname" -}} |
||||
{{ include "loki.fullname" . }}-ingester |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
ingester common labels |
||||
*/}} |
||||
{{- define "loki.ingesterLabels" -}} |
||||
{{ include "loki.labels" . }} |
||||
app.kubernetes.io/component: ingester |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
ingester selector labels |
||||
*/}} |
||||
{{- define "loki.ingesterSelectorLabels" -}} |
||||
{{ include "loki.selectorLabels" . }} |
||||
app.kubernetes.io/component: ingester |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
ingester priority class name |
||||
*/}} |
||||
{{- define "loki.ingesterPriorityClassName" -}} |
||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.ingester.priorityClassName -}} |
||||
{{- if $pcn }} |
||||
priorityClassName: {{ $pcn }} |
||||
{{- end }} |
||||
{{- end }} |
||||
|
||||
{{- define "loki.ingester.readinessProbe" -}} |
||||
{{- with .Values.ingester.readinessProbe }} |
||||
readinessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- else }} |
||||
{{- with .Values.loki.readinessProbe }} |
||||
readinessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end -}} |
||||
|
||||
{{- define "loki.ingester.livenessProbe" -}} |
||||
{{- with .Values.ingester.livenessProbe }} |
||||
livenessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- else }} |
||||
{{- with .Values.loki.livenessProbe }} |
||||
livenessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end -}} |
||||
|
||||
{{/* |
||||
expects global context |
||||
*/}} |
||||
{{- define "loki.ingester.replicaCount" -}} |
||||
{{- ceil (divf .Values.ingester.replicas 3) -}} |
||||
{{- end -}} |
||||
|
||||
{{/* |
||||
expects a dict |
||||
{ |
||||
"replicas": replicas in a zone, |
||||
"ctx": global context |
||||
} |
||||
*/}} |
||||
{{- define "loki.ingester.maxUnavailable" -}} |
||||
{{- ceil (mulf .replicas (divf (int .ctx.Values.ingester.zoneAwareReplication.maxUnavailablePct) 100)) -}} |
||||
{{- end -}} |
||||
@ -0,0 +1,55 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed .Values.ingester.autoscaling.enabled }} |
||||
{{- $apiVersion := include "loki.hpa.apiVersion" . -}} |
||||
apiVersion: {{ $apiVersion }} |
||||
kind: HorizontalPodAutoscaler |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterLabels" . | nindent 4 }} |
||||
spec: |
||||
scaleTargetRef: |
||||
apiVersion: apps/v1 |
||||
kind: Statefulset |
||||
name: {{ include "loki.ingesterFullname" . }} |
||||
minReplicas: {{ .Values.ingester.autoscaling.minReplicas }} |
||||
maxReplicas: {{ .Values.ingester.autoscaling.maxReplicas }} |
||||
metrics: |
||||
{{- with .Values.ingester.autoscaling.targetMemoryUtilizationPercentage }} |
||||
- type: Resource |
||||
resource: |
||||
name: memory |
||||
{{- if (eq $apiVersion "autoscaling/v2") }} |
||||
target: |
||||
type: Utilization |
||||
averageUtilization: {{ . }} |
||||
{{- else }} |
||||
targetAverageUtilization: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.autoscaling.targetCPUUtilizationPercentage }} |
||||
- type: Resource |
||||
resource: |
||||
name: cpu |
||||
{{- if (eq $apiVersion "autoscaling/v2") }} |
||||
target: |
||||
type: Utilization |
||||
averageUtilization: {{ . }} |
||||
{{- else }} |
||||
targetAverageUtilization: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.autoscaling.customMetrics }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- if .Values.ingester.autoscaling.behavior.enabled }} |
||||
behavior: |
||||
{{- with .Values.ingester.autoscaling.behavior.scaleDown }} |
||||
scaleDown: {{ toYaml . | nindent 6 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.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.ingester.replicas) 1) (.Values.ingester.zoneAwareReplication.enabled) }} |
||||
{{- if kindIs "invalid" .Values.ingester.maxUnavailable }} |
||||
{{- fail "`.Values.ingester.maxUnavailable` must be set when `.Values.ingester.replicas` is greater than 1." }} |
||||
{{- else }} |
||||
apiVersion: {{ include "loki.pdb.apiVersion" . }} |
||||
kind: PodDisruptionBudget |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }}-rollout |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterLabels" . | nindent 4 }} |
||||
spec: |
||||
selector: |
||||
matchLabels: |
||||
rollout-group: ingester |
||||
{{- with .Values.ingester.maxUnavailable }} |
||||
maxUnavailable: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,27 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed (gt (int .Values.ingester.replicas) 1) (or (not .Values.ingester.zoneAwareReplication.enabled) .Values.ingester.zoneAwareReplication.migration.enabled) }} |
||||
{{- if kindIs "invalid" .Values.ingester.maxUnavailable }} |
||||
{{- fail "`.Values.ingester.maxUnavailable` must be set when `.Values.ingester.replicas` is greater than 1." }} |
||||
{{- else }} |
||||
apiVersion: {{ include "loki.pdb.apiVersion" . }} |
||||
kind: PodDisruptionBudget |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterLabels" . | nindent 4 }} |
||||
spec: |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }} |
||||
{{/* zone aware ingesters get their own pod disruption budget, ignore them here */}} |
||||
matchExpressions: |
||||
- key: rollout-group |
||||
operator: NotIn |
||||
values: |
||||
- "ingester" |
||||
{{- with .Values.ingester.maxUnavailable }} |
||||
maxUnavailable: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,32 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed (or (not .Values.ingester.zoneAwareReplication.enabled) .Values.ingester.zoneAwareReplication.migration.enabled) }} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }}-headless |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }} |
||||
prometheus.io/service-monitor: "false" |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- 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.ingester.appProtocol.grpc }} |
||||
appProtocol: {{ .Values.ingester.appProtocol.grpc }} |
||||
{{- end }} |
||||
selector: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }} |
||||
{{- end -}} |
||||
@ -0,0 +1,35 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed .Values.ingester.zoneAwareReplication.enabled }} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }}-zone-a-headless |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterLabels" . | nindent 4 }} |
||||
{{- with .Values.ingester.serviceLabels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
clusterIP: None |
||||
ports: |
||||
- name: http-metrics |
||||
port: 3100 |
||||
targetPort: http-metrics |
||||
protocol: TCP |
||||
- name: grpc |
||||
port: 9095 |
||||
targetPort: grpc |
||||
protocol: TCP |
||||
{{- if .Values.ingester.appProtocol.grpc }} |
||||
appProtocol: {{ .Values.ingester.appProtocol.grpc }} |
||||
{{- end }} |
||||
selector: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }} |
||||
name: ingester-zone-a |
||||
rollout-group: ingester |
||||
{{- end -}} |
||||
@ -0,0 +1,35 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed .Values.ingester.zoneAwareReplication.enabled }} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }}-zone-b-headless |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterLabels" . | nindent 4 }} |
||||
{{- with .Values.ingester.serviceLabels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
clusterIP: None |
||||
ports: |
||||
- name: http-metrics |
||||
port: 3100 |
||||
targetPort: http-metrics |
||||
protocol: TCP |
||||
- name: grpc |
||||
port: 9095 |
||||
targetPort: grpc |
||||
protocol: TCP |
||||
{{- if .Values.ingester.appProtocol.grpc }} |
||||
appProtocol: {{ .Values.ingester.appProtocol.grpc }} |
||||
{{- end }} |
||||
selector: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }} |
||||
name: ingester-zone-b |
||||
rollout-group: ingester |
||||
{{- end -}} |
||||
@ -0,0 +1,35 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed .Values.ingester.zoneAwareReplication.enabled }} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }}-zone-c-headless |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterLabels" . | nindent 4 }} |
||||
{{- with .Values.ingester.serviceLabels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
clusterIP: None |
||||
ports: |
||||
- name: http-metrics |
||||
port: 3100 |
||||
targetPort: http-metrics |
||||
protocol: TCP |
||||
- name: grpc |
||||
port: 9095 |
||||
targetPort: grpc |
||||
protocol: TCP |
||||
{{- if .Values.ingester.appProtocol.grpc }} |
||||
appProtocol: {{ .Values.ingester.appProtocol.grpc }} |
||||
{{- end }} |
||||
selector: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }} |
||||
name: ingester-zone-c |
||||
rollout-group: ingester |
||||
{{- end -}} |
||||
@ -0,0 +1,33 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed (or (not .Values.ingester.zoneAwareReplication.enabled) .Values.ingester.zoneAwareReplication.migration.enabled) }} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterLabels" . | nindent 4 }} |
||||
{{- with .Values.ingester.serviceLabels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- 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.ingester.appProtocol.grpc }} |
||||
appProtocol: {{ .Values.ingester.appProtocol.grpc }} |
||||
{{- end }} |
||||
selector: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }} |
||||
{{- end -}} |
||||
@ -0,0 +1,232 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed .Values.ingester.zoneAwareReplication.enabled }} |
||||
{{- $replicas := (include "loki.ingester.replicaCount" .) -}} |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }}-zone-a |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterLabels" . | nindent 4 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
rollout-group: ingester |
||||
name: ingester-zone-a |
||||
annotations: |
||||
rollout-max-unavailable: "{{ include "loki.ingester.maxUnavailable" (dict "ctx" . "replicas" $replicas)}}" |
||||
{{- with .Values.loki.annotations }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneA.annotations }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
{{- if not .Values.ingester.autoscaling.enabled }} |
||||
replicas: {{ $replicas }} |
||||
{{- end }} |
||||
podManagementPolicy: Parallel |
||||
serviceName: {{ include "loki.ingesterFullname" . }}-zone-a |
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.ingester.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: {{ .Values.ingester.persistence.whenDeleted }} |
||||
whenScaled: {{ .Values.ingester.persistence.whenScaled }} |
||||
{{- end }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }} |
||||
name: ingester-zone-a |
||||
rollout-group: ingester |
||||
updateStrategy: |
||||
type: OnDelete |
||||
template: |
||||
metadata: |
||||
annotations: |
||||
{{- include "loki.config.checksum" . | nindent 8 }} |
||||
{{- with .Values.loki.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneA.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
labels: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 8 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
name: ingester-zone-a |
||||
rollout-group: ingester |
||||
{{- with .Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} |
||||
{{- with .Values.ingester.topologySpreadConstraints }} |
||||
topologySpreadConstraints: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||
{{- with .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- include "loki.ingesterPriorityClassName" . | nindent 6 }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.ingester.terminationGracePeriodSeconds }} |
||||
{{- with .Values.ingester.initContainers }} |
||||
initContainers: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: ingester |
||||
image: {{ include "loki.image" . }} |
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||
{{- if or .Values.loki.command .Values.ingester.command }} |
||||
command: |
||||
- {{ coalesce .Values.ingester.command .Values.loki.command | quote }} |
||||
{{- end }} |
||||
args: |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
- -ingester.availability-zone=zone-a |
||||
- -ingester.unregister-on-shutdown=false |
||||
- -ingester.tokens-file-path=/var/loki/ring-tokens |
||||
- -target=ingester |
||||
{{- with .Values.ingester.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.ingester.extraEnv }} |
||||
env: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.extraEnvFrom }} |
||||
envFrom: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} |
||||
{{- include "loki.ingester.readinessProbe" . | nindent 10 }} |
||||
{{- include "loki.ingester.livenessProbe" . | nindent 10 }} |
||||
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.ingester.extraVolumeMounts }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.resources }} |
||||
resources: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.lifecycle }} |
||||
lifecycle: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- if .Values.ingester.extraContainers }} |
||||
{{- toYaml .Values.ingester.extraContainers | nindent 8}} |
||||
{{- end }} |
||||
affinity: |
||||
podAntiAffinity: |
||||
requiredDuringSchedulingIgnoredDuringExecution: |
||||
- labelSelector: |
||||
matchExpressions: |
||||
- key: rollout-group |
||||
operator: In |
||||
values: |
||||
- ingester |
||||
- key: name |
||||
operator: NotIn |
||||
values: |
||||
- ingester-zone-a |
||||
topologyKey: kubernetes.io/hostname |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneA.extraAffinity }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneA.nodeSelector }} |
||||
nodeSelector: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.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.ingester.extraVolumes }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- if not .Values.ingester.persistence.enabled }} |
||||
- name: data |
||||
emptyDir: {} |
||||
{{- else if .Values.ingester.persistence.inMemory }} |
||||
- name: data |
||||
{{- if .Values.ingester.persistence.inMemory }} |
||||
emptyDir: |
||||
medium: Memory |
||||
{{- end }} |
||||
{{- if .Values.ingester.persistence.size }} |
||||
sizeLimit: {{ .Values.ingester.persistence.size }} |
||||
{{- end }} |
||||
{{- else }} |
||||
volumeClaimTemplates: |
||||
{{- range .Values.ingester.persistence.claims }} |
||||
- metadata: |
||||
name: {{ .name }} |
||||
{{- with .annotations }} |
||||
annotations: |
||||
{{- . | toYaml | nindent 10 }} |
||||
{{- end }} |
||||
spec: |
||||
accessModes: |
||||
- ReadWriteOnce |
||||
{{- with .storageClass }} |
||||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} |
||||
{{- end }} |
||||
resources: |
||||
requests: |
||||
storage: {{ .size | quote }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,232 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed .Values.ingester.zoneAwareReplication.enabled }} |
||||
{{- $replicas := (include "loki.ingester.replicaCount" .) -}} |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }}-zone-b |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterLabels" . | nindent 4 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
rollout-group: ingester |
||||
name: ingester-zone-b |
||||
annotations: |
||||
rollout-max-unavailable: "{{ include "loki.ingester.maxUnavailable" (dict "ctx" . "replicas" $replicas)}}" |
||||
{{- with .Values.loki.annotations }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneB.annotations }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
{{- if not .Values.ingester.autoscaling.enabled }} |
||||
replicas: {{ $replicas }} |
||||
{{- end }} |
||||
podManagementPolicy: Parallel |
||||
serviceName: {{ include "loki.ingesterFullname" . }}-zone-b |
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.ingester.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: {{ .Values.ingester.persistence.whenDeleted }} |
||||
whenScaled: {{ .Values.ingester.persistence.whenScaled }} |
||||
{{- end }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }} |
||||
name: ingester-zone-b |
||||
rollout-group: ingester |
||||
updateStrategy: |
||||
type: OnDelete |
||||
template: |
||||
metadata: |
||||
annotations: |
||||
{{- include "loki.config.checksum" . | nindent 8 }} |
||||
{{- with .Values.loki.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneB.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
labels: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 8 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
name: ingester-zone-b |
||||
rollout-group: ingester |
||||
{{- with .Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} |
||||
{{- with .Values.ingester.topologySpreadConstraints }} |
||||
topologySpreadConstraints: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||
{{- with .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- include "loki.ingesterPriorityClassName" . | nindent 6 }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.ingester.terminationGracePeriodSeconds }} |
||||
{{- with .Values.ingester.initContainers }} |
||||
initContainers: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: ingester |
||||
image: {{ include "loki.image" . }} |
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||
{{- if or .Values.loki.command .Values.ingester.command }} |
||||
command: |
||||
- {{ coalesce .Values.ingester.command .Values.loki.command | quote }} |
||||
{{- end }} |
||||
args: |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
- -ingester.availability-zone=zone-b |
||||
- -ingester.unregister-on-shutdown=false |
||||
- -ingester.tokens-file-path=/var/loki/ring-tokens |
||||
- -target=ingester |
||||
{{- with .Values.ingester.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.ingester.extraEnv }} |
||||
env: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.extraEnvFrom }} |
||||
envFrom: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} |
||||
{{- include "loki.ingester.readinessProbe" . | nindent 10 }} |
||||
{{- include "loki.ingester.livenessProbe" . | nindent 10 }} |
||||
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.ingester.extraVolumeMounts }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.resources }} |
||||
resources: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.lifecycle }} |
||||
lifecycle: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- if .Values.ingester.extraContainers }} |
||||
{{- toYaml .Values.ingester.extraContainers | nindent 8}} |
||||
{{- end }} |
||||
affinity: |
||||
podAntiAffinity: |
||||
requiredDuringSchedulingIgnoredDuringExecution: |
||||
- labelSelector: |
||||
matchExpressions: |
||||
- key: rollout-group |
||||
operator: In |
||||
values: |
||||
- ingester |
||||
- key: name |
||||
operator: NotIn |
||||
values: |
||||
- ingester-zone-b |
||||
topologyKey: kubernetes.io/hostname |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneA.extraAffinity }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneA.nodeSelector }} |
||||
nodeSelector: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.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.ingester.extraVolumes }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- if not .Values.ingester.persistence.enabled }} |
||||
- name: data |
||||
emptyDir: {} |
||||
{{- else if .Values.ingester.persistence.inMemory }} |
||||
- name: data |
||||
{{- if .Values.ingester.persistence.inMemory }} |
||||
emptyDir: |
||||
medium: Memory |
||||
{{- end }} |
||||
{{- if .Values.ingester.persistence.size }} |
||||
sizeLimit: {{ .Values.ingester.persistence.size }} |
||||
{{- end }} |
||||
{{- else }} |
||||
volumeClaimTemplates: |
||||
{{- range .Values.ingester.persistence.claims }} |
||||
- metadata: |
||||
name: {{ .name }} |
||||
{{- with .annotations }} |
||||
annotations: |
||||
{{- . | toYaml | nindent 10 }} |
||||
{{- end }} |
||||
spec: |
||||
accessModes: |
||||
- ReadWriteOnce |
||||
{{- with .storageClass }} |
||||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} |
||||
{{- end }} |
||||
resources: |
||||
requests: |
||||
storage: {{ .size | quote }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,232 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed .Values.ingester.zoneAwareReplication.enabled }} |
||||
{{- $replicas := (include "loki.ingester.replicaCount" .) -}} |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }}-zone-c |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterLabels" . | nindent 4 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
rollout-group: ingester |
||||
name: ingester-zone-c |
||||
annotations: |
||||
rollout-max-unavailable: "{{ include "loki.ingester.maxUnavailable" (dict "ctx" . "replicas" $replicas)}}" |
||||
{{- with .Values.loki.annotations }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneC.annotations }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
{{- if not .Values.ingester.autoscaling.enabled }} |
||||
replicas: {{ $replicas }} |
||||
{{- end }} |
||||
podManagementPolicy: Parallel |
||||
serviceName: {{ include "loki.ingesterFullname" . }}-zone-c |
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.ingester.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: {{ .Values.ingester.persistence.whenDeleted }} |
||||
whenScaled: {{ .Values.ingester.persistence.whenScaled }} |
||||
{{- end }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }} |
||||
name: ingester-zone-c |
||||
rollout-group: ingester |
||||
updateStrategy: |
||||
type: OnDelete |
||||
template: |
||||
metadata: |
||||
annotations: |
||||
{{- include "loki.config.checksum" . | nindent 8 }} |
||||
{{- with .Values.loki.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneC.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
labels: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 8 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
name: ingester-zone-c |
||||
rollout-group: ingester |
||||
{{- with .Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} |
||||
{{- with .Values.ingester.topologySpreadConstraints }} |
||||
topologySpreadConstraints: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||
{{- with .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- include "loki.ingesterPriorityClassName" . | nindent 6 }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.ingester.terminationGracePeriodSeconds }} |
||||
{{- with .Values.ingester.initContainers }} |
||||
initContainers: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: ingester |
||||
image: {{ include "loki.image" . }} |
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||
{{- if or .Values.loki.command .Values.ingester.command }} |
||||
command: |
||||
- {{ coalesce .Values.ingester.command .Values.loki.command | quote }} |
||||
{{- end }} |
||||
args: |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
- -ingester.availability-zone=zone-c |
||||
- -ingester.unregister-on-shutdown=false |
||||
- -ingester.tokens-file-path=/var/loki/ring-tokens |
||||
- -target=ingester |
||||
{{- with .Values.ingester.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.ingester.extraEnv }} |
||||
env: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.extraEnvFrom }} |
||||
envFrom: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} |
||||
{{- include "loki.ingester.readinessProbe" . | nindent 10 }} |
||||
{{- include "loki.ingester.livenessProbe" . | nindent 10 }} |
||||
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.ingester.extraVolumeMounts }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.resources }} |
||||
resources: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.lifecycle }} |
||||
lifecycle: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- if .Values.ingester.extraContainers }} |
||||
{{- toYaml .Values.ingester.extraContainers | nindent 8}} |
||||
{{- end }} |
||||
affinity: |
||||
podAntiAffinity: |
||||
requiredDuringSchedulingIgnoredDuringExecution: |
||||
- labelSelector: |
||||
matchExpressions: |
||||
- key: rollout-group |
||||
operator: In |
||||
values: |
||||
- ingester |
||||
- key: name |
||||
operator: NotIn |
||||
values: |
||||
- ingester-zone-c |
||||
topologyKey: kubernetes.io/hostname |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneA.extraAffinity }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.zoneAwareReplication.zoneA.nodeSelector }} |
||||
nodeSelector: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.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.ingester.extraVolumes }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- if not .Values.ingester.persistence.enabled }} |
||||
- name: data |
||||
emptyDir: {} |
||||
{{- else if .Values.ingester.persistence.inMemory }} |
||||
- name: data |
||||
{{- if .Values.ingester.persistence.inMemory }} |
||||
emptyDir: |
||||
medium: Memory |
||||
{{- end }} |
||||
{{- if .Values.ingester.persistence.size }} |
||||
sizeLimit: {{ .Values.ingester.persistence.size }} |
||||
{{- end }} |
||||
{{- else }} |
||||
volumeClaimTemplates: |
||||
{{- range .Values.ingester.persistence.claims }} |
||||
- metadata: |
||||
name: {{ .name }} |
||||
{{- with .annotations }} |
||||
annotations: |
||||
{{- . | toYaml | nindent 10 }} |
||||
{{- end }} |
||||
spec: |
||||
accessModes: |
||||
- ReadWriteOnce |
||||
{{- with .storageClass }} |
||||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} |
||||
{{- end }} |
||||
resources: |
||||
requests: |
||||
storage: {{ .size | quote }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,204 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed (or (not .Values.ingester.zoneAwareReplication.enabled) .Values.ingester.zoneAwareReplication.migration.enabled) }} |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
metadata: |
||||
name: {{ include "loki.ingesterFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.ingesterLabels" . | nindent 4 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- with .Values.loki.annotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
{{- if not .Values.ingester.autoscaling.enabled }} |
||||
replicas: {{ .Values.ingester.replicas }} |
||||
{{- end }} |
||||
podManagementPolicy: Parallel |
||||
updateStrategy: |
||||
rollingUpdate: |
||||
partition: 0 |
||||
serviceName: {{ include "loki.ingesterFullname" . }}-headless |
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.ingester.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: {{ .Values.ingester.persistence.whenDeleted }} |
||||
whenScaled: {{ .Values.ingester.persistence.whenScaled }} |
||||
{{- end }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }} |
||||
template: |
||||
metadata: |
||||
annotations: |
||||
{{- include "loki.config.checksum" . | nindent 8 }} |
||||
{{- with .Values.loki.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
labels: |
||||
{{- include "loki.ingesterSelectorLabels" . | nindent 8 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- with .Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} |
||||
{{- with .Values.ingester.topologySpreadConstraints }} |
||||
topologySpreadConstraints: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||
{{- with .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- include "loki.ingesterPriorityClassName" . | nindent 6 }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.ingester.terminationGracePeriodSeconds }} |
||||
{{- with .Values.ingester.initContainers }} |
||||
initContainers: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: ingester |
||||
image: {{ include "loki.image" . }} |
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||
{{- if or .Values.loki.command .Values.ingester.command }} |
||||
command: |
||||
- {{ coalesce .Values.ingester.command .Values.loki.command | quote }} |
||||
{{- end }} |
||||
args: |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
- -ingester.ring.instance-availability-zone=zone-default |
||||
- -target=ingester |
||||
{{- with .Values.ingester.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.ingester.extraEnv }} |
||||
env: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.extraEnvFrom }} |
||||
envFrom: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} |
||||
{{- include "loki.ingester.readinessProbe" . | nindent 10 }} |
||||
{{- include "loki.ingester.livenessProbe" . | nindent 10 }} |
||||
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.ingester.extraVolumeMounts }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.resources }} |
||||
resources: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.lifecycle }} |
||||
lifecycle: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- if .Values.ingester.extraContainers }} |
||||
{{- toYaml .Values.ingester.extraContainers | nindent 8}} |
||||
{{- end }} |
||||
{{- with .Values.ingester.affinity }} |
||||
affinity: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.nodeSelector }} |
||||
nodeSelector: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ingester.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.ingester.extraVolumes }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- if not .Values.ingester.persistence.enabled }} |
||||
- name: data |
||||
emptyDir: { } |
||||
{{- else if .Values.ingester.persistence.inMemory }} |
||||
- name: data |
||||
{{- if .Values.ingester.persistence.inMemory }} |
||||
emptyDir: |
||||
medium: Memory |
||||
{{- end }} |
||||
{{- if .Values.ingester.persistence.size }} |
||||
sizeLimit: {{ .Values.ingester.persistence.size }} |
||||
{{- end }} |
||||
{{- else }} |
||||
volumeClaimTemplates: |
||||
{{- range .Values.ingester.persistence.claims }} |
||||
- metadata: |
||||
name: {{ .name }} |
||||
{{- with .annotations }} |
||||
annotations: |
||||
{{- . | toYaml | nindent 10 }} |
||||
{{- end }} |
||||
spec: |
||||
accessModes: |
||||
- ReadWriteOnce |
||||
{{- with .storageClass }} |
||||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} |
||||
{{- end }} |
||||
resources: |
||||
requests: |
||||
storage: {{ .size | quote }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,159 @@ |
||||
{{/* |
||||
memcached StatefulSet |
||||
Params: |
||||
ctx = . context |
||||
valuesSection = name of the section in values.yaml |
||||
component = name of the component |
||||
valuesSection and component are specified separately because helm prefers camelcase for naming convetion and k8s components are named with snake case. |
||||
*/}} |
||||
{{- define "loki.memcached.statefulSet" -}} |
||||
{{ with (index $.ctx.Values $.valuesSection) }} |
||||
{{- if .enabled -}} |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
metadata: |
||||
name: {{ include "loki.resourceName" (dict "ctx" $.ctx "component" $.component) }} |
||||
labels: |
||||
{{- include "loki.labels" $.ctx | nindent 4 }} |
||||
app.kubernetes.io/component: "memcached-{{ $.component }}" |
||||
name: "memcached-{{ $.component }}" |
||||
annotations: |
||||
{{- toYaml .annotations | nindent 4 }} |
||||
namespace: {{ $.ctx.Release.Namespace | quote }} |
||||
spec: |
||||
podManagementPolicy: {{ .podManagementPolicy }} |
||||
replicas: {{ .replicas }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.selectorLabels" $.ctx | nindent 6 }} |
||||
app.kubernetes.io/component: "memcached-{{ $.component }}" |
||||
name: "memcached-{{ $.component }}" |
||||
updateStrategy: |
||||
{{- toYaml .statefulStrategy | nindent 4 }} |
||||
serviceName: {{ template "loki.fullname" $.ctx }}-{{ $.component }} |
||||
|
||||
template: |
||||
metadata: |
||||
labels: |
||||
{{- include "loki.selectorLabels" $.ctx | nindent 8 }} |
||||
app.kubernetes.io/component: "memcached-{{ $.component }}" |
||||
name: "memcached-{{ $.component }}" |
||||
{{- with $.ctx.Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
annotations: |
||||
{{- with $.ctx.Values.global.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
|
||||
spec: |
||||
serviceAccountName: {{ template "loki.serviceAccountName" $.ctx }} |
||||
{{- if .priorityClassName }} |
||||
priorityClassName: {{ .priorityClassName }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml $.ctx.Values.memcached.podSecurityContext | nindent 8 }} |
||||
initContainers: |
||||
{{- toYaml .initContainers | nindent 8 }} |
||||
nodeSelector: |
||||
{{- toYaml .nodeSelector | nindent 8 }} |
||||
affinity: |
||||
{{- toYaml .affinity | nindent 8 }} |
||||
topologySpreadConstraints: |
||||
{{- toYaml .topologySpreadConstraints | nindent 8 }} |
||||
tolerations: |
||||
{{- toYaml .tolerations | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .terminationGracePeriodSeconds }} |
||||
{{- if $.ctx.Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- range $.ctx.Values.image.pullSecrets }} |
||||
- name: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- if .extraVolumes }} |
||||
volumes: |
||||
{{- toYaml .extraVolumes | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
{{- if .extraContainers }} |
||||
{{ toYaml .extraContainers | nindent 8 }} |
||||
{{- end }} |
||||
- name: memcached |
||||
{{- with $.ctx.Values.memcached.image }} |
||||
image: {{ .repository }}:{{ .tag }} |
||||
imagePullPolicy: {{ .pullPolicy }} |
||||
{{- end }} |
||||
resources: |
||||
{{- if .resources }} |
||||
{{- toYaml .resources | nindent 12 }} |
||||
{{- else }} |
||||
{{- /* Calculate requested memory as round(allocatedMemory * 1.2). But with integer built-in operators. */}} |
||||
{{- $requestMemory := div (add (mul .allocatedMemory 12) 5) 10 }} |
||||
limits: |
||||
memory: {{ $requestMemory }}Mi |
||||
requests: |
||||
cpu: 500m |
||||
memory: {{ $requestMemory }}Mi |
||||
{{- end }} |
||||
ports: |
||||
- containerPort: {{ .port }} |
||||
name: client |
||||
args: |
||||
- -m {{ .allocatedMemory }} |
||||
- --extended=modern,track_sizes{{ with .extraExtendedOptions }},{{ . }}{{ end }} |
||||
- -I {{ .maxItemMemory }}m |
||||
- -c {{ .connectionLimit }} |
||||
- -v |
||||
- -u {{ .port }} |
||||
{{- range $key, $value := .extraArgs }} |
||||
- "-{{ $key }}{{ if $value }} {{ $value }}{{ end }}" |
||||
{{- end }} |
||||
env: |
||||
{{- with $.ctx.Values.global.extraEnv }} |
||||
{{ toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
envFrom: |
||||
{{- with $.ctx.Values.global.extraEnvFrom }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml $.ctx.Values.memcached.containerSecurityContext | nindent 12 }} |
||||
{{- if .extraVolumeMounts }} |
||||
volumeMounts: |
||||
{{- toYaml .extraVolumeMounts | nindent 12 }} |
||||
{{- end }} |
||||
|
||||
{{- if $.ctx.Values.memcachedExporter.enabled }} |
||||
- name: exporter |
||||
{{- with $.ctx.Values.memcachedExporter.image }} |
||||
image: {{ .repository}}:{{ .tag }} |
||||
imagePullPolicy: {{ .pullPolicy }} |
||||
{{- end }} |
||||
ports: |
||||
- containerPort: 9150 |
||||
name: http-metrics |
||||
args: |
||||
- "--memcached.address=localhost:{{ .port }}" |
||||
- "--web.listen-address=0.0.0.0:9150" |
||||
{{- range $key, $value := $.ctx.Values.memcachedExporter.extraArgs }} |
||||
- "--{{ $key }}{{ if $value }}={{ $value }}{{ end }}" |
||||
{{- end }} |
||||
resources: |
||||
{{- toYaml $.ctx.Values.memcachedExporter.resources | nindent 12 }} |
||||
securityContext: |
||||
{{- toYaml $.ctx.Values.memcachedExporter.containerSecurityContext | nindent 12 }} |
||||
{{- if .extraVolumeMounts }} |
||||
volumeMounts: |
||||
{{- toYaml .extraVolumeMounts | nindent 12 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
|
||||
@ -0,0 +1,42 @@ |
||||
{{/* |
||||
memcached Service |
||||
Params: |
||||
ctx = . context |
||||
valuesSection = name of the section in values.yaml |
||||
component = name of the component |
||||
valuesSection and component are specified separately because helm prefers camelcase for naming convetion and k8s components are named with snake case. |
||||
*/}} |
||||
{{- define "loki.memcached.service" -}} |
||||
{{ with (index $.ctx.Values $.valuesSection) }} |
||||
{{- if .enabled -}} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ include "loki.resourceName" (dict "ctx" $.ctx "component" $.component) }} |
||||
labels: |
||||
{{- include "loki.labels" $.ctx | nindent 4 }} |
||||
app.kubernetes.io/component: "memcached-{{ $.component }}" |
||||
{{- with .service.labels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
annotations: |
||||
{{- toYaml .service.annotations | nindent 4 }} |
||||
namespace: {{ $.ctx.Release.Namespace | quote }} |
||||
spec: |
||||
type: ClusterIP |
||||
clusterIP: None |
||||
ports: |
||||
- name: memcached-client |
||||
port: {{ .port }} |
||||
targetPort: {{ .port }} |
||||
{{ if $.ctx.Values.memcachedExporter.enabled -}} |
||||
- name: http-metrics |
||||
port: 9150 |
||||
targetPort: 9150 |
||||
{{ end }} |
||||
selector: |
||||
{{- include "loki.selectorLabels" $.ctx | nindent 4 }} |
||||
app.kubernetes.io/component: "memcached-{{ $.component }}" |
||||
{{- end -}} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
@ -0,0 +1,58 @@ |
||||
{{/* |
||||
pattern ingester fullname |
||||
*/}} |
||||
{{- define "loki.patternIngesterFullname" -}} |
||||
{{ include "loki.fullname" . }}-pattern-ingester |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
pattern ingester common labels |
||||
*/}} |
||||
{{- define "loki.patternIngesterLabels" -}} |
||||
{{ include "loki.labels" . }} |
||||
app.kubernetes.io/component: pattern-ingester |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
pattern ingester selector labels |
||||
*/}} |
||||
{{- define "loki.patternIngesterSelectorLabels" -}} |
||||
{{ include "loki.selectorLabels" . }} |
||||
app.kubernetes.io/component: pattern-ingester |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
pattern ingester readinessProbe |
||||
*/}} |
||||
{{- define "loki.patternIngester.readinessProbe" -}} |
||||
{{- with .Values.patternIngester.readinessProbe }} |
||||
readinessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- else }} |
||||
{{- with .Values.loki.readinessProbe }} |
||||
readinessProbe: |
||||
{{- toYaml . | nindent 2 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end -}} |
||||
|
||||
{{/* |
||||
pattern ingester priority class name |
||||
*/}} |
||||
{{- define "loki.patternIngesterPriorityClassName" }} |
||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.patternIngester.priorityClassName -}} |
||||
{{- if $pcn }} |
||||
priorityClassName: {{ $pcn }} |
||||
{{- end }} |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
Create the name of the pattern ingester service account |
||||
*/}} |
||||
{{- define "loki.patternIngesterServiceAccountName" -}} |
||||
{{- if .Values.patternIngester.serviceAccount.create -}} |
||||
{{ default (print (include "loki.serviceAccountName" .) "-pattern-ingester") .Values.patternIngester.serviceAccount.name }} |
||||
{{- else -}} |
||||
{{ default (include "loki.serviceAccountName" .) .Values.patternIngester.serviceAccount.name }} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
@ -0,0 +1,179 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if $isDistributed }} |
||||
{{- if (gt (int .Values.patternIngester.replicas) 0) -}} |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
metadata: |
||||
name: {{ include "loki.patternIngesterFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.patternIngesterLabels" . | nindent 4 }} |
||||
{{- with .Values.loki.annotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
replicas: {{ .Values.patternIngester.replicas }} |
||||
podManagementPolicy: Parallel |
||||
updateStrategy: |
||||
rollingUpdate: |
||||
partition: 0 |
||||
serviceName: {{ include "loki.patternIngesterFullname" . }}-headless |
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.patternIngester.persistence.enableStatefulSetAutoDeletePVC) }} |
||||
persistentVolumeClaimRetentionPolicy: |
||||
whenDeleted: {{ .Values.patternIngester.persistence.whenDeleted }} |
||||
whenScaled: {{ .Values.patternIngester.persistence.whenScaled }} |
||||
{{- end }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.patternIngesterSelectorLabels" . | nindent 6 }} |
||||
template: |
||||
metadata: |
||||
annotations: |
||||
{{- include "loki.config.checksum" . | nindent 8 }} |
||||
{{- with .Values.loki.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.patternIngester.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
labels: |
||||
{{- include "loki.patternIngesterSelectorLabels" . | nindent 8 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- with .Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.patternIngester.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||
{{- with .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.patternIngester.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- include "loki.patternIngesterPriorityClassName" . | nindent 6 }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.patternIngester.terminationGracePeriodSeconds }} |
||||
{{- with .Values.patternIngester.initContainers }} |
||||
initContainers: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: pattern-ingester |
||||
image: {{ include "loki.image" . }} |
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||
{{- if or .Values.loki.command .Values.patternIngester.command }} |
||||
command: |
||||
- {{ coalesce .Values.patternIngester.command .Values.loki.command | quote }} |
||||
{{- end }} |
||||
args: |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
- -target=pattern-ingester |
||||
{{- with .Values.patternIngester.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.patternIngester.extraEnv }} |
||||
env: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.patternIngester.extraEnvFrom }} |
||||
envFrom: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} |
||||
{{- include "loki.patternIngester.readinessProbe" . | nindent 10 }} |
||||
volumeMounts: |
||||
- name: temp |
||||
mountPath: /tmp |
||||
- 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.patternIngester.extraVolumeMounts }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.patternIngester.resources }} |
||||
resources: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- if .Values.patternIngester.extraContainers }} |
||||
{{- toYaml .Values.patternIngester.extraContainers | nindent 8}} |
||||
{{- end }} |
||||
{{- with .Values.patternIngester.affinity }} |
||||
affinity: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.patternIngester.nodeSelector }} |
||||
nodeSelector: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
volumes: |
||||
- name: temp |
||||
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 }} |
||||
{{- if not .Values.patternIngester.persistence.enabled }} |
||||
- name: data |
||||
emptyDir: {} |
||||
{{- end }} |
||||
{{- with .Values.patternIngester.extraVolumes }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- if .Values.patternIngester.persistence.enabled }} |
||||
volumeClaimTemplates: |
||||
{{- range .Values.patternIngester.persistence.claims }} |
||||
- metadata: |
||||
name: {{ .name }} |
||||
{{- with .annotations }} |
||||
annotations: |
||||
{{- . | toYaml | nindent 10 }} |
||||
{{- end }} |
||||
spec: |
||||
accessModes: |
||||
- ReadWriteOnce |
||||
{{- with .storageClass }} |
||||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} |
||||
{{- end }} |
||||
resources: |
||||
requests: |
||||
storage: {{ .size | quote }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
@ -0,0 +1,32 @@ |
||||
{{/* |
||||
querier fullname |
||||
*/}} |
||||
{{- define "loki.querierFullname" -}} |
||||
{{ include "loki.fullname" . }}-querier |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
querier common labels |
||||
*/}} |
||||
{{- define "loki.querierLabels" -}} |
||||
{{ include "loki.labels" . }} |
||||
app.kubernetes.io/component: querier |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
querier selector labels |
||||
*/}} |
||||
{{- define "loki.querierSelectorLabels" -}} |
||||
{{ include "loki.selectorLabels" . }} |
||||
app.kubernetes.io/component: querier |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
querier priority class name |
||||
*/}} |
||||
{{- define "loki.querierPriorityClassName" -}} |
||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.querier.priorityClassName -}} |
||||
{{- if $pcn }} |
||||
priorityClassName: {{ $pcn }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,166 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if $isDistributed }} |
||||
apiVersion: apps/v1 |
||||
kind: Deployment |
||||
metadata: |
||||
name: {{ include "loki.querierFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.querierLabels" . | nindent 4 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- with .Values.loki.annotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
{{- if not .Values.querier.autoscaling.enabled }} |
||||
replicas: {{ .Values.querier.replicas }} |
||||
{{- end }} |
||||
strategy: |
||||
rollingUpdate: |
||||
maxSurge: {{ .Values.querier.maxSurge }} |
||||
maxUnavailable: 1 |
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.querierSelectorLabels" . | nindent 6 }} |
||||
template: |
||||
metadata: |
||||
annotations: |
||||
{{- include "loki.config.checksum" . | nindent 8 }} |
||||
{{- with .Values.loki.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.querier.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
labels: |
||||
{{- include "loki.querierSelectorLabels" . | nindent 8 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- with .Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.querier.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} |
||||
{{- with .Values.querier.topologySpreadConstraints }} |
||||
topologySpreadConstraints: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||
{{- with .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.querier.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- include "loki.querierPriorityClassName" . | nindent 6 }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.querier.terminationGracePeriodSeconds }} |
||||
{{- with .Values.querier.initContainers }} |
||||
initContainers: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: querier |
||||
image: {{ include "loki.image" . }} |
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||
args: |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
- -target=querier |
||||
{{- if .Values.ingester.zoneAwareReplication.enabled }} |
||||
{{- if and (.Values.ingester.zoneAwareReplication.migration.enabled) (not .Values.ingester.zoneAwareReplication.migration.readPath) }} |
||||
- -distributor.zone-awareness-enabled=false |
||||
{{- else }} |
||||
- -distributor.zone-awareness-enabled=true |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- with .Values.querier.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.querier.extraEnv }} |
||||
env: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.querier.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 |
||||
- name: data |
||||
mountPath: /var/loki |
||||
{{- if .Values.enterprise.enabled }} |
||||
- name: license |
||||
mountPath: /etc/loki/license |
||||
{{- end }} |
||||
{{- with .Values.querier.extraVolumeMounts }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
resources: |
||||
{{- toYaml .Values.querier.resources | nindent 12 }} |
||||
{{- if .Values.querier.extraContainers }} |
||||
{{- toYaml .Values.querier.extraContainers | nindent 8}} |
||||
{{- end }} |
||||
{{- with .Values.querier.affinity }} |
||||
affinity: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.querier.nodeSelector }} |
||||
nodeSelector: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.querier.tolerations }} |
||||
tolerations: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.querier.dnsConfig }} |
||||
dnsConfig: |
||||
{{- 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 }} |
||||
- name: data |
||||
emptyDir: {} |
||||
{{- with .Values.querier.extraVolumes }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,55 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed .Values.querier.autoscaling.enabled }} |
||||
{{- $apiVersion := include "loki.hpa.apiVersion" . -}} |
||||
apiVersion: {{ $apiVersion }} |
||||
kind: HorizontalPodAutoscaler |
||||
metadata: |
||||
name: {{ include "loki.querierFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.querierLabels" . | nindent 4 }} |
||||
spec: |
||||
scaleTargetRef: |
||||
apiVersion: apps/v1 |
||||
kind: Deployment |
||||
name: {{ include "loki.querierFullname" . }} |
||||
minReplicas: {{ .Values.querier.autoscaling.minReplicas }} |
||||
maxReplicas: {{ .Values.querier.autoscaling.maxReplicas }} |
||||
metrics: |
||||
{{- with .Values.querier.autoscaling.targetMemoryUtilizationPercentage }} |
||||
- type: Resource |
||||
resource: |
||||
name: memory |
||||
{{- if (eq $apiVersion "autoscaling/v2") }} |
||||
target: |
||||
type: Utilization |
||||
averageUtilization: {{ . }} |
||||
{{- else }} |
||||
targetAverageUtilization: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- with .Values.querier.autoscaling.targetCPUUtilizationPercentage }} |
||||
- type: Resource |
||||
resource: |
||||
name: cpu |
||||
{{- if (eq $apiVersion "autoscaling/v2") }} |
||||
target: |
||||
type: Utilization |
||||
averageUtilization: {{ . }} |
||||
{{- else }} |
||||
targetAverageUtilization: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- with .Values.querier.autoscaling.customMetrics }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- if .Values.querier.autoscaling.behavior.enabled }} |
||||
behavior: |
||||
{{- with .Values.querier.autoscaling.behavior.scaleDown }} |
||||
scaleDown: {{ toYaml . | nindent 6 }} |
||||
{{- end }} |
||||
{{- with .Values.querier.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.querier.replicas) 1) }} |
||||
{{- if kindIs "invalid" .Values.querier.maxUnavailable }} |
||||
{{- fail "`.Values.querier.maxUnavailable` must be set when `.Values.querier.replicas` is greater than 1." }} |
||||
{{- else }} |
||||
apiVersion: {{ include "loki.pdb.apiVersion" . }} |
||||
kind: PodDisruptionBudget |
||||
metadata: |
||||
name: {{ include "loki.querierFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.querierLabels" . | nindent 4 }} |
||||
spec: |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.querierSelectorLabels" . | nindent 6 }} |
||||
{{- with .Values.querier.maxUnavailable }} |
||||
maxUnavailable: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,33 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if $isDistributed -}} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ include "loki.querierFullname" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.querierLabels" . | nindent 4 }} |
||||
{{- with .Values.querier.serviceLabels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- 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.querier.appProtocol.grpc }} |
||||
appProtocol: {{ .Values.querier.appProtocol.grpc }} |
||||
{{- end }} |
||||
selector: |
||||
{{- include "loki.querierSelectorLabels" . | nindent 4 }} |
||||
{{- end -}} |
||||
@ -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,142 @@ |
||||
{{- $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: |
||||
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 -}} |
||||
@ -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,43 @@ |
||||
{{- $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" |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
clusterIP: None |
||||
type: ClusterIP |
||||
publishNotReadyAddresses: true |
||||
ports: |
||||
- name: http-metrics |
||||
port: 3100 |
||||
targetPort: http |
||||
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,41 @@ |
||||
{{- $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 }} |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- 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 -}} |
||||
@ -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 }} |
||||
@ -0,0 +1,140 @@ |
||||
{{- $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: |
||||
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 }} |
||||
@ -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 }} |
||||
@ -0,0 +1,35 @@ |
||||
{{- $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 }} |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
type: ClusterIP |
||||
clusterIP: None |
||||
publishNotReadyAddresses: true |
||||
ports: |
||||
- name: http-metrics |
||||
port: 3100 |
||||
targetPort: http |
||||
protocol: TCP |
||||
- name: grpclb |
||||
port: 9095 |
||||
targetPort: grpc |
||||
protocol: TCP |
||||
{{- with .Values.queryScheduler.appProtocol.grpc }} |
||||
appProtocol: {{ . }} |
||||
{{- end }} |
||||
selector: |
||||
{{- include "loki.querySchedulerSelectorLabels" . | nindent 4 }} |
||||
{{- end }} |
||||
@ -0,0 +1,16 @@ |
||||
{{- if .Values.resultsCache.enabled }} |
||||
apiVersion: {{ include "loki.pdb.apiVersion" . }} |
||||
kind: PodDisruptionBudget |
||||
metadata: |
||||
name: {{ include "loki.fullname" . }}-memcached-results-cache |
||||
namespace: {{ .Release.Namespace }} |
||||
labels: |
||||
{{- include "loki.selectorLabels" . | nindent 4 }} |
||||
app.kubernetes.io/component: memcached-results-cache |
||||
spec: |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.selectorLabels" . | nindent 6 }} |
||||
app.kubernetes.io/component: memcached-results-cache |
||||
maxUnavailable: 1 |
||||
{{- end -}} |
||||
@ -0,0 +1 @@ |
||||
{{- include "loki.memcached.service" (dict "ctx" $ "valuesSection" "resultsCache" "component" "results-cache" ) }} |
||||
@ -0,0 +1 @@ |
||||
{{- include "loki.memcached.statefulSet" (dict "ctx" $ "valuesSection" "resultsCache" "component" "results-cache" ) }} |
||||
@ -0,0 +1,47 @@ |
||||
{{/* |
||||
ruler fullname |
||||
*/}} |
||||
{{- define "loki.rulerFullname" -}} |
||||
{{ include "loki.fullname" . }}-ruler |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
ruler common labels |
||||
*/}} |
||||
{{- define "loki.rulerLabels" -}} |
||||
{{ include "loki.labels" . }} |
||||
app.kubernetes.io/component: ruler |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
ruler selector labels |
||||
*/}} |
||||
{{- define "loki.rulerSelectorLabels" -}} |
||||
{{ include "loki.selectorLabels" . }} |
||||
app.kubernetes.io/component: ruler |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
ruler image |
||||
*/}} |
||||
{{- define "loki.rulerImage" -}} |
||||
{{- $dict := dict "loki" .Values.loki.image "service" .Values.ruler.image "global" .Values.global.image "defaultVersion" .Chart.AppVersion -}} |
||||
{{- include "loki.lokiImage" $dict -}} |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
format rules dir |
||||
*/}} |
||||
{{- define "loki.rulerRulesDirName" -}} |
||||
rules-{{ . | replace "_" "-" | trimSuffix "-" | lower }} |
||||
{{- end }} |
||||
|
||||
{{/* |
||||
ruler priority class name |
||||
*/}} |
||||
{{- define "loki.rulerPriorityClassName" -}} |
||||
{{- $pcn := coalesce .Values.global.priorityClassName .Values.ruler.priorityClassName -}} |
||||
{{- if $pcn }} |
||||
priorityClassName: {{ $pcn }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,14 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if $isDistributed }} |
||||
{{- range $dir, $files := .Values.ruler.directories }} |
||||
--- |
||||
apiVersion: v1 |
||||
kind: ConfigMap |
||||
metadata: |
||||
name: {{ include "loki.rulerFullname" $ }}-{{ include "loki.rulerRulesDirName" $dir }} |
||||
labels: |
||||
{{- include "loki.rulerLabels" $ | nindent 4 }} |
||||
data: |
||||
{{- toYaml $files | nindent 2}} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,20 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed (gt (int .Values.ruler.replicas) 1) }} |
||||
{{- if kindIs "invalid" .Values.ruler.maxUnavailable }} |
||||
{{- fail "`.Values.ruler.maxUnavailable` must be set when `.Values.ruler.replicas` is greater than 1." }} |
||||
{{- else }} |
||||
apiVersion: {{ include "loki.pdb.apiVersion" . }} |
||||
kind: PodDisruptionBudget |
||||
metadata: |
||||
name: {{ include "loki.rulerFullname" . }} |
||||
labels: |
||||
{{- include "loki.rulerLabels" . | nindent 4 }} |
||||
spec: |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.rulerSelectorLabels" . | nindent 6 }} |
||||
{{- with .Values.ruler.maxUnavailable }} |
||||
maxUnavailable: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,33 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed .Values.ruler.enabled }} |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: {{ include "loki.rulerFullname" . }} |
||||
labels: |
||||
{{- include "loki.rulerSelectorLabels" . | nindent 4 }} |
||||
{{- with .Values.ruler.serviceLabels }} |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- with .Values.loki.serviceAnnotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
type: ClusterIP |
||||
clusterIP: None |
||||
ports: |
||||
- name: http-metrics |
||||
port: 3100 |
||||
targetPort: http |
||||
protocol: TCP |
||||
- name: grpc |
||||
port: 9095 |
||||
targetPort: grpc |
||||
protocol: TCP |
||||
{{- with .Values.ruler.appProtocol.grpc }} |
||||
appProtocol: {{ . }} |
||||
{{- end }} |
||||
selector: |
||||
{{- include "loki.rulerSelectorLabels" . | nindent 4 }} |
||||
{{- end }} |
||||
@ -0,0 +1,177 @@ |
||||
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
||||
{{- if and $isDistributed .Values.ruler.enabled }} |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
metadata: |
||||
name: {{ include "loki.rulerFullname" . }} |
||||
labels: |
||||
{{- include "loki.rulerLabels" . | nindent 4 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- with .Values.loki.annotations }} |
||||
annotations: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
spec: |
||||
replicas: {{ .Values.ruler.replicas }} |
||||
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
||||
serviceName: {{ include "loki.rulerFullname" . }} |
||||
selector: |
||||
matchLabels: |
||||
{{- include "loki.rulerSelectorLabels" . | nindent 6 }} |
||||
template: |
||||
metadata: |
||||
annotations: |
||||
{{- include "loki.config.checksum" . | nindent 8 }} |
||||
{{- with .Values.loki.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ruler.podAnnotations }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
labels: |
||||
{{- include "loki.rulerSelectorLabels" . | nindent 8 }} |
||||
app.kubernetes.io/part-of: memberlist |
||||
{{- with .Values.loki.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ruler.podLabels }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
spec: |
||||
serviceAccountName: {{ include "loki.serviceAccountName" . }} |
||||
{{- with .Values.imagePullSecrets }} |
||||
imagePullSecrets: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ruler.hostAliases }} |
||||
hostAliases: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- include "loki.rulerPriorityClassName" . | nindent 6 }} |
||||
securityContext: |
||||
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
||||
terminationGracePeriodSeconds: {{ .Values.ruler.terminationGracePeriodSeconds }} |
||||
{{- with .Values.ruler.initContainers }} |
||||
initContainers: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
containers: |
||||
- name: ruler |
||||
image: {{ include "loki.image" . }} |
||||
imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
||||
args: |
||||
- -config.file=/etc/loki/config/config.yaml |
||||
- -target=ruler |
||||
{{- with .Values.ruler.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.ruler.extraEnv }} |
||||
env: |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
{{- with .Values.ruler.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: data |
||||
mountPath: /var/loki |
||||
- name: tmp |
||||
mountPath: /tmp/loki |
||||
{{- if .Values.enterprise.enabled }} |
||||
- name: license |
||||
mountPath: /etc/loki/license |
||||
{{- end }} |
||||
{{- range $dir, $_ := .Values.ruler.directories }} |
||||
- name: {{ include "loki.rulerRulesDirName" $dir }} |
||||
mountPath: /etc/loki/rules/{{ $dir }} |
||||
{{- end }} |
||||
{{- with .Values.ruler.extraVolumeMounts }} |
||||
{{- toYaml . | nindent 12 }} |
||||
{{- end }} |
||||
resources: |
||||
{{- toYaml .Values.ruler.resources | nindent 12 }} |
||||
{{- with .Values.ruler.extraContainers }} |
||||
{{- toYaml . | nindent 8}} |
||||
{{- end }} |
||||
{{- with .Values.ruler.affinity }} |
||||
affinity: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ruler.nodeSelector }} |
||||
nodeSelector: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ruler.tolerations }} |
||||
tolerations: |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- with .Values.ruler.dnsConfig }} |
||||
dnsConfig: |
||||
{{- 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 }} |
||||
{{- range $dir, $_ := .Values.ruler.directories }} |
||||
- name: {{ include "loki.rulerRulesDirName" $dir }} |
||||
configMap: |
||||
name: {{ include "loki.rulerFullname" $ }}-{{ include "loki.rulerRulesDirName" $dir }} |
||||
{{- end }} |
||||
- name: tmp |
||||
emptyDir: {} |
||||
{{- with .Values.ruler.extraVolumes }} |
||||
{{- toYaml . | nindent 8 }} |
||||
{{- end }} |
||||
{{- if not .Values.ruler.persistence.enabled }} |
||||
- name: data |
||||
emptyDir: {} |
||||
{{- else }} |
||||
volumeClaimTemplates: |
||||
- metadata: |
||||
name: data |
||||
{{- with .Values.ruler.persistence.annotations }} |
||||
annotations: |
||||
{{- . | toYaml | nindent 10 }} |
||||
{{- end }} |
||||
spec: |
||||
accessModes: |
||||
- ReadWriteOnce |
||||
{{- with .Values.ruler.persistence.storageClass }} |
||||
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} |
||||
{{- end }} |
||||
resources: |
||||
requests: |
||||
storage: {{ .Values.ruler.persistence.size | quote }} |
||||
{{- end }} |
||||
{{- end }} |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue