Skip to content

Commit

Permalink
Don't send nil workload to OnDelete. Send name, namespace.
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Hallgren <[email protected]>
  • Loading branch information
thallgren committed Feb 20, 2024
1 parent f0be659 commit 4c8c21b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/traffic/cmd/manager/mutator/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Map interface {
Get(string, string) (agentconfig.SidecarExt, error)
Run(context.Context) error
OnAdd(context.Context, k8sapi.Workload, agentconfig.SidecarExt) error
OnDelete(context.Context, k8sapi.Workload) error
OnDelete(context.Context, string, string) error
DeleteMapsAndRolloutAll(ctx context.Context)

store(ctx context.Context, acx agentconfig.SidecarExt, updateSnapshot bool) error
Expand Down Expand Up @@ -394,8 +394,7 @@ func (c *configWatcher) OnAdd(ctx context.Context, wl k8sapi.Workload, acx agent
return nil
}

func (c *configWatcher) OnDelete(ctx context.Context, wl k8sapi.Workload) error {
triggerRollout(ctx, wl, nil)
func (c *configWatcher) OnDelete(context.Context, string, string) error {
return nil
}

Expand Down Expand Up @@ -466,9 +465,12 @@ func (c *configWatcher) handleDelete(ctx context.Context, e entry) {
return
}
}
if err = c.self.OnDelete(ctx, wl); err != nil {
if err = c.self.OnDelete(ctx, e.name, e.namespace); err != nil {
dlog.Error(ctx, err)
}
if wl != nil {
triggerRollout(ctx, wl, nil)
}
}

func (c *configWatcher) Get(key, ns string) (agentconfig.SidecarExt, error) {
Expand Down

0 comments on commit 4c8c21b

Please sign in to comment.