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

Remove cni dependency #7

Merged
merged 1 commit into from
Sep 22, 2021
Merged

Conversation

Luap99
Copy link
Contributor

@Luap99 Luap99 commented Sep 17, 2021

Podman 4.0 no longer uses CNI to store the network information therefore
reading the status file into a cni result will fail. This library should
not make any assumptions about the network status format used by Podman.
I personally don't see much value in displaying the IP address with
checkpointctl for a podman container. A container can have 0-n IP
addresses. Which one should be displayed anyway?

Fixes #6

Signed-off-by: Paul Holzinger [email protected]

@rhatdan
Copy link

rhatdan commented Sep 18, 2021

@adrianreber PTAL

@adrianreber
Copy link
Member

I am still not sure if this would not be necessary if the proposed fixes from #5 are merged.

I was also concerned how this works with restoring IP addresses during container restore, but I just saw that you changed all that code a month ago. Has the format of the file network.status changed in Podman because of your changes to Podman? Is it no longer possible to restore a container checkpointed with the old version of network.status?

@Luap99
Copy link
Contributor Author

Luap99 commented Sep 20, 2021

I am still not sure if this would not be necessary if the proposed fixes from #5 are merged.

Well #5 would be fine for podman because then I could bump the CNI version in podman. However there is no longer a reason for this lib to include CNI because the network status in podman no longer uses CNI structures.

I was also concerned how this works with restoring IP addresses during container restore, but I just saw that you changed all that code a month ago. Has the format of the file network.status changed in Podman because of your changes to Podman?

Yes the format has changed, we no longer store a CNI result. We store a map[string]StatusBlock defined in https://github.com/containers/podman/blob/b906ecbb5bc887f5123a0f61a5a51782aa34357f/libpod/network/types/network.go#L120
While we could update this lib to use the new structure I personally see no reason why this is needed. I don't want to make any guarantees that this structure will remain stable. It is internal to libpod and can therefore be changed any time as long as we handle the migration inside libpod.

The only reason for this lib to use the network status is to show the IP address with checkpointctl.
A podman container can have 0-n IP addresses. Which one should be displayed anyway? I would prefer checkpointctl to not show IP addresses for podman containers.

Is it no longer possible to restore a container checkpointed with the old version of network.status?

Since this change is for podman 4.0 I see no problems to break old checkpoints, only the network information is lost. Besides the network settings the restore of an old 3.X checkpoint should still work correctly.

@adrianreber
Copy link
Member

I am still not sure if this would not be necessary if the proposed fixes from #5 are merged.

Well #5 would be fine for podman because then I could bump the CNI version in podman. However there is no longer a reason for this lib to include CNI because the network status in podman no longer uses CNI structures.

The reason why I created checkpointctl and the library is that I want to use the same code in CRI-O, Podman and Kubernetes as far as possible. As I am able to move checkpoints from Podman to CRI-O it is important to have compatible checkpoint archives.

It is internal to libpod and can therefore be changed any time as long as we handle the migration inside libpod.

Would be nice to have a format which is independent of internal changes.

But currently in my CRI-O PR I am not using the network part of checkpointctl, so the code can be dumped and later introduced if necessary. But having a format for network information which is independent of an internal struct would be nice.

Is it no longer possible to restore a container checkpointed with the old version of network.status?

Since this change is for podman 4.0 I see no problems to break old checkpoints, only the network information is lost. Besides the network settings the restore of an old 3.X checkpoint should still work correctly.

That does not sound like the best solution.

Anyway, if you can make CI happy, this can be merged.

@Luap99
Copy link
Contributor Author

Luap99 commented Sep 20, 2021

Podman is actively moving away from CNI so using the same code for networking will be difficult.

If you want to know about network settings with a stable format I would recommend to define a struct here in this lib with the fields you would like to know about. If there is such a struct the consumers (podman, crio, ...) would be required to fill in the data and dump in into the network status file. With that this lib could read it without having to worry about changes to the format.

As long as podman can still dump the raw format into the checkpoint to read advanced options I would be fine with using a fixed struct from this lib for the network status file.

Podman 4.0 no longer uses CNI to store the network information therefore
reading the status file into a cni result will fail. This library should
not make any assumptions about the network status format used by Podman.
I personally don't see much value in displaying the IP address with
checkpointctl for a podman container. A container can have 0-n IP
addresses. Which one should be displayed anyway?

Also removed the now obsolete network.status file tests.

Signed-off-by: Paul Holzinger <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Merging #7 (32e875e) into main (1ca930a) will increase coverage by 2.97%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main       #7      +/-   ##
==========================================
+ Coverage   55.97%   58.94%   +2.97%     
==========================================
  Files           4        4              
  Lines         427      436       +9     
==========================================
+ Hits          239      257      +18     
+ Misses        149      145       -4     
+ Partials       39       34       -5     
Impacted Files Coverage Δ
container.go 69.76% <ø> (+5.72%) ⬆️
lib/metadata.go 55.84% <ø> (+6.44%) ⬆️
checkpointctl.go 55.45% <0.00%> (+0.99%) ⬆️
pod.go 61.36% <0.00%> (+1.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ca930a...32e875e. Read the comment docs.

@adrianreber adrianreber merged commit c31748b into checkpoint-restore:main Sep 22, 2021
@Luap99 Luap99 deleted the remove-cni branch September 22, 2021 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not use the podman network status
4 participants