Panfactum LogoPanfactum
Infrastructure ModulesSubmodulesKuberneteskube_disruption_window_controller
kube_disruption_window_controller
Stable
Submodule
Source Code Link

Disruption Window Controller

The Disruption Window Controller is a Panfactum-created addon that periodically enables voluntary disruptions by setting a PDB's maxUnavailable field to a non-zero value and then subsequently disables voluntary disruptions after some time by setting maxUnavailable to 0. The period where disruptions are enabled is referred to as the disruption window.

There may be many instances of this submodule running in the cluster and each is namespace-scoped. For example, we make use of this submodule in our database modules (e.g., kube_pg_cluster).

The controller will search for all PDBs in its namespace with the label panfactum.com/voluntary-disruption-window-id set to the disruption_window_id output from this module. Disruption windows will begin at the times indicated by the cron_schedule module input.

Disruption windows may be configured via annotations on the PDBs:

  • panfactum.com/voluntary-disruption-window-seconds: The minimum number of seconds that the disruption window will last. The maximum amount of time will be this value plus an additional 900 seconds (15 minutes). Defaults to 3600.

  • panfactum.com/voluntary-disruption-window-max-unavailable: During the disruption window, the PDB's maxUnavailable field will be set to this value. Defaults to 1.

Architecture

This addon is simply two CronJobs:

  • One runs on the cron_schedule and enables the disruption window by running the Panfactum CLI command pf-voluntary-disruptions-enable.

  • The other runs every 15 minutes and attempts to disable disruption windows that have exceeded a PDB's panfactum.com/voluntary-disruption-window-seconds annotation by running the Panfactum CLI command pf-voluntary-disruptions-disable.

Providers

The following providers are needed by this module:

  • kubectl (2.0.4)

  • kubernetes (2.27.0)

  • random (3.6.0)

Required Inputs

The following input variables are required:

namespace

Description: The namespace the PDBs are in

Type: string

Optional Inputs

The following input variables are optional (have default values):

cron_schedule

Description: The times when disruption windows should start

Type: string

Default: "0 4 * * *"

panfactum_scheduler_enabled

Description: Whether to use the Panfactum pod scheduler with enhanced bin-packing

Type: bool

Default: true

pull_through_cache_enabled

Description: Whether to use the ECR pull through cache for the annotator images

Type: bool

Default: true

vpa_enabled

Description: Whether to enable the vertical pod autoscaler

Type: bool

Default: true

Outputs

The following outputs are exported:

disruption_window_id

Description: n/a