Skip to content

Commit

Permalink
Merge pull request #406 from Random-Liu/use-metadata-to-filter
Browse files Browse the repository at this point in the history
Use metadata to filter
  • Loading branch information
k8s-ci-robot authored Nov 9, 2018
2 parents ef6bc62 + cd33519 commit 4370621
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 28 deletions.
25 changes: 0 additions & 25 deletions cmd/crictl/constants.go

This file was deleted.

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 4370621

Please sign in to comment.