Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "crictl pods --name filter" with Metadata name. #403

Closed
rjaini opened this issue Nov 6, 2018 · 6 comments · Fixed by #406
Closed

Support "crictl pods --name filter" with Metadata name. #403

rjaini opened this issue Nov 6, 2018 · 6 comments · Fixed by #406
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@rjaini
Copy link

rjaini commented Nov 6, 2018

if I use following pod config to create pod:
{
"metadata": {
"name": "linux-sandbox",
"namespace": "default",
"attempt": 1
},
"labels": {
"sandbox-platform": "linux/amd64"
}
}

crictl pods command return following output
POD ID CREATED STATE NAME NAMESPACE ATTEMPT
3e696d25f77a7 24 hours ago Ready linux-sandbox default 1

Now when I try to search the pod with above name
crictl pods --name linux-sandbox

I see no output. Ideally I should be able to get above pod.

But If I add below two labels with same value then things works.
io.kubernetes.pod.name
io.kubernetes.pod.namespace

Ideally I should also be able to search by metadata name.

@feiskyer
Copy link
Member

feiskyer commented Nov 8, 2018

@rjaini crictl pods --name supports regexp, could you try with that?

@jterry75
Copy link
Contributor

jterry75 commented Nov 8, 2018

@feiskyer - That's not what he is saying.

{
    "metadata": {
        "name": "linux-sandbox",
        "namespace": "default",
        "attempt": 1
    },
    "labels": {
        "sandbox-platform": "linux/amd64"
    }
}
crictrl pods --name linux-sandbox

Returns nothing.

--
But

{
    "metadata": {
        "name": "linux-sandbox",
        "namespace": "default",
        "attempt": 1
    },
    "labels": {
        "sandbox-platform": "linux/amd64",
        "io.kubernetes.pod.name": "test-name",
        "io.kubernetes.pod.namespace": "test-namespace"
    }
}
crictrl pods --name test-name

Returns the POD as expected.

--

The ask is that --name and --namespace support matching the metadata.Name and metadata.Namespace and not just the labels io.kubernetes.pod.name and io.kubernetes.pod.namespace.

@Random-Liu
Copy link
Contributor

This makes sense to me. We don't need to use labels for metadata that already exists in the pod config.

@Random-Liu Random-Liu added kind/feature Categorizes issue or PR as related to a new feature. kind/bug Categorizes issue or PR as related to a bug. and removed kind/feature Categorizes issue or PR as related to a new feature. labels Nov 9, 2018
@feiskyer
Copy link
Member

feiskyer commented Nov 9, 2018

@rjaini Oops, you are right.

@jterry75
Copy link
Contributor

jterry75 commented Nov 9, 2018

Thanks!

@rjaini
Copy link
Author

rjaini commented Nov 9, 2018

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants