Skip to content

Commit a402ffd

Browse files
committed
docs: add description about our code structure
Document most important directories when trying to understand our project. Signed-off-by: Paul Holzinger <[email protected]>
1 parent 2a6f190 commit a402ffd

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ Pull requests that change the vendor/ directory directly will not be accepted.
117117
Instead, changes should be submitted to the original package (defined by the path in `vendor/`; for example, `vendor/github.com/containers/storage` is the [containers/storage library](https://github.com/containers/storage/).
118118
Once the changes have been merged into the original package, Podman's vendor directory can be updated by using `go get` on the appropriate version of the package, then running `make vendor` or `make vendor-in-container`.
119119

120+
## Codebase structure
121+
122+
Description about important directories in our repository is found [here](./docs/CODE_STRUCTURE.md).
123+
120124
## Testing
121125

122126
Podman provides an extensive suite of regression tests in the `test/` directory.

docs/CODE_STRUCTURE.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Podman Codebase structure
2+
3+
Description about important directories in our repository.
4+
5+
#### bin/
6+
7+
- Build binaries are put here, podman, podman-remote, quadlet, etc...
8+
9+
### cmd/
10+
11+
- Each directory here builds its own binary.
12+
13+
#### cmd/podman/
14+
15+
- Podman CLI code, CLI commands and flags are defined here, we are using the [Cobra CLI library](https://github.com/spf13/cobra) for command line parsing.
16+
17+
#### cmd/quadlet/
18+
19+
- Quadlet CLI code.
20+
21+
### contrib/
22+
23+
- CI scripts, packaging files some container image build files.
24+
25+
### docs/
26+
27+
- Sphinx based documentation for Podman that is build on [Read the Docs](https://readthedocs.com/) and hosted at [docs.podman.io](https://docs.podman.io/).
28+
- More information is found in [README.md](./README.md).
29+
30+
### libpod/ (only works on linux and freebsd)
31+
- Underlying core for most Podman operations, defines container, pod, volume management operations.
32+
- Contains the database to store these information on disk, either Sqlite or Botldb (our old db format).
33+
- Integrates with our other libraries such as:
34+
- containers/storage to create and mount container storage.
35+
- containers/buildah for building images.
36+
- containers/common/libnetwork for network management.
37+
38+
### pkg/
39+
40+
- Various packages to do all sorts of different things.
41+
42+
#### pkg/api/
43+
44+
- The HTTP REST API server code.
45+
46+
#### pkg/bindings/
47+
48+
- The HTTP REST API client code.
49+
- This package must have a stable API as it is for use by external consumers as well.
50+
51+
#### pkg/domain/
52+
53+
- "glue" code between cli and the actual operations performed.
54+
55+
##### pkg/domain/entities/
56+
57+
- The package defines two interfaces (ContainerEngine, ImageEngine) that more or less have a function for each cli command defined.
58+
- It also defines a lot of types (structs) for the various options the functions accept.
59+
60+
##### pkg/domain/infra/tunnel/
61+
62+
- Implements the two interfaces for the remote mode (podman-remote) which just maps each operations to the bindings code from pkg/bindings which then talks to the remote server.
63+
64+
##### pkg/domain/infra/abi/
65+
66+
- Implements the two interfaces for the local mode (podman) that calls then directly into the core parts of libpod/ or our other libraries containers/{common,image,storage}...
67+
68+
#### pkg/libartifact/
69+
70+
- Core code for the new podman artifact commands.
71+
72+
#### pkg/machine/
73+
74+
- Core code for podman machine commands.
75+
76+
##### pkg/machine/e2e/
77+
78+
- e2e tests for podman machine commands.
79+
- Runs on Windows, MacOS and Linux.
80+
81+
### test/
82+
83+
- Various tests suites, see the test [README.md](../test/README.md) for more details.
84+
- These run on linux only.
85+
86+
#### vendor/
87+
88+
- Directory created with "go mod vendor".
89+
- This includes all go deps in our repo, DO NOT edit this directory directly, changes in dependencies must be made in their respective upstream repositories and then updated in go.mod.

0 commit comments

Comments
 (0)