Helm chart: Add enableServiceLinks (#7129)

**What this PR does / why we need it**:
This is to allow disable `enableServiceLinks` so that the service
environments are not injected into the pods where in my scenario Loki is
deployed in the same namespace as the Knative services resulted the Loki
pod unable to start up due to too many service environment being
injected.

Reference issue for pod unable to startup due to too many services:
https://github.com/kubernetes/kubernetes/issues/84539#issue-514261281

Co-authored-by: Trevor Whitney <trevorjwhitney@gmail.com>
pull/8179/head helm-loki-4.2.0
TAY TS 2 years ago committed by GitHub
parent 399eb097fd
commit 94ee5a2930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      docs/sources/installation/helm/reference.md
  2. 2
      production/helm/loki/Chart.yaml
  3. 2
      production/helm/loki/README.md
  4. 11
      production/helm/loki/templates/_helpers.tpl
  5. 3
      production/helm/loki/templates/gateway/deployment-gateway.yaml
  6. 1
      production/helm/loki/templates/read/statefulset-read.yaml
  7. 1
      production/helm/loki/templates/single-binary/statefulset.yaml
  8. 1
      production/helm/loki/templates/write/statefulset-write.yaml
  9. 3
      production/helm/loki/values.yaml

@ -1583,6 +1583,15 @@ See values.yaml
"readOnlyRootFilesystem": true
}
</pre>
</td>
</tr>
<tr>
<td>loki.enableServiceLinks</td>
<td>bool</td>
<td>Should enableServiceLinks be enabled. Default to enable</td>
<td><pre lang="json">
true
</pre>
</td>
</tr>
<tr>

@ -4,7 +4,7 @@ name: loki
description: Helm chart for Grafana Loki in simple, scalable mode
type: application
appVersion: 2.7.0
version: 4.1.0
version: 4.2.0
home: https://grafana.github.io/helm-charts
sources:
- https://github.com/grafana/loki

@ -1,6 +1,6 @@
# loki
![Version: 4.1.0](https://img.shields.io/badge/Version-4.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.7.0](https://img.shields.io/badge/AppVersion-2.7.0-informational?style=flat-square)
![Version: 4.2.0](https://img.shields.io/badge/Version-4.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.7.0](https://img.shields.io/badge/AppVersion-2.7.0-informational?style=flat-square)
Helm chart for Grafana Loki in simple, scalable mode

@ -651,3 +651,14 @@ http {
}
}
{{- end }}
{{/* Configure enableServiceLinks in pod */}}
{{- define "loki.enableServiceLinks" -}}
{{- if semverCompare ">=1.13-0" .Capabilities.KubeVersion.Version -}}
{{- if or (.Values.loki.enableServiceLinks) (ne .Values.loki.enableServiceLinks false) -}}
enableServiceLinks: true
{{- else -}}
enableServiceLinks: false
{{- end -}}
{{- end -}}
{{- end -}}

@ -37,7 +37,8 @@ spec:
{{- end }}
{{- include "loki.gatewaySelectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "loki.serviceAccountName" . -}}
serviceAccountName: {{ include "loki.serviceAccountName" . }}
{{ include "loki.enableServiceLinks" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}

@ -53,6 +53,7 @@ spec:
spec:
serviceAccountName: {{ include "loki.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{ include "loki.enableServiceLinks" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}

@ -44,6 +44,7 @@ spec:
spec:
serviceAccountName: {{ include "loki.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{ include "loki.enableServiceLinks" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}

@ -45,6 +45,7 @@ spec:
spec:
serviceAccountName: {{ include "loki.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{ include "loki.enableServiceLinks" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}

@ -69,6 +69,8 @@ loki:
drop:
- ALL
allowPrivilegeEscalation: false
# -- Should enableServiceLinks be enabled. Default to enable
enableServiceLinks: true
# -- Specify an existing secret containing loki configuration. If non-empty, overrides `loki.config`
existingSecretForConfig: ""
# -- Config file contents for Loki
@ -1141,7 +1143,6 @@ gateway:
htpasswd: >-
{{ htpasswd (required "'gateway.basicAuth.username' is required" .Values.gateway.basicAuth.username) (required "'gateway.basicAuth.password' is required" .Values.gateway.basicAuth.password) }}
# -- Existing basic auth secret to use. Must contain '.htpasswd'
existingSecret: null
# Configures the readiness probe for the gateway

Loading…
Cancel
Save