|
| 1 | +import useBaseUrl from '@docusaurus/useBaseUrl'; |
| 2 | + |
| 3 | +# Sleep Mode |
| 4 | + |
| 5 | +Sleep mode is the act of scaling the replicas of a workload to 0 for a specified period of time. With sleep mode, you can put the DevSpace to sleep which means that Kubernetes will delete all pods but the entire configuration within the DevSpace is still there. |
| 6 | + |
| 7 | +## What workloads support sleep? |
| 8 | + |
| 9 | +* `StatefulSet` |
| 10 | +* `Deployment` |
| 11 | +* `CronJob` |
| 12 | + |
| 13 | +## How to sleep/wakeup? |
| 14 | + |
| 15 | +You can trigger sleep/wakeup in three different ways. |
| 16 | + |
| 17 | +* In the `DevSpace` management page, customize the sleep time period, and the eligible `DevSpace` will automatically trigger sleep/wakeup. |
| 18 | +<figure className="img-frame"> |
| 19 | + <img className="gif-img" src={useBaseUrl('/img/sleep/custom.png')} /> |
| 20 | +</figure> |
| 21 | + |
| 22 | +* In the `DevSpace` management page, manually trigger sleep/wakeup. |
| 23 | +<figure className="img-frame"> |
| 24 | + <img className="gif-img" src={useBaseUrl('/img/sleep/dashboard.png')} /> |
| 25 | +</figure> |
| 26 | + |
| 27 | +* In JetBrains Plugin / VSCode Plugin, manually trigger sleep/wakeup. |
| 28 | +<figure className="img-frame"> |
| 29 | + <img className="gif-img" src={useBaseUrl('/img/sleep/jetbrains.png')} /> |
| 30 | +</figure> |
| 31 | + |
| 32 | +## How does `sleep` works? |
| 33 | + |
| 34 | +- `StatefulSet`: set `spec.replicas: 0` |
| 35 | +- `Deployment`: set `spec.replicas: 0` |
| 36 | +- `CronJob`: set `spec.suspend: true` |
| 37 | + |
| 38 | +## How does `wakeup` works? |
| 39 | + |
| 40 | +- `StatefulSet`: restore `spec.replicas` |
| 41 | +- `Deployment`: restore `spec.replicas` |
| 42 | +- `CronJob`: set `spec.suspend: false` |
| 43 | + |
| 44 | +## Notes |
| 45 | + |
| 46 | +- By default, `Nocalhost` performs a round of sleep checks every `10s`. |
| 47 | +- Workloads that are already in `DevMode` will be ignored and will not be sleep. |
| 48 | +- `DevSpace` that are manually sleep by the user will not automatically wakeup that day. |
| 49 | +- `DevSpace` that are manually wakeup by the user will not automatically sleep that day. |
| 50 | +- When the user clears all sleep settings, the `DevSpace` that has gone into sleep will automatically wakeup. |
| 51 | + |
0 commit comments