MCPcopy
hub / github.com/containerd/containerd / WithNamespace

Function WithNamespace

pkg/namespaces/context.go:38–43  ·  view source on GitHub ↗

WithNamespace sets a given namespace on the context

(ctx context.Context, namespace string)

Source from the content-addressed store, hash-verified

36
37// WithNamespace sets a given namespace on the context
38func WithNamespace(ctx context.Context, namespace string) context.Context {
39 ctx = context.WithValue(ctx, namespaceKey{}, namespace) // set our key for namespace
40 // also store on the grpc and ttrpc headers so it gets picked up by any clients that
41 // are using this.
42 return withTTRPCNamespaceHeader(withGRPCNamespaceHeader(ctx, namespace), namespace)
43}
44
45// NamespaceFromEnv uses the namespace defined in CONTAINERD_NAMESPACE or
46// default

Callers 15

unaryMethod · 0.92
streamMethod · 0.92
WithNewSpecFunction · 0.92
fuzzContextFunction · 0.92
FuzzExchangeFunction · 0.92
testEnvFunction · 0.92
testDBFunction · 0.92
getShimPidFunction · 0.92
shimPidMethod · 0.92
TestImageVolumeBasicFunction · 0.92

Calls 2

withTTRPCNamespaceHeaderFunction · 0.85
withGRPCNamespaceHeaderFunction · 0.85

Tested by 15

fuzzContextFunction · 0.74
FuzzExchangeFunction · 0.74
testEnvFunction · 0.74
testDBFunction · 0.74
getShimPidFunction · 0.74
shimPidMethod · 0.74
TestImageVolumeBasicFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…