Skip to content

fix(k8s): don't copy autoscalers or disruption budgets into bridges - #16

Merged
vercel-eddie merged 1 commit into
mainfrom
strip-scaling-resources
Oct 1, 2026
Merged

vercel-eddie merged 1 commit into
mainfrom
strip-scaling-resources

Conversation

@vercel-eddie

Copy link
Copy Markdown
Collaborator

Bridging from source manifests (bridge create --source) copied every resource in them, including the service's HorizontalPodAutoscaler and PodDisruptionBudget. The transforms rename those copies, but they still act on the source workload: an HPA's scaleTargetRef and a PDB's selector name the real Deployment and its pods. So every bridge broke the real service while it existed:

  • the real HPA reported AmbiguousSelector and stopped scaling (venus's api-managed-drives is in this state now)
  • pods covered by more than one PDB can't be evicted (MultiplePodDisruptionBudgets events on venus's api-sandboxes pods)

Change

CreateBridge runs a new StripScalingResources transform first, which drops HPAs, PDBs and KEDA ScaledObjects from the bundle. A bridge is a single pod with nothing to scale. SourceFromNamespace only ever copies the Deployment, so only --source bridges were affected.

#12 already deletes any that existing bridges created, on bridge remove.

Rollout

Venus's administrator has been running since 2026-07-02, before #12, so bridge remove there still leaves these behind. There are 1,041 HPAs and 1,635 PDBs from bridges that no longer exist. It runs bridge-cli:latest with imagePullPolicy: Always, so restarting it picks up #12, #15 and this. The existing orphans need a one-time cleanup, since their bridges are gone and nothing will call remove for them.

Testing

  • TestStripScalingResources: a packed source with a Deployment, Service, HPA, PDB and ScaledObject parses to five resources, and only the Deployment and Service survive the transform.
  • go vet, and go test ./pkg/k8s/resources/ ./pkg/commands/ pass.

🤖 Generated with Claude Code

Bridging from source manifests copied every resource in them, including
the service's HorizontalPodAutoscaler and PodDisruptionBudget. Those still
act on the source workload after the bridge transforms (an HPA's
scaleTargetRef and a PDB's selector name the real Deployment and pods), so
each bridge broke the real service while it existed: its HPA reported
AmbiguousSelector and stopped scaling, and its pods, covered by more than
one PDB, couldn't be evicted.

CreateBridge now strips HPAs, PDBs and KEDA ScaledObjects before anything
else. A bridge is a single pod with nothing to scale. #12 already removes
any that existing bridges created, on bridge remove.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@vercel-eddie
vercel-eddie merged commit b5d4152 into main Oct 1, 2026
6 checks passed
@vercel-eddie
vercel-eddie deleted the strip-scaling-resources branch October 1, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant