Period
Understanding Periods
Periods define when and how your resources should be scaled. Each scaler (K8s, Gcp, or Flow) can contain multiple period definitions that control scaling behavior based on time patterns.
Key Concepts
- Sequential Evaluation: Periods are evaluated in order, with the first matching period taking precedence
- Named Periods: Use the optional
namefield to identify periods, especially when referencing them in Flow resources - Reverse Mode: Use the
reversefield to invert period logic – making it inactive during the specified time range and active outside of it - One-time Scaling: Set
once: trueto apply scaling only when entering or leaving a time range, preventing interference with manual scaling - Inclusive End Time: The
endTimeis inclusive, meaning a period remains active until the last second before the specified end time (e.g.,endTime: "00:00"stays active until23:59:59) - Same-day Periods Only: For recurring periods,
startTimeandendTimemust both fall within the same calendar day. Midnight-crossing ranges (e.g.startTime: "22:00",endTime: "07:00") are not supported and will return a configuration error. Usereverse: trueon the equivalent daytime window to achieve the same result (see example below).
Warning
Recurring periods cannot cross midnight. A period with startTime: "22:00" and endTime: "07:00" is invalid because the end time is before the start time within the same day. Use reverse: true instead.
Note
When once is enabled, KubeCloudScaler will only scale resources when transitioning into or out of the specified time range. Manual scaling operations will not be overridden.
Period Structure
periods:
- type: "down" # Required: "down" or "up"
name: "my-period" # Optional: period name (alphanumeric, hyphens, underscores)
minReplicas: 0 # Optional: minimum replica count
maxReplicas: 10 # Optional: maximum replica count
time:
recurring: { ... } # Use recurring OR fixed, not both
fixed: { ... }Period Types
Recurring Periods
Recurring periods repeat on a daily basis according to specified days and times.
Time Format: HH:MM (24-hour format)
Available days: monday, tuesday, wednesday, thursday, friday, saturday, sunday, all
Fields:
| Field | Required | Description |
|---|---|---|
days | Yes | List of day names or all |
startTime | Yes | Start time in HH:MM format |
endTime | Yes | End time in HH:MM format |
timezone | No | IANA timezone (e.g., Europe/Paris) |
once | No | Only scale on period transition |
reverse | No | Invert the period (active outside the time range) |
gracePeriod | No | Duration before scaling (e.g., 60s) |
Fixed Periods
Fixed periods occur at specific dates and times, useful for one-time events or maintenance windows.
Time Format: YYYY-MM-DD HH:MM:SS
Fields:
| Field | Required | Description |
|---|---|---|
startTime | Yes | Start date/time in YYYY-MM-DD HH:MM:SS format |
endTime | Yes | End date/time in YYYY-MM-DD HH:MM:SS format |
timezone | No | IANA timezone (e.g., Europe/Paris) |
once | No | Only scale on period transition |
reverse | No | Invert the period |
gracePeriod | No | Duration before scaling (e.g., 120s) |
Configuration Examples
Scenario: Scale down resources during off-hours
periods:
- type: "down"
name: "off-hours"
minReplicas: 0
maxReplicas: 10
time:
recurring:
days:
- all
startTime: "01:00"
endTime: "22:50"
timezone: "Europe/Paris"Note
Resources are scaled down to 0 replicas daily from 1:00 AM to 10:50 PM (Paris time).