MCPcopy Create free account
hub / github.com/containerd/nerdctl / getIPAddressOpts

Function getIPAddressOpts

pkg/ocihook/ocihook.go:374–391  ·  view source on GitHub ↗
(opts *handlerOpts)

Source from the content-addressed store, hash-verified

372}
373
374func getIPAddressOpts(opts *handlerOpts) ([]cni.NamespaceOpts, error) {
375 if opts.containerIP != "" {
376 if rootlessutil.IsRootlessChild() {
377 log.L.Debug("container IP assignment is not fully supported in rootless mode. The IP is not accessible from the host (but still accessible from other containers).")
378 }
379
380 return []cni.NamespaceOpts{
381 cni.WithLabels(map[string]string{
382 // Special tick for go-cni. Because go-cni marks all labels and args as same
383 // So, we need add a special label to pass the containerIP to the host-local plugin.
384 // FYI: https://github.com/containerd/go-cni/blob/v1.1.3/README.md?plain=1#L57-L64
385 "IgnoreUnknown": "1",
386 }),
387 cni.WithArgs("IP", opts.containerIP),
388 }, nil
389 }
390 return nil, nil
391}
392
393func getMACAddressOpts(opts *handlerOpts) ([]cni.NamespaceOpts, error) {
394 if opts.containerMAC != "" {

Callers 2

applyNetworkSettingsFunction · 0.85
onPostStopFunction · 0.85

Calls 2

IsRootlessChildFunction · 0.92
WithArgsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…