You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Move *.go files for subcommand out main package #1631
Sorry, I have to admit that I'm unable to review/carry this amount of PR 🙇♂️
Possible plan B might be incrementally separating out cobra-independent functions into pkg directory but I'm not sure we need to do so because codes under cmd/nerdctl are tightly coupled.
Yes, this should be done in a series of small PRs if we want to continue this. e.g.,
PR 1: move cobra-independent functions into pkg/...
PR 2: split other common functions into somewhere like cmd/nerdctl/cmdpkg/...
PR 3: split the client cmdpkg
PR 4: split nerdctl namespace
PR 5: split nerdctl apparmor
PR 6: split nerdctl builder
PR 7: ...
The git diff has to be kept minimal for ease of reviewing and potential rebasing. It mustn't contain unnecessary changes such as exposing private functions. Some private functions could be exposed, but it has to be done in a separate PR.
Also, there shouldn't be the common package that is likely to result in being the home of random mutually irrelevant functions; the common package has to be split to multiple small cmdpkgs with clear purposes.
We also have to revisit whether we really have to split cmd/nerdctl in the first place ( #1631 (comment) ), as the functions in cmd/nerdctl aren't really designed to be imported from other projects. There might be some functions that can be safely imported from third parties, but they should be rather decoupled from the CLI and should be moved to pkg/... .
Then there might be no good reason to split cmd/nerdctl ? I expected that splitting cmd/nerdctl will increase the code readability as a side effect, but improper splitting will rather decrease the readability, so it has to be done seriously carefully.
@Zheaoli Thanks anyway for your hard work, and hope you will get well soon! 👍
Moreover, I want to add a feature for nerdctl run to record accessed files when a container is running. If it is acceptable, We could consider adding it to the nerdctl source code and contributing it to the community.
Also, there shouldn't be the common package that is likely to result in being the home of random mutually irrelevant functions; the common package has to be split to multiple small cmdpkgs with clear purposes.
We also have to revisit whether we really have to split cmd/nerdctl in the first place ( #1631 (comment) ), as the functions in cmd/nerdctl aren't really designed to be imported from other projects. There might be some functions that can be safely imported from third parties, but they should be rather decoupled from the CLI and should be moved to pkg/... .
Then there might be no good reason to split cmd/nerdctl ? I expected that splitting cmd/nerdctl will increase the code readability as a side effect, but improper splitting will rather decrease the readability, so it has to be done seriously carefully.
Yes, I couldn't agree more that we should consider it carefully. One reason for this is to add private features for nerdctl.
Hi @sctb512, we're refactoring nerdctl as you may see above (#1680). If you feel the refactor (or the direction the refactor towards) is sufficient for your use case or you find workaround bypassing the necessary refactor, please feel free to close.
We are considering implementing containerd/nydus-snapshotter#228 with OCI hooks, so we can currently bypass this refactor. However, the feature mentioned in this PR is also useful for developers. Let's close this issue after #1680 is finished.
Activity
AkihiroSuda commentedon Dec 16, 2022
@sctb512
What function actually do you want to be exposed?
AkihiroSuda commentedon Dec 16, 2022
Cross-posting #1639 (comment)
sctb512 commentedon Dec 21, 2022
Thanks for your reply. I want to add features for
nerdctl runsubcommand. If we can split subcommand into a package, It will benefit developers.There are two reasons:
The files in
cmd/nerdctlare too many.We cannot import them as packages because they all belong to the
main.sctb512 commentedon Dec 21, 2022
Moreover, I want to add a feature for
nerdctl runto record accessed files when a container is running. If it is acceptable, We could consider adding it to thenerdctlsource code and contributing it to the community.sctb512 commentedon Dec 21, 2022
There is some information about it. containerd/nydus-snapshotter#228
AkihiroSuda commentedon Dec 21, 2022
cc @ktock
sctb512 commentedon Dec 21, 2022
Yes, I couldn't agree more that we should consider it carefully. One reason for this is to add private features for
nerdctl.sctb512 commentedon Feb 9, 2023
May we close this issue?
djdongjin commentedon Feb 9, 2023
Hi @sctb512, we're refactoring nerdctl as you may see above (#1680). If you feel the refactor (or the direction the refactor towards) is sufficient for your use case or you find workaround bypassing the necessary refactor, please feel free to close.
sctb512 commentedon Feb 9, 2023
We are considering implementing containerd/nydus-snapshotter#228 with OCI hooks, so we can currently bypass this refactor. However, the feature mentioned in this PR is also useful for developers. Let's close this issue after #1680 is finished.
apostasie commentedon Nov 30, 2024
@AkihiroSuda I assume this is what we did with #3379 and #3383 ?
Shall this be closed?