The SleepSchedule Custom Resource Definition (CRD) manages the sleeping and waking of Kubernetes deployments based on a defined schedule or manual triggers. To track the current state of the system and operations, the CRD uses a set of standardized conditions stored in its status field.
This document describes the conditions used and how they reflect the state of the system.
The SleepSchedule CRD uses four conditions:
| Condition | Description | Possible Values | Reason Examples |
|---|---|---|---|
Sleeping |
Indicates whether the system is asleep. | True / False |
ScheduledSleep, ManualSleep, ScheduledWakeUp, ManualWakeUp |
Transitioning |
Indicates if a sleep or wake operation is in progress. | True / False |
Sleeping, WakingUp, NoTransition |
ManualOverride |
Indicates if the current state was triggered manually. | True / False |
Sleep, WakeUp, NoOverride |
Error |
Captures failures during operations. | True / False |
ScaleFailed, IngressUpdateFailed, NoError |
- True: The specified deployments are scaled down and the ingress is modified to show the sleep page.
- False: The deployments are running and ingress is in its original state.
- Reasons:
ScheduledSleep: Sleep was initiated by the schedule.ManualSleep: Sleep was manually triggered.ScheduledWakeUp: Wake was initiated by the schedule.ManualWakeUp: Wake was manually triggered.InitialValue: Initial value set for a new sleep schedule.
- True: A sleep or wake operation is in progress.
- False: No ongoing operations.
- Reasons:
Sleeping: Deployments are going to sleep.WakingUp: Deployments are waking up.NoTransition: No transition operation in progress.
- True: The current sleeping or awake state was triggered manually.
- False: The state was set by the schedule.
- Reasons:
WakeUp: Manual wake up action requested the user.Sleep: Manual sleep action requested the user.NoOverride: No manual intervention present.
- True: The last operation failed.
- False: No errors occurred in the most recent operation.
- Reasons:
ScaleFailed: Failed to scale deployments.IngressSleepFailed: Failed to update ingress to sleep page.IngressWakeUpFailed: Failed to restore ingress to original state.NoError: No errors present.
status:
conditions:
- type: Sleeping
status: "True"
lastTransitionTime: "2025-02-21T23:00:00Z"
reason: ScheduledSleep
message: "Deployments have been scaled down and ingress updated."
- type: Transitioning
status: "False"
lastTransitionTime: "2025-02-21T23:01:00Z"
reason: NoTransition
message: "No transition in progress."
- type: ManualOverride
status: "False"
lastTransitionTime: "2025-02-21T23:02:00Z"
reason: NoManualOverride
message: "No manual override present."
- type: Error
status: "False"
lastTransitionTime: "2025-02-21T23:01:00Z"
reason: NoError- Set
Transitioning=Truewithreason=Sleeping. - Scale down deployments and update ingress.
- Set
Sleeping=True,Transitioning=Falsewithreason=ScheduledSleep.
- User triggers wake via web endpoint.
- Set
ManualOverride=TrueandTransitioning=Truewithreason=ManualWakeUp. - Scale up deployments and restore ingress.
- Set
Sleeping=False,Transitioning=Falsewithreason=ManualWakeUp. - Set
ManualOverride=False.
- If an error occurs during sleep or wake:
- Set
Error=Truewith an appropriatereasonandmessage. Transitioning=Falseindicates the operation stopped.
- Set
lastTransitionTimereflects when the condition last changed.Transitioning=Trueindicates in-progress operations and should beFalseotherwise.ManualOverride=Truepersists until the next scheduled state change unless cleared.Error=Trueshould reset toFalseafter a successful subsequent operation.