diff --git a/docs/guides/sleep-mode.md b/docs/guides/sleep-mode.md new file mode 100644 index 000000000..84622ba4d --- /dev/null +++ b/docs/guides/sleep-mode.md @@ -0,0 +1,51 @@ +import useBaseUrl from '@docusaurus/useBaseUrl'; + +# 休眠模式 + +休眠模式是在指定的时间内将工作负载副本数缩为 0 的一种行为,通过休眠模式,您可以让开发空间进入睡眠状态,这意味着 Kubernetes 将删除所有 pods,但开发空间内的资源配置仍然存在。 + +## 支持休眠的工作负载类型 + +* `StatefulSet` +* `Deployment` +* `CronJob` + +## 如何休眠/唤醒? + +您可以通过以下三种不同的方式触发休眠/唤醒: + +* 在 `DevSpace` 管理页面,自定义休眠时间段,符合条件的开发空间将自动触发休眠/唤醒。 + +
+ +
+ +* 在 `DevSpace` 管理页面,手动触发休眠/唤醒。 +
+ +
+ +* 在 JetBrains 插件 / VSCode 插件,手动触发休眠/唤醒。 +
+ +
+ +## 休眠原理 + +- `StatefulSet`: 设置 `spec.replicas: 0` +- `Deployment`: 设置 `spec.replicas: 0` +- `CronJob`: 设置 `spec.suspend: true` + +## 唤醒原理 + +- `StatefulSet`: 恢复 `spec.replicas` +- `Deployment`: 恢复 `spec.replicas` +- `CronJob`: 设置 `spec.suspend: false` + +## 注意事项 + +- 默认情况下,`10s` 执行一轮休眠检查,符合条件的开发空间将自动执行休眠/唤醒; +- 当用户清除所有休眠时间设定,已进入休眠的开发空间将在下一轮检查中自动唤醒; +- 已进入 `DevMode` 的工作负载,将会被忽略,不作休眠处理; +- 用户手动休眠的开发空间,当天将不会自动唤醒; +- 用户手动唤醒的开发空间,当天将不会自动休眠; diff --git a/sidebars.js b/sidebars.js index 46badfdc8..d0c3079e3 100644 --- a/sidebars.js +++ b/sidebars.js @@ -69,6 +69,7 @@ module.exports = { 'guides/remote-run', // Hot Reload 'guides/hot-reload', + 'guides/sleep-mode', // 'guides/clear-pvc', ] }, diff --git a/static/img/sleep/custom.png b/static/img/sleep/custom.png new file mode 100644 index 000000000..30b73ec42 Binary files /dev/null and b/static/img/sleep/custom.png differ diff --git a/static/img/sleep/dashboard.png b/static/img/sleep/dashboard.png new file mode 100644 index 000000000..7a165c073 Binary files /dev/null and b/static/img/sleep/dashboard.png differ diff --git a/static/img/sleep/jetbrains.png b/static/img/sleep/jetbrains.png new file mode 100644 index 000000000..2085e47aa Binary files /dev/null and b/static/img/sleep/jetbrains.png differ