Skip to content

Commit d5430fa

Browse files
authored
feat(restarter): switch to rancher/kubectl image with auto versioning (#500)
* feat(restarter): switch to rancher/kubectl image with auto versioning * PR fix
1 parent 483a3f0 commit d5430fa

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

charts/netdata/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ The following table lists the configurable parameters of the netdata chart and t
166166
| `APIKEY` | The key shared between the parent and the child netdata for streaming | `11111111-2222-3333-4444-555555555555` |
167167
| `restarter.enabled` | Install CronJob to update Netdata Pods | `false` |
168168
| `restarter.schedule` | The schedule in Cron format | `00 06 * * *` |
169-
| `restarter.image.repository` | Container image repo | `bitnami/kubectl` |
170-
| `restarter.image.tag` | Container image tag | `1.25` |
169+
| `restarter.image.repository` | Container image repo | `rancher/kubectl` |
170+
| `restarter.image.tag` | Container image tag if `.auto`, the image tag version of `rancher/kubectl` will reflect the Kubernetes cluster version | `.auto` |
171171
| `restarter.image.pullPolicy` | Container image pull policy | `Always` |
172172
| `restarter.image.restartPolicy` | Container restart policy | `Never` |
173173
| `restarter.image.resources` | Container resources | `{}` |

charts/netdata/templates/restarter/cronjob.yaml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{{- if include "netdata.restarter.enabled" . }}
22
---
3-
{{- $cmdList := list }}
4-
{{- $cmd := printf "kubectl rollout restart deployment %s-parent" (include "netdata.name" .) }}
5-
{{- $cmdList = append $cmdList (ternary $cmd "" .Values.parent.enabled) }}
6-
{{- $cmd = printf "kubectl rollout restart daemonset %s-child" (include "netdata.name" .) }}
7-
{{- $cmdList = append $cmdList (ternary $cmd "" .Values.child.enabled) }}
8-
{{- $cmd = printf "kubectl rollout restart deployment %s-k8s-state" (include "netdata.name" .) }}
9-
{{- $cmdList = append $cmdList (ternary $cmd "" .Values.k8sState.enabled) }}
10-
{{- $cmdList = compact $cmdList }}
3+
{{- $argsList := list }}
4+
{{- $args := printf "deployment/%s-parent" (include "netdata.name" .) }}
5+
{{- $argsList = append $argsList (ternary $args "" .Values.parent.enabled) }}
6+
{{- $args = printf "daemonset/%s-child" (include "netdata.name" .) }}
7+
{{- $argsList = append $argsList (ternary $args "" .Values.child.enabled) }}
8+
{{- $args = printf "deployment/%s-k8s-state" (include "netdata.name" .) }}
9+
{{- $argsList = append $argsList (ternary $args "" .Values.k8sState.enabled) }}
10+
{{- $argsList = compact $argsList }}
1111
apiVersion: batch/v1
1212
kind: CronJob
1313
metadata:
@@ -31,12 +31,10 @@ spec:
3131
{{- end }}
3232
containers:
3333
- name: netdata-restarter
34-
image: {{ .Values.restarter.image.repository }}:{{ .Values.restarter.image.tag }}
34+
image: {{ .Values.restarter.image.repository }}:{{ ternary (printf "v%s.%s.0" .Capabilities.KubeVersion.Major .Capabilities.KubeVersion.Minor) .Values.restarter.image.tag (eq (.Values.restarter.image.tag | toString) ".auto") }}
3535
imagePullPolicy: {{ .Values.restarter.image.pullPolicy }}
3636
resources:
3737
{{ toYaml .Values.restarter.resources | indent 16 }}
38-
command:
39-
- "/bin/bash"
40-
- "-c"
41-
- {{ $cmdList | join " && " }}
38+
args:
39+
{{ toYaml (concat (list "rollout" "restart") $argsList) | indent 16 }}
4240
{{- end }}

charts/netdata/values.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ restarter:
8484
enabled: false
8585
schedule: "00 06 * * *"
8686
image:
87-
repository: bitnami/kubectl
88-
tag: 1.25
87+
repository: rancher/kubectl
88+
# if `.auto`, the image tag version of the rancher/kubectl will reflect the Kubernetes cluster version
89+
tag: .auto
8990
pullPolicy: Always
9091
restartPolicy: Never
9192
resources: {}

0 commit comments

Comments
 (0)