Get returns a resource by name. Soft-deleted resources (i.e. resources where DeletedOn != nil) are not returned.
(ctx context.Context, name *runtimev1.ResourceName, clone bool)
| 421 | // Get returns a resource by name. |
| 422 | // Soft-deleted resources (i.e. resources where DeletedOn != nil) are not returned. |
| 423 | func (c *Controller) Get(ctx context.Context, name *runtimev1.ResourceName, clone bool) (*runtimev1.Resource, error) { |
| 424 | ctx, span := tracer.Start(ctx, "Controller.Get", trace.WithAttributes(attribute.String("instance_id", c.InstanceID), attribute.String("kind", name.Kind), attribute.String("name", name.Name))) |
| 425 | defer span.End() |
| 426 | if err := c.checkRunning(); err != nil { |
| 427 | return nil, err |
| 428 | } |
| 429 | if ctx.Err() != nil { |
| 430 | return nil, ctx.Err() |
| 431 | } |
| 432 | c.lock(ctx, true) |
| 433 | defer c.unlock(ctx, true) |
| 434 | |
| 435 | // We don't return soft-deleted resources, unless the lookup is from the reconciler itself (which may be executing the delete). |
| 436 | withDeleted := c.isReconcilerForResource(ctx, name) |
| 437 | |
| 438 | return c.catalog.get(name, withDeleted, clone) |
| 439 | } |
| 440 | |
| 441 | // List returns a list of resources of the specified kind. |
| 442 | // If kind is empty, all resources are returned. |
nothing calls this directly
no test coverage detected