Skip to content

Commit

Permalink
rework kubelet configuration to have a file instead of bash script (#427
Browse files Browse the repository at this point in the history
)

rework kubelet configuration to have a file instead of bash script
  • Loading branch information
calvix authored Nov 21, 2023
1 parent 19889b0 commit 88b82a2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
4 changes: 4 additions & 0 deletions helm/cluster-aws/files/etc/kubelet-configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
shutdownGracePeriod: 300s
shutdownGracePeriodCriticalPods: 60s
5 changes: 0 additions & 5 deletions helm/cluster-aws/files/opt/kubelet-config.sh

This file was deleted.

1 change: 0 additions & 1 deletion helm/cluster-aws/templates/_control_plane.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ spec:
{{- include "flatcarKubeadmPreCommands" . | nindent 4 }}
{{- if .Values.connectivity.proxy.enabled }}{{- include "proxyCommand" $ | nindent 4 }}{{- end }}
postKubeadmCommands:
{{- include "kubeletConfigPostKubeadmCommands" . | nindent 4 }}
{{- include "controlPlanePostKubeadmCommands" . | nindent 4 }}
{{- if .Values.internal.migration.controlPlanePostKubeadmCommands -}}
{{- toYaml .Values.internal.migration.controlPlanePostKubeadmCommands | nindent 4 }}
Expand Down
12 changes: 5 additions & 7 deletions helm/cluster-aws/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ giantswarm.io/prevent-deletion: "true"
key: registry-config.toml
{{- end -}}
{{- define "kubeletConfigFiles" -}}
- path: /opt/kubelet-config.sh
- path: /etc/kubelet-configuration.yaml
permissions: "0700"
encoding: base64
content: {{ $.Files.Get "files/opt/kubelet-config.sh" | b64enc }}
content: {{ .Files.Get "files/etc/kubelet-configuration.yaml" | b64enc }}
- path: /etc/systemd/logind.conf.d/zzz-kubelet-graceful-shutdown.conf
permissions: "0700"
encoding: base64
content: {{ $.Files.Get "files/etc/systemd/logind.conf.d/zzz-kubelet-graceful-shutdown.conf" | b64enc }}
content: {{ .Files.Get "files/etc/systemd/logind.conf.d/zzz-kubelet-graceful-shutdown.conf" | b64enc }}
{{- end -}}

{{- define "kubernetesFiles" -}}
Expand Down Expand Up @@ -272,10 +272,6 @@ and is used to join the node to the teleport cluster.
- /opt/control-plane-config.sh
{{- end -}}

{{- define "kubeletConfigPostKubeadmCommands" -}}
- /bin/sh /opt/kubelet-config.sh
{{- end -}}

{{- define "sshUsers" -}}
- name: giantswarm
groups: sudo
Expand Down Expand Up @@ -364,6 +360,8 @@ imageLookupOrg: "706635527432"
{{- define "flatcarKubeadmPreCommands" -}}
- envsubst < /etc/kubeadm.yml > /etc/kubeadm.yml.tmp
- mv /etc/kubeadm.yml.tmp /etc/kubeadm.yml
- echo "---" >> /etc/kubeadm.yml
- cat /etc/kubelet-configuration.yaml >> /etc/kubeadm.yml
{{- end -}}

{{/*
Expand Down
2 changes: 0 additions & 2 deletions helm/cluster-aws/templates/_machine_pools.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ spec:
{{- include "flatcarKubeadmPreCommands" . | nindent 4 }}
{{- include "sshPreKubeadmCommands" . | nindent 4 }}
{{- if $.Values.connectivity.proxy.enabled }}{{- include "proxyCommand" $ | nindent 4 }}{{- end }}
postKubeadmCommands:
{{- include "kubeletConfigPostKubeadmCommands" . | nindent 4 }}
users:
{{- include "sshUsers" . | nindent 2 }}
files:
Expand Down

0 comments on commit 88b82a2

Please sign in to comment.