MCPcopy
hub / github.com/containerd/containerd / SetLabel

Method SetLabel

client/namespaces.go:67–85  ·  view source on GitHub ↗
(ctx context.Context, namespace, key, value string)

Source from the content-addressed store, hash-verified

65}
66
67func (r *remoteNamespaces) SetLabel(ctx context.Context, namespace, key, value string) error {
68 var req api.UpdateNamespaceRequest
69
70 req.Namespace = &api.Namespace{
71 Name: namespace,
72 Labels: map[string]string{key: value},
73 }
74
75 req.UpdateMask = &types.FieldMask{
76 Paths: []string{strings.Join([]string{"labels", key}, ".")},
77 }
78
79 _, err := r.client.Update(ctx, &req)
80 if err != nil {
81 return errgrpc.ToNative(err)
82 }
83
84 return nil
85}
86
87func (r *remoteNamespaces) List(ctx context.Context) ([]string, error) {
88 var req api.ListNamespacesRequest

Callers

nothing calls this directly

Calls 1

UpdateMethod · 0.65

Tested by

no test coverage detected