diff --git a/docs/sources/setup/install/helm/reference.md b/docs/sources/setup/install/helm/reference.md index 338946f4fc7c5..e6c3630b6f51b 100644 --- a/docs/sources/setup/install/helm/reference.md +++ b/docs/sources/setup/install/helm/reference.md @@ -2127,7 +2127,7 @@ null
-"dnssrvnoa+_memcached-client._tcp.{{ include \"loki.resourceName\" (dict \"ctx\" $ \"component\" \"chunks-cache\" \"suffix\" $.Values.chunksCache.suffix ) }}.{{ include \"loki.namespace\" $ }}.svc"
+"dnssrvnoa+_memcached-client._tcp.{{ include \"loki.resourceName\" (dict \"ctx\" $ \"component\" \"chunks-cache\" \"suffix\" $.Values.chunksCache.suffix ) }}.{{ include \"loki.namespace\" $ }}.svc.{{ .Values.global.clusterDomain }}"
{
- "addresses": "dnssrvnoa+_memcached-client._tcp.{{ include \"loki.resourceName\" (dict \"ctx\" $ \"component\" \"chunks-cache\" \"suffix\" $.Values.chunksCache.l2.suffix ) }}.{{ include \"loki.namespace\" $ }}.svc",
+ "addresses": "dnssrvnoa+_memcached-client._tcp.{{ include \"loki.resourceName\" (dict \"ctx\" $ \"component\" \"chunks-cache\" \"suffix\" $.Values.chunksCache.l2.suffix ) }}.{{ include \"loki.namespace\" $ }}.svc.{{ .Values.global.clusterDomain }}",
"affinity": {},
"allocatedMemory": 8192,
"annotations": {},
@@ -2331,7 +2331,7 @@ true
string
Comma separated addresses list in DNS Service Discovery format
-"dnssrvnoa+_memcached-client._tcp.{{ include \"loki.resourceName\" (dict \"ctx\" $ \"component\" \"chunks-cache\" \"suffix\" $.Values.chunksCache.l2.suffix ) }}.{{ include \"loki.namespace\" $ }}.svc"
+"dnssrvnoa+_memcached-client._tcp.{{ include \"loki.resourceName\" (dict \"ctx\" $ \"component\" \"chunks-cache\" \"suffix\" $.Values.chunksCache.l2.suffix ) }}.{{ include \"loki.namespace\" $ }}.svc.{{ .Values.global.clusterDomain }}"
@@ -11380,7 +11380,7 @@ null
string
Comma separated addresses list in DNS Service Discovery format
-"dnssrvnoa+_memcached-client._tcp.{{ include \"loki.resourceName\" (dict \"ctx\" $ \"component\" \"results-cache\") }}.{{ include \"loki.namespace\" $ }}.svc"
+"dnssrvnoa+_memcached-client._tcp.{{ include \"loki.resourceName\" (dict \"ctx\" $ \"component\" \"results-cache\") }}.{{ include \"loki.namespace\" $ }}.svc.{{ .Values.global.clusterDomain }}"
@@ -13153,7 +13153,7 @@ false
{
"annotations": {},
- "canaryServiceAddress": "http://loki-canary:3500/metrics",
+ "canaryServiceAddress": "http://{{ include \"loki-canary.fullname\" $ }}.{{ include \"loki.namespace\" $ }}.svc.{{ .Values.global.clusterDomain }}:3500/metrics",
"enabled": true,
"hostUsers": "nil",
"image": {
@@ -13184,7 +13184,7 @@ false
string
Used to directly query the metrics endpoint of the canary for testing, this approach avoids needing prometheus for testing. This in a newer approach to using prometheusAddress such that tests do not have a dependency on prometheus
-"http://loki-canary:3500/metrics"
+"http://{{ include \"loki-canary.fullname\" $ }}.{{ include \"loki.namespace\" $ }}.svc.{{ .Values.global.clusterDomain }}:3500/metrics"
diff --git a/production/helm/loki/CHANGELOG.md b/production/helm/loki/CHANGELOG.md
index 1b0d51edd46f5..e54b5843489a7 100644
--- a/production/helm/loki/CHANGELOG.md
+++ b/production/helm/loki/CHANGELOG.md
@@ -13,6 +13,8 @@ Entries should include a reference to the pull request that introduced the chang
## Unreleased
+- [CHANGE] `nameOverride` now passed through helm tpl function [#19590](https://github.com/grafana/loki/pull/19590).
+- [BUGFIX] Wrong context passed to loki.namespace helper from table manager servicemonitor. [#19461](https://github.com/grafana/loki/pull/19461)
- [BUGFIX] Don't fail for missing bucket name, if local disk is used. [#19675](https://github.com/grafana/loki/pull/19675)
- [FEATURE] Add load balancer port to query-frontend service. [#19462](https://github.com/grafana/loki/pull/19462)
diff --git a/production/helm/loki/ci/non-default-values.yaml b/production/helm/loki/ci/non-default-values.yaml
index 2497dc67c3c4f..ef27798a581b7 100644
--- a/production/helm/loki/ci/non-default-values.yaml
+++ b/production/helm/loki/ci/non-default-values.yaml
@@ -1,4 +1,7 @@
deploymentMode: Distributed
+nameOverride: '{{ $.Release.Name }}'
+test:
+ enabled: true
loki:
commonConfig:
replication_factor: 1
@@ -50,6 +53,7 @@ queryFrontend:
queryScheduler:
replicas: 1
lokiCanary:
+ enabled: true
kind: Deployment
chunksCache:
suffix: "l1"
diff --git a/production/helm/loki/templates/_helpers.tpl b/production/helm/loki/templates/_helpers.tpl
index 7a397a2feaadb..34dcfaca76a6c 100644
--- a/production/helm/loki/templates/_helpers.tpl
+++ b/production/helm/loki/templates/_helpers.tpl
@@ -10,8 +10,11 @@ See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#sy
Expand the name of the chart.
*/}}
{{- define "loki.name" -}}
-{{- $default := ternary "enterprise-logs" "loki" .Values.enterprise.enabled }}
-{{- coalesce .Values.nameOverride $default | trunc 63 | trimSuffix "-" }}
+{{- $name := ternary "enterprise-logs" "loki" .Values.enterprise.enabled }}
+{{- if .Values.nameOverride }}
+{{- $name = (tpl .Values.nameOverride $) }}
+{{- end }}
+{{- $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
@@ -32,7 +35,7 @@ singleBinary fullname
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
-{{- $name := default .Chart.Name .Values.nameOverride -}}
+{{- $name := (include "loki.name" $) -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
@@ -149,10 +152,12 @@ app.kubernetes.io/instance: {{ .Release.Name }}
Create the name of the service account to use
*/}}
{{- define "loki.serviceAccountName" -}}
-{{- if .Values.serviceAccount.create -}}
- {{ default (include "loki.name" .) .Values.serviceAccount.name }}
+{{- if .Values.serviceAccount.name }}
+ {{- tpl .Values.serviceAccount.name $ }}
+{{- else if .Values.serviceAccount.create -}}
+ {{- include "loki.fullname" . }}
{{- else -}}
- {{ default "default" .Values.serviceAccount.name }}
+ {{- "default" }}
{{- end -}}
{{- end -}}
@@ -673,7 +678,16 @@ Create the service endpoint including port for MinIO.
{{/* Configure the correct name for the memberlist service */}}
{{- define "loki.memberlist" -}}
-{{ include "loki.name" . }}-memberlist
+{{- if .Values.memberlist.service.name }}
+{{- tpl .Values.memberlist.service.name $ }}
+{{- else }}
+{{- include "loki.fullname" . }}-memberlist
+{{- end -}}
+{{- end -}}
+
+{{/* Configure the correct name for the runtime config */}}
+{{- define "loki.runtime.name" -}}
+{{ include "loki.fullname" . }}-runtime
{{- end -}}
{{/* Determine the public host for the Loki cluster */}}
diff --git a/production/helm/loki/templates/tests/test-canary.yaml b/production/helm/loki/templates/tests/test-canary.yaml
index 34ecbb5fed87f..744b2d6cddc1c 100644
--- a/production/helm/loki/templates/tests/test-canary.yaml
+++ b/production/helm/loki/templates/tests/test-canary.yaml
@@ -25,7 +25,7 @@ spec:
image: {{ include "loki.helmTestImage" $ }}
env:
- name: CANARY_SERVICE_ADDRESS
- value: "{{ .canaryServiceAddress }}"
+ value: "{{ tpl .canaryServiceAddress $ }}"
- name: CANARY_PROMETHEUS_ADDRESS
value: "{{ .prometheusAddress }}"
{{- with .timeout }}
diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml
index cfe5000c9aa45..905d911e5ce78 100644
--- a/production/helm/loki/values.yaml
+++ b/production/helm/loki/values.yaml
@@ -181,7 +181,7 @@ loki:
{{- toYaml .Values.loki.extraMemberlistConfig | nindent 2}}
{{- end }}
join_members:
- - {{ include "loki.memberlist" . }}
+ - {{ include "loki.memberlist" . }}.{{ include "loki.namespace" $ }}.svc.{{ .Values.global.clusterDomain }}
{{- with .Values.migrate.fromDistributed }}
{{- if .enabled }}
- {{ .memberlistService }}
@@ -746,7 +746,7 @@ test:
enabled: true
# -- Used to directly query the metrics endpoint of the canary for testing, this approach avoids needing prometheus for testing.
# This in a newer approach to using prometheusAddress such that tests do not have a dependency on prometheus
- canaryServiceAddress: "http://loki-canary:3500/metrics"
+ canaryServiceAddress: 'http://{{ include "loki-canary.fullname" $ }}.{{ include "loki.namespace" $ }}.svc.{{ .Values.global.clusterDomain }}:3500/metrics'
# -- Address of the prometheus server to query for the test. This overrides any value set for canaryServiceAddress.
# This is kept for backward compatibility and may be removed in future releases. Previous value was 'http://prometheus:9090'
prometheusAddress: ""
@@ -3567,7 +3567,7 @@ resultsCache:
# -- Specifies whether memcached based results-cache should be enabled
enabled: true
# -- Comma separated addresses list in DNS Service Discovery format
- addresses: dnssrvnoa+_memcached-client._tcp.{{ include "loki.resourceName" (dict "ctx" $ "component" "results-cache") }}.{{ include "loki.namespace" $ }}.svc
+ addresses: dnssrvnoa+_memcached-client._tcp.{{ include "loki.resourceName" (dict "ctx" $ "component" "results-cache") }}.{{ include "loki.namespace" $ }}.svc.{{ .Values.global.clusterDomain }}
# -- Specify how long cached results should be stored in the results-cache before being expired
defaultValidity: 12h
# -- Memcached operation timeout
@@ -3674,7 +3674,7 @@ chunksCache:
# -- Specifies whether memcached based chunks-cache should be enabled
enabled: true
# -- Comma separated addresses list in DNS Service Discovery format
- addresses: dnssrvnoa+_memcached-client._tcp.{{ include "loki.resourceName" (dict "ctx" $ "component" "chunks-cache" "suffix" $.Values.chunksCache.suffix ) }}.{{ include "loki.namespace" $ }}.svc
+ addresses: 'dnssrvnoa+_memcached-client._tcp.{{ include "loki.resourceName" (dict "ctx" $ "component" "chunks-cache" "suffix" $.Values.chunksCache.suffix ) }}.{{ include "loki.namespace" $ }}.svc.{{ .Values.global.clusterDomain }}'
# -- Batchsize for sending and receiving chunks from chunks cache
batchSize: 4
# -- Parallel threads for sending and receiving chunks from chunks cache
@@ -3788,7 +3788,7 @@ chunksCache:
# -- Specifies whether memcached based chunks-cache-l2 should be enabled
enabled: false
# -- Comma separated addresses list in DNS Service Discovery format
- addresses: 'dnssrvnoa+_memcached-client._tcp.{{ include "loki.resourceName" (dict "ctx" $ "component" "chunks-cache" "suffix" $.Values.chunksCache.l2.suffix ) }}.{{ include "loki.namespace" $ }}.svc'
+ addresses: 'dnssrvnoa+_memcached-client._tcp.{{ include "loki.resourceName" (dict "ctx" $ "component" "chunks-cache" "suffix" $.Values.chunksCache.l2.suffix ) }}.{{ include "loki.namespace" $ }}.svc.{{ .Values.global.clusterDomain }}'
# -- Batchsize for sending and receiving chunks from chunks cache
batchSize: 4
# -- Parallel threads for sending and receiving chunks from chunks cache