Skip to content

Commit

Permalink
SleepMode docs w/pending config reference
Browse files Browse the repository at this point in the history
  • Loading branch information
zerbitx committed Dec 18, 2024
1 parent 6585edb commit 2f768a3
Showing 1 changed file with 76 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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'

<ProAdmonition />

:::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 <resource>`_
* 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
:::

0 comments on commit 2f768a3

Please sign in to comment.