From 1841fbe3f482f544e672bb8cca4b6450c75530b7 Mon Sep 17 00:00:00 2001 From: Yury Kulazhenkov Date: Tue, 9 Apr 2024 14:38:48 +0300 Subject: [PATCH 1/2] Change system dependencies for "post" systemd service This is required to be compatible with OVS installations, which use SysV init scripts (wrapped with systemd-sysv-generator). On such systems, OVS may depend on the network-online.target, so the start order of services changes (OVS will start after the "post" service). The proposed solution is to add the following explicit dependencies After: openvswitch-switch.service Before: kubelet.service. Note: the dependency is ignored if the openvswitch-switch.service is not found. Signed-off-by: Yury Kulazhenkov --- .../kubernetes/sriov-config-post-network-service.yaml | 6 +++--- .../openshift/sriov-config-service.yaml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bindata/manifests/sriov-config-service/kubernetes/sriov-config-post-network-service.yaml b/bindata/manifests/sriov-config-service/kubernetes/sriov-config-post-network-service.yaml index ecfb4c108..08c8bce76 100644 --- a/bindata/manifests/sriov-config-service/kubernetes/sriov-config-post-network-service.yaml +++ b/bindata/manifests/sriov-config-service/kubernetes/sriov-config-post-network-service.yaml @@ -1,8 +1,8 @@ contents: | [Unit] Description=Configures SRIOV NIC - post network configuration - After=systemd-networkd-wait-online.service NetworkManager-wait-online.service - Before=network-online.target + After=systemd-networkd-wait-online.service NetworkManager-wait-online.service openvswitch-switch.service + Before=kubelet.service [Service] Type=oneshot @@ -10,6 +10,6 @@ contents: | StandardOutput=journal+console [Install] - WantedBy=network-online.target + WantedBy=multi-user.target enabled: true name: sriov-config-post-network.service diff --git a/bindata/manifests/sriov-config-service/openshift/sriov-config-service.yaml b/bindata/manifests/sriov-config-service/openshift/sriov-config-service.yaml index 62b919f6f..706679430 100644 --- a/bindata/manifests/sriov-config-service/openshift/sriov-config-service.yaml +++ b/bindata/manifests/sriov-config-service/openshift/sriov-config-service.yaml @@ -33,8 +33,8 @@ spec: # Removal of this file signals firstboot completion ConditionPathExists=!/etc/ignition-machine-config-encapsulated.json Description=Configures SRIOV NIC - post network configuration - After=systemd-networkd-wait-online.service NetworkManager-wait-online.service - Before=network-online.target + After=systemd-networkd-wait-online.service NetworkManager-wait-online.service openvswitch-switch.service + Before=kubelet.service [Service] Type=oneshot @@ -42,6 +42,6 @@ spec: StandardOutput=journal+console [Install] - WantedBy=network-online.target + WantedBy=multi-user.target enabled: true name: "sriov-config-post-network.service" From 359282a87662e50c8d27daf59927dd74348bf883 Mon Sep 17 00:00:00 2001 From: Yury Kulazhenkov Date: Fri, 12 Apr 2024 16:00:13 +0300 Subject: [PATCH 2/2] Use `systemctl reenable` command to enable services We use reenable command (the command is a combination of disable+enable) to reset symlinks for the unit and make sure that only symlinks that are currently configured in the [Install] section exist for the service. Signed-off-by: Yury Kulazhenkov --- pkg/host/internal/service/service.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/host/internal/service/service.go b/pkg/host/internal/service/service.go index f1574526f..c8705068a 100644 --- a/pkg/host/internal/service/service.go +++ b/pkg/host/internal/service/service.go @@ -97,8 +97,11 @@ func (s *service) EnableService(service *types.Service) error { } defer exit() - // Enable service - _, _, err = s.utilsHelper.RunCommand("systemctl", "enable", service.Name) + // Enable the service + // we use reenable command (the command is a combination of disable+enable) to reset + // symlinks for the unit and make sure that only symlinks that are currently + // configured in the [Install] section exist for the service. + _, _, err = s.utilsHelper.RunCommand("systemctl", "reenable", service.Name) return err }