Skip to content
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

WIP: sleep mode #165

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions docs/guides/sleep-mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import useBaseUrl from '@docusaurus/useBaseUrl';

# Sleep Mode

Sleep mode is the act of scaling the replicas of a workload to 0 within a specified 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.

## What workloads support sleep?

* `StatefulSet`
* `Deployment`
* `CronJob`

## How to sleep/wakeup?

You can trigger sleep/wakeup in three different ways.

* Customize the sleep time period in the `DevSpace` management page, the `DevSpace` will automatically sleep/wakeup.
<figure className="img-frame">
<img className="gif-img" src={useBaseUrl('/img/sleep/custom.png')} />
</figure>

* Manually trigger sleep/wakeup in the `DevSpace` management page.
<figure className="img-frame">
<img className="gif-img" src={useBaseUrl('/img/sleep/dashboard.png')} />
</figure>

* Manually trigger sleep/wakeup in the JetBrains Plugin / VSCode Plugin.
<figure className="img-frame">
<img className="gif-img" src={useBaseUrl('/img/sleep/jetbrains.png')} />
</figure>

## How does `sleep` works?

- `StatefulSet`: set `spec.replicas: 0`
- `Deployment`: set `spec.replicas: 0`
- `CronJob`: set `spec.suspend: true`

## How does `wakeup` works?

- `StatefulSet`: restore `spec.replicas`
- `Deployment`: restore `spec.replicas`
- `CronJob`: set `spec.suspend: false`

## Notes

- By default, `Nocalhost` performs a round of sleep checks every `10s`.
- Workloads that are already in `DevMode` will be ignored and will not be sleep.
- `DevSpace` that are manually sleep by the user will not automatically wakeup on the same day.
- `DevSpace` that are manually wakeup by the user will not automatically sleep on the same day.
- When the user clears all sleep settings, the `DevSpace` that has gone to sleep will wake up automatically.
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module.exports = {
'guides/remote-run',
// Hot Reload
'guides/hot-reload',
'guides/sleep-mode',
// 'guides/clear-pvc',
]
},
Expand Down
Binary file added static/img/sleep/custom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/sleep/dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/sleep/jetbrains.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.