Skip to main content
Rollback policies enable health monitoring and automatic rollback after failed resizes. Use them when you want the controller to monitor workloads after a resize is applied and automatically restore the last known good state if health checks fail. Important: Without a matching rollback policy, the controller will not monitor, rollback, or retry failed resizes. The rollback mechanism is disabled by default until you create a policy.

Scope Mapping

  • RollbackPolicy is namespaced and applies to workloads within a single namespace.
  • ClusterRollbackPolicy is cluster-scoped and can apply across multiple namespaces using namespace selectors.

Field Reference

RollbackPolicy.spec

ClusterRollbackPolicy.spec

Example: Namespaced Rollback Policy

Example: Cluster Rollback Policy

Rollback Target Options

lastSuccessful

Restores the last known successful resource settings that the controller recorded when monitoring succeeded. This allows the controller to restore intermediate values that worked, rather than going all the way back to the original manifest. Use when you want to preserve incremental progress from successful resizes.

manifest

Restores the original resource settings defined in the workload manifest. This ignores any intermediate successful states and returns directly to the baseline. Use when you want predictable, deterministic rollback behavior that always returns to the manifest values.

Recommendation key changes

Rollback fingerprints include the physical recommendation annotation key. Enabling or disabling GlobalConfiguration.spec.multiPolicyContainerRightsizingEnabled can move an otherwise unchanged recommendation between a fixed key and a hashed policy-owned key. Rollback treats that conversion as a new recommendation and restarts its normal monitoring path. No rollback-state migration occurs.

Adoption Threshold

The adoptionThresholdPercent field determines what percentage of the workload cohort (e.g., all pods in a Deployment) must successfully adopt the active recommendation fingerprint before monitoring is considered successful.
  • Setting 80 means at least 80% of the baseline workload cohort must be healthy on the targeted resources by the end of the monitoring window
  • Pods count toward the threshold only after they adopt the active recommendation fingerprint and become healthy
  • The controller evaluates the threshold at the end of the monitoring window, allowing transient restarts or hiccups to recover before deciding whether the resize succeeds or rollback is needed
  • Newly created pods are monitored through the same window after admission and scheduling; they are not declared successful or rolled back immediately based on their initial health
  • Range: 1-100

Backoff Turn Calculation

The backoff wait time is calculated as:
Example with timePeriod: 1m and multiplyByTurn: 2:
  • Turn 1: 1m * 2 * 1 = 2m
  • Turn 2: 1m * 2 * 2 = 4m
  • Turn 3: 1m * 2 * 3 = 6m
After maxAttempts turns are exhausted, the rollback moves to failedPermanent and the controller stops retrying.

Notes

  • Use namespaced rollback policies when teams own their own namespaces and want namespace-specific rollback behavior.
  • Use cluster rollback policies when you want consistent rollback behavior across multiple namespaces or the entire cluster.
  • Model is included in default workload types. Use spec.scope.workloadTypes: [Model] when you want to restrict scope to KubeAI Model objects only. Rollback policy selection and rollback state live on the Model owner, and health monitoring evaluates model-owned pods.
  • When multiple rollback policies of the same kind match, higher weight wins, then older objects win on ties.
  • For behavioral details and operational expectations, see Rollback Backoff.
  • Rollback policies are independent of automation strategies and proactive/static policies - they work alongside those policies to add health monitoring and automatic rollback capabilities.

Understanding Resize vs. Rollback Behavior

Kubex handles how recommendations are applied differently depending on whether a pod is already running or being newly created. Both paths still go through the rollback policy monitoring period before success or rollback is declared:
Key distinctions:
  • Existing pods: Node capacity checked before action. Insufficient capacity filters the recommendation—the pod is not deleted. Not a rollback.
  • New pods: Applied during admission before node assignment, then scheduled by Kubernetes. When a rollback policy matches, the pod goes through the configured monitoring period just like an existing pod; only after that window does the controller declare success or start a rollback based on health and adoption results.
  • Rollback monitoring requires: A recommendation was successfully applied AND a matching rollback policy exists.