Start adding scheduled stop for container
parent
a84cbed217
commit
cc8ca41915
|
@ -130,6 +130,12 @@ COPY automount/minikube-automount.service /usr/lib/systemd/system/minikube-autom
|
|||
RUN ln -fs /usr/lib/systemd/system/minikube-automount.service \
|
||||
/etc/systemd/system/multi-user.target.wants/minikube-automount.service
|
||||
|
||||
# scheduled stop service
|
||||
COPY scheduled-stop/stop.sh /var/lib/minikube/scheduled-stop/minikube-scheduled-stop
|
||||
COPY scheduled-stop/minikube-scheduled-stop.service /usr/lib/systemd/system/minikube-scheduled-stop.service
|
||||
RUN ln -fs /usr/lib/systemd/system/minikube-scheduled-stop.service \
|
||||
/etc/systemd/system/multi-user.target.wants/minikube-scheduled-stop.service
|
||||
|
||||
# disable non-docker runtimes by default
|
||||
RUN systemctl disable containerd && systemctl disable crio && rm /etc/crictl.yaml
|
||||
# enable docker which is default
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
|
||||
echo "running scheduled stop ...";
|
||||
|
||||
echo "sleeping %$SLEEP seconds..."
|
||||
sleep $SLEEP
|
||||
|
||||
echo "running poweroff..."
|
||||
sudo systemctl poweroff
|
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=minikube scheduled stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
ExecStart=/var/lib/minikube/scheduled-stop/minikube-scheduled-stop
|
||||
EnvironmentFile=/var/lib/minikube/scheduled-stop/environment
|
|
@ -79,6 +79,10 @@ const (
|
|||
MinikubeForceSystemdEnv = "MINIKUBE_FORCE_SYSTEMD"
|
||||
// TestDiskUsedEnv is used in integration tests for insufficient storage with 'minikube status'
|
||||
TestDiskUsedEnv = "MINIKUBE_TEST_STORAGE_CAPACITY"
|
||||
|
||||
// scheduled stop constants
|
||||
ScheduledStopEnvFile = "/var/lib/minikube/scheduled-stop/environment"
|
||||
ScheduledStopSystemdService = "minikube-scheduled-stop"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
Loading…
Reference in New Issue