feat(helm): Add kubeVersionOverride for Helm chart (#14434)

Signed-off-by: Manuel Castellin <manuel@castellinconsulting.com>
pull/14560/head^2
Manuel Castellin 1 year ago committed by GitHub
parent 3d0236bc71
commit 0935d77df0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      docs/sources/setup/install/helm/reference.md
  2. 17
      production/helm/loki/templates/_helpers.tpl
  3. 2
      production/helm/loki/templates/backend/statefulset-backend.yaml
  4. 2
      production/helm/loki/templates/bloom-gateway/statefulset-bloom-gateway.yaml
  5. 2
      production/helm/loki/templates/bloom-planner/statefulset-bloom-planner.yaml
  6. 2
      production/helm/loki/templates/compactor/statefulset-compactor.yaml
  7. 2
      production/helm/loki/templates/index-gateway/statefulset-index-gateway.yaml
  8. 2
      production/helm/loki/templates/ingester/statefulset-ingester-zone-a.yaml
  9. 2
      production/helm/loki/templates/ingester/statefulset-ingester-zone-b.yaml
  10. 2
      production/helm/loki/templates/ingester/statefulset-ingester-zone-c.yaml
  11. 2
      production/helm/loki/templates/ingester/statefulset-ingester.yaml
  12. 2
      production/helm/loki/templates/pattern-ingester/statefulset-pattern-ingester.yaml
  13. 2
      production/helm/loki/templates/read/statefulset-read.yaml
  14. 2
      production/helm/loki/templates/single-binary/statefulset.yaml
  15. 2
      production/helm/loki/templates/write/statefulset-write.yaml
  16. 6
      production/helm/loki/values.yaml

@ -5800,6 +5800,15 @@ null
<td><pre lang="json"> <td><pre lang="json">
[] []
</pre> </pre>
</td>
</tr>
<tr>
<td>kubeVersionOverride</td>
<td>string</td>
<td>Overrides the version used to determine compatibility of resources with the target Kubernetes cluster. This is useful when using `helm template`, because then helm will use the client version of kubectl as the Kubernetes version, which may or may not match your cluster's server version. Example: 'v1.24.4'. Set to null to use the version that helm devises.</td>
<td><pre lang="json">
null
</pre>
</td> </td>
</tr> </tr>
<tr> <tr>

@ -540,11 +540,16 @@ Memcached Exporter Docker image
{{- include "loki.image" $dict -}} {{- include "loki.image" $dict -}}
{{- end }} {{- end }}
{{/* Allow KubeVersion to be overridden. */}}
{{- define "loki.kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}}
{{- end -}}
{{/* {{/*
Return the appropriate apiVersion for ingress. Return the appropriate apiVersion for ingress.
*/}} */}}
{{- define "loki.ingress.apiVersion" -}} {{- define "loki.ingress.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) -}} {{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" (include "loki.kubeVersion" .)) -}}
{{- print "networking.k8s.io/v1" -}} {{- print "networking.k8s.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}} {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
{{- print "networking.k8s.io/v1beta1" -}} {{- print "networking.k8s.io/v1beta1" -}}
@ -564,14 +569,14 @@ Return if ingress is stable.
Return if ingress supports ingressClassName. Return if ingress supports ingressClassName.
*/}} */}}
{{- define "loki.ingress.supportsIngressClassName" -}} {{- define "loki.ingress.supportsIngressClassName" -}}
{{- or (eq (include "loki.ingress.isStable" .) "true") (and (eq (include "loki.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}} {{- or (eq (include "loki.ingress.isStable" .) "true") (and (eq (include "loki.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" (include "loki.kubeVersion" .))) -}}
{{- end -}} {{- end -}}
{{/* {{/*
Return if ingress supports pathType. Return if ingress supports pathType.
*/}} */}}
{{- define "loki.ingress.supportsPathType" -}} {{- define "loki.ingress.supportsPathType" -}}
{{- or (eq (include "loki.ingress.isStable" .) "true") (and (eq (include "loki.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}} {{- or (eq (include "loki.ingress.isStable" .) "true") (and (eq (include "loki.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" (include "loki.kubeVersion" .))) -}}
{{- end -}} {{- end -}}
{{/* {{/*
@ -986,7 +991,7 @@ http {
{{/* Configure enableServiceLinks in pod */}} {{/* Configure enableServiceLinks in pod */}}
{{- define "loki.enableServiceLinks" -}} {{- define "loki.enableServiceLinks" -}}
{{- if semverCompare ">=1.13-0" .Capabilities.KubeVersion.Version -}} {{- if semverCompare ">=1.13-0" (include "loki.kubeVersion" .) -}}
{{- if or (.Values.loki.enableServiceLinks) (ne .Values.loki.enableServiceLinks false) -}} {{- if or (.Values.loki.enableServiceLinks) (ne .Values.loki.enableServiceLinks false) -}}
enableServiceLinks: true enableServiceLinks: true
{{- else -}} {{- else -}}
@ -1086,7 +1091,7 @@ checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256
Return the appropriate apiVersion for PodDisruptionBudget. Return the appropriate apiVersion for PodDisruptionBudget.
*/}} */}}
{{- define "loki.pdb.apiVersion" -}} {{- define "loki.pdb.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "policy/v1") (semverCompare ">=1.21-0" .Capabilities.KubeVersion.Version) -}} {{- if and (.Capabilities.APIVersions.Has "policy/v1") (semverCompare ">=1.21-0" (include "loki.kubeVersion" .)) -}}
{{- print "policy/v1" -}} {{- print "policy/v1" -}}
{{- else -}} {{- else -}}
{{- print "policy/v1beta1" -}} {{- print "policy/v1beta1" -}}
@ -1108,7 +1113,7 @@ Return the object store type for use with the test schema.
Return the appropriate apiVersion for HorizontalPodAutoscaler. Return the appropriate apiVersion for HorizontalPodAutoscaler.
*/}} */}}
{{- define "loki.hpa.apiVersion" -}} {{- define "loki.hpa.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "autoscaling/v2") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) -}} {{- if and (.Capabilities.APIVersions.Has "autoscaling/v2") (semverCompare ">= 1.19-0" (include "loki.kubeVersion" .)) -}}
{{- print "autoscaling/v2" -}} {{- print "autoscaling/v2" -}}
{{- else if .Capabilities.APIVersions.Has "autoscaling/v2beta2" -}} {{- else if .Capabilities.APIVersions.Has "autoscaling/v2beta2" -}}
{{- print "autoscaling/v2beta2" -}} {{- print "autoscaling/v2beta2" -}}

@ -32,7 +32,7 @@ spec:
partition: 0 partition: 0
serviceName: {{ include "loki.backendFullname" . }}-headless serviceName: {{ include "loki.backendFullname" . }}-headless
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.backend.persistence.enableStatefulSetAutoDeletePVC) (.Values.backend.persistence.volumeClaimsEnabled) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.backend.persistence.enableStatefulSetAutoDeletePVC) (.Values.backend.persistence.volumeClaimsEnabled) }}
{{/* {{/*
Data on the backend nodes is easy to replace, so we want to always delete PVCs to make Data on the backend nodes is easy to replace, so we want to always delete PVCs to make
operation easier, and will rely on re-fetching data when needed. operation easier, and will rely on re-fetching data when needed.

@ -19,7 +19,7 @@ spec:
partition: 0 partition: 0
serviceName: {{ include "loki.bloomGatewayFullname" . }}-headless serviceName: {{ include "loki.bloomGatewayFullname" . }}-headless
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.bloomGateway.persistence.enableStatefulSetAutoDeletePVC) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.bloomGateway.persistence.enableStatefulSetAutoDeletePVC) }}
persistentVolumeClaimRetentionPolicy: persistentVolumeClaimRetentionPolicy:
whenDeleted: {{ .Values.bloomGateway.persistence.whenDeleted }} whenDeleted: {{ .Values.bloomGateway.persistence.whenDeleted }}
whenScaled: {{ .Values.bloomGateway.persistence.whenScaled }} whenScaled: {{ .Values.bloomGateway.persistence.whenScaled }}

@ -19,7 +19,7 @@ spec:
partition: 0 partition: 0
serviceName: {{ include "loki.bloomPlannerFullname" . }}-headless serviceName: {{ include "loki.bloomPlannerFullname" . }}-headless
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.bloomPlanner.persistence.enableStatefulSetAutoDeletePVC) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.bloomPlanner.persistence.enableStatefulSetAutoDeletePVC) }}
persistentVolumeClaimRetentionPolicy: persistentVolumeClaimRetentionPolicy:
whenDeleted: {{ .Values.bloomPlanner.persistence.whenDeleted }} whenDeleted: {{ .Values.bloomPlanner.persistence.whenDeleted }}
whenScaled: {{ .Values.bloomPlanner.persistence.whenScaled }} whenScaled: {{ .Values.bloomPlanner.persistence.whenScaled }}

@ -20,7 +20,7 @@ spec:
partition: 0 partition: 0
serviceName: {{ include "loki.compactorFullname" . }}-headless serviceName: {{ include "loki.compactorFullname" . }}-headless
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.compactor.persistence.enableStatefulSetAutoDeletePVC) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.compactor.persistence.enableStatefulSetAutoDeletePVC) }}
persistentVolumeClaimRetentionPolicy: persistentVolumeClaimRetentionPolicy:
whenDeleted: {{ .Values.compactor.persistence.whenDeleted }} whenDeleted: {{ .Values.compactor.persistence.whenDeleted }}
whenScaled: {{ .Values.compactor.persistence.whenScaled }} whenScaled: {{ .Values.compactor.persistence.whenScaled }}

@ -18,7 +18,7 @@ spec:
{{- end }} {{- end }}
serviceName: {{ include "loki.indexGatewayFullname" . }}-headless serviceName: {{ include "loki.indexGatewayFullname" . }}-headless
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.indexGateway.persistence.enableStatefulSetAutoDeletePVC) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.indexGateway.persistence.enableStatefulSetAutoDeletePVC) }}
{{/* {{/*
Data on the read nodes is easy to replace, so we want to always delete PVCs to make Data on the read nodes is easy to replace, so we want to always delete PVCs to make
operation easier, and will rely on re-fetching data when needed. operation easier, and will rely on re-fetching data when needed.

@ -26,7 +26,7 @@ spec:
podManagementPolicy: Parallel podManagementPolicy: Parallel
serviceName: {{ include "loki.ingesterFullname" . }}-zone-a serviceName: {{ include "loki.ingesterFullname" . }}-zone-a
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.ingester.persistence.enableStatefulSetAutoDeletePVC) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.ingester.persistence.enableStatefulSetAutoDeletePVC) }}
{{/* {{/*
Data on the read nodes is easy to replace, so we want to always delete PVCs to make Data on the read nodes is easy to replace, so we want to always delete PVCs to make
operation easier, and will rely on re-fetching data when needed. operation easier, and will rely on re-fetching data when needed.

@ -26,7 +26,7 @@ spec:
podManagementPolicy: Parallel podManagementPolicy: Parallel
serviceName: {{ include "loki.ingesterFullname" . }}-zone-b serviceName: {{ include "loki.ingesterFullname" . }}-zone-b
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.ingester.persistence.enableStatefulSetAutoDeletePVC) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.ingester.persistence.enableStatefulSetAutoDeletePVC) }}
{{/* {{/*
Data on the read nodes is easy to replace, so we want to always delete PVCs to make Data on the read nodes is easy to replace, so we want to always delete PVCs to make
operation easier, and will rely on re-fetching data when needed. operation easier, and will rely on re-fetching data when needed.

@ -26,7 +26,7 @@ spec:
podManagementPolicy: Parallel podManagementPolicy: Parallel
serviceName: {{ include "loki.ingesterFullname" . }}-zone-c serviceName: {{ include "loki.ingesterFullname" . }}-zone-c
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.ingester.persistence.enableStatefulSetAutoDeletePVC) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.ingester.persistence.enableStatefulSetAutoDeletePVC) }}
{{/* {{/*
Data on the read nodes is easy to replace, so we want to always delete PVCs to make Data on the read nodes is easy to replace, so we want to always delete PVCs to make
operation easier, and will rely on re-fetching data when needed. operation easier, and will rely on re-fetching data when needed.

@ -23,7 +23,7 @@ spec:
{{- end }} {{- end }}
serviceName: {{ include "loki.ingesterFullname" . }}-headless serviceName: {{ include "loki.ingesterFullname" . }}-headless
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.ingester.persistence.enableStatefulSetAutoDeletePVC) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.ingester.persistence.enableStatefulSetAutoDeletePVC) }}
{{/* {{/*
Data on the read nodes is easy to replace, so we want to always delete PVCs to make Data on the read nodes is easy to replace, so we want to always delete PVCs to make
operation easier, and will rely on re-fetching data when needed. operation easier, and will rely on re-fetching data when needed.

@ -20,7 +20,7 @@ spec:
partition: 0 partition: 0
serviceName: {{ include "loki.patternIngesterFullname" . }}-headless serviceName: {{ include "loki.patternIngesterFullname" . }}-headless
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.patternIngester.persistence.enableStatefulSetAutoDeletePVC) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.patternIngester.persistence.enableStatefulSetAutoDeletePVC) }}
persistentVolumeClaimRetentionPolicy: persistentVolumeClaimRetentionPolicy:
whenDeleted: {{ .Values.patternIngester.persistence.whenDeleted }} whenDeleted: {{ .Values.patternIngester.persistence.whenDeleted }}
whenScaled: {{ .Values.patternIngester.persistence.whenScaled }} whenScaled: {{ .Values.patternIngester.persistence.whenScaled }}

@ -32,7 +32,7 @@ spec:
partition: 0 partition: 0
serviceName: {{ printf "%s-headless" (include "loki.readFullname" .) }} serviceName: {{ printf "%s-headless" (include "loki.readFullname" .) }}
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.read.persistence.enableStatefulSetAutoDeletePVC) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.read.persistence.enableStatefulSetAutoDeletePVC) }}
{{/* {{/*
Data on the read nodes is easy to replace, so we want to always delete PVCs to make Data on the read nodes is easy to replace, so we want to always delete PVCs to make
operation easier, and will rely on re-fetching data when needed. operation easier, and will rely on re-fetching data when needed.

@ -26,7 +26,7 @@ spec:
partition: 0 partition: 0
serviceName: {{ include "loki.singleBinaryFullname" . }}-headless serviceName: {{ include "loki.singleBinaryFullname" . }}-headless
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.singleBinary.persistence.enableStatefulSetAutoDeletePVC) (.Values.singleBinary.persistence.enabled) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.singleBinary.persistence.enableStatefulSetAutoDeletePVC) (.Values.singleBinary.persistence.enabled) }}
{{/* {{/*
Data on the singleBinary nodes is easy to replace, so we want to always delete PVCs to make Data on the singleBinary nodes is easy to replace, so we want to always delete PVCs to make
operation easier, and will rely on re-fetching data when needed. operation easier, and will rely on re-fetching data when needed.

@ -32,7 +32,7 @@ spec:
partition: 0 partition: 0
serviceName: {{ include "loki.writeFullname" . }}-headless serviceName: {{ include "loki.writeFullname" . }}-headless
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.write.persistence.enableStatefulSetAutoDeletePVC) (.Values.write.persistence.volumeClaimsEnabled) }} {{- if and (semverCompare ">= 1.23-0" (include "loki.kubeVersion" .)) (.Values.write.persistence.enableStatefulSetAutoDeletePVC) (.Values.write.persistence.volumeClaimsEnabled) }}
{{/* {{/*
Data on the write nodes is easy to replace, so we want to always delete PVCs to make Data on the write nodes is easy to replace, so we want to always delete PVCs to make
operation easier, and will rely on re-fetching data when needed. operation easier, and will rely on re-fetching data when needed.

@ -1,3 +1,9 @@
# -- Overrides the version used to determine compatibility of resources with the target Kubernetes cluster.
# This is useful when using `helm template`, because then helm will use the client version of kubectl as the Kubernetes version,
# which may or may not match your cluster's server version. Example: 'v1.24.4'. Set to null to use the version that helm
# devises.
kubeVersionOverride: null
global: global:
image: image:
# -- Overrides the Docker registry globally for all images # -- Overrides the Docker registry globally for all images

Loading…
Cancel
Save