Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

How to change sleeping time in kube-green

In the namespace where you want to enable kube-green, apply the SleepInfo CRD To get the sleepinfo config for all namespaces, you can use the following command : kubectl get sleepinfo --all-namespace

If you want to configure the desired namespace, you can run the following command : For example, we will configure the hh-ballbot namespace

kubectl edit sleepinfo -n hh-ballbot

it will open your default Editor app

tThe SleepInfo spec contains :weekdays
Day of the week. * is every day, 1 is monday, 1-5 is from monday to friday
sleepAt
Time in hours and minutes (HH:mm) when namespace will go to sleep. Valid values are, for example, 19:00 or:* for every minute and every hour.
Resources sleep will be deployments (setting replicas value to 0) and, if suspendCronjobs option is set to true, cron jobs will be suspended.
wakeUpAt
Time in hours and minutes (HH:mm) when namespace should be restored to the initial state (before sleep). Valid values are, for example, 19:00 or:* for every minute and every hour. If wake up value is not set, pod in namespace will not be restored. So, you will need to deploy the initial namespace configuration to restore it.
timeZone
Time zone in IANA specification. For example for jakarta hour, set Asia/Jakarta.

In the hh-ballbot namespace has been implemented with this CRD, it is configured to sleep until 20:00 and wake until 20:10 everyday.
If you want to apply a different configuration, you can change this section :
spec:
  sleepAt: '20:00'
  timeZone: Asia/Jakarta
  wakeUpAt: '20:10'
  weekdays: '*'

If it is correct, save the changeswith the command if you use VIM:

type :wq then press Enter


that way, kube-green will adjust to these changes.