@@ -324,7 +324,8 @@ func (s *session) handleInterceptSnapshot(ctx context.Context, podIcepts *podInt
324
324
podIcepts .cancelUnwanted (ctx )
325
325
}
326
326
327
- // getCurrentIntercepts returns a copy of the current intercept snapshot.
327
+ // getCurrentIntercepts returns a copy of the current intercept snapshot. This snapshot does
328
+ // not include any local-only intercepts.
328
329
func (s * session ) getCurrentIntercepts () []* intercept {
329
330
// Copy the current snapshot
330
331
s .currentInterceptsLock .Lock ()
@@ -750,7 +751,8 @@ func (s *session) RemoveIntercept(c context.Context, name string) error {
750
751
dlog .Debugf (c , "Removing intercept %s" , name )
751
752
752
753
if _ , ok := s .localIntercepts [name ]; ok {
753
- return s .RemoveLocalOnlyIntercept (c , name )
754
+ s .RemoveLocalOnlyIntercept (c , name )
755
+ return nil
754
756
}
755
757
756
758
ii := s .getInterceptByName (name )
@@ -861,6 +863,10 @@ func (s *session) ClearIntercepts(c context.Context) error {
861
863
return err
862
864
}
863
865
}
866
+ for ic := range s .localIntercepts {
867
+ dlog .Debugf (c , "Clearing local-only intercept %s" , ic )
868
+ s .RemoveLocalOnlyIntercept (c , ic )
869
+ }
864
870
return nil
865
871
}
866
872
@@ -986,7 +992,7 @@ func (s *session) addLocalOnlyIntercept(c context.Context, spec *manager.Interce
986
992
}
987
993
}
988
994
989
- func (s * session ) RemoveLocalOnlyIntercept (c context.Context , name string ) error {
995
+ func (s * session ) RemoveLocalOnlyIntercept (c context.Context , name string ) {
990
996
dlog .Debugf (c , "removing local-only intercept %s" , name )
991
997
992
998
// Ensure that namespace is removed from localInterceptedNamespaces if this was the last local intercept
@@ -998,5 +1004,4 @@ func (s *session) RemoveLocalOnlyIntercept(c context.Context, name string) error
998
1004
}
999
1005
s .currentInterceptsLock .Unlock ()
1000
1006
s .updateDaemonNamespaces (c )
1001
- return nil
1002
1007
}
0 commit comments