From ce2c20f884fcb0ce34fd3bef95275bf79e447ed1 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 30 Apr 2020 20:22:10 +0000 Subject: [PATCH] templates: Add a special machine-config-daemon-firstboot-v42.service This is aiming to fix: https://bugzilla.redhat.com/show_bug.cgi?id=1829642 AKA https://github.com/openshift/machine-config-operator/pull/1215#issuecomment-622081019 Basically we have our systemd units dynamically differentiate between "4.2" and "4.3 or above" by looking at the aleph version. --- ...achine-config-daemon-firstboot-v42.service | 21 +++++++++++++++++++ .../machine-config-daemon-firstboot.service | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 templates/common/_base/units/machine-config-daemon-firstboot-v42.service diff --git a/templates/common/_base/units/machine-config-daemon-firstboot-v42.service b/templates/common/_base/units/machine-config-daemon-firstboot-v42.service new file mode 100644 index 0000000000..f7db6ed856 --- /dev/null +++ b/templates/common/_base/units/machine-config-daemon-firstboot-v42.service @@ -0,0 +1,21 @@ +name: "machine-config-daemon-firstboot-v42.service" +enabled: true +contents: | + [Unit] + Description=Machine Config Daemon Firstboot (4.2 bootimage) + # Make sure it runs only on OSTree booted system + ConditionPathExists=/run/ostree-booted + BindsTo=ignition-firstboot-complete.service + ConditionPathExists=/etc/ignition-machine-config-encapsulated.json + # Note the opposite of this in machine-config-daemon-firstboot + ConditionPathExists=!/sysroot/.coreos-aleph-version.json + After=ignition-firstboot-complete.service + Before=kubelet.service + + [Service] + # Need oneshot to delay kubelet + Type=oneshot + ExecStart=/usr/libexec/machine-config-daemon pivot + + [Install] + WantedBy=multi-user.target diff --git a/templates/common/_base/units/machine-config-daemon-firstboot.service b/templates/common/_base/units/machine-config-daemon-firstboot.service index 67754e1e6d..61ac9a9836 100644 --- a/templates/common/_base/units/machine-config-daemon-firstboot.service +++ b/templates/common/_base/units/machine-config-daemon-firstboot.service @@ -7,6 +7,9 @@ contents: | ConditionPathExists=/run/ostree-booted BindsTo=ignition-firstboot-complete.service ConditionPathExists=/etc/ignition-machine-config-encapsulated.json + # We only want to run on 4.3 clusters and above; this came from + # https://github.com/coreos/coreos-assembler/pull/768 + ConditionPathExists=/sysroot/.coreos-aleph-version.json After=ignition-firstboot-complete.service Before=kubelet.service