Skip to content

Commit

Permalink
Use metadata to filter instead of using labels.
Browse files Browse the repository at this point in the history
Signed-off-by: Lantao Liu <lantaol@google.com>
  • Loading branch information
Random-Liu committed Nov 9, 2018
1 parent c080f38 commit 333a6b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/crictl/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ func ListContainers(client pb.RuntimeServiceClient, opts listOptions) error {
}
for _, c := range r.Containers {
// Filter by pod name/namespace regular expressions.
if !matchesRegex(opts.nameRegexp, c.Labels[kubeContainerNameLabel]) {
if !matchesRegex(opts.nameRegexp, c.Metadata.Name) {
continue
}
if opts.quiet {
Expand Down
4 changes: 2 additions & 2 deletions cmd/crictl/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,10 @@ func ListPodSandboxes(client pb.RuntimeServiceClient, opts listOptions) error {
}
for _, pod := range r.Items {
// Filter by pod name/namespace regular expressions.
if !matchesRegex(opts.nameRegexp, pod.Labels[kubePodNameLabel]) {
if !matchesRegex(opts.nameRegexp, pod.Metadata.Name) {
continue
}
if !matchesRegex(opts.podNamespaceRegexp, pod.Labels[kubePodNamespaceLabel]) {
if !matchesRegex(opts.podNamespaceRegexp, pod.Metadata.Namespace) {
continue
}

Expand Down

0 comments on commit 333a6b4

Please sign in to comment.