mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
Merge pull request #5623 from zmerlynn/fix_salt_daemon_kill
Ensure salt-minion never starts
This commit is contained in:
commit
4877f4504d
@ -128,6 +128,19 @@ install-salt() {
|
|||||||
)
|
)
|
||||||
URL_BASE="https://storage.googleapis.com/kubernetes-release/salt"
|
URL_BASE="https://storage.googleapis.com/kubernetes-release/salt"
|
||||||
|
|
||||||
|
# Based on
|
||||||
|
# https://major.io/2014/06/26/install-debian-packages-without-starting-daemons/
|
||||||
|
# We do this to prevent Salt from starting the salt-minion
|
||||||
|
# daemon. The other packages don't have relevant daemons. (If you
|
||||||
|
# add a package that needs a daemon started, add it to a different
|
||||||
|
# list.)
|
||||||
|
cat > /usr/sbin/policy-rc.d <<EOF
|
||||||
|
#!/bin/sh
|
||||||
|
echo "Salt shall not start." >&2
|
||||||
|
exit 101
|
||||||
|
EOF
|
||||||
|
chmod 0755 /usr/sbin/policy-rc.d
|
||||||
|
|
||||||
for tar in "${TARS[@]}"; do
|
for tar in "${TARS[@]}"; do
|
||||||
download-or-bust "${URL_BASE}/${tar}"
|
download-or-bust "${URL_BASE}/${tar}"
|
||||||
dpkg -i "${tar}" || true
|
dpkg -i "${tar}" || true
|
||||||
@ -135,19 +148,19 @@ install-salt() {
|
|||||||
|
|
||||||
# This will install any of the unmet dependencies from above.
|
# This will install any of the unmet dependencies from above.
|
||||||
apt-get install -f -y
|
apt-get install -f -y
|
||||||
|
|
||||||
|
rm /usr/sbin/policy-rc.d
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure salt-minion *isn't* running
|
# Ensure salt-minion never runs
|
||||||
stop-salt-minion() {
|
stop-salt-minion() {
|
||||||
# This ensures it on next reboot
|
# This ensures it on next reboot
|
||||||
echo manual > /etc/init/salt-minion.override
|
echo manual > /etc/init/salt-minion.override
|
||||||
|
|
||||||
service salt-minion stop
|
if service salt-minion status >/dev/null; then
|
||||||
while service salt-minion status >/dev/null; do
|
echo "salt-minion started in defiance of runlevel policy, aborting startup." >&2
|
||||||
service salt-minion stop # No, really.
|
return 1
|
||||||
echo "Waiting for salt-minion to shut down"
|
fi
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Mounts a persistent disk (formatting if needed) to store the persistent data
|
# Mounts a persistent disk (formatting if needed) to store the persistent data
|
||||||
|
Loading…
Reference in New Issue
Block a user