Skip to content

Commit

Permalink
cmdimage: reconcile() should hold the lock (#6121)
Browse files Browse the repository at this point in the history
this ensures that a ForceApply doesn't modify the internal data
structures during reconcilation

Mirrors the similar code in the dockerimage reconciler:
https://github.com/tilt-dev/tilt/blob/31595cfb3ca178c1f7f36b24f0f935068c838398/internal/controllers/core/dockerimage/reconciler.go#L60

fixes #6120

Signed-off-by: Nick Santos <[email protected]>
  • Loading branch information
nicks authored May 24, 2023
1 parent 31595cf commit dce51e4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/controllers/core/cmdimage/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ func NewReconciler(client ctrlclient.Client, st store.RStore, scheme *runtime.Sc
}

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
r.mu.Lock()
defer r.mu.Unlock()

nn := req.NamespacedName
obj := &v1alpha1.CmdImage{}
err := r.client.Get(ctx, nn, obj)
Expand Down

0 comments on commit dce51e4

Please sign in to comment.