Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
fix: ensure we wait for the right CRI service name (#4115)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis authored Dec 15, 2020
1 parent 3f77233 commit f5e4f97
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 62 deletions.
2 changes: 1 addition & 1 deletion parts/k8s/cloud-init/artifacts/docker-monitor.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=a script that checks docker health and restarts if needed
After=docker.service
After={{GetContainerRuntime}}.service
[Service]
Restart=always
RestartSec=10
Expand Down
6 changes: 1 addition & 5 deletions parts/k8s/cloud-init/artifacts/kubelet.service
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
[Unit]
Description=Kubelet
ConditionPathExists=/usr/local/bin/kubelet
{{- if NeedsContainerd}}
Requires=containerd.service
{{else}}
Requires=docker.service
{{- end}}
Requires={{GetContainerRuntime}}.service

[Service]
Restart=always
Expand Down
15 changes: 3 additions & 12 deletions parts/k8s/cloud-init/masternodecustomdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,14 @@ write_files:
Slice={{- GetKubeReservedCgroup -}}.slice
#EOF
{{if NeedsContainerd}}
- path: /etc/systemd/system/containerd.service.d/kubereserved-slice.conf
- path: /etc/systemd/system/{{GetContainerRuntime}}.service.d/kubereserved-slice.conf
permissions: "0644"
owner: root
content: |
[Service]
Slice={{- GetKubeReservedCgroup -}}.slice
#EOF
{{else}}
- path: /etc/systemd/system/docker.service.d/kubereserved-slice.conf
permissions: "0644"
owner: root
content: |
[Service]
Slice={{- GetKubeReservedCgroup -}}.slice
#EOF
{{end}}
{{end}}
{{- end}}

- path: /usr/local/bin/health-monitor.sh
permissions: "0544"
Expand Down Expand Up @@ -139,6 +129,7 @@ write_files:
content: !!binary |
{{CloudInitData "kubeletSystemdService"}}

{{- /* for historical reasons, we overload the name "docker" here; in fact this monitor service supports both docker and containerd */}}
- path: /etc/systemd/system/docker-monitor.service
permissions: "0644"
encoding: gzip
Expand Down
17 changes: 4 additions & 13 deletions parts/k8s/cloud-init/nodecustomdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,14 @@ write_files:
Slice={{- GetKubeReservedCgroup -}}.slice
#EOF
{{if NeedsContainerd}}
- path: /etc/systemd/system/containerd.service.d/kubereserved-slice.conf
- path: /etc/systemd/system/{{GetContainerRuntime}}.service.d/kubereserved-slice.conf
permissions: "0644"
owner: root
content: |
[Service]
Slice={{- GetKubeReservedCgroup -}}.slice
#EOF
{{else}}
- path: /etc/systemd/system/docker.service.d/kubereserved-slice.conf
permissions: "0644"
owner: root
content: |
[Service]
Slice={{- GetKubeReservedCgroup -}}.slice
#EOF
{{end}}
{{end}}
{{- end}}

{{- if HasKubeletHealthZPort}}
- path: /etc/systemd/system/kubelet-monitor.service
Expand Down Expand Up @@ -144,6 +134,7 @@ write_files:
content: !!binary |
{{CloudInitData "kubeletSystemdService"}}

{{- /* for historical reasons, we overload the name "docker" here; in fact this monitor service supports both docker and containerd */}}
- path: /etc/systemd/system/docker-monitor.service
permissions: "0644"
encoding: gzip
Expand Down Expand Up @@ -424,7 +415,7 @@ coreos:
drop-ins:
- name: "10-flatcar.conf"
content: |
After=docker.service
After={{GetContainerRuntime}}.service
[Service]
ExecStart=
ExecStart=/opt/bin/health-monitor.sh container-runtime
Expand Down
40 changes: 9 additions & 31 deletions pkg/engine/templates_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f5e4f97

Please sign in to comment.