@@ -206,8 +206,8 @@ func (c *ControlPlaneController) Reconcile(ctx context.Context, req ctrl.Request
206206
207207 commands := config .Spec .PreStartCommands
208208 commands = append (commands , downloadCommands ... )
209- commands = append (commands , "(command -v systemctl > /dev/null 2>&1 && (systemctl daemon-reload && systemctl enable k0sleave.service && systemctl start k0sleave.service) || true)" )
210- commands = append (commands , "(command -v rc-service > /dev/null 2>&1 && rc-update add k0sleave shutdown || true)" )
209+ commands = append (commands , "(command -v systemctl > /dev/null 2>&1 && (cp /k0s/k0sleave.service /etc/systemd/system/k0sleave.service && systemctl daemon-reload && systemctl enable k0sleave.service && systemctl start k0sleave.service) || true)" )
210+ commands = append (commands , "(command -v rc-service > /dev/null 2>&1 && (cp /k0s/k0sleave-openrc /etc/init.d/k0sleave && rc-update add k0sleave shutdown) || true)" )
211211 commands = append (commands , installCmd , "k0s start" )
212212 commands = append (commands , config .Spec .PostStartCommands ... )
213213 // Create the sentinel file as the last step so we know all previous _stuff_ has completed
@@ -614,11 +614,13 @@ MACHINE_NAME=${AUTOPILOT_HOSTNAME#"AUTOPILOT_HOSTNAME="}
614614IS_LEAVING=$(/usr/local/bin/k0s kc get controlnodes $MACHINE_NAME -o jsonpath='{.metadata.annotations.k0smotron\.io/leave}')
615615
616616if [ $IS_LEAVING = "true" ]; then
617- /usr/local/bin/k0s etcd leave
617+ until /usr/local/bin/k0s etcd leave; do
618+ sleep 1
619+ done
618620fi
619621` ,
620622 }, {
621- Path : "/etc/systemd/system /k0sleave.service" ,
623+ Path : "/k0s /k0sleave.service" ,
622624 Permissions : "0644" ,
623625 Content : `[Unit]
624626Description=k0s etcd leave service
@@ -637,7 +639,7 @@ WantedBy=multi-user.target
637639` ,
638640 },
639641 {
640- Path : "/etc/init.d/ k0sleave" ,
642+ Path : "/k0s/ k0sleave-openrc " ,
641643 Permissions : "0644" ,
642644 Content : `#!/sbin/openrc-run
643645
0 commit comments