Skip to content

Fix incomplete Mounts attributes #25697

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

D3vil0p3r
Copy link

Does this PR introduce a user-facing change?

Fix #24878

The container list API call now returns the complete Mounts attributes for each container.

@openshift-ci openshift-ci bot added release-note do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Mar 26, 2025
Copy link
Contributor

openshift-ci bot commented Mar 26, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: D3vil0p3r
Once this PR has been reviewed and has the lgtm label, please assign rhatdan for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: Antonio <[email protected]>
@D3vil0p3r D3vil0p3r changed the title Implement Mount Fix Implement Mount Fix attributes Mar 26, 2025
@D3vil0p3r D3vil0p3r changed the title Implement Mount Fix attributes Fix incomplete Mounts attributes Mar 26, 2025
@@ -147,7 +147,7 @@ type ContainerRootFSConfig struct {
// Mounts contains all additional mounts into the container rootfs.
// It is presently only used for the container's SHM directory.
// These must be unmounted before the container's rootfs is unmounted.
Mounts []string `json:"mounts,omitempty"`
Copy link
Member

@mheon mheon Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to break upgrades from previous versions - you can't deserialize a JSON string into a define.InspectMount. It should be possible to, instead of this, make a func (c *Container) InspectMounts() ([]define.InspectMount, error) that takes the libpod ContainerConfig and converts it into InspectMount in the same way Inspect does (with a minor refactor, you could use the same code for both). That would probably be sufficient for your needs here, no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I can try. I understand it would be a breaking change. As I reported in my comment below, it would be great if, at least, it could be applied on the next major release.

Copy link
Author

@D3vil0p3r D3vil0p3r Mar 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the same way Inspect does (with a minor refactor, you could use the same code for both)

to which specific Inspect function you refer? This one?

func (c *Container) Inspect(size bool) (*define.InspectContainerData, error) {

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall as I said on the issue we simply cannot do this, it will break everyone.

And then you may only care about mounts right now but the next person wants something else, to me this is simply not a sustainable fix in any way or form.
This needs a larger decision on what info the list API should carry because right now it is only aimed at the podman ps output.

@@ -41,7 +42,7 @@ type ListContainer struct {
// Labels for container
Labels map[string]string
// User volume mounts
Mounts []string
Mounts []pod_define.InspectMount
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned on the issue these are breaking changes to a user facing API and cannot be done. We canont just break things.

Copy link
Author

@D3vil0p3r D3vil0p3r Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My 2cent: I understand, but at least for a major release. Each major release of all software could introduce breaking changes, but the fear to keep everything "unbreakable" just stops any improvement on the software itself (and on podman). But still, those "Mounts" attributes as-is, that are just destination directories, are unusable, simply because the same call does not return the related "Source", it is just an example.

For this particular case, I'm happily spending my small free time to enrich those data. I don't do this only because I need, I do because I "believe" on podman project and I use it as a standard over docker

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the fear to keep everything "unbreakable" just stops any improvement on the software itself (and on podman)

This isn't a fear, this is plain and simple a breaking API change. An old remote client would be unable to parse this json and thus break podman ps and the other way around the same way.

We cannot just break API users just because you happen to need different data in the field. There are ways to introduce new features without breaking existing ones, we do that all the time. New options and new fields would be fine (still assumes they make sense overall and are maintainable) but you cannot break the format of an existing one.

Yes we can break things in a major release but a new major release is still far away, not even planned yet. And if we like to break things that there must be a strong reason and we should do a careful audit of similar problems in the list API. Otherwise we have the same issue on a different field again.

For this particular case, I'm happily spending my small free time to enrich those data. I don't do this only because I need, I do because I "believe" on podman project and I use it as a standard over docker

I am thankful that you take the time to contribute to the project, but compatibility is an important topic for us, so you would need to find another way to move this forward. Adding a new API field that has the data you need could be an option.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 6, 2025
@openshift-merge-robot
Copy link
Collaborator

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Podman REST API return a list of containers with partial/missing "Mounts" attribute values
4 participants