From 2f768a3b69b75814f25f197b60150faca6f07986 Mon Sep 17 00:00:00 2001 From: RyanSwanson Date: Wed, 18 Dec 2024 05:56:53 -0700 Subject: [PATCH] SleepMode docs w/pending config reference --- .../experimental/native-sleep-mode.mdx | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 vcluster/configure/vcluster-yaml/experimental/native-sleep-mode.mdx diff --git a/vcluster/configure/vcluster-yaml/experimental/native-sleep-mode.mdx b/vcluster/configure/vcluster-yaml/experimental/native-sleep-mode.mdx new file mode 100644 index 00000000..70939bbe --- /dev/null +++ b/vcluster/configure/vcluster-yaml/experimental/native-sleep-mode.mdx @@ -0,0 +1,76 @@ +--- +title: Experimental Sleep Mode +sidebar_label: sleepMode +sidebar_position: 7 +sidebar_class_name: pro +description: Configure a vCluster to sleep/wake without an agent +--- + +import ProAdmonition from '../../../_partials/admonitions/pro-admonition.mdx' + + + +:::warning +Native sleep mode is intended for pre-production use cases only, and comes with some limitations and +caveats. +::: + +### Configuration examples + +#### Sleep after 3 hours of inactivity, anything that does not have the label `dont=sleep` + +```yaml +experimental: + sleepMode: + enabled: true + autoSleep: + afterInactivity: 3h # Uses Go's Duration with a max unit of hour + exclude: + selector: + labels: + dont: sleep +``` + +#### Sleep every Friday at 17:30 and wake every Monday at 7:00 in Mountain timezone + +```yaml +experimental: + sleepMode: + enabled: true + timezone: America/Denver + autoSleep: + schedule: 30 17 * * 5 + wakeup: + schedule: 0 7 * * 1 +``` + +### How it works + +**Sleeping** will delete bare pods and scale down the following resources: + * Deployments + * ReplicaSets + * ReplicationControllers + * DaemonSets + +**Waking** will scale those resources back up, but it will be unable to restore bare pods. To exempt resources from being +put to sleep, either add the annotation `sleepmode.loft.sh/exclude: true` or configure sleep mode with labels to exclude and +add that label to all the workloads you'd like to keep running. + +### Detecting activity + +To wake a sleeping cluster or to update the last active time, native sleep mode captures the following: + + * Access of cluster resources. _Think `kubectl get `_ + * Attempts to contact Ingress endpoints (NGINX only). + +:::info Note: +Ingress activity detection is only available for [NGINX](https://github.com/kubernetes/ingress-nginx/tree/main) +ingress controllers, making use of the [mirror-target](https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md#mirror) +annotation. If you use this annotation, it will be overwritten for the sleep mode to function. +::: + +## Config reference + +:::info 🚧 +Coming soon +:::