containerd / containerd/nerdctl
Refactor the (container) run command flagging process
- Dominant language
- Go
- Stars
- 10.4k
- Forks
- 826
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 44
Description
### What is the problem you're trying to solve
I'm currently refactoring the process of handling flags for the (container) run command. However, it is very complex and I would like to discuss it further.
### Describe the solution you'd like
First, we should split the `createContainer` function into smaller functions. As seen in the code at https://github.com/containerd/nerdctl/blob/1bbfe6930c56f3d69fe05b300f7c2817b828c024/cmd/nerdctl/container_run.go#L408-753
We will divide it into three tasks:
1. Move all helper functions to `pkg/cmd/*util`;
2. Add a function `processInternalLabels`;
3. Move all flag retrieval to `processCreateContainerFlags`.
Next, we will move `createContainer` to `pkg/cmd/containerutil`.
Finally, we will create `ContainerRunOptions` in `pkg/api/types/container_types.go` and `Run` in `pkg/cmd/container/run.go`.
Due to the complexity of the `createContainer` function and its numerous helper functions, it will take more time to handle.
@AkihiroSuda @djdongjin @Zheaoli , WDYT? Can you share your ideas?
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.