MCPcopy
hub / github.com/kubernetes/client-go / Delete

Method Delete

testing/fixture.go:433–460  ·  view source on GitHub ↗
(gvr schema.GroupVersionResource, ns, name string)

Source from the content-addressed store, hash-verified

431}
432
433func (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

Callers

nothing calls this directly

Calls 4

getWatchesMethod · 0.95
GetNamespaceMethod · 0.65
GetNameMethod · 0.65
DeleteMethod · 0.65

Tested by

no test coverage detected