Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@littlejawa
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This PR is made of cherry-pics from #8008: The refactoring that is done there can make sense outside of the PR.
The goal here is to reduce the complexity of createSandboxContainer() by extracting some functions. Some are moved to the factory/container code, others are just made sub-functions in the same file.

Hopefully, this can make createSandboxContainer() easier to maintain.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

I'm not sure that the way I split the functions makes sense in the way the "container" object is used. My focus was on code readability, and extracting related parts of the code as sub-functions. We can discuss it and adapt.
See this as a first draft.

Does this PR introduce a user-facing change?

None

@littlejawa littlejawa requested a review from mrunalp as a code owner July 18, 2024 07:54
@openshift-ci openshift-ci bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Jul 18, 2024
@openshift-ci openshift-ci bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jul 18, 2024
@codecov
Copy link

codecov bot commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 61.31387% with 53 lines in your changes missing coverage. Please review.

Project coverage is 49.55%. Comparing base (20c06a1) to head (66c0109).
Report is 240 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8397      +/-   ##
==========================================
+ Coverage   49.34%   49.55%   +0.21%     
==========================================
  Files         153      153              
  Lines       17206    17235      +29     
==========================================
+ Hits         8490     8541      +51     
+ Misses       7649     7627      -22     
  Partials     1067     1067              

@littlejawa littlejawa force-pushed the cleanup/refactor_createSandboxContainer branch from d6c0ab7 to 8902f8b Compare July 18, 2024 14:55
@littlejawa littlejawa force-pushed the cleanup/refactor_createSandboxContainer branch from 8902f8b to f8d411d Compare July 19, 2024 06:56
@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 Aug 19, 2024
@github-actions github-actions bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 21, 2024
@littlejawa littlejawa force-pushed the cleanup/refactor_createSandboxContainer branch from 99b171d to 779fada Compare August 22, 2024 12:35
@haircommander
Copy link
Member

a couple of unit, lint and build failures @littlejawa

@littlejawa littlejawa force-pushed the cleanup/refactor_createSandboxContainer branch from 779fada to afd7220 Compare August 22, 2024 15:40
Take some code out of the createSandboxContainer() function
and make it part of the Container package.

Signed-off-by: Julien ROPÉ <[email protected]>
@littlejawa littlejawa force-pushed the cleanup/refactor_createSandboxContainer branch from afd7220 to c39a6a6 Compare August 22, 2024 15:50
…tion

Get some spec generation code out of createSandboxContainer() and
make it a function under the contaienr package.

Signed-off-by: Julien ROPÉ <[email protected]>
Make a function out of the code that deals with the default values in
the security context.
We need some of the fields to be non-nil, but we're checking them and
setting default values where we need them.
Instead, use a single function to set all default values appropriately,
and call it once and for all at the beginning.

Signed-off-by: Julien ROPÉ <[email protected]>
…ner()

These functions are still accessing things that only the Server can use,
so we can't put them directly in the container package. But splitting them
helps simplify reading/maintaining createSandboxContainer().

Signed-off-by: Julien ROPÉ <[email protected]>
@littlejawa littlejawa force-pushed the cleanup/refactor_createSandboxContainer branch from 84bb265 to 66c0109 Compare August 22, 2024 16:08
@littlejawa
Copy link
Contributor Author

a couple of unit, lint and build failures

Looks like I fixed them...
I merged the fix for the freebsd build with the commit that introduced the problem (b0b584a).

@littlejawa
Copy link
Contributor Author

/test ci-fedora-kata

@littlejawa
Copy link
Contributor Author

@haircommander - do you think we can move forward with this?

@haircommander
Copy link
Member

/approve

LGTM, thanks @cri-o/cri-o-maintainers PTAL

FYI @xw19

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, littlejawa

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

The pull request process is described here

Details 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 18, 2024
@xw19
Copy link
Member

xw19 commented Sep 18, 2024

noted

@haircommander
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Sep 30, 2024
@kwilczynski kwilczynski removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 16, 2024
@littlejawa
Copy link
Contributor Author

/test ci-e2e-evented-pleg

@littlejawa
Copy link
Contributor Author

/retest

2 similar comments
@littlejawa
Copy link
Contributor Author

/retest

@littlejawa
Copy link
Contributor Author

/retest

@openshift-merge-bot openshift-merge-bot bot merged commit 7269e0d into cri-o:main Nov 12, 2024
21 checks passed
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants