Skip to content

Commit

Permalink
[stable/kube-downscaler] Kube-Downscaler does not respect release nam…
Browse files Browse the repository at this point in the history
…espace when templating (#601)

* Kube-Downscaler does not respect release namespace when templating

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 }}
```

* Bump version for change

* Regenerate docs

* Regenerate docs
  • Loading branch information
hlascelles authored Sep 17, 2024
1 parent 0b42082 commit ad2432b
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Follow these steps:
1. Fork this repo
2. Make desired changes to the chart
3. Bump the chart version
4. Regenerate the chart `README.md`: `docker run --rm -v "${PWD}:/helm-docs" jnorwood/helm-docs:v1.11.3 --template-files ./ci/README.md.gotmpl`
4. Regenerate the chart `README.md`. Run from the repo root: `docker run --rm -v "${PWD}:/helm-docs" jnorwood/helm-docs:v1.11.3 --template-files ./ci/README.md.gotmpl`
5. Commit and push changes
6. Open 1 pull request per chart you want to change
7. Set pull request title to `[stable/<chart name>]: <description>`
Expand Down
2 changes: 1 addition & 1 deletion stable/kube-downscaler/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: kube-downscaler
apiVersion: v1
version: "0.7.4"
version: "0.7.5"
appVersion: 23.2.0-6-gc9b88e8
description: Scale down Kubernetes deployments after work hours
keywords:
Expand Down
2 changes: 1 addition & 1 deletion stable/kube-downscaler/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# kube-downscaler

![Version: 0.7.4](https://img.shields.io/badge/Version-0.7.4-informational?style=flat-square) ![AppVersion: 23.2.0-6-gc9b88e8](https://img.shields.io/badge/AppVersion-23.2.0--6--gc9b88e8-informational?style=flat-square)
![Version: 0.7.5](https://img.shields.io/badge/Version-0.7.5-informational?style=flat-square) ![AppVersion: 23.2.0-6-gc9b88e8](https://img.shields.io/badge/AppVersion-23.2.0--6--gc9b88e8-informational?style=flat-square)

Scale down Kubernetes deployments after work hours

Expand Down
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 ad2432b

Please sign in to comment.