containerd / nerdctl

contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...
Apache License 2.0
7.93k stars 589 forks source link

Support filters opts #54

Open soharaki opened 3 years ago

soharaki commented 3 years ago

Add the filter options to the nerdctl.

The almost default behavior to add multiple filter args is equals to append OR conditions.

soharaki commented 3 years ago

client.Containers()'s filters support some features. https://godoc.org/k8s.io/cri-api/pkg/apis/runtime/v1alpha2#ContainerFilter

For example, we get some containers with the label lkey or lkey2 by executing the below.

filters := "labels.lkey==lvalue"
filters2 := "labels.lkey2==lvalue2"
containers, err := client.Containers(ctx, filters, filters2)

Since client.Containers()'s filters are not functional enough, we need applying filter again after getting the containers.

tcarland commented 1 year ago

This does break kubernetes-sigs/kind which makes me pretty sad.