Skip to content

Conversation

@dfr
Copy link
Contributor

@dfr dfr commented Feb 2, 2024

Following on from #7472, this adds support for creating containers inside a pod sandbox. This gives us a functioning cri-o for FreeBSD, missing pod and container stats and some features such as device support and privileged containers. Part of #6492.

Note: the FreeBSD implementation of createSandboxContainer was copied from the Linux implementation and modified for FreeBSD. Some code could be shared between the two platforms at the expense of reduced readability. Its not clear to me which approach is better and I would welcome feedback on this.

What type of PR is this?

/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Experimental support for FreeBSD.

@dfr dfr requested a review from mrunalp as a code owner February 2, 2024 13:41
@openshift-ci openshift-ci bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Feb 2, 2024
@openshift-ci openshift-ci bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/feature Categorizes issue or PR as related to a new feature. labels Feb 2, 2024
@haircommander
Copy link
Member

I think I'd prefer to share code where possible. Even if the readibility suffers, it will reduce the liklihood we miss patches to one or the other

@dfr
Copy link
Contributor Author

dfr commented Feb 2, 2024

I think I'd prefer to share code where possible. Even if the readibility suffers, it will reduce the liklihood we miss patches to one or the other

The approach I took in Podman for some similar changes was to move e.g. container_create_linux.go to container_create_common.go and then iteratively factor out things which didn't make sense for FreeBSD back to container_create_linux.go until I got to a place where both platforms build. I can do something similar here and see how that turns out.

@dfr dfr force-pushed the freebsd-container branch from d876214 to 49b17ae Compare February 5, 2024 10:43
@dfr
Copy link
Contributor Author

dfr commented Feb 5, 2024

I re-implemented this to keep as much of the code for container creation shared between Linux and FreeBSD. I kept the history fairly detailed to make it easier to see the sequence of small refactors clear.

@codecov
Copy link

codecov bot commented Feb 5, 2024

Codecov Report

Attention: Patch coverage is 39.20530% with 459 lines in your changes missing coverage. Please review.

Project coverage is 47.50%. Comparing base (403bef8) to head (8287e41).
Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7727      +/-   ##
==========================================
+ Coverage   47.49%   47.50%   +0.01%     
==========================================
  Files         154      156       +2     
  Lines       23125    23132       +7     
==========================================
+ Hits        10983    10989       +6     
- Misses      11072    11073       +1     
  Partials     1070     1070              

@dfr dfr force-pushed the freebsd-container branch from 49b17ae to 582f5a1 Compare February 6, 2024 14:55
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 8, 2024
@github-actions
Copy link

A friendly reminder that this PR had no activity for 30 days.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 10, 2024
@sohankunkerkar sohankunkerkar removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 15, 2024
@dfr dfr force-pushed the freebsd-container branch from 582f5a1 to 12398ce Compare April 16, 2024 22:20
@dfr
Copy link
Contributor Author

dfr commented Apr 17, 2024

Note: this iteration disables timezone support for FreeBSD - this can be removed if we update the vendor of github.com/containers/common to v0.58 but perhaps that should happen in a separate PR?

@dfr dfr force-pushed the freebsd-container branch from 12398ce to 4e5b1ff Compare April 17, 2024 23:03
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 17, 2024
@dfr dfr force-pushed the freebsd-container branch from 4e5b1ff to fcecb2e Compare April 17, 2024 23:09
@kwilczynski
Copy link
Contributor

@dfr, you might have to rebase this against main as there have been changes that will affect your work here.

@dfr dfr force-pushed the freebsd-container branch from fcecb2e to d4eefc3 Compare April 18, 2024 16:41
@dfr
Copy link
Contributor Author

dfr commented Apr 18, 2024

@dfr, you might have to rebase this against main as there have been changes that will affect your work here.

I just rebased and updated the PR, thanks!

@haircommander
Copy link
Member

there do seem to be some legitimate breakages here

@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 26, 2024
@sohankunkerkar
Copy link
Member

@dfr, could you rebase on top of the main branch to pick the container/common changes?

@dfr dfr force-pushed the freebsd-container branch from d4eefc3 to 32fdf8a Compare May 7, 2024 15:33
@dfr dfr force-pushed the freebsd-container branch from a80f844 to fad82e1 Compare February 12, 2025 15:01
@sohankunkerkar
Copy link
Member

@dfr Thanks for your patience.
Could you fix this test?
https://github.com/cri-o/cri-o/actions/runs/13288331349/job/37102473662?pr=7727

dfr added 2 commits February 12, 2025 17:45
…r_create.go

This allows most of the container create logic to be shared between
Linux and FreeBSD.

Signed-off-by: Doug Rabson <[email protected]>
This field is not set on FreeBSD

Signed-off-by: Doug Rabson <[email protected]>
@dfr dfr force-pushed the freebsd-container branch from fad82e1 to 8287e41 Compare February 12, 2025 17:46
@dfr
Copy link
Contributor Author

dfr commented Feb 12, 2025

