tinycodinglm / sys /sys-0026.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 19)
034ba67 verified
|
Raw History Blame Contribute Delete
1.38 kB
opencode trace
System You are an expert software engineer.

You are an expert software engineer.

User

Walk through the Kubernetes Deployment controller internals

Assistant

DeploymentController manages rolling updates and rollbacks.

Constructor:

  • Watches Deployments, ReplicaSets, Pods
  • Uses workqueue.NewTypedRateLimitingQueue
  • Registers event handlers that enqueue Deployment keys

syncDeployment flow:

  1. Get Deployment from lister (deep-copy to avoid cache mutation)
  2. Validate selector
  3. getReplicaSetsForDeployment: find matching RSs via ControllerRefManager
  4. Route to strategy: rollback, scaling, Recreate, or RollingUpdate

RollingUpdate strategy:

  • maxSurge: how many extra pods above desired
  • maxUnavailable: how many pods can be unavailable
  • Creates new RS, scales up, scales down old RS
  • Uses rollingUpdateStrategy to control pace

Expectations pattern:

  • Before creating/deleting pods: ExpectCreations/ExpectDeletions
  • Watches observe actual creates and decrement expectations
  • Controller only syncs when expectations satisfied or timeout (5min)
  • Prevents acting on stale informer data