Policy Algorithms
This page documents the controller policy algorithms implemented in cmd/operator/main.go.
Classification Input
Policy demand classification is derived from pod scheduling constraints on joulie.io/power-profile:
performance-only: pod can run only onperformance/draining-performance.eco-only: pod can run only oneco.general(implicit unconstrained): no explicit power-profile constraint, or both profiles allowed.unknown: unsupported/ambiguous constraint shape.
For safety, unknown is treated as performance-sensitive in downgrade guards.
Shared Reconcile Flow
Each reconcile tick:
- Select eligible nodes from
NODE_SELECTOR, excluding reserved and unschedulable nodes. - Build a desired plan with the selected policy.
- Apply downgrade guard (can convert planned
ecotodraining-performance/performance). - Write
NodePowerProfileand update node labeljoulie.io/power-profile.
static_partition
Goal: deterministic fixed HP/LP split.
Inputs:
N: number of eligible nodes.STATIC_HP_FRAC: target fraction of high-performance nodes.
Algorithm:
hp_count = round(N * STATIC_HP_FRAC).- Clamp
hp_countto[0, N]. - Sort eligible nodes lexicographically.
- First
hp_countnodes ->performance; remaining ->eco.
Properties:
- deterministic,
- stable over time unless node set changes.
queue_aware_v1
Goal: adapt HP count to current performance-only pressure.
Inputs:
N: number of eligible nodes.P: count of active performance-sensitive pods cluster-wide.QUEUE_HP_BASE_FRACQUEUE_HP_MINQUEUE_HP_MAXQUEUE_PERF_PER_HP_NODE
Algorithm:
base = round(N * QUEUE_HP_BASE_FRAC).need = ceil(P / QUEUE_PERF_PER_HP_NODE).hp_count = max(base, need).- Clamp
hp_countto[QUEUE_HP_MIN, QUEUE_HP_MAX]. - Clamp again to
[0, N]. - Sort nodes lexicographically.
- First
hp_countnodes ->performance; remaining ->eco.
Properties:
- deterministic for a fixed
(N, P), - monotonic in pressure
P, - bounded by min/max limits.
rule_swap_v1 (debug policy)
Goal: force visible state transitions for debugging.
Algorithm:
- Compute phase from wall-clock and
RECONCILE_INTERVAL. - Alternate which of the first nodes is assigned
eco. - Others remain
performance.
This policy is intended for debugging only, not as default production behavior.
Downgrade Guard
When planned profile is eco on a node currently performance:
- Count active performance-sensitive pods on that node.
- If count > 0:
- keep cap/profile as
performance, - set label profile to
draining-performance.
- keep cap/profile as
- If count == 0:
- allow transition to
eco.
- allow transition to
If node is already draining-performance, the same check decides whether to complete drain or remain draining.