[bitnami/grafana-loki] feat: 🎉 Add chart (#10281)

* [bitnami/grafana-loki] feat: 🎉 Add chart

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <containers@bitnami.com>

* Fix description and add VIB pipelines

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Fix memcached issues

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Apply requested changes

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Fix metadata and README

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update bitnami-shell

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <containers@bitnami.com>

* Fix parenthesis

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* FIx incorrect common calls

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update vib-publish

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Fix reported issues

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

Co-authored-by: Bitnami Containers <containers@bitnami.com>
This commit is contained in:
Javier J. Salmerón-García
2022-05-19 16:37:59 +02:00
committed by GitHub
parent f46c3bf782
commit 55e92bf870
53 changed files with 8915 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ on: # rebuild any PRs and main branch changes
- master
paths:
- 'bitnami/wordpress/Chart.yaml'
- 'bitnami/grafana-loki/Chart.yaml'
env:
CSP_API_URL: https://console.cloud.vmware.com
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}

View File

@@ -0,0 +1,68 @@
{
"phases": {
"package": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/grafana-loki"
}
},
"actions": [
{
"action_id": "helm-package"
},
{
"action_id": "helm-lint"
}
]
},
"verify": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/grafana-loki"
},
"runtime_parameters": "ImdhdGV3YXkiOgogICJzZXJ2aWNlIjoKICAgICJwb3J0cyI6CiAgICAgICJodHRwIjogODAKICAgICJ0eXBlIjogIkxvYWRCYWxhbmNlciIK",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
"name": "S4"
}
}
},
"actions": [
{
"action_id": "trivy",
"params": {
"threshold": "CRITICAL",
"vuln_type": [
"OS"
]
}
},
{
"action_id": "health-check",
"params": {
"endpoint": "lb-grafana-loki-gateway-http",
"app_protocol": "HTTP"
}
}
]
},
"publish": {
"actions": [
{
"action_id": "helm-publish",
"params": {
"repository": {
"kind": "S3",
"url": "{VIB_ENV_S3_URL}",
"username": "{VIB_ENV_S3_USERNAME}",
"password": "{VIB_ENV_S3_PASSWORD}"
}
}
}
]
}
}
}

View File

@@ -0,0 +1,53 @@
{
"phases": {
"package": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/grafana-loki"
}
},
"actions": [
{
"action_id": "helm-package"
},
{
"action_id": "helm-lint"
}
]
},
"verify": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/grafana-loki"
},
"runtime_parameters": "ImdhdGV3YXkiOgogICJzZXJ2aWNlIjoKICAgICJwb3J0cyI6CiAgICAgICJodHRwIjogODAKICAgICJ0eXBlIjogIkxvYWRCYWxhbmNlciIK",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
"name": "S4"
}
}
},
"actions": [
{
"action_id": "trivy",
"params": {
"threshold": "CRITICAL",
"vuln_type": [
"OS"
]
}
},
{
"action_id": "health-check",
"params": {
"endpoint": "lb-grafana-loki-gateway-http",
"app_protocol": "HTTP"
}
}
]
}
}
}

View File

@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj

View File

@@ -0,0 +1,18 @@
dependencies:
- name: memcached
repository: https://charts.bitnami.com/bitnami
version: 6.0.17
- name: memcached
repository: https://charts.bitnami.com/bitnami
version: 6.0.17
- name: memcached
repository: https://charts.bitnami.com/bitnami
version: 6.0.17
- name: memcached
repository: https://charts.bitnami.com/bitnami
version: 6.0.17
- name: common
repository: https://charts.bitnami.com/bitnami
version: 1.14.0
digest: sha256:e91b58d245b77fcdb0fc30e6d96853018ce3590c66ba8745492448f93285e04e
generated: "2022-05-17T17:20:00.423599+02:00"

View File

@@ -0,0 +1,47 @@
annotations:
category: Infrastructure
apiVersion: v2
appVersion: 1.4.1
dependencies:
- condition: memcachedchunks.enabled
name: memcached
repository: https://charts.bitnami.com/bitnami
version: 6.x.x
alias: memcachedchunks
- condition: memcachedfrontend.enabled
name: memcached
repository: https://charts.bitnami.com/bitnami
version: 6.x.x
alias: memcachedfrontend
- condition: memcachedindexqueries.enabled
name: memcached
repository: https://charts.bitnami.com/bitnami
version: 6.x.x
alias: memcachedindexqueries
- condition: memcachedindexwrites.enabled
name: memcached
repository: https://charts.bitnami.com/bitnami
version: 6.x.x
alias: memcachedindexwrites
- name: common
repository: https://charts.bitnami.com/bitnami
tags:
- bitnami-common
version: 1.x.x
description: Grafana Loki is a horizontally scalable, highly available, and multi-tenant log aggregation system. It provides real-time long tailing and full persistence to object storage.
engine: gotpl
home: https://github.com/grafana/loki/
icon: https://bitnami.com/assets/stacks/grafana-loki/img/grafana-loki-stack-220x234.png
keywords:
- grafana
- tracing
- metrics
- infrastructure
maintainers:
- email: containers@bitnami.com
name: Bitnami
name: grafana-loki
sources:
- https://github.com/bitnami/bitnami-docker-grafana-loki
- https://github.com/grafana/loki/
version: 1.1.5

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,102 @@
CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}
** Please be patient while the chart is being deployed **
{{- if .Values.diagnosticMode.enabled }}
The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with:
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }}
Get the list of pods by executing:
kubectl get pods --namespace {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }}
Access the pod you want to debug by executing
kubectl exec --namespace {{ .Release.Namespace }} -ti <NAME OF THE POD> -- bash
In order to replicate the container startup execute this command:
loki -config.file=/bitnami/grafana-loki/conf/loki.yaml
{{- else }}
Installed components:
* ingester
* distributor
* querier
* query-frontend
* promtail
{{- if .Values.compactor.enabled }}
* compactor
{{- end }}
{{- if .Values.indexGateway.enabled }}
* index-gateway
{{- end }}
{{- if .Values.gateway.enabled }}
* gateway
{{- end }}
{{- if .Values.ruler.enabled }}
* ruler
{{- end }}
{{- if .Values.tableManager.enabled }}
* table-manager
{{- end }}
{{- if .Values.gateway.enabled }}
{{- if .Values.gateway.ingress.enabled }}
1. Get the gateway URL and associate the gateway hostname to your cluster external IP:
export CLUSTER_IP=$(minikube ip) # On Minikube. Use: `kubectl cluster-info` on others K8s clusters
echo "Gateway URL: http{{ if .Values.gateway.ingress.tls }}s{{ end }}://{{ .Values.gateway.ingress.hostname }}/"
echo "$CLUSTER_IP {{ .Values.gateway.ingress.hostname }}" | sudo tee -a /etc/hosts
{{- else }}
1. Get the gateway URL by running these commands:
{{- if contains "NodePort" .Values.gateway.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "grafana-loki.gateway.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.gateway.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ template "common.names.fullname" . }}
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "common.names.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.gateway.service.ports.http }}
{{- else if contains "ClusterIP" .Values.gateway.service.type }}
echo "The Gateway is available at http://127.0.0.1:{{ .Values.gateway.service.ports.http }}"
kubectl port-forward svc/{{ template "grafana-loki.gateway.fullname" . }} {{ .Values.gateway.service.ports.http }}:{{ .Values.gateway.service.ports.http }} &
{{- end }}
{{- end }}
{{- if .Values.gateway.auth.enabled }}
2. Login with the following credentials below to see your blog:
echo Username: {{ .Values.gateway.auth.username }}
echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "grafana-loki.gateway.secretName" . }} -o jsonpath="{.data.password}" | base64 --decode)
{{- end }}
{{- else }}
1. Get the query-frontend URL by running these commands:
{{- if contains "NodePort" .Values.queryFrontend.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "grafana-loki.query-frontend.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.queryFrontend.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ template "common.names.fullname" . }}
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "common.names.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.queryFrontend.service.ports.http }}
{{- else if contains "ClusterIP" .Values.queryFrontend.service.type }}
echo "The Query Frontend is available at http://127.0.0.1:{{ .Values.queryFrontend.service.ports.http }}"
kubectl port-forward svc/{{ template "grafana-loki.query-frontend.fullname" . }} {{ .Values.queryFrontend.service.ports.http }}:{{ .Values.queryFrontend.service.ports.http }} &
{{- end }}
{{- end }}
{{- end }}
{{- include "grafana-loki.checkRollingTags" . }}
{{- include "grafana-loki.validateValues" . }}

View File

@@ -0,0 +1,337 @@
{{/*
Return the proper Grafana Loki image name
*/}}
{{- define "grafana-loki.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.loki.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper Grafana Loki compactor fullname
*/}}
{{- define "grafana-loki.compactor.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "compactor" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana Loki distributor fullname
*/}}
{{- define "grafana-loki.distributor.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "distributor" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana Loki gateway fullname
*/}}
{{- define "grafana-loki.gateway.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "gateway" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana Loki index-gateway fullname
*/}}
{{- define "grafana-loki.index-gateway.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "index-gateway" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana Loki ingester fullname
*/}}
{{- define "grafana-loki.ingester.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "ingester" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana Loki querier fullname
*/}}
{{- define "grafana-loki.querier.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "querier" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana Loki query-frontend fullname
*/}}
{{- define "grafana-loki.query-frontend.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "query-frontend" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana Loki ruler fullname
*/}}
{{- define "grafana-loki.ruler.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "ruler" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana Loki table-manager fullname
*/}}
{{- define "grafana-loki.table-manager.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "table-manager" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana Loki gossip-ring fullname
*/}}
{{- define "grafana-loki.gossip-ring.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "gossip-ring" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana Loki promtail fullname
*/}}
{{- define "grafana-loki.promtail.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "promtail" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana Loki image name
*/}}
{{- define "grafana-loki.promtail.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.promtail.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper Grafana Loki image name
*/}}
{{- define "grafana-loki.volumePermissions.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.volumePermissions.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper Grafana Loki image name
*/}}
{{- define "grafana-loki.gateway.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.gateway.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "grafana-loki.imagePullSecrets" -}}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.loki.image .Values.gateway.image .Values.promtail.image .Values.volumePermissions.image) "global" .Values.global) -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "grafana-loki.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Get the Loki configuration configmap.
*/}}
{{- define "grafana-loki.loki.configmapName" -}}
{{- if .Values.loki.existingConfigmap -}}
{{- .Values.loki.existingConfigmap -}}
{{- else }}
{{- printf "%s" (include "common.names.fullname" . ) -}}
{{- end -}}
{{- end -}}
{{/*
Get the promtail configuration configmap.
*/}}
{{- define "grafana-loki.promtail.secretName" -}}
{{- if .Values.promtail.existingSecret -}}
{{- .Values.promtail.existingSecret -}}
{{- else }}
{{- include "grafana-loki.promtail.fullname" . -}}
{{- end -}}
{{- end -}}
{{/*
Get the promtail configuration configmap.
*/}}
{{- define "grafana-loki.gateway.secretName" -}}
{{- if .Values.gateway.auth.existingSecret -}}
{{- .Values.gateway.auth.existingSecret -}}
{{- else }}
{{- include "grafana-loki.gateway.fullname" . -}}
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "grafana-loki.promtail.serviceAccountName" -}}
{{- if .Values.promtail.serviceAccount.create -}}
{{ default (printf "%s" (include "common.names.fullname" .)) .Values.promtail.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.promtail.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Create a default fully qualified memcached (chunks) name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "grafana-loki.memcached-chunks.fullname" -}}
{{- $name := default "memcachedchunks" .Values.memcachedchunks.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified memcached (chunks) name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "grafana-loki.memcached-chunks.host" -}}
{{- $port := "" -}}
{{- if .Values.externalMemcachedChunks.host -}}
{{- $servicePortString := printf "%v" .Values.externalMemcachedChunks.port -}}
{{- $port = printf ":%s" $servicePortString -}}
{{- printf "%s%s" .Values.externalMemcachedChunks.host $port }}
{{- else -}}
{{- $servicePortString := printf "%v" .Values.memcachedchunks.service.ports.memcached -}}
{{- $port = printf ":%s" $servicePortString -}}
{{- printf "%s%s" (include "grafana-loki.memcached-chunks.fullname" .) $port }}
{{- end -}}
{{- end -}}
{{/*
Create a default fully qualified memcached (index-queries) name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "grafana-loki.memcached-index-queries.fullname" -}}
{{- $name := default "memcachedindexqueries" .Values.memcachedindexqueries.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified memcached (index-queries) name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "grafana-loki.memcached-index-queries.host" -}}
{{- $port := "" -}}
{{- if .Values.externalMemcachedIndexQueries.host -}}
{{- $servicePortString := printf "%v" .Values.externalMemcachedIndexQueries.port -}}
{{- $port = printf ":%s" $servicePortString -}}
{{- printf "%s%s" .Values.externalMemcachedIndexQueries.host $port }}
{{- else -}}
{{- $servicePortString := printf "%v" .Values.memcachedindexqueries.service.ports.memcached -}}
{{- $port = printf ":%s" $servicePortString -}}
{{- printf "%s%s" (include "grafana-loki.memcached-index-queries.fullname" .) $port }}
{{- end -}}
{{- end -}}
{{/*
Create a default fully qualified memcached (frontend) name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "grafana-loki.memcached-frontend.fullname" -}}
{{- $name := default "memcachedfrontend" .Values.memcachedfrontend.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified memcached (frontend) name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "grafana-loki.memcached-frontend.host" -}}
{{- $port := "" -}}
{{- if .Values.externalMemcachedFrontend.host -}}
{{- $servicePortString := printf "%v" .Values.externalMemcachedFrontend.port -}}
{{- $port = printf ":%s" $servicePortString -}}
{{- printf "%s%s" .Values.externalMemcachedFrontend.host $port }}
{{- else -}}
{{- $servicePortString := printf "%v" .Values.memcachedfrontend.service.ports.memcached -}}
{{- $port = printf ":%s" $servicePortString -}}
{{- printf "%s%s" (include "grafana-loki.memcached-frontend.fullname" .) $port }}
{{- end -}}
{{- end -}}
{{/*
Create a default fully qualified memcached (index-writes) name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "grafana-loki.memcached-index-writes.fullname" -}}
{{- $name := default "memcachedindexwrites" .Values.memcachedindexwrites.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified memcached (index-writes) name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "grafana-loki.memcached-index-writes.host" -}}
{{- $port := "" -}}
{{- if .Values.externalMemcachedIndexWrites.host -}}
{{- $servicePortString := printf "%v" .Values.externalMemcachedIndexWrites.port -}}
{{- $port = printf ":%s" $servicePortString -}}
{{- printf "%s%s" .Values.externalMemcachedIndexWrites.host $port }}
{{- else -}}
{{- $servicePortString := printf "%v" .Values.memcachedindexwrites.service.ports.memcached -}}
{{- $port = printf ":%s" $servicePortString -}}
{{- printf "%s%s" (include "grafana-loki.memcached-index-writes.fullname" .) $port }}
{{- end -}}
{{- end -}}
{{/*
Check if there are rolling tags in the images
*/}}
{{- define "grafana-loki.checkRollingTags" -}}
{{- include "common.warnings.rollingTag" .Values.loki.image }}
{{- include "common.warnings.rollingTag" .Values.promtail.image }}
{{- include "common.warnings.rollingTag" .Values.gateway.image }}
{{- include "common.warnings.rollingTag" .Values.volumePermissions.image }}
{{- end -}}
{{/*
Compile all warnings into a single message.
*/}}
{{- define "grafana-loki.validateValues" -}}
{{- $messages := list -}}
{{- $messages := append $messages (include "grafana-loki.validateValues.memcachedChunks" .) -}}
{{- $messages := append $messages (include "grafana-loki.validateValues.memcachedIndexWrites" .) -}}
{{- $messages := append $messages (include "grafana-loki.validateValues.memcachedIndexQueries" .) -}}
{{- $messages := append $messages (include "grafana-loki.validateValues.memcachedFrontend" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}
{{- if $message -}}
{{- printf "\nVALUES VALIDATION:\n%s" $message -}}
{{- end -}}
{{- end -}}
{{/* Validate values of Grafana Loki - Memcached (Chunks) */}}
{{- define "grafana-loki.validateValues.memcachedChunks" -}}
{{- if and .Values.memcachedchunks.enabled .Values.externalMemcachedChunks.host -}}
grafana-loki: Memcached Chunks
You can only use one chunk cache.
Please choose installing a Memcached chart (--set memcachedChunks.enabled=true) or
using an external database (--set externalMemcachedChunks.host)
{{- end -}}
{{- end -}}
{{/* Validate values of Grafana Loki - Memcached (IndexWrites) */}}
{{- define "grafana-loki.validateValues.memcachedIndexWrites" -}}
{{- if and .Values.memcachedindexwrites.enabled .Values.externalMemcachedIndexWrites.host -}}
grafana-loki: Memcached Index Writes
You can only use one index-write cache.
Please choose installing a Memcached chart (--set memcachedIndexWrites.enabled=true) or
using an external database (--set externalMemcachedIndexWrites.host)
{{- end -}}
{{- end -}}
{{/* Validate values of Grafana Loki - Memcached (IndexQueries) */}}
{{- define "grafana-loki.validateValues.memcachedIndexQueries" -}}
{{- if and .Values.memcachedindexqueries.enabled .Values.externalMemcachedIndexQueries.host -}}
grafana-loki: Memcached Index Queries
You can only use one chunk cache.
Please choose installing a Memcached chart (--set memcachedIndexQueries.enabled=true) or
using an external database (--set externalMemcachedIndexQueries.host)
{{- end -}}
{{- end -}}
{{/* Validate values of Grafana Loki - Memcached (Frontend) */}}
{{- define "grafana-loki.validateValues.memcachedFrontend" -}}
{{- if and .Values.memcachedfrontend.enabled .Values.externalMemcachedFrontend.host -}}
grafana-loki: Memcached Frontend
You can only use one frontend cache.
Please choose installing a Memcached chart (--set memcachedFrontend.enabled=true) or
using an external database (--set externalMemcachedFrontend.host)
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,171 @@
{{- if .Values.compactor.enabled }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "grafana-loki.compactor.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: compactor
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.compactor.replicaCount }}
{{- if .Values.compactor.updateStrategy }}
strategy: {{- toYaml .Values.compactor.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: compactor
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/loki-configmap.yaml") . | sha256sum }}
{{- if .Values.compactor.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.compactor.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: compactor
loki-gossip-member: "true"
{{- if .Values.compactor.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.compactor.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "grafana-loki.serviceAccountName" . }}
{{- include "grafana-loki.imagePullSecrets" . | nindent 6 }}
{{- if .Values.compactor.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.compactor.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.compactor.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.compactor.podAffinityPreset "component" "compactor" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.compactor.podAntiAffinityPreset "component" "compactor" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.compactor.nodeAffinityPreset.type "key" .Values.compactor.nodeAffinityPreset.key "values" .Values.compactor.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.compactor.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.compactor.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.compactor.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.compactor.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.compactor.priorityClassName }}
priorityClassName: {{ .Values.compactor.priorityClassName | quote }}
{{- end }}
{{- if .Values.compactor.schedulerName }}
schedulerName: {{ .Values.compactor.schedulerName }}
{{- end }}
{{- if .Values.compactor.podSecurityContext.enabled }}
securityContext: {{- omit .Values.compactor.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.compactor.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.compactor.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: grafana-loki-compactor
image: {{ template "grafana-loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
{{- if .Values.compactor.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.compactor.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.compactor.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.compactor.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.args "context" $) | nindent 12 }}
{{- else }}
args:
- -target=compactor
- -config.file={{ .Values.loki.dataDir }}/conf/loki.yaml
- -boltdb.shipper.compactor.working-directory={{ .Values.loki.dataDir }}/loki/compactor
{{- end }}
{{- if .Values.compactor.extraEnvVars }}
env: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.compactor.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.compactor.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.compactor.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.compactor.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- containerPort: {{ .Values.loki.containerPorts.http }}
name: http
- containerPort: {{ .Values.loki.containerPorts.gossipRing }}
name: http-memberlist
{{- if .Values.compactor.resources }}
resources: {{- toYaml .Values.compactor.resources | nindent 12 }}
{{- end }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.compactor.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.compactor.livenessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.compactor.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.compactor.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.compactor.readinessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.compactor.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.compactor.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.compactor.startupProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.compactor.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.compactor.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: loki-config
mountPath: {{ .Values.loki.dataDir }}/conf/loki.yaml
subPath: loki.yaml
- name: data
mountPath: {{ .Values.loki.dataDir }}/loki/compactor
{{- if .Values.compactor.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.compactor.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.compactor.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.compactor.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: data
{{- if .Values.compactor.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.compactor.persistence.existingClaim | default (include "grafana-loki.compactor.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end }}
- name: loki-config
configMap:
name: {{ template "grafana-loki.loki.configmapName" . }}
{{- if .Values.compactor.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.compactor.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,35 @@
{{- if and .Values.compactor.enabled .Values.compactor.persistence.enabled (not .Values.compactor.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.compactor.persistence.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.compactor.persistence.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.compactor.persistence.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
accessModes:
{{- range .Values.compactor.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.compactor.persistence.size | quote }}
{{- include "common.storage.class" (dict "persistence" .Values.compactor.persistence "global" .Values.global) | nindent 2 }}
{{- if .Values.compactor.persistence.dataSource }}
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.persistence.dataSource "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.compactor.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.persistence.selector "context" $) | nindent 4 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,58 @@
{{- if .Values.compactor.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.compactor.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: compactor
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.compactor.service.annotations }}
annotations:
{{- if .Values.compactor.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.compactor.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.compactor.service.type }}
{{- if .Values.compactor.service.sessionAffinity }}
sessionAffinity: {{ .Values.compactor.service.sessionAffinity }}
{{- end }}
{{- if .Values.compactor.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.compactor.service.clusterIP }}
clusterIP: {{ .Values.compactor.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.compactor.service.type "LoadBalancer") (eq .Values.compactor.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.compactor.service.externalTrafficPolicy | quote }}
{{- end }}
{{ if eq .Values.compactor.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.compactor.service.loadBalancerSourceRanges }}
{{ end }}
{{- if (and (eq .Values.compactor.service.type "LoadBalancer") (not (empty .Values.compactor.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.compactor.service.loadBalancerIP }}
{{- end }}
ports:
- name: http
port: {{ .Values.compactor.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.compactor.service.type "NodePort") (eq .Values.compactor.service.type "LoadBalancer")) (not (empty .Values.compactor.service.nodePorts.http))) }}
nodePort: {{ .Values.compactor.service.nodePorts.http }}
{{- else if eq .Values.compactor.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.compactor.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.compactor.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: compactor
{{- end }}

View File

@@ -0,0 +1,56 @@
{{- if and .Values.compactor.enabled .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "grafana-loki.compactor.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: compactor
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if .Values.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
{{- end }}
selector:
matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }}
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: compactor
endpoints:
- port: http
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- end }}

View File

@@ -0,0 +1,163 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "grafana-loki.distributor.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: distributor
loki-gossip-member: "true"
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.distributor.replicaCount }}
{{- if .Values.distributor.updateStrategy }}
strategy: {{- toYaml .Values.distributor.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: distributor
loki-gossip-member: "true"
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/loki-configmap.yaml") . | sha256sum }}
{{- if .Values.distributor.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.distributor.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: distributor
loki-gossip-member: "true"
{{- if .Values.distributor.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.distributor.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "grafana-loki.serviceAccountName" . }}
{{- include "grafana-loki.imagePullSecrets" . | nindent 6 }}
{{- if .Values.distributor.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.distributor.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.distributor.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.distributor.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.distributor.podAffinityPreset "component" "distributor" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.distributor.podAntiAffinityPreset "component" "distributor" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.distributor.nodeAffinityPreset.type "key" .Values.distributor.nodeAffinityPreset.key "values" .Values.distributor.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.distributor.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.distributor.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.distributor.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.distributor.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.distributor.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.distributor.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.distributor.priorityClassName }}
priorityClassName: {{ .Values.distributor.priorityClassName | quote }}
{{- end }}
{{- if .Values.distributor.schedulerName }}
schedulerName: {{ .Values.distributor.schedulerName }}
{{- end }}
{{- if .Values.distributor.podSecurityContext.enabled }}
securityContext: {{- omit .Values.distributor.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.distributor.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.distributor.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: grafana-loki-distributor
image: {{ template "grafana-loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
{{- if .Values.distributor.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.distributor.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.distributor.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.distributor.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.distributor.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.distributor.args "context" $) | nindent 12 }}
{{- else }}
args:
- -target=distributor
- -config.file={{ .Values.loki.dataDir }}/conf/loki.yaml
{{- end }}
{{- if .Values.distributor.extraEnvVars }}
env: {{- include "common.tplvalues.render" (dict "value" .Values.distributor.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.distributor.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.distributor.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.distributor.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.distributor.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- containerPort: {{ .Values.loki.containerPorts.http }}
name: http
- containerPort: {{ .Values.loki.containerPorts.gossipRing }}
name: http-memberlist
- containerPort: {{ .Values.loki.containerPorts.grpc }}
name: grpc
{{- if .Values.distributor.resources }}
resources: {{- toYaml .Values.distributor.resources | nindent 12 }}
{{- end }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.distributor.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.distributor.livenessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.distributor.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.distributor.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.distributor.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.distributor.readinessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.distributor.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.distributor.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.distributor.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.distributor.startupProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.distributor.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.distributor.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.distributor.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.distributor.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: loki-config
mountPath: {{ .Values.loki.dataDir }}/conf/loki.yaml
subPath: loki.yaml
{{- if .Values.distributor.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.distributor.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.distributor.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.distributor.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: loki-config
configMap:
name: {{ template "grafana-loki.loki.configmapName" . }}
{{- if .Values.distributor.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.distributor.extraVolumes "context" $) | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,65 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.distributor.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: distributor
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.distributor.service.annotations }}
annotations:
{{- if .Values.distributor.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.distributor.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.distributor.service.type }}
{{- if .Values.distributor.service.sessionAffinity }}
sessionAffinity: {{ .Values.distributor.service.sessionAffinity }}
{{- end }}
{{- if .Values.distributor.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.distributor.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.distributor.service.clusterIP }}
clusterIP: {{ .Values.distributor.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.distributor.service.type "LoadBalancer") (eq .Values.distributor.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.distributor.service.externalTrafficPolicy | quote }}
{{- end }}
{{ if eq .Values.distributor.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.distributor.service.loadBalancerSourceRanges }}
{{ end }}
{{- if (and (eq .Values.distributor.service.type "LoadBalancer") (not (empty .Values.distributor.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.distributor.service.loadBalancerIP }}
{{- end }}
ports:
- name: http
port: {{ .Values.distributor.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.distributor.service.type "NodePort") (eq .Values.distributor.service.type "LoadBalancer")) (not (empty .Values.distributor.service.nodePorts.http))) }}
nodePort: {{ .Values.distributor.service.nodePorts.http }}
{{- else if eq .Values.distributor.service.type "ClusterIP" }}
nodePort: null
{{- end }}
- name: grpc
port: {{ .Values.distributor.service.ports.grpc }}
protocol: TCP
targetPort: grpc
{{- if (and (or (eq .Values.distributor.service.type "NodePort") (eq .Values.distributor.service.type "LoadBalancer")) (not (empty .Values.distributor.service.nodePorts.grpc))) }}
nodePort: {{ .Values.distributor.service.nodePorts.grpc }}
{{- else if eq .Values.distributor.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.distributor.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.distributor.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: distributor

View File

@@ -0,0 +1,56 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "grafana-loki.distributor.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: distributor
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if .Values.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
{{- end }}
selector:
matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }}
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: distributor
endpoints:
- port: http
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- end }}

View File

@@ -0,0 +1,4 @@
{{- range .Values.extraDeploy }}
---
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
{{- end }}

View File

@@ -0,0 +1,109 @@
{{- if .Values.gateway.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "grafana-loki.gateway.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: gateway
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
nginx.conf: |+
worker_processes 5; ## Default: 1
error_log /dev/stderr;
pid /tmp/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096; ## Default: 1024
}
http {
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status ' '"$request" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';
include /opt/bitnami/nginx/conf/resolvers.conf;
{{- if .Values.gateway.verboseLogging }}
access_log /dev/stderr main;
{{- else }}
map $status $loggable {
~^[23] 0;
default 1;
}
access_log /dev/stderr main if=$loggable;
{{- end }}
sendfile on;
tcp_nopush on;
server {
listen 8080;
{{- if .Values.gateway.auth.enabled }}
auth_basic "Loki";
auth_basic_user_file /bitnami/nginx/secrets/.htpasswd;
{{- end }}
location = / {
return 200 'OK';
auth_basic off;
}
location = /api/prom/push {
proxy_pass http://{{ include "grafana-loki.distributor.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:3100$request_uri;
}
location = /api/prom/tail {
proxy_pass http://{{ include "grafana-loki.querier.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:3100$request_uri;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# Ruler
location ~ /prometheus/api/v1/alerts.* {
proxy_pass http://{{ include "grafana-loki.ruler.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:3100$request_uri;
}
location ~ /prometheus/api/v1/rules.* {
proxy_pass http://{{ include "grafana-loki.ruler.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:3100$request_uri;
}
location ~ /api/prom/rules.* {
proxy_pass http://{{ include "grafana-loki.ruler.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:3100$request_uri;
}
location ~ /api/prom/alerts.* {
proxy_pass http://{{ include "grafana-loki.ruler.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:3100$request_uri;
}
location ~ /api/prom/.* {
proxy_pass http://{{ include "grafana-loki.query-frontend.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:3100$request_uri;
}
location = /loki/api/v1/push {
proxy_pass http://{{ include "grafana-loki.distributor.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:3100$request_uri;
}
location = /loki/api/v1/tail {
proxy_pass http://{{ include "grafana-loki.querier.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:3100$request_uri;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~ /loki/api/.* {
proxy_pass http://{{ include "grafana-loki.query-frontend.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:3100$request_uri;
}
}
}
{{- end }}

View File

@@ -0,0 +1,178 @@
{{- if .Values.gateway.enabled }}
apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "grafana-loki.gateway.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: gateway
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.gateway.replicaCount }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: gateway
{{- if .Values.gateway.updateStrategy }}
strategy: {{- toYaml .Values.gateway.updateStrategy | nindent 4 }}
{{- end }}
template:
metadata:
labels: {{- include "common.labels.standard" . | nindent 8 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }}
{{- end }}
{{- if .Values.gateway.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.gateway.podLabels "context" $) | nindent 8 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: gateway
annotations:
checksum/configmap: {{ include (print $.Template.BasePath "/gateway/configmap-http.yaml") . | sha256sum }}
{{- if .Values.gateway.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.podAnnotations "context" $) | nindent 8 }}
{{- end }}
spec:
{{- include "grafana-loki.imagePullSecrets" . | nindent 6 }}
{{- if .Values.gateway.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.gateway.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.gateway.podAffinityPreset "component" "gateway" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.gateway.podAntiAffinityPreset "component" "gateway" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.gateway.nodeAffinityPreset.type "key" .Values.gateway.nodeAffinityPreset.key "values" .Values.gateway.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.gateway.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.gateway.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.tolerations "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.gateway.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.gateway.priorityClassName }}
priorityClassName: {{ .Values.gateway.priorityClassName | quote }}
{{- end }}
{{- if .Values.gateway.schedulerName }}
schedulerName: {{ .Values.gateway.schedulerName }}
{{- end }}
{{- if .Values.gateway.podSecurityContext.enabled }}
securityContext: {{- omit .Values.gateway.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
{{- if .Values.gateway.initContainers }}
initContainers: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: gateway
image: {{ include "grafana-loki.gateway.image" . }}
imagePullPolicy: {{ .Values.gateway.image.pullPolicy | quote }}
{{- if .Values.gateway.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.gateway.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.gateway.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.command "context" $) | nindent 12 }}
{{- else }}
command:
- /bin/bash
- -ec
- |
# Generate resolver data
echo resolver $(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf) ";" > /opt/bitnami/nginx/conf/resolvers.conf
/opt/bitnami/scripts/nginx/entrypoint.sh /opt/bitnami/scripts/nginx/run.sh
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.gateway.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.args "context" $) | nindent 12 }}
{{- end }}
env:
- name: BITNAMI_DEBUG
value: {{ ternary "true" "false" .Values.gateway.image.debug | quote }}
{{- if .Values.gateway.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.gateway.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.gateway.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.gateway.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.gateway.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.gateway.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.gateway.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
ports:
- containerPort: {{ .Values.gateway.containerPorts.http }}
name: http
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.gateway.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.gateway.startupProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.gateway.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.gateway.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.gateway.livenessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /
port: http
{{- else if .Values.gateway.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.gateway.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.gateway.readinessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /
port: http
{{- else if .Values.gateway.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.gateway.resources }}
resources: {{- toYaml .Values.gateway.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /opt/bitnami/nginx/conf/nginx.conf
subPath: nginx.conf
{{- if .Values.gateway.auth.enabled }}
- name: htpasswd
mountPath: /bitnami/nginx/secrets/
{{- end }}
{{- if .Values.gateway.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.gateway.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.gateway.sidecars }}
{{- include "common.tplvalues.render" (dict "value" .Values.gateway.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ include "grafana-loki.gateway.fullname" . }}
{{- if .Values.gateway.auth.enabled }}
- name: htpasswd
secret:
secretName: {{ include "grafana-loki.gateway.secretName" . }}
items:
- key: htpasswd
path: .htpasswd
{{- end }}
{{- if .Values.gateway.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.gateway.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,57 @@
{{- if .Values.gateway.ingress.enabled }}
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ include "grafana-loki.gateway.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.gateway.ingress.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.gateway.ingress.annotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.gateway.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
ingressClassName: {{ .Values.gateway.ingress.ingressClassName | quote }}
{{- end }}
rules:
{{- if .Values.gateway.ingress.hostname }}
- host: {{ .Values.gateway.ingress.hostname | quote }}
http:
paths:
{{- if .Values.gateway.ingress.extraPaths }}
{{- toYaml .Values.gateway.ingress.extraPaths | nindent 10 }}
{{- end }}
- path: {{ .Values.gateway.ingress.path }}
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: {{ .Values.gateway.ingress.pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" .) "servicePort" "http" "context" $) | nindent 14 }}
{{- end }}
{{- range .Values.gateway.ingress.extraHosts }}
- host: {{ .name | quote }}
http:
paths:
- path: {{ default "/" .path }}
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
pathType: {{ default "ImplementationSpecific" .pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" $) "servicePort" "http" "context" $) | nindent 14 }}
{{- end }}
{{- if or (and .Values.gateway.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.gateway.ingress.annotations )) .Values.gateway.ingress.selfSigned)) .Values.gateway.ingress.extraTls }}
tls:
{{- if and .Values.gateway.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.gateway.ingress.annotations )) .Values.gateway.ingress.selfSigned) }}
- hosts:
- {{ .Values.gateway.ingress.hostname | quote }}
secretName: {{ printf "%s-tls" .Values.gateway.ingress.hostname }}
{{- end }}
{{- if .Values.gateway.ingress.extraTls }}
{{- include "common.tplvalues.render" (dict "value" .Values.gateway.ingress.extraTls "context" $) | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,21 @@
{{- if and .Values.gateway.enabled .Values.gateway.auth.enabled (not .Values.gateway.auth.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "grafana-loki.gateway.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: gateway
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: Opaque
data:
{{- $password := (include "common.secrets.passwords.manage" (dict "secret" (include "grafana-loki.gateway.fullname" .) "key" "password" "providedValues" (list "gateway.auth.password") "context" $)) }}
password: {{ $password | quote }}
htpasswd: {{ htpasswd .Values.gateway.auth.username (b64dec $password) | b64enc | quote }}
{{- end }}

View File

@@ -0,0 +1,57 @@
{{- if .Values.gateway.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.gateway.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: gateway
annotations:
{{- if .Values.gateway.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.gateway.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.gateway.service.type }}
{{- if .Values.gateway.service.sessionAffinity }}
sessionAffinity: {{ .Values.gateway.service.sessionAffinity }}
{{- end }}
{{- if .Values.gateway.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.gateway.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if and .Values.gateway.service.clusterIP (eq .Values.gateway.service.type "ClusterIP") }}
clusterIP: {{ .Values.gateway.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.gateway.service.type "LoadBalancer") (eq .Values.gateway.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.gateway.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if (and (eq .Values.gateway.service.type "LoadBalancer") .Values.gateway.service.loadBalancerSourceRanges) }}
{{- with .Values.gateway.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if (and (eq .Values.gateway.service.type "LoadBalancer") (not (empty .Values.gateway.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.gateway.service.loadBalancerIP }}
{{- end }}
ports:
- name: http
port: {{ .Values.gateway.service.ports.http }}
targetPort: http
{{- if and (or (eq .Values.gateway.service.type "NodePort") (eq .Values.gateway.service.type "LoadBalancer")) (not (empty .Values.gateway.service.nodePorts.http)) }}
nodePort: {{ .Values.gateway.service.nodePorts.http }}
{{- else if eq .Values.gateway.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.gateway.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.gateway.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: gateway
{{- end }}

View File

@@ -0,0 +1,44 @@
{{- if .Values.gateway.ingress.enabled }}
{{- if .Values.gateway.ingress.secrets }}
{{- range .Values.gateway.ingress.secrets }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .name }}
namespace: {{ $.Release.Namespace | quote }}
labels: {{- include "common.labels.standard" $ | nindent 4 }}
{{- if $.Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if $.Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
tls.crt: {{ .certificate | b64enc }}
tls.key: {{ .key | b64enc }}
---
{{- end }}
{{- end }}
{{- if and .Values.gateway.ingress.tls .Values.gateway.ingress.selfSigned }}
{{- $ca := genCA "grafana-loki-ca" 365 }}
{{- $cert := genSignedCert .Values.gateway.ingress.hostname nil (list .Values.gateway.ingress.hostname) 365 $ca }}
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-tls" .Values.gateway.ingress.hostname }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
tls.crt: {{ $cert.Cert | b64enc | quote }}
tls.key: {{ $cert.Key | b64enc | quote }}
ca.crt: {{ $ca.Cert | b64enc | quote }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,31 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.gossip-ring.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: loki
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.loki.gossipRing.service.annotations }}
annotations:
{{- if .Values.loki.gossipRing.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.loki.gossipRing.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: ClusterIP
publishNotReadyAddresses: true
clusterIP: None
ports:
- name: http
port: {{ .Values.loki.gossipRing.service.ports.http }}
targetPort: http-memberlist
protocol: TCP
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
loki-gossip-member: "true"

View File

@@ -0,0 +1,67 @@
{{- if .Values.indexGateway.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.index-gateway.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: indexGateway
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.indexGateway.service.annotations }}
annotations:
{{- if .Values.indexGateway.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.indexGateway.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.indexGateway.service.type }}
{{- if .Values.indexGateway.service.sessionAffinity }}
sessionAffinity: {{ .Values.indexGateway.service.sessionAffinity }}
{{- end }}
{{- if .Values.indexGateway.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.indexGateway.service.clusterIP }}
clusterIP: {{ .Values.indexGateway.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.indexGateway.service.type "LoadBalancer") (eq .Values.indexGateway.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.indexGateway.service.externalTrafficPolicy | quote }}
{{- end }}
{{ if eq .Values.indexGateway.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.indexGateway.service.loadBalancerSourceRanges }}
{{ end }}
{{- if (and (eq .Values.indexGateway.service.type "LoadBalancer") (not (empty .Values.indexGateway.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.indexGateway.service.loadBalancerIP }}
{{- end }}
ports:
- name: http
port: {{ .Values.indexGateway.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.indexGateway.service.type "NodePort") (eq .Values.indexGateway.service.type "LoadBalancer")) (not (empty .Values.indexGateway.service.nodePorts.http))) }}
nodePort: {{ .Values.indexGateway.service.nodePorts.http }}
{{- else if eq .Values.indexGateway.service.type "ClusterIP" }}
nodePort: null
{{- end }}
- name: grpc
port: {{ .Values.indexGateway.service.ports.grpc }}
protocol: TCP
targetPort: grpc
{{- if (and (or (eq .Values.indexGateway.service.type "NodePort") (eq .Values.indexGateway.service.type "LoadBalancer")) (not (empty .Values.indexGateway.service.nodePorts.grpc))) }}
nodePort: {{ .Values.indexGateway.service.nodePorts.grpc }}
{{- else if eq .Values.indexGateway.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.indexGateway.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: indexGateway
{{- end }}

View File

@@ -0,0 +1,56 @@
{{- if and .Values.indexGateway.enabled .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "grafana-loki.index-gateway.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: index-gateway
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if .Values.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
{{- end }}
selector:
matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }}
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: indexGateway
endpoints:
- port: http
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- end }}

View File

@@ -0,0 +1,166 @@
{{- if .Values.indexGateway.enabled }}
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
kind: StatefulSet
metadata:
name: {{ template "grafana-loki.index-gateway.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: index-gateway
loki-gossip-member: "true"
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.indexGateway.replicaCount }}
{{- if .Values.indexGateway.updateStrategy }}
updateStrategy: {{- toYaml .Values.indexGateway.updateStrategy | nindent 4 }}
{{- end }}
podManagementPolicy: {{ .Values.indexGateway.podManagementPolicy }}
serviceName: {{ template "grafana-loki.index-gateway.fullname" . }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: index-gateway
loki-gossip-member: "true"
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/loki-configmap.yaml") . | sha256sum }}
{{- if .Values.indexGateway.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: index-gateway
loki-gossip-member: "true"
{{- if .Values.indexGateway.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "grafana-loki.serviceAccountName" . }}
{{- include "grafana-loki.imagePullSecrets" . | nindent 6 }}
{{- if .Values.indexGateway.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.indexGateway.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.indexGateway.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.indexGateway.podAffinityPreset "component" "indexGateway" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.indexGateway.podAntiAffinityPreset "component" "indexGateway" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.indexGateway.nodeAffinityPreset.type "key" .Values.indexGateway.nodeAffinityPreset.key "values" .Values.indexGateway.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.indexGateway.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.indexGateway.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.indexGateway.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.indexGateway.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.indexGateway.priorityClassName }}
priorityClassName: {{ .Values.indexGateway.priorityClassName | quote }}
{{- end }}
{{- if .Values.indexGateway.schedulerName }}
schedulerName: {{ .Values.indexGateway.schedulerName }}
{{- end }}
{{- if .Values.indexGateway.podSecurityContext.enabled }}
securityContext: {{- omit .Values.indexGateway.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.indexGateway.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: grafana-loki-index-gateway
image: {{ template "grafana-loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
{{- if .Values.indexGateway.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.indexGateway.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.indexGateway.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.indexGateway.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.args "context" $) | nindent 12 }}
{{- else }}
args:
- -target=index-gateway
- -config.file={{ .Values.loki.dataDir }}/conf/loki.yaml
{{- end }}
{{- if .Values.indexGateway.extraEnvVars }}
env: {{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.indexGateway.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.indexGateway.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.indexGateway.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.indexGateway.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- containerPort: {{ .Values.loki.containerPorts.http }}
name: http
- containerPort: {{ .Values.loki.containerPorts.grpc }}
name: grpc
{{- if .Values.indexGateway.resources }}
resources: {{- toYaml .Values.indexGateway.resources | nindent 12 }}
{{- end }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.indexGateway.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.indexGateway.livenessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.indexGateway.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.indexGateway.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.indexGateway.readinessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.indexGateway.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.indexGateway.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.indexGateway.startupProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.indexGateway.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.indexGateway.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: loki-config
mountPath: {{ .Values.loki.dataDir }}/conf/loki.yaml
subPath: loki.yaml
{{- if .Values.indexGateway.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.indexGateway.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.indexGateway.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: loki-config
configMap:
name: {{ template "grafana-loki.loki.configmapName" . }}
{{- if .Values.indexGateway.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.indexGateway.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,65 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.ingester.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ingester
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.ingester.service.annotations }}
annotations:
{{- if .Values.ingester.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.ingester.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.ingester.service.type }}
{{- if .Values.ingester.service.sessionAffinity }}
sessionAffinity: {{ .Values.ingester.service.sessionAffinity }}
{{- end }}
{{- if .Values.ingester.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.ingester.service.clusterIP }}
clusterIP: {{ .Values.ingester.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.ingester.service.type "LoadBalancer") (eq .Values.ingester.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.ingester.service.externalTrafficPolicy | quote }}
{{- end }}
{{ if eq .Values.ingester.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.ingester.service.loadBalancerSourceRanges }}
{{ end }}
{{- if (and (eq .Values.ingester.service.type "LoadBalancer") (not (empty .Values.ingester.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.ingester.service.loadBalancerIP }}
{{- end }}
ports:
- name: http
port: {{ .Values.ingester.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.ingester.service.type "NodePort") (eq .Values.ingester.service.type "LoadBalancer")) (not (empty .Values.ingester.service.nodePorts.http))) }}
nodePort: {{ .Values.ingester.service.nodePorts.http }}
{{- else if eq .Values.ingester.service.type "ClusterIP" }}
nodePort: null
{{- end }}
- name: grpc
port: {{ .Values.ingester.service.ports.grpc }}
targetPort: grpc
protocol: TCP
{{- if (and (or (eq .Values.ingester.service.type "NodePort") (eq .Values.ingester.service.type "LoadBalancer")) (not (empty .Values.ingester.service.nodePorts.grpc))) }}
nodePort: {{ .Values.ingester.service.nodePorts.grpc }}
{{- else if eq .Values.ingester.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.ingester.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.ingester.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ingester

View File

@@ -0,0 +1,56 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "grafana-loki.ingester.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ingester
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if .Values.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
{{- end }}
selector:
matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }}
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ingester
endpoints:
- port: http
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- end }}

View File

@@ -0,0 +1,218 @@
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
kind: StatefulSet
metadata:
name: {{ template "grafana-loki.ingester.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ingester
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.ingester.replicaCount }}
{{- if .Values.ingester.updateStrategy }}
updateStrategy: {{- toYaml .Values.ingester.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ingester
serviceName: {{ template "grafana-loki.ingester.fullname" . }}
podManagementPolicy: {{ .Values.ingester.podManagementPolicy }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/loki-configmap.yaml") . | sha256sum }}
{{- if .Values.ingester.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.ingester.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ingester
loki-gossip-member: "true"
{{- if .Values.ingester.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.ingester.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "grafana-loki.serviceAccountName" . }}
{{- include "grafana-loki.imagePullSecrets" . | nindent 6 }}
{{- if .Values.ingester.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.ingester.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.ingester.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.ingester.podAffinityPreset "component" "ingester" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.ingester.podAntiAffinityPreset "component" "ingester" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.ingester.nodeAffinityPreset.type "key" .Values.ingester.nodeAffinityPreset.key "values" .Values.ingester.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.ingester.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.ingester.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.ingester.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.ingester.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.ingester.priorityClassName }}
priorityClassName: {{ .Values.ingester.priorityClassName | quote }}
{{- end }}
{{- if .Values.ingester.schedulerName }}
schedulerName: {{ .Values.ingester.schedulerName }}
{{- end }}
{{- if .Values.ingester.podSecurityContext.enabled }}
securityContext: {{- omit .Values.ingester.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.ingester.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.ingester.initContainers "context" $) | nindent 8 }}
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.ingester.persistence.enabled }}
- name: volume-permissions
image: {{ include "grafana-loki.volumePermissions.image" . }}
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
command:
- /bin/bash
args:
- -ec
- |
mkdir -p {{ .Values.loki.dataDir }}{{- if .Values.ingester.persistence.subPath }}/{{ .Values.ingester.persistence.subPath }}{{- end }}
{{- if and .Values.ingester.podSecurityContext.enabled .Values.ingester.containerSecurityContext.enabled }}
find {{ .Values.loki.dataDir }}{{- if .Values.ingester.persistence.subPath }}/{{ .Values.ingester.persistence.subPath }}{{- end }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs -r chown -R {{ .Values.ingester.containerSecurityContext.runAsUser }}:{{ .Values.ingester.podSecurityContext.fsGroup }}
{{- end }}
{{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto" }}
securityContext: {{- omit .Values.volumePermissions.containerSecurityContext "runAsUser" | toYaml | nindent 12 }}
{{- else }}
securityContext: {{- .Values.volumePermissions.containerSecurityContext | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: data
mountPath: {{ .Values.loki.dataDir }}
{{- end }}
containers:
- name: grafana-loki-ingester
image: {{ template "grafana-loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
{{- if .Values.ingester.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.ingester.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.ingester.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.ingester.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.args "context" $) | nindent 12 }}
{{- else }}
args:
- -target=ingester
- -config.file=/bitnami/grafana-loki/conf/loki.yaml
{{- end }}
{{- if .Values.ingester.extraEnvVars }}
env: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.ingester.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.ingester.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.ingester.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.ingester.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- containerPort: {{ .Values.loki.containerPorts.http }}
name: http
- containerPort: {{ .Values.loki.containerPorts.gossipRing }}
name: http-memberlist
- containerPort: {{ .Values.loki.containerPorts.grpc }}
name: grpc
{{- if .Values.ingester.resources }}
resources: {{- toYaml .Values.ingester.resources | nindent 12 }}
{{- end }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.ingester.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.ingester.livenessProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.ingester.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.ingester.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.ingester.readinessProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.ingester.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.ingester.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.ingester.startupProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.ingester.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.ingester.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: loki-config
mountPath: /bitnami/grafana-loki/conf/loki.yaml
subPath: loki.yaml
- name: data
mountPath: {{ .Values.loki.dataDir }}
{{- if .Values.ingester.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.ingester.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.ingester.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.ingester.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: loki-config
configMap:
name: {{ template "grafana-loki.loki.configmapName" . }}
{{- if .Values.ingester.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.ingester.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if not .Values.ingester.persistence.enabled }}
- name: data
emptyDir: {}
{{- else }}
volumeClaimTemplates:
- metadata:
name: data
{{- if .Values.commonLabels }}
labels: {{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 10 }}
{{- end }}
annotations:
{{- if .Values.ingester.persistence.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.ingester.persistence.annotations "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- range .Values.ingester.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.ingester.persistence.size | quote }}
{{- if .Values.ingester.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.ingester.persistence.selector "context" $) | nindent 10 }}
{{- end }}
{{- include "common.storage.class" (dict "persistence" .Values.ingester.persistence "global" .Values.global) | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "common.names.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: loki
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
loki.yaml: |-
{{- include "common.tplvalues.render" (dict "value" .Values.loki.configuration "context" $) | nindent 4 }}

View File

@@ -0,0 +1,28 @@
{{- if .Values.promtail.rbac.create }}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: ClusterRole
metadata:
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: promtail
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
name: {{ template "grafana-loki.promtail.fullname" . }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
- apiGroups:
- ""
resources:
- nodes
- nodes/proxy
- services
- endpoints
- pods
verbs:
- get
- watch
- list
{{- end }}

View File

@@ -0,0 +1,23 @@
{{- if .Values.promtail.rbac.create }}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: ClusterRoleBinding
metadata:
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: promtail
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
name: {{ template "grafana-loki.promtail.fullname" . }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "grafana-loki.promtail.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "grafana-loki.promtail.serviceAccountName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- end }}

View File

@@ -0,0 +1,190 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ template "grafana-loki.promtail.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: promtail
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.promtail.updateStrategy }}
updateStrategy: {{- toYaml .Values.promtail.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: promtail
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/loki-configmap.yaml") . | sha256sum }}
{{- if .Values.promtail.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.promtail.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: promtail
loki-gossip-member: "true"
{{- if .Values.promtail.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.promtail.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "grafana-loki.promtail.serviceAccountName" . }}
{{- include "grafana-loki.imagePullSecrets" . | nindent 6 }}
{{- if .Values.promtail.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.promtail.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.promtail.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.promtail.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.promtail.podAffinityPreset "component" "promtail" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.promtail.podAntiAffinityPreset "component" "promtail" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.promtail.nodeAffinityPreset.type "key" .Values.promtail.nodeAffinityPreset.key "values" .Values.promtail.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.promtail.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.promtail.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.promtail.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.promtail.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.promtail.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.promtail.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.promtail.priorityClassName }}
priorityClassName: {{ .Values.promtail.priorityClassName | quote }}
{{- end }}
{{- if .Values.promtail.schedulerName }}
schedulerName: {{ .Values.promtail.schedulerName }}
{{- end }}
{{- if .Values.promtail.podSecurityContext.enabled }}
securityContext: {{- omit .Values.promtail.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.promtail.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.promtail.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: promtail
image: {{ template "grafana-loki.promtail.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
{{- if .Values.promtail.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.promtail.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.promtail.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.promtail.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.promtail.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.promtail.args "context" $) | nindent 12 }}
{{- else }}
args:
- -config.file=/bitnami/promtail/conf/promtail.yaml
{{- end }}
env:
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{- if .Values.promtail.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.promtail.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.promtail.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.promtail.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.promtail.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.promtail.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- containerPort: {{ .Values.promtail.containerPorts.http }}
name: http
{{- if .Values.promtail.resources }}
resources: {{- toYaml .Values.promtail.resources | nindent 12 }}
{{- end }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.promtail.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.promtail.livenessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.promtail.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.promtail.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.promtail.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.promtail.readinessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.promtail.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.promtail.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.promtail.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.promtail.startupProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.promtail.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.promtail.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.promtail.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.promtail.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: loki-config
mountPath: /bitnami/promtail/conf/promtail.yaml
subPath: promtail.yaml
- name: containers
mountPath: /var/lib/docker/containers
readOnly: true
- name: pods
mountPath: /var/log/pods
readOnly: true
- name: run
mountPath: /run/promtail
{{- if .Values.gateway.auth.enabled }}
- name: gateway-password
mountPath: /bitnami/promtail/conf/secrets
{{- end }}
{{- if .Values.promtail.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.promtail.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.promtail.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.promtail.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: loki-config
secret:
secretName: {{ template "grafana-loki.promtail.secretName" . }}
- name: containers
hostPath:
path: /var/lib/docker/containers
- name: pods
hostPath:
path: /var/log/pods
- name: run
hostPath:
path: /run/promtail
{{- if .Values.gateway.auth.enabled }}
- name: gateway-password
secret:
secretName: {{ include "grafana-loki.gateway.secretName" . }}
items:
- key: password
path: password
{{- end }}
{{- if .Values.promtail.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.promtail.extraVolumes "context" $) | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ template "grafana-loki.promtail.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: loki
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
stringData:
promtail.yaml: |-
{{- include "common.tplvalues.render" (dict "value" .Values.promtail.configuration "context" $) | nindent 4 }}

View File

@@ -0,0 +1,21 @@
{{- if .Values.promtail.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "grafana-loki.promtail.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: loki
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.promtail.serviceAccount.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.promtail.serviceAccount.annotations "context" $ ) | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.promtail.serviceAccount.automountServiceAccountToken }}
{{- end }}

View File

@@ -0,0 +1,56 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.promtail.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: promtail
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.promtail.service.annotations }}
annotations:
{{- if .Values.promtail.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.promtail.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.promtail.service.type }}
{{- if .Values.promtail.service.sessionAffinity }}
sessionAffinity: {{ .Values.promtail.service.sessionAffinity }}
{{- end }}
{{- if .Values.promtail.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.promtail.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.promtail.service.clusterIP }}
clusterIP: {{ .Values.promtail.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.promtail.service.type "LoadBalancer") (eq .Values.promtail.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.promtail.service.externalTrafficPolicy | quote }}
{{- end }}
{{ if eq .Values.promtail.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.promtail.service.loadBalancerSourceRanges }}
{{ end }}
{{- if (and (eq .Values.promtail.service.type "LoadBalancer") (not (empty .Values.promtail.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.promtail.service.loadBalancerIP }}
{{- end }}
ports:
- name: http
port: {{ .Values.promtail.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.promtail.service.type "NodePort") (eq .Values.promtail.service.type "LoadBalancer")) (not (empty .Values.promtail.service.nodePorts.http))) }}
nodePort: {{ .Values.promtail.service.nodePorts.http }}
{{- else if eq .Values.promtail.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.promtail.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.promtail.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: promtail

View File

@@ -0,0 +1,56 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "grafana-loki.promtail.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: promtail
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if .Values.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
{{- end }}
selector:
matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }}
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: promtail
endpoints:
- port: http
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- end }}

View File

@@ -0,0 +1,65 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.querier.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: querier
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.querier.service.annotations }}
annotations:
{{- if .Values.querier.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.querier.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.querier.service.type }}
{{- if .Values.querier.service.sessionAffinity }}
sessionAffinity: {{ .Values.querier.service.sessionAffinity }}
{{- end }}
{{- if .Values.querier.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.querier.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.querier.service.clusterIP }}
clusterIP: {{ .Values.querier.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.querier.service.type "LoadBalancer") (eq .Values.querier.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.querier.service.externalTrafficPolicy | quote }}
{{- end }}
{{ if eq .Values.querier.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.querier.service.loadBalancerSourceRanges }}
{{ end }}
{{- if (and (eq .Values.querier.service.type "LoadBalancer") (not (empty .Values.querier.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.querier.service.loadBalancerIP }}
{{- end }}
ports:
- name: http
port: {{ .Values.querier.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.querier.service.type "NodePort") (eq .Values.querier.service.type "LoadBalancer")) (not (empty .Values.querier.service.nodePorts.http))) }}
nodePort: {{ .Values.querier.service.nodePorts.http }}
{{- else if eq .Values.querier.service.type "ClusterIP" }}
nodePort: null
{{- end }}
- name: grpc
port: {{ .Values.querier.service.ports.grpc }}
targetPort: grpc
protocol: TCP
{{- if (and (or (eq .Values.querier.service.type "NodePort") (eq .Values.querier.service.type "LoadBalancer")) (not (empty .Values.querier.service.nodePorts.grpc))) }}
nodePort: {{ .Values.querier.service.nodePorts.grpc }}
{{- else if eq .Values.querier.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.querier.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.querier.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: querier

View File

@@ -0,0 +1,56 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "grafana-loki.querier.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: querier
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if .Values.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
{{- end }}
selector:
matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }}
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: querier
endpoints:
- port: http
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- end }}

View File

@@ -0,0 +1,220 @@
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
kind: StatefulSet
metadata:
name: {{ template "grafana-loki.querier.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: querier
loki-gossip-member: "true"
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.querier.replicaCount }}
{{- if .Values.querier.updateStrategy }}
updateStrategy: {{- toYaml .Values.querier.updateStrategy | nindent 4 }}
{{- end }}
podManagementPolicy: {{ .Values.querier.podManagementPolicy }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: querier
loki-gossip-member: "true"
serviceName: {{ template "grafana-loki.querier.fullname" . }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/loki-configmap.yaml") . | sha256sum }}
{{- if .Values.querier.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.querier.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: querier
loki-gossip-member: "true"
{{- if .Values.querier.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.querier.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "grafana-loki.serviceAccountName" . }}
{{- include "grafana-loki.imagePullSecrets" . | nindent 6 }}
{{- if .Values.querier.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.querier.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.querier.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.querier.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.querier.podAffinityPreset "component" "querier" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.querier.podAntiAffinityPreset "component" "querier" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.querier.nodeAffinityPreset.type "key" .Values.querier.nodeAffinityPreset.key "values" .Values.querier.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.querier.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.querier.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.querier.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.querier.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.querier.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.querier.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.querier.priorityClassName }}
priorityClassName: {{ .Values.querier.priorityClassName | quote }}
{{- end }}
{{- if .Values.querier.schedulerName }}
schedulerName: {{ .Values.querier.schedulerName }}
{{- end }}
{{- if .Values.querier.podSecurityContext.enabled }}
securityContext: {{- omit .Values.querier.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.querier.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.querier.initContainers "context" $) | nindent 8 }}
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.querier.persistence.enabled }}
- name: volume-permissions
image: {{ include "grafana-loki.volumePermissions.image" . }}
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
command:
- /bin/bash
args:
- -ec
- |
mkdir -p {{ .Values.loki.dataDir }}{{- if .Values.querier.persistence.subPath }}/{{ .Values.querier.persistence.subPath }}{{- end }}
{{- if and .Values.querier.podSecurityContext.enabled .Values.querier.containerSecurityContext.enabled }}
find {{ .Values.loki.dataDir }}{{- if .Values.querier.persistence.subPath }}/{{ .Values.querier.persistence.subPath }}{{- end }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs -r chown -R {{ .Values.querier.containerSecurityContext.runAsUser }}:{{ .Values.querier.podSecurityContext.fsGroup }}
{{- end }}
{{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto" }}
securityContext: {{- omit .Values.volumePermissions.containerSecurityContext "runAsUser" | toYaml | nindent 12 }}
{{- else }}
securityContext: {{- .Values.volumePermissions.containerSecurityContext | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: data
mountPath: {{ .Values.loki.dataDir }}
{{- end }}
containers:
- name: grafana-loki-querier
image: {{ template "grafana-loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
{{- if .Values.querier.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.querier.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.querier.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.querier.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.querier.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.querier.args "context" $) | nindent 12 }}
{{- else }}
args:
- -target=querier
- -config.file={{ .Values.loki.dataDir }}/conf/loki.yaml
{{- end }}
{{- if .Values.querier.extraEnvVars }}
env: {{- include "common.tplvalues.render" (dict "value" .Values.querier.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.querier.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.querier.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.querier.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.querier.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- containerPort: {{ .Values.loki.containerPorts.http }}
name: http
- containerPort: {{ .Values.loki.containerPorts.gossipRing }}
name: http-memberlist
- containerPort: {{ .Values.loki.containerPorts.grpc }}
name: grpc
{{- if .Values.querier.resources }}
resources: {{- toYaml .Values.querier.resources | nindent 12 }}
{{- end }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.querier.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.querier.livenessProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.querier.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.querier.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.querier.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.querier.readinessProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.querier.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.querier.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.querier.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.querier.startupProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.querier.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.querier.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.querier.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.querier.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: loki-config
mountPath: {{ .Values.loki.dataDir }}/conf/loki.yaml
subPath: loki.yaml
- name: data
mountPath: {{ .Values.loki.dataDir }}
{{- if .Values.querier.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.querier.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.querier.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.querier.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: loki-config
configMap:
name: {{ template "grafana-loki.loki.configmapName" . }}
{{- if .Values.querier.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.querier.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if not .Values.querier.persistence.enabled }}
- name: data
emptyDir: {}
{{- else }}
volumeClaimTemplates:
- metadata:
name: data
{{- if .Values.commonLabels }}
labels: {{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 10 }}
{{- end }}
annotations:
{{- if .Values.querier.persistence.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.querier.persistence.annotations "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- range .Values.querier.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.querier.persistence.size | quote }}
{{- if .Values.querier.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.querier.persistence.selector "context" $) | nindent 10 }}
{{- end }}
{{- include "common.storage.class" (dict "persistence" .Values.querier.persistence "global" .Values.global) | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,159 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "grafana-loki.query-frontend.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.queryFrontend.replicaCount }}
{{- if .Values.queryFrontend.updateStrategy }}
strategy: {{- toYaml .Values.queryFrontend.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/loki-configmap.yaml") . | sha256sum }}
{{- if .Values.queryFrontend.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend
loki-gossip-member: "true"
{{- if .Values.queryFrontend.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "grafana-loki.serviceAccountName" . }}
{{- include "grafana-loki.imagePullSecrets" . | nindent 6 }}
{{- if .Values.queryFrontend.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.queryFrontend.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.queryFrontend.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.queryFrontend.podAffinityPreset "component" "query-frontend" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.queryFrontend.podAntiAffinityPreset "component" "query-frontend" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.queryFrontend.nodeAffinityPreset.type "key" .Values.queryFrontend.nodeAffinityPreset.key "values" .Values.queryFrontend.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.queryFrontend.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.queryFrontend.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.queryFrontend.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.queryFrontend.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.queryFrontend.priorityClassName }}
priorityClassName: {{ .Values.queryFrontend.priorityClassName | quote }}
{{- end }}
{{- if .Values.queryFrontend.schedulerName }}
schedulerName: {{ .Values.queryFrontend.schedulerName }}
{{- end }}
{{- if .Values.queryFrontend.podSecurityContext.enabled }}
securityContext: {{- omit .Values.queryFrontend.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.queryFrontend.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: grafana-loki-query-frontend
image: {{ template "grafana-loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
{{- if .Values.queryFrontend.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.queryFrontend.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.queryFrontend.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.queryFrontend.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.args "context" $) | nindent 12 }}
{{- else }}
args:
- -target=query-frontend
- -config.file={{ .Values.loki.dataDir }}/conf/loki.yaml
{{- end }}
{{- if .Values.queryFrontend.extraEnvVars }}
env: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.queryFrontend.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.queryFrontend.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- containerPort: {{ .Values.loki.containerPorts.http }}
name: http
- containerPort: {{ .Values.loki.containerPorts.grpc }}
name: grpc
{{- if .Values.queryFrontend.resources }}
resources: {{- toYaml .Values.queryFrontend.resources | nindent 12 }}
{{- end }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.queryFrontend.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.queryFrontend.livenessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.queryFrontend.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.queryFrontend.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.queryFrontend.readinessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.queryFrontend.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.queryFrontend.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.queryFrontend.startupProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.queryFrontend.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.queryFrontend.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: loki-config
mountPath: /bitnami/grafana-loki/conf/loki.yaml
subPath: loki.yaml
{{- if .Values.queryFrontend.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.queryFrontend.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.queryFrontend.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: loki-config
configMap:
name: {{ template "grafana-loki.loki.configmapName" . }}
{{- if .Values.queryFrontend.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraVolumes "context" $) | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,34 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.query-frontend.fullname" . }}-headless
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
# NOTE: this is based on this https://github.com/grafana/helm-charts/pull/451. Should be reviewed if it is actually necessary in the future
publishNotReadyAddresses: true
type: ClusterIP
clusterIP: None
ports:
- name: http
port: {{ .Values.queryFrontend.service.ports.http }}
targetPort: http
protocol: TCP
- name: grpc
port: {{ .Values.queryFrontend.service.ports.grpc }}
targetPort: grpc
protocol: TCP
{{- if .Values.queryFrontend.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend

View File

@@ -0,0 +1,66 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.query-frontend.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.queryFrontend.service.annotations }}
annotations:
{{- if .Values.queryFrontend.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.queryFrontend.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.queryFrontend.service.type }}
{{- if .Values.queryFrontend.service.sessionAffinity }}
sessionAffinity: {{ .Values.queryFrontend.service.sessionAffinity }}
{{- end }}
{{- if .Values.queryFrontend.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.queryFrontend.service.clusterIP }}
clusterIP: {{ .Values.queryFrontend.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.queryFrontend.service.type "LoadBalancer") (eq .Values.queryFrontend.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.queryFrontend.service.externalTrafficPolicy | quote }}
{{- end }}
{{ if eq .Values.queryFrontend.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.queryFrontend.service.loadBalancerSourceRanges }}
{{ end }}
{{- if (and (eq .Values.queryFrontend.service.type "LoadBalancer") (not (empty .Values.queryFrontend.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.queryFrontend.service.loadBalancerIP }}
{{- end }}
publishNotReadyAddresses: true
ports:
- name: http
port: {{ .Values.queryFrontend.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.queryFrontend.service.type "NodePort") (eq .Values.queryFrontend.service.type "LoadBalancer")) (not (empty .Values.queryFrontend.service.nodePorts.http))) }}
nodePort: {{ .Values.queryFrontend.service.nodePorts.http }}
{{- else if eq .Values.queryFrontend.service.type "ClusterIP" }}
nodePort: null
{{- end }}
- name: grpc
port: {{ .Values.queryFrontend.service.ports.grpc }}
targetPort: grpc
protocol: TCP
{{- if (and (or (eq .Values.queryFrontend.service.type "NodePort") (eq .Values.queryFrontend.service.type "LoadBalancer")) (not (empty .Values.queryFrontend.service.nodePorts.grpc))) }}
nodePort: {{ .Values.queryFrontend.service.nodePorts.grpc }}
{{- else if eq .Values.queryFrontend.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.queryFrontend.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend

View File

@@ -0,0 +1,56 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "grafana-loki.query-frontend.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if .Values.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
{{- end }}
selector:
matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }}
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend
endpoints:
- port: http
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- end }}

View File

@@ -0,0 +1,67 @@
{{- if .Values.ruler.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.ruler.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ruler
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.ruler.service.annotations }}
annotations:
{{- if .Values.ruler.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.ruler.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.ruler.service.type }}
{{- if .Values.ruler.service.sessionAffinity }}
sessionAffinity: {{ .Values.ruler.service.sessionAffinity }}
{{- end }}
{{- if .Values.ruler.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.ruler.service.clusterIP }}
clusterIP: {{ .Values.ruler.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.ruler.service.type "LoadBalancer") (eq .Values.ruler.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.ruler.service.externalTrafficPolicy | quote }}
{{- end }}
{{ if eq .Values.ruler.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.ruler.service.loadBalancerSourceRanges }}
{{ end }}
{{- if (and (eq .Values.ruler.service.type "LoadBalancer") (not (empty .Values.ruler.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.ruler.service.loadBalancerIP }}
{{- end }}
ports:
- name: http
port: {{ .Values.ruler.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.ruler.service.type "NodePort") (eq .Values.ruler.service.type "LoadBalancer")) (not (empty .Values.ruler.service.nodePorts.http))) }}
nodePort: {{ .Values.ruler.service.nodePorts.http }}
{{- else if eq .Values.ruler.service.type "ClusterIP" }}
nodePort: null
{{- end }}
- name: grpc
port: {{ .Values.ruler.service.ports.grpc }}
targetPort: grpc
protocol: TCP
{{- if (and (or (eq .Values.ruler.service.type "NodePort") (eq .Values.ruler.service.type "LoadBalancer")) (not (empty .Values.ruler.service.nodePorts.grpc))) }}
nodePort: {{ .Values.ruler.service.nodePorts.grpc }}
{{- else if eq .Values.ruler.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.ruler.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.ruler.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ruler
{{- end }}

View File

@@ -0,0 +1,56 @@
{{- if and .Values.ruler.enabled .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "grafana-loki.ruler.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ruler
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if .Values.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
{{- end }}
selector:
matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }}
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ruler
endpoints:
- port: http
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- end }}

View File

@@ -0,0 +1,222 @@
{{- if .Values.indexGateway.enabled }}
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
kind: StatefulSet
metadata:
name: {{ template "grafana-loki.ruler.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ruler
loki-gossip-member: "true"
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.ruler.replicaCount }}
{{- if .Values.ruler.updateStrategy }}
updateStrategy: {{- toYaml .Values.ruler.updateStrategy | nindent 4 }}
{{- end }}
podManagementPolicy: {{ .Values.ruler.podManagementPolicy }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ruler
loki-gossip-member: "true"
serviceName: {{ template "grafana-loki.ruler.fullname" . }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/loki-configmap.yaml") . | sha256sum }}
{{- if .Values.ruler.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.ruler.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: ruler
loki-gossip-member: "true"
{{- if .Values.ruler.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.ruler.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "grafana-loki.serviceAccountName" . }}
{{- include "grafana-loki.imagePullSecrets" . | nindent 6 }}
{{- if .Values.ruler.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.ruler.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.ruler.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.ruler.podAffinityPreset "component" "ruler" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.ruler.podAntiAffinityPreset "component" "ruler" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.ruler.nodeAffinityPreset.type "key" .Values.ruler.nodeAffinityPreset.key "values" .Values.ruler.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.ruler.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.ruler.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.ruler.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.ruler.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.ruler.priorityClassName }}
priorityClassName: {{ .Values.ruler.priorityClassName | quote }}
{{- end }}
{{- if .Values.ruler.schedulerName }}
schedulerName: {{ .Values.ruler.schedulerName }}
{{- end }}
{{- if .Values.ruler.podSecurityContext.enabled }}
securityContext: {{- omit .Values.ruler.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.ruler.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.ruler.initContainers "context" $) | nindent 8 }}
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.ruler.persistence.enabled }}
- name: volume-permissions
image: {{ include "grafana-loki.volumePermissions.image" . }}
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
command:
- /bin/bash
args:
- -ec
- |
mkdir -p {{ .Values.loki.dataDir }}{{- if .Values.ruler.persistence.subPath }}/{{ .Values.ruler.persistence.subPath }}{{- end }}
{{- if and .Values.ruler.podSecurityContext.enabled .Values.ruler.containerSecurityContext.enabled }}
find {{ .Values.loki.dataDir }}{{- if .Values.ruler.persistence.subPath }}/{{ .Values.ruler.persistence.subPath }}{{- end }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs -r chown -R {{ .Values.ruler.containerSecurityContext.runAsUser }}:{{ .Values.ruler.podSecurityContext.fsGroup }}
{{- end }}
{{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto" }}
securityContext: {{- omit .Values.volumePermissions.containerSecurityContext "runAsUser" | toYaml | nindent 12 }}
{{- else }}
securityContext: {{- .Values.volumePermissions.containerSecurityContext | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: data
mountPath: {{ .Values.loki.dataDir }}
{{- end }}
containers:
- name: grafana-loki-ruler
image: {{ template "grafana-loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
{{- if .Values.ruler.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.ruler.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.ruler.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.ruler.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.args "context" $) | nindent 12 }}
{{- else }}
args:
- -target=ruler
- -config.file={{ .Values.loki.dataDir }}/conf/loki.yaml
{{- end }}
{{- if .Values.ruler.extraEnvVars }}
env: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.ruler.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.ruler.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.ruler.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.ruler.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- containerPort: {{ .Values.loki.containerPorts.http }}
name: http
- containerPort: {{ .Values.loki.containerPorts.gossipRing }}
name: http-memberlist
- containerPort: {{ .Values.loki.containerPorts.grpc }}
name: grpc
{{- if .Values.ruler.resources }}
resources: {{- toYaml .Values.ruler.resources | nindent 12 }}
{{- end }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.ruler.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.ruler.livenessProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.ruler.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.ruler.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.ruler.readinessProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.ruler.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.ruler.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.ruler.startupProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.ruler.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.ruler.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: loki-config
mountPath: {{ .Values.loki.dataDir }}/conf/loki.yaml
subPath: loki.yaml
- name: data
mountPath: {{ .Values.loki.dataDir }}
{{- if .Values.ruler.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.ruler.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.ruler.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.ruler.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: loki-config
configMap:
name: {{ template "grafana-loki.loki.configmapName" . }}
{{- if .Values.ruler.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.ruler.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if not .Values.ruler.persistence.enabled }}
- name: data
emptyDir: {}
{{- else }}
volumeClaimTemplates:
- metadata:
name: data
{{- if .Values.commonLabels }}
labels: {{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 10 }}
{{- end }}
annotations:
{{- if .Values.ruler.persistence.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.ruler.persistence.annotations "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- range .Values.ruler.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.ruler.persistence.size | quote }}
{{- if .Values.ruler.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.ruler.persistence.selector "context" $) | nindent 10 }}
{{- end }}
{{- include "common.storage.class" (dict "persistence" .Values.ruler.persistence "global" .Values.global) | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,21 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "grafana-loki.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: loki
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.serviceAccount.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.serviceAccount.annotations "context" $ ) | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- end }}

View File

@@ -0,0 +1,161 @@
{{- if .Values.tableManager.enabled }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "grafana-loki.table-manager.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: table-manager
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.tableManager.replicaCount }}
{{- if .Values.tableManager.updateStrategy }}
strategy: {{- toYaml .Values.tableManager.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: table-manager
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/loki-configmap.yaml") . | sha256sum }}
{{- if .Values.tableManager.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.tableManager.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: table-manager
loki-gossip-member: "true"
{{- if .Values.tableManager.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.tableManager.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "grafana-loki.serviceAccountName" . }}
{{- include "grafana-loki.imagePullSecrets" . | nindent 6 }}
{{- if .Values.tableManager.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.tableManager.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.tableManager.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.tableManager.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.tableManager.podAffinityPreset "component" "tableManager" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.tableManager.podAntiAffinityPreset "component" "tableManager" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.tableManager.nodeAffinityPreset.type "key" .Values.tableManager.nodeAffinityPreset.key "values" .Values.tableManager.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.tableManager.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.tableManager.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.tableManager.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tableManager.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.tableManager.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.tableManager.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.tableManager.priorityClassName }}
priorityClassName: {{ .Values.tableManager.priorityClassName | quote }}
{{- end }}
{{- if .Values.tableManager.schedulerName }}
schedulerName: {{ .Values.tableManager.schedulerName }}
{{- end }}
{{- if .Values.tableManager.podSecurityContext.enabled }}
securityContext: {{- omit .Values.tableManager.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.tableManager.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.tableManager.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: grafana-loki-table-manager
image: {{ template "grafana-loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
{{- if .Values.tableManager.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.tableManager.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.tableManager.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.tableManager.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.tableManager.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.tableManager.args "context" $) | nindent 12 }}
{{- else }}
args:
- -target=table-manager
- -config.file=/bitnami/grafana-loki/conf/loki.yaml
{{- end }}
{{- if .Values.tableManager.extraEnvVars }}
env: {{- include "common.tplvalues.render" (dict "value" .Values.tableManager.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.tableManager.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.tableManager.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.tableManager.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.tableManager.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- containerPort: {{ .Values.loki.containerPorts.http }}
name: http
- containerPort: {{ .Values.loki.containerPorts.grpc }}
name: grpc
{{- if .Values.tableManager.resources }}
resources: {{- toYaml .Values.tableManager.resources | nindent 12 }}
{{- end }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.tableManager.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.tableManager.livenessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.tableManager.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.tableManager.customLivenessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.tableManager.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.tableManager.readinessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- else if .Values.tableManager.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.tableManager.customReadinessProbe "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.tableManager.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.tableManager.startupProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- else if .Values.tableManager.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.tableManager.customStartupProbe "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.tableManager.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.tableManager.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: loki-config
mountPath: {{ .Values.loki.dataDir }}/conf/loki.yaml
subPath: loki.yaml
{{- if .Values.tableManager.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.tableManager.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.tableManager.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.tableManager.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: loki-config
configMap:
name: {{ template "grafana-loki.loki.configmapName" . }}
{{- if .Values.tableManager.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.tableManager.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,67 @@
{{- if .Values.indexGateway.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "grafana-loki.table-manager.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: table-manager
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.tableManager.service.annotations }}
annotations:
{{- if .Values.tableManager.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.tableManager.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.tableManager.service.type }}
{{- if .Values.tableManager.service.sessionAffinity }}
sessionAffinity: {{ .Values.tableManager.service.sessionAffinity }}
{{- end }}
{{- if .Values.tableManager.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.tableManager.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.tableManager.service.clusterIP }}
clusterIP: {{ .Values.tableManager.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.tableManager.service.type "LoadBalancer") (eq .Values.tableManager.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.tableManager.service.externalTrafficPolicy | quote }}
{{- end }}
{{ if eq .Values.tableManager.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.tableManager.service.loadBalancerSourceRanges }}
{{ end }}
{{- if (and (eq .Values.tableManager.service.type "LoadBalancer") (not (empty .Values.tableManager.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.tableManager.service.loadBalancerIP }}
{{- end }}
ports:
- name: http
port: {{ .Values.tableManager.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.tableManager.service.type "NodePort") (eq .Values.tableManager.service.type "LoadBalancer")) (not (empty .Values.tableManager.service.nodePorts.http))) }}
nodePort: {{ .Values.tableManager.service.nodePorts.http }}
{{- else if eq .Values.tableManager.service.type "ClusterIP" }}
nodePort: null
{{- end }}
- name: grpc
port: {{ .Values.tableManager.service.ports.grpc }}
protocol: TCP
targetPort: grpc
{{- if (and (or (eq .Values.tableManager.service.type "NodePort") (eq .Values.tableManager.service.type "LoadBalancer")) (not (empty .Values.tableManager.service.nodePorts.grpc))) }}
nodePort: {{ .Values.tableManager.service.nodePorts.grpc }}
{{- else if eq .Values.tableManager.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.tableManager.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.tableManager.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: table-manager
{{- end }}

View File

@@ -0,0 +1,56 @@
{{- if and .Values.tableManager.enabled .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "grafana-loki.table-manager.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: table-manager
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if .Values.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
{{- end }}
selector:
matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }}
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: table-manager
endpoints:
- port: http
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- end }}

File diff suppressed because it is too large Load Diff