Skip to content

Commit d5a2651

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

File tree

5 files changed

+51
-0
lines changed

5 files changed

+51
-0
lines changed

docs/guides/sleep-mode.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
* 在 Nocalhost 后台自定义休眠时间段
18+
<figure className="img-frame">
19+
<img className="gif-img" src={useBaseUrl('/img/sleep/custom.png')} />
20+
</figure>
21+
22+
* 在 Nocalhost 后台,手动触发休眠/唤醒
23+
<figure className="img-frame">
24+
<img className="gif-img" src={useBaseUrl('/img/sleep/dashboard.png')} />
25+
</figure>
26+
27+
* 在 JetBrains 插件 / VSCode 插件,手动触发休眠/唤醒
28+
<figure className="img-frame">
29+
<img className="gif-img" src={useBaseUrl('/img/sleep/jetbrains.png')} />
30+
</figure>
31+
32+
## 休眠原理
33+
34+
- `StatefulSet`: 设置 `spec.replicas: 0`
35+
- `Deployment`: 设置 `spec.replicas: 0`
36+
- `CronJob`: 设置 `spec.suspend: true`
37+
38+
## 唤醒原理
39+
40+
- `StatefulSet`: 恢复 `spec.replicas`
41+
- `Deployment`: 恢复 `spec.replicas`
42+
- `CronJob`: 设置 `spec.suspend: false`
43+
44+
## 注意事项
45+
46+
- 默认情况下,`10s` 执行一轮休眠检查,对符合条件的开发空间,自动执行休眠/唤醒;
47+
- 当用户清除所有休眠时间设定,已进入休眠的开发空间将在下一轮检查中被自动唤醒;
48+
- 已经进入 `DevMode` 的工作负载,将会被忽略,不作休眠处理;
49+
- 用户手动休眠的开发空间,当天将不会自动唤醒;
50+
- 用户手动唤醒的开发空间,当天将不会自动休眠;

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)