Skip to content

Commit d3a392c

Browse files
committed
- sleep mode
Signed-off-by: Weijie <[email protected]>
1 parent 2f20671 commit d3a392c

File tree

6 files changed

+103
-0
lines changed

6 files changed

+103
-0
lines changed

docs/guides/sleep-mode-en.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+

docs/guides/sleep-mode.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import useBaseUrl from '@docusaurus/useBaseUrl';
2+
3+
# 休眠模式
4+
5+
休眠模式是在指定的时间内将工作负载副本数缩为 0 的一种行为,通过休眠模式,您可以让开发空间进入睡眠状态,这意味着 Kubernetes 将删除所有 pods,但开发空间内的资源配置仍然存在。
6+
7+
## 支持休眠的工作负载类型
8+
9+
* `StatefulSet`
10+
* `Deployment`
11+
* `CronJob`
12+
13+
## 如何休眠/唤醒?
14+
15+
您可以通过以下三种不同的方式触发休眠/唤醒:
16+
17+
*`DevSpace` 管理页面,自定义休眠时间段,符合条件的开发空间将自动触发休眠/唤醒。
18+
19+
<figure className="img-frame">
20+
<img className="gif-img" src={useBaseUrl('/img/sleep/custom.png')} />
21+
</figure>
22+
23+
*`DevSpace` 管理页面,手动触发休眠/唤醒。
24+
<figure className="img-frame">
25+
<img className="gif-img" src={useBaseUrl('/img/sleep/dashboard.png')} />
26+
</figure>
27+
28+
* 在 JetBrains 插件 / VSCode 插件,手动触发休眠/唤醒。
29+
<figure className="img-frame">
30+
<img className="gif-img" src={useBaseUrl('/img/sleep/jetbrains.png')} />
31+
</figure>
32+
33+
## 休眠原理
34+
35+
- `StatefulSet`: 设置 `spec.replicas: 0`
36+
- `Deployment`: 设置 `spec.replicas: 0`
37+
- `CronJob`: 设置 `spec.suspend: true`
38+
39+
## 唤醒原理
40+
41+
- `StatefulSet`: 恢复 `spec.replicas`
42+
- `Deployment`: 恢复 `spec.replicas`
43+
- `CronJob`: 设置 `spec.suspend: false`
44+
45+
## 注意事项
46+
47+
- 默认情况下,`Nocalhost`每隔`10s`执行一轮休眠检查。
48+
- 已进入 `DevMode` 的工作负载,将会被忽略,不执行休眠处理;
49+
- 用户手动休眠的开发空间,当天将不会自动唤醒;
50+
- 用户手动唤醒的开发空间,当天将不会自动休眠;
51+
- 当用户清除所有休眠时间设定,已进入休眠的开发空间将被自动唤醒;

sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ module.exports = {
6969
'guides/remote-run',
7070
// Hot Reload
7171
'guides/hot-reload',
72+
'guides/sleep-mode',
7273
// 'guides/clear-pvc',
7374
]
7475
},

static/img/sleep/custom.png

178 KB
Loading

static/img/sleep/dashboard.png

183 KB
Loading

static/img/sleep/jetbrains.png

120 KB
Loading

0 commit comments

Comments
 (0)