MCPcopy
hub / github.com/containerd/containerd / GetLabel

Method GetLabel

client/client.go:649–666  ·  view source on GitHub ↗

GetLabel gets a label value from namespace store If there is no default label, an empty string returned with nil error

(ctx context.Context, label string)

Source from the content-addressed store, hash-verified

647// GetLabel gets a label value from namespace store
648// If there is no default label, an empty string returned with nil error
649func (c *Client) GetLabel(ctx context.Context, label string) (string, error) {
650 ns, err := namespaces.NamespaceRequired(ctx)
651 if err != nil {
652 if c.defaultns == "" {
653 return "", err
654 }
655 ns = c.defaultns
656 }
657
658 srv := c.NamespaceService()
659 labels, err := srv.Labels(ctx, ns)
660 if err != nil {
661 return "", err
662 }
663
664 value := labels[label]
665 return value, nil
666}
667
668// Subscribe to events that match one or more of the provided filters.
669//

Callers 3

defaultRuntimeMethod · 0.95
defaultSandboxerMethod · 0.95

Calls 3

NamespaceServiceMethod · 0.95
NamespaceRequiredFunction · 0.92
LabelsMethod · 0.65

Tested by

no test coverage detected