Skip to content

Commit

Permalink
Kube-Downscaler does not respect release namespace when templating
Browse files Browse the repository at this point in the history
The `kube-downscaler` helm chart doesn't honor the namespace passed in to helm. This is because the chart is missing the typical metadata configuration on its kubernetes resources. ie, this problem is the same as this one for another chart: #216

To reproduce this problem:

```bash
helm fetch deliveryhero/kube-downscaler --version 0.7.4 --untar=true
helm template my-release kube-downscaler --namespace kube-systen  > kube-downscaler.yaml
```

The `deployment.yaml` and other files will have no namespace. ie, it is not configured here: https://github.com/deliveryhero/helm-charts/blob/0b420820e3f88d5e7f9f10ddd1c9a029adb9a422/stable/kube-downscaler/templates/deployment.yaml#L3

Fix is as below:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: "{{ $fullname }}-{{ .name }}"
  namespace: {{ .Release.Namespace }}
```
  • Loading branch information
hlascelles committed Sep 10, 2024
1 parent 0b42082 commit 310da2b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions stable/kube-downscaler/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ template "batch.apiVersion" . }}
kind: CronJob
metadata:
name: {{ template "kube-downscaler.fullname" . }}-de-annotate
namespace: {{ .Release.Namespace }}
labels:
{{ include "kube-downscaler.labels" . | indent 4 }}
{{- if .Values.extraLabels }}
Expand Down
1 change: 1 addition & 0 deletions stable/kube-downscaler/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "kube-downscaler.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{ include "kube-downscaler.labels" . | indent 4 }}
{{- if .Values.extraLabels }}
Expand Down
1 change: 1 addition & 0 deletions stable/kube-downscaler/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ metadata:
labels:
{{ include "kube-downscaler.labels" . | indent 4 }}
name: {{ template "kube-downscaler.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}

0 comments on commit 310da2b

Please sign in to comment.