Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions cmd/ateapi/internal/controlapi/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (s *WorkerPoolSyncer) Start(ctx context.Context) {

// Reconcile the other direction: clean up stored workers whose pods no
// longer exist. This recovers delete events missed while ate-api-server
// was down neither the watch relist nor the resync period can replay a
// was down, neither the watch relist nor the resync period can replay a
// delete across a process restart, because the informer cache starts empty.
s.reconcileOrphanedWorkers(ctx)
}()
Expand All @@ -115,7 +115,7 @@ func (s *WorkerPoolSyncer) syncWorkerToStore(ctx context.Context, pod *corev1.Po
if pod.DeletionTimestamp != nil {
// The pod has entered Terminating: mark the worker DRAINING so the
// scheduler stops routing new actors to it. We deliberately do NOT touch
// the bound actor here inside the pod ateom has received SIGTERM and is
// the bound actor here, inside the pod ateom has received SIGTERM and is
// gracefully shutting the actor down. Actor cleanup happens on the Pod
// Deleted event.
if err := s.markWorkerDraining(ctx, pod.Namespace, pod.Labels[workerPodLabel], pod.Name); err != nil {
Expand Down Expand Up @@ -185,7 +185,6 @@ func (s *WorkerPoolSyncer) syncWorkerToStore(ctx context.Context, pod *corev1.Po
w.Labels = pool.GetLabels()
changed = true
}

if changed {
if err = s.persistence.UpdateWorker(ctx, w, w.Version); err != nil {
slog.ErrorContext(ctx, "Failed to update worker in store", slog.Any("err", err))
Expand All @@ -200,7 +199,7 @@ func isWorkerEligible(pod *corev1.Pod) bool {
// markWorkerDraining transitions a worker to STATE_DRAINING so the scheduler
// stops routing new actors to it while its pod is Terminating. Best-effort: if
// the worker is already gone or already draining, or a concurrent update wins,
// there is nothing more to do the Pod Deleted event will clean up the record.
// there is nothing more to do, the Pod Deleted event will clean up the record.
func (s *WorkerPoolSyncer) markWorkerDraining(ctx context.Context, namespace, pool, podName string) error {
worker, err := s.persistence.GetWorker(ctx, namespace, pool, podName)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ateapi/internal/controlapi/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func TestSyncer_OmittedFields(t *testing.T) {

// TestSyncer_SoftDelete_MarksDraining verifies that a pod entering Terminating
// (DeletionTimestamp set) flips its worker to STATE_DRAINING without deleting the
// worker record or touching the bound actor the actor is still gracefully
// worker record or touching the bound actor, the actor is still gracefully
// shutting down inside the pod.
func TestSyncer_SoftDelete_MarksDraining(t *testing.T) {
ctx := context.Background()
Expand Down