Merge pull request #8175 from Iceber/fix_cni_metadata
adding cni metadata to the container in the `ctr run --config`
This commit is contained in:
@@ -238,10 +238,6 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
opts = append(opts, oci.WithAnnotations(annos))
|
||||
}
|
||||
|
||||
if context.Bool("cni") {
|
||||
cniMeta := &commands.NetworkMetaData{EnableCni: true}
|
||||
cOpts = append(cOpts, containerd.WithContainerExtension(commands.CtrCniMetadataExtension, cniMeta))
|
||||
}
|
||||
if caps := context.StringSlice("cap-add"); len(caps) > 0 {
|
||||
for _, cap := range caps {
|
||||
if !strings.HasPrefix(cap, "CAP_") {
|
||||
@@ -374,6 +370,11 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
}
|
||||
}
|
||||
|
||||
if context.Bool("cni") {
|
||||
cniMeta := &commands.NetworkMetaData{EnableCni: true}
|
||||
cOpts = append(cOpts, containerd.WithContainerExtension(commands.CtrCniMetadataExtension, cniMeta))
|
||||
}
|
||||
|
||||
runtimeOpts, err := getRuntimeOptions(context)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user