-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exit init-process when all services have died #18
Comments
Note however that the kubernetes restart-policy includes livenessProbe / readinessProbe actions that do not rely on the existance of a PID-1 https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy |
I can add that
|
Instead of checking for dead services I have impemented atleast the most basic condition for an exit - if the systemctl.py init process finds itself to be alone in a container then it will exit. In the case that all the "systemctl halt" services have correctly stopped, thereby killing all its children, then the systemctl.py will stop as well. That's also okay for a debugging POV as there is nothing left to attach to. The only missing point is the exit status of PID 1. What shall it return? A forking service will not transmit an exit code. Neither oneshot - basically it does only make sense when there is a type=simple service and one would ask systemctl.py to mimic the behaviour as if someone has been extracting the ExecStart statement to make a docker-entrypoint.sh with a final exec-$cmd. Or is there more to it? |
I have cut out the remaining features to "exit init-process when the required services have died" #27 ... while I am closing this ticket for the current milestone. In most situation it will do what is expected. Note that I was rethinking it also as may be one could use /usr/bin/systemctl as the main process before running an actual service. In reality I found that simulations of an operating system in a container had the "cron" and possibly "sshd" running. So the list of processes is not empty. |
As an alternative to #14 where one will automatically restart the services inside a container:
There are cloud services like a kubernetes service which will watch over the status of the containers. If any container has stopped/failed then it will restart the container whereas actually restarting the service inside the container.
In order to cooperate with external docker container managers the "--init" function of systemctl.py should not loop infinitely. Instead if no controlled service is in the "running" status anymore then the PID-1 systemctl.py should exit. This might be just done after some timeout (waiting for the startup of a service) but atleast it should always be done. Even when not using an external docker container manager the status of the container gets more visible if "docker ps" shows it as having exited when all services in the container have exited one way or the other.
The text was updated successfully, but these errors were encountered: