(gvr schema.GroupVersionResource, ns, name string)
| 431 | } |
| 432 | |
| 433 | func (t *tracker) Delete(gvr schema.GroupVersionResource, ns, name string) error { |
| 434 | t.lock.Lock() |
| 435 | defer t.lock.Unlock() |
| 436 | |
| 437 | found := false |
| 438 | |
| 439 | for i, existingObj := range t.objects[gvr] { |
| 440 | objMeta, err := meta.Accessor(existingObj) |
| 441 | if err != nil { |
| 442 | return err |
| 443 | } |
| 444 | if objMeta.GetNamespace() == ns && objMeta.GetName() == name { |
| 445 | obj := t.objects[gvr][i] |
| 446 | t.objects[gvr] = append(t.objects[gvr][:i], t.objects[gvr][i+1:]...) |
| 447 | for _, w := range t.getWatches(gvr, ns) { |
| 448 | w.Delete(obj) |
| 449 | } |
| 450 | found = true |
| 451 | break |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | if found { |
| 456 | return nil |
| 457 | } |
| 458 | |
| 459 | return errors.NewNotFound(gvr.GroupResource(), name) |
| 460 | } |
| 461 | |
| 462 | // filterByNamespaceAndName returns all objects in the collection that |
| 463 | // match provided namespace and name. Empty namespace matches |
nothing calls this directly
no test coverage detected