Skip to content

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 name field to identify periods, especially when referencing them in Flow resources
  • Reverse Mode: Use the reverse field to invert period logic – making it inactive during the specified time range and active outside of it
  • One-time Scaling: Set once: true to apply scaling only when entering or leaving a time range, preventing interference with manual scaling
  • Inclusive End Time: The endTime is inclusive, meaning a period remains active until the last second before the specified end time (e.g., endTime: "00:00" stays active until 23:59:59)
  • Same-day Periods Only: For recurring periods, startTime and endTime must 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. Use reverse: true on 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:

FieldRequiredDescription
daysYesList of day names or all
startTimeYesStart time in HH:MM format
endTimeYesEnd time in HH:MM format
timezoneNoIANA timezone (e.g., Europe/Paris)
onceNoOnly scale on period transition
reverseNoInvert the period (active outside the time range)
gracePeriodNoDuration 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:

FieldRequiredDescription
startTimeYesStart date/time in YYYY-MM-DD HH:MM:SS format
endTimeYesEnd date/time in YYYY-MM-DD HH:MM:SS format
timezoneNoIANA timezone (e.g., Europe/Paris)
onceNoOnly scale on period transition
reverseNoInvert the period
gracePeriodNoDuration 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).