Skip to content

Commit

Permalink
- sleep mode
Browse files Browse the repository at this point in the history
Signed-off-by: Weijie <[email protected]>
  • Loading branch information
ovaldi committed Dec 28, 2021
1 parent 2f20671 commit 3f4464f
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/guides/sleep-mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import useBaseUrl from '@docusaurus/useBaseUrl';

# 休眠模式

休眠模式是在指定的时间内将工作负载副本数缩为 0 的一种行为,通过休眠模式,您可以让开发空间进入睡眠状态,这意味着 Kubernetes 将删除所有 pods,但开发空间内的资源配置仍然存在。

## 支持休眠的工作负载类型

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

## 如何休眠/唤醒?

您可以通过以下三种不同的方式触发休眠/唤醒:

*`DevSpace` 管理页面,自定义休眠时间段,符合条件的开发空间将自动触发休眠/唤醒。

<figure className="img-frame">
<img className="gif-img" src={useBaseUrl('/img/sleep/custom.png')} />
</figure>

*`DevSpace` 管理页面,手动触发休眠/唤醒。
<figure className="img-frame">
<img className="gif-img" src={useBaseUrl('/img/sleep/dashboard.png')} />
</figure>

* 在 JetBrains 插件 / VSCode 插件,手动触发休眠/唤醒。
<figure className="img-frame">
<img className="gif-img" src={useBaseUrl('/img/sleep/jetbrains.png')} />
</figure>

## 休眠原理

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

## 唤醒原理

- `StatefulSet`: 恢复 `spec.replicas`
- `Deployment`: 恢复 `spec.replicas`
- `CronJob`: 设置 `spec.suspend: false`

## 注意事项

- 默认情况下,`10s` 执行一轮休眠检查,符合条件的开发空间将自动执行休眠/唤醒;
- 当用户清除所有休眠时间设定,已进入休眠的开发空间将在下一轮检查中自动唤醒;
- 已进入 `DevMode` 的工作负载,将会被忽略,不作休眠处理;
- 用户手动休眠的开发空间,当天将不会自动唤醒;
- 用户手动唤醒的开发空间,当天将不会自动休眠;
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.

0 comments on commit 3f4464f

Please sign in to comment.