-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Describe the bug
The Loki helm chart fails to deploy on older Kubernetes clusters due to Pod Disruption budget being moved to stable policy/v1beta1 to policy/v1. We are using an old verison of Kubernetes that is still on the policy/v1beta1 endpoint. It appears a template exists in _helpers.tpl that correctly determines which apiVersion to use. However, this template does not appear to be applied in every file. This results in an error message when installing the chart.
_helpers.tpl template
{{- define "loki.pdb.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "policy/v1") (semverCompare ">=1.21-0" .Capabilities.KubeVersion.Version) -}}
{{- print "policy/v1" -}}
{{- else -}}
{{- print "policy/v1beta1" -}}
{{- end -}}
{{- end -}}
Affected files:
https://github.com/grafana/loki/blob/main/production/helm/loki/templates/read/poddisruptionbudget-read.yaml#L4
https://github.com/grafana/loki/blob/main/production/helm/loki/templates/backend/poddisruptionbudget-backend.yaml
https://github.com/grafana/loki/blob/main/production/helm/loki/templates/gateway/poddisruptionbudget-gateway.yaml
https://github.com/grafana/loki/blob/main/production/helm/loki/templates/single-binary/pdb.yaml
https://github.com/grafana/loki/blob/main/production/helm/loki/templates/write/poddisruptionbudget-write.yaml
To Reproduce
Steps to reproduce the behavior:
- Run helm install against the latest version of the helm chart on a Kubernetes cluster with version < 1.21
- Notice that an error message is printed complaining about missing CRDs
Expected behavior
The helm install to succeed without error.
Suggested Solution
Use the helpers.tpl template to correctly identify the API version for PodDisruptionBudget.
Environment:
- Infrastructure: Kubernetes 1.20.11
- Deployment tool: helm
