Skip to content

Instantly share code, notes, and snippets.

@spacepluk
Last active October 3, 2016 23:48
Show Gist options
  • Select an option

  • Save spacepluk/a14f10cfed3756c0f1f079e73cdc6c9a to your computer and use it in GitHub Desktop.

Select an option

Save spacepluk/a14f10cfed3756c0f1f079e73cdc6c9a to your computer and use it in GitHub Desktop.
commit 426024c6e2cc424fc958fab9245fc131ff67579a
Author: Oscar Morante <oscar.morante@mirada.tv>
Date: Thu Sep 15 21:54:59 2016 +0300
Workaround for systemd #1312
diff --git a/multi-node/aws/pkg/config/templates/cloud-config-controller b/multi-node/aws/pkg/config/templates/cloud-config-controller
index 24fa5b9..f5a4226 100644
--- a/multi-node/aws/pkg/config/templates/cloud-config-controller
+++ b/multi-node/aws/pkg/config/templates/cloud-config-controller
@@ -21,8 +21,8 @@ coreos:
- name: 40-flannel.conf
content: |
[Unit]
- Requires=flanneld.service
- After=flanneld.service
+ Wants=flanneld.service
+ ExecStartPre=systemctl is-active flanneld.service
[Service]
EnvironmentFile=/etc/kubernetes/cni/docker_opts_cni.env
@@ -90,8 +90,8 @@ coreos:
[Unit]
Description=Load rkt stage1 images
Documentation=http://github.com/coreos/rkt
- Requires=network-online.target
- After=network-online.target
+ Wants=network-online.target
+ ExecStartPre=systemctl is-active network-online.target
Before=rkt-api.service
[Service]
Type=oneshot
@@ -107,8 +107,8 @@ coreos:
content: |
[Unit]
Description=Calico per-host agent
- Requires=network-online.target
- After=network-online.target
+ Wants=network-online.target
+ ExecStartPre=systemctl is-active network-online.target
[Service]
Slice=machine.slice
@@ -137,8 +137,8 @@ coreos:
[Unit]
Description=decrypt kubelet tls assets using amazon kms
Before=kubelet.service
- After=docker.service
- Requires=docker.service
+ ExecStartPre=systemctl is-active docker.service
+ Wants=docker.service
[Service]
Type=oneshot
@@ -152,8 +152,8 @@ coreos:
command: start
content: |
[Unit]
- Requires=kubelet.service docker.service
- After=kubelet.service docker.service
+ Wants=kubelet.service docker.service
+ ExecStartPre=systemctl is-active kubelet.service docker.service
[Service]
Type=simple
@@ -167,8 +167,8 @@ coreos:
command: start
content: |
[Unit]
- Requires=kubelet.service docker.service
- After=kubelet.service docker.service
+ Wants=kubelet.service docker.service
+ ExecStartPre=systemctl is-active kubelet.service docker.service
[Service]
Type=simple
diff --git a/multi-node/aws/pkg/config/templates/cloud-config-worker b/multi-node/aws/pkg/config/templates/cloud-config-worker
index 6f919d9..0a39ad1 100644
--- a/multi-node/aws/pkg/config/templates/cloud-config-worker
+++ b/multi-node/aws/pkg/config/templates/cloud-config-worker
@@ -11,8 +11,8 @@ coreos:
- name: 40-flannel.conf
content: |
[Unit]
- Requires=flanneld.service
- After=flanneld.service
+ Wants=flanneld.service
+ ExecStartPre=systemctl is-active flanneld.service
[Service]
EnvironmentFile=/etc/kubernetes/cni/docker_opts_cni.env
@@ -74,8 +74,8 @@ coreos:
[Unit]
Description=Load rkt stage1 images
Documentation=http://github.com/coreos/rkt
- Requires=network-online.target
- After=network-online.target
+ Wants=network-online.target
+ ExecStartPre=systemctl is-active network-online.target
Before=rkt-api.service
[Service]
Type=oneshot
@@ -91,8 +91,8 @@ coreos:
content: |
[Unit]
Description=Calico per-host agent
- Requires=network-online.target
- After=network-online.target
+ Wants=network-online.target
+ ExecStartPre=systemctl is-active network-online.target
[Service]
Slice=machine.slice
@@ -121,8 +121,8 @@ coreos:
[Unit]
Description=decrypt kubelet tls assets using amazon kms
Before=kubelet.service
- After=docker.service
- Requires=docker.service
+ ExecStartPre=systemctl is-active docker.service
+ Wants=docker.service
[Service]
Type=oneshot
@mumoshu

mumoshu commented Sep 29, 2016

Copy link
Copy Markdown

Hey, thanks for sharing this!
Sorry for being nit-picky but ExecStartPres in [Unit] sections seem to be ignored by systemd.
You will want to move these to [Service] sections.

Relevant logs follows. See Unknown lvalue 'ExecStartPre' in section 'Unit' messages indicating systemd is ignoring them.

Sep 28 14:18:36 ip-10-0-0-172.ap-northeast-1.compute.internal systemd[1]: [/etc/systemd/system/docker.service.d/40-flannel.conf:3] Unknown lvalue 'ExecStartPre' in section 'Unit'
Sep 28 14:18:36 ip-10-0-0-172.ap-northeast-1.compute.internal systemd[1]: Started Garbage Collection for rkt.
Sep 28 14:18:36 ip-10-0-0-172.ap-northeast-1.compute.internal sshd_keygen[786]: ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
Sep 28 14:18:36 ip-10-0-0-172.ap-northeast-1.compute.internal systemd[1]: Starting Generate /run/coreos/motd...
Sep 28 14:18:36 ip-10-0-0-172.ap-northeast-1.compute.internal coreos-cloudinit[893]: 2016/09/28 14:18:36 Calling unit command "start" on "kubelet.service"'
Sep 28 14:18:36 ip-10-0-0-172.ap-northeast-1.compute.internal systemd[1]: Started Generate /run/coreos/motd.
Sep 28 14:18:36 ip-10-0-0-172.ap-northeast-1.compute.internal systemd[1]: [/run/systemd/system/kubelet.service:2] Unknown lvalue 'ExecStartPre' in section 'Unit'

@spacepluk

Copy link
Copy Markdown
Author

Hi,
No problem :) I didn't notice that. Did you fix it in your PR?

@mumoshu

mumoshu commented Oct 3, 2016

Copy link
Copy Markdown

@spacepluk Definitely yes! FYI, the PR can be located at coreos/coreos-kubernetes#697

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment