vv9k / podman-api-rs

Rust interface to Podman (libpod).
MIT License
84 stars 12 forks source link

labels not applied during volume creation #170

Open wez opened 7 months ago

wez commented 7 months ago

Can you help me figure out what might be happening here?

I have this code:

volumes
    .create(
        &VolumeCreateOpts::builder()
            .name(&volume_name)
            .labels(vec![
                ("integrator.cache", "true"),
                ("integrator.project", project_name),
            ])
            .build(),
    )
    .await
    .with_context(|| {
        format!("Failed to create volume {volume_name} for cache dir {cache_dir}")
    })?;

the volume is created, but when I inspect it, there are no labels set:

$ podman volume inspect --all
[
    {
        "Name": "integrator-github.comzZzwezzZzintegrator-cache-myworkflow-zZzintegratorzZzhomezZz.cargozZzbin",
        "Driver": "local",
        "Mountpoint": "/home/wez/.local/share/containers/storage/volumes/integrator-github.comzZzwezzZzintegrator-cache-myworkflow-zZzintegratorzZzhomezZz.cargozZzbin/_data",
        "CreatedAt": "2024-04-22T10:30:57.835792599-07:00",
        "Labels": {},
        "Scope": "local",
        "Options": {}
    },

I can create volumes with these kind of labels via podman itself:

$ podman volume create --label integrator.project=woot asdfasdf
asdfasdf
$ podman volume inspect asdfasdf
[
    {
        "Name": "asdfasdf",
        "Driver": "local",
        "Mountpoint": "/home/wez/.local/share/containers/storage/volumes/asdfasdf/_data",
        "CreatedAt": "2024-04-22T10:38:21.480191794-07:00",
        "Labels": {
            "integrator.project": "woot"
        },
        "Scope": "local",
        "Options": {}
    }
]

I can see that there are integration tests for labeling volumes, so I don't want to call this a bug in the podman-api, but I'd appreciate your insight into figuring out why the labels are not applying.

Thoughts on what I should check?

Thanks!