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

Refactor sandbox creation function arguments #8141

Closed
wants to merge 1 commit into from

Conversation

saschagrunert
Copy link
Member

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

  • Add a dedicated list of setters for the various pod sandbox fields and use them directly on sandbox creation
  • Add a new method to convert a runtime spec to a sandbox and use it on restore.
  • Enable the revive linter and set it to a minimum amount of arguments.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

None

Does this PR introduce a user-facing change?

None

@openshift-ci openshift-ci bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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. labels May 7, 2024
@openshift-ci openshift-ci bot requested review from klihub and wgahnagl May 7, 2024 12:27
Copy link
Contributor

openshift-ci bot commented May 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: saschagrunert

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

The pull request process is described 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 7, 2024
@saschagrunert saschagrunert force-pushed the argument-limit branch 5 times, most recently from c6e0fb4 to ffeb28a Compare May 7, 2024 13:22
Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 54.01460% with 63 lines in your changes are missing coverage. Please review.

Project coverage is 49.43%. Comparing base (cdfc5b7) to head (983cfd1).
Report is 45 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8141      +/-   ##
==========================================
- Coverage   49.58%   49.43%   -0.16%     
==========================================
  Files         153      152       -1     
  Lines       16926    16994      +68     
==========================================
+ Hits         8393     8401       +8     
- Misses       7487     7550      +63     
+ Partials     1046     1043       -3     

@saschagrunert saschagrunert force-pushed the argument-limit branch 2 times, most recently from 8950fae to f8db4be Compare May 7, 2024 14:45
@saschagrunert
Copy link
Member Author

/retest

- Add a dedicated list of setters for the various pod sandbox fields and
  use them directly on sandbox creation
- Add a new method to convert a runtime spec to a sandbox and use it on
  restore.
- Enable the revive linter and set it to a minimum amount of arguments.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
@saschagrunert saschagrunert changed the title WIP: Refactor sandbox creation function arguments Refactor sandbox creation function arguments May 8, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 8, 2024
@saschagrunert
Copy link
Member Author

/retest

1 similar comment
@saschagrunert
Copy link
Member Author

/retest

@saschagrunert
Copy link
Member Author

@cri-o/cri-o-maintainers PTAL

@saschagrunert
Copy link
Member Author

/retest

@saschagrunert
Copy link
Member Author

@cri-o/cri-o-maintainers PTAL

@haircommander
Copy link
Member

I'm thinking about this more, and I find myself wondering if the internal/factory packages were actually a mistake. Part of me wants to move these functions into that package, but doing so would either cause us to do what you're doing here where we ultimately have setters inside of the sandbox package, or it would cause us to keep the problem as-is (a large number of args in sandbox.New()), or it could cause us to overuse an intermediate struct (copying all of the values from server/ into a SandboxBuilder object, and then passing that object ultimately to the sandbox package.

Maybe instead we should really move internal/factory packages into oci and sandbox packages , and create a new file that is factory.go in each, where we define these setters/translation functions)

Ultimately, we want a way to translate CRI spec (and server configuration) to sandbox/container instance, as well as a way to restore each of those from a file

WDYT @cri-o/cri-o-maintainers? Maybe we discuss this at next week's community meeting?

@saschagrunert
Copy link
Member Author

Maybe instead we should really move internal/factory packages into oci and sandbox packages , and create a new file that is factory.go in each, where we define these setters/translation functions)

Is the goal to have an immutable sandbox after its creation? Then a dedicated builder would help, which is probably a complete replacement for the factory.

This PR also clashes with #7859

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 13, 2024
@haircommander
Copy link
Member

Is the goal to have an immutable sandbox after its creation? Then a dedicated builder would help, which is probably a complete replacement for the factory.

I mean it could be partially mutable, but I don't think we need this level of flexibility. there are definitely fields that will never change and we shouldn't expose the ability to change externally.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 16, 2024
@openshift-merge-robot
Copy link
Contributor

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.

@saschagrunert saschagrunert deleted the argument-limit branch May 16, 2024 07:15
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

None yet

3 participants