SocialEngine / rancher-cron

A service that can start containers on a defined schedule.
MIT License
130 stars 13 forks source link

Disable cron for "Stopped" services #9

Open ghost opened 8 years ago

ghost commented 8 years ago

While debugging (or calming backend services) I sometimes need to temporarily disable a cron-ed service.

I tried setting the service to "Stopped" but rancher-cron runs the service anyway. My current workaround is to "upgrade" services and change the rancher-cron label to something like 'off....' to preserve the crontab entry format but disable.

It would be ideal if rancher-cron could poll the api and not start cron services if they are "Stopped"

smazurov commented 8 years ago

Good idea, thats easy enough, just add a check here and "continue" if service.status is stopped.

I'm pretty busy at the moment, I plan to certainly address it in the future, otherwise PRs are welcome!

jmloeffler commented 7 years ago

I took a quick look at this. At first glance I'd say the major hangup is that the rancher-metadata service does not expose the state of the service. It only does so for containers and that's not helpful because the containers themselves are naturally going to be stopped most of the time.

smazurov commented 7 years ago

Yeah, metadata might not be the best option for this - its great to quickly get a container with a specific label, but not much else (for this use case). Rancher API does have ability to get Service by Id (service.uuid) and Service has HealthState

jmloeffler commented 7 years ago

Any chance of rolling out a new release so that these changes are available in the official image?