@dfr Thanks for your patience. Could you fix this test? https://github.com/cri-o/cri-o/actions/runs/13288331349/job/37102473662?pr=7727

Done.

@bitoku
Copy link
Contributor

bitoku commented Feb 13, 2025

It's not clear to me what should be working with this PR.
How about adding an integration test for freebsd?

There's no default runner, but there seem some 3rd party options.
actions/runner#385

I think it's ok to disable some tests, but we can get better understanding what is remaining to fully support freebsd.

@dfr
Copy link
Contributor Author

dfr commented Feb 13, 2025

It's not clear to me what should be working with this PR. How about adding an integration test for freebsd?

There's no default runner, but there seem some 3rd party options. actions/runner#385

I think it's ok to disable some tests, but we can get better understanding what is remaining to fully support freebsd.

I think that at this stage, I would be happy with a simple 'does it build' test. We did this in Podman and it has been quite helpful - this was easy in Podman since they use Cirrus CI which supports FreeBSD. I'm not sure what it would take to add a 3rd party FreeBSD runner.

@bitoku
Copy link
Contributor

bitoku commented Feb 13, 2025

hmm, did you do any manual test on this change? or is this PR just a preliminary one for the future changes?
I suppose CreateContainer should succeed probably.

I think that at this stage, I would be happy with a simple 'does it build' test.
I'm not sure what it would take to add a 3rd party FreeBSD runner.

I believe we should have the e2e test for the freebsd functionality as soon as possible, but you made the point about 3rd party runner. we may as well not implement it for now.

@kasperk81
Copy link

ideally, https://actuated.com/blog/kvm-in-github-actions should be the target. i.e. on linux, we deploy a minimal freebsd VM using kvm and do podman build -t freebsd-helloworld -f Dockerfile.freebsd-test. that will resonate with larger community out in the wild.

@dfr
Copy link
Contributor Author

dfr commented Feb 13, 2025

hmm, did you do any manual test on this change? or is this PR just a preliminary one for the future changes? I suppose CreateContainer should succeed probably.

I have a small set of tests which use crictl to create pods and containers in a few configurations that cover creating simple containers, containers with volumes, etc. and I run them manually. I also have a two node FreeBSD Kubernetes cluster that uses cri-o with this PR and a few much smaller patches that I can use for ad-hoc testing.

I think that at this stage, I would be happy with a simple 'does it build' test.
I'm not sure what it would take to add a 3rd party FreeBSD runner.

I believe we should have the e2e test for the freebsd functionality as soon as possible, but you made the point about 3rd party runner. we may as well not implement it for now.

If we can collectively figure out a way to run tests in a FreeBSD VM, I would be very happy. Possibly https://github.com/marketplace/actions/cross-platform-action would work for this?

@dfr
Copy link
Contributor Author

dfr commented Feb 13, 2025

I just remembered that I actually added a FreeBSD cross build which runs on a Linux worker and helps to keep the tree buildable. I will see if this binary is functional, which it should be unless something in the build depends on CGO.

@bitoku
Copy link
Contributor

bitoku commented Feb 14, 2025

@dfr
I created the issue for FreeBSD CI. #9005
Aside from that, as you tested it already manually, I feel ok to merge it.
Once you verified the binary, please let us know.

@haircommander
Copy link
Member

/lgtm
/hold

Feel free to remove the hold when it's ready. Thanks for being so patient and thorough here. I'm very excited about this!

@openshift-ci openshift-ci bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Feb 14, 2025
@dfr
Copy link
Contributor Author

dfr commented Feb 19, 2025

/lgtm /hold

Feel free to remove the hold when it's ready. Thanks for being so patient and thorough here. I'm very excited about this!

/unhold

After some more testing, including with my experimental FreeBSD Kubernetes cluster, I'm happy with this change. I will follow up with a few much smaller pull requests to fill out the features needed for minimal Kubernetes support.

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 19, 2025
@dfr
Copy link
Contributor Author

dfr commented Feb 19, 2025

/retest-required

2 similar comments
@dfr
Copy link
Contributor Author

dfr commented Feb 20, 2025

/retest-required

@dfr
Copy link
Contributor Author

dfr commented Feb 20, 2025

/retest-required

@kasperk81
Copy link

seems like unrelated timeouts and not related to these changes?

@dfr
Copy link
Contributor Author

dfr commented Feb 21, 2025

seems like unrelated timeouts and not related to these changes?

I think so - it usually takes a while to get this set of tests to pass. Unfortunately, they are important end-to-end tests ensuring that we can still bring up Kubernetes clusters etc. so we need them. I do wish they were less flaky though.

@dfr
Copy link
Contributor Author

dfr commented Feb 21, 2025

/retest

1 similar comment
@sohankunkerkar
Copy link
Member

/retest

@openshift-merge-bot openshift-merge-bot bot merged commit cf6e4f2 into cri-o:main Feb 21, 2025
77 of 78 checks passed
@dfr dfr deleted the freebsd-container branch February 24, 2025 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants