Skip to content

Commit 178e9a1

Browse files
authored
Merge pull request #4866 from zhsj/doc-fix
Update BUILDING.md after moving to Go modules and various other small docs update
2 parents ac5ca3a + 5988bfc commit 178e9a1

23 files changed

Lines changed: 59 additions & 60 deletions

BUILDING.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ To build the `containerd` daemon, and the `ctr` simple test client, the followin
2222

2323
First you need to setup your Go development environment. You can follow this
2424
guideline [How to write go code](https://golang.org/doc/code.html) and at the
25-
end you need to have `GOPATH` and `GOROOT` set in your environment.
25+
end you have `go` command in your `PATH`.
2626

27-
At this point you can use `go` to checkout `containerd` in your `GOPATH`:
27+
You need `git` to checkout the source code:
2828

2929
```sh
30-
go get github.com/containerd/containerd
30+
git clone https://github.com/containerd/containerd
3131
```
3232

3333
For proper results, install the `protoc` release into `/usr/local` on your build system. For example, the following commands will download and install the 3.11.4 release for a 64-bit Linux host:
@@ -41,9 +41,8 @@ $ sudo unzip protoc-3.11.4-linux-x86_64.zip -d /usr/local
4141
need to satisfy these dependencies in your system:
4242

4343
* CentOS/Fedora: `yum install btrfs-progs-devel`
44-
* Debian/Ubuntu: `apt-get install btrfs-tools`
45-
* Debian Buster/Ubuntu 19.10/ Ubuntu 20.04:
46-
`apt-get install btrfs-progs libbtrfs-dev`
44+
* Debian/Ubuntu: `apt-get install btrfs-progs libbtrfs-dev`
45+
* Debian(before Buster)/Ubuntu(before 19.10): `apt-get install btrfs-tools`
4746

4847
At this point you are ready to build `containerd` yourself!
4948

@@ -63,27 +62,23 @@ correct version of `runc` installed.
6362

6463
For the quick and dirty installation, you can use the following:
6564

66-
go get github.com/opencontainers/runc
67-
68-
This is not recommended, as the generated binary will not have version
69-
information. Instead, cd into the source directory and use make to build and
70-
install the binary:
71-
72-
cd $GOPATH/src/github.com/opencontainers/runc
73-
make
74-
make install
65+
```
66+
git clone https://github.com/opencontainers/runc
67+
cd runc
68+
make
69+
sudo make install
70+
```
7571

7672
Make sure to follow the guidelines for versioning in [RUNC.md](RUNC.md) for the
77-
best results. Some pointers on proper build tag setupVersion mismatches can
78-
result in undefined behavior.
73+
best results.
7974

8075
## Build containerd
8176

8277
`containerd` uses `make` to create a repeatable build flow. It means that you
8378
can run:
8479

8580
```
86-
cd $GOPATH/src/github.com/containerd/containerd
81+
cd containerd
8782
make
8883
```
8984

@@ -111,7 +106,10 @@ make generate
111106
> For example, adding `BUILDTAGS=no_btrfs` to your environment before calling the **binaries**
112107
> Makefile target will disable the btrfs driver within the containerd Go build.
113108
114-
Vendoring of external imports uses the [`vndr` tool](https://github.com/LK4D4/vndr) which uses a simple config file, `vendor.conf`, to provide the URL and version or hash details for each vendored import. After modifying `vendor.conf` run the `vndr` tool to update the `vendor/` directory contents. Combining the `vendor.conf` update with the changeset in `vendor/` after running `vndr` should become a single commit for a PR which relies on vendored updates.
109+
Vendoring of external imports uses the [Go Modules](https://golang.org/ref/mod#vendoring). You need
110+
to use `go mod` command to modify the dependencies. After modifition, you should run `go mod tidy`
111+
and `go mod vendor` to ensure the `go.mod`, `go.sum` files and `vendor` directory are up to date.
112+
Changes to these files should become a single commit for a PR which relies on vendored updates.
115113

116114
Please refer to [RUNC.md](/RUNC.md) for the currently supported version of `runc` that is used by containerd.
117115

@@ -131,6 +129,8 @@ make EXTRA_FLAGS="-buildmode pie" \
131129
132130
# Via Docker container
133131

132+
The following instructions assume you are at the parent directory of containerd source directory.
133+
134134
## Build containerd
135135

136136
You can build `containerd` via a Linux-based Docker container.
@@ -148,7 +148,7 @@ containerd source root directory you can run the following command:
148148

149149
```sh
150150
docker run -it \
151-
-v ${PWD}:/go/src/github.com/containerd/containerd \
151+
-v ${PWD}/containerd:/go/src/github.com/containerd/containerd \
152152
-e GOPATH=/go \
153153
-w /go/src/github.com/containerd/containerd containerd/build sh
154154
```
@@ -164,10 +164,10 @@ You are now ready to [build](#build-containerd):
164164
## Build containerd and runc
165165
To have complete core container runtime, you will need both `containerd` and `runc`. It is possible to build both of these via Docker container.
166166

167-
You can use `go` to checkout `runc` in your `GOPATH`:
167+
You can use `git` to checkout `runc`:
168168

169169
```sh
170-
go get github.com/opencontainers/runc
170+
git clone https://github.com/opencontainers/runc
171171
```
172172

173173
We can build an image from this `Dockerfile`:
@@ -187,8 +187,8 @@ Let's suppose you build an image called `containerd/build` from the above Docker
187187
```sh
188188
docker run -it --privileged \
189189
-v /var/lib/containerd \
190-
-v ${GOPATH}/src/github.com/opencontainers/runc:/go/src/github.com/opencontainers/runc \
191-
-v ${GOPATH}/src/github.com/containerd/containerd:/go/src/github.com/containerd/containerd \
190+
-v ${PWD}/runc:/go/src/github.com/opencontainers/runc \
191+
-v ${PWD}/containerd:/go/src/github.com/containerd/containerd \
192192
-e GOPATH=/go \
193193
-w /go/src/github.com/containerd/containerd containerd/build sh
194194
```

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ man: mandir $(addprefix man/,$(MANPAGES))
227227
mandir:
228228
@mkdir -p man
229229

230-
# Kept for backwards compatability
230+
# Kept for backwards compatibility
231231
genman: man/containerd.8 man/ctr.8
232232

233233
man/containerd.8: FORCE

README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
[![PkgGoDev](https://pkg.go.dev/badge/github.com/containerd/containerd)](https://pkg.go.dev/github.com/containerd/containerd)
44
[![Build Status](https://github.com/containerd/containerd/workflows/CI/badge.svg)](https://github.com/containerd/containerd/actions?query=workflow%3ACI)
5-
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/containerd/containerd?branch=master&svg=true)](https://ci.appveyor.com/project/mlaventure/containerd-3g73f?branch=master)
65
[![Nightlies](https://github.com/containerd/containerd/workflows/Nightly/badge.svg)](https://github.com/containerd/containerd/actions?query=workflow%3ANightly)
76
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fcontainerd%2Fcontainerd.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fcontainerd%2Fcontainerd?ref=badge_shield)
87
[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/containerd)](https://goreportcard.com/report/github.com/containerd/containerd)
@@ -249,6 +248,16 @@ the autocomplete/ctr file in your `.bashrc`, or manually like:
249248
$ source ./contrib/autocomplete/ctr
250249
```
251250

251+
#### Distribution of `ctr` autocomplete for bash and zsh
252+
253+
For bash, copy the `contrib/autocomplete/ctr` script into
254+
`/etc/bash_completion.d/` and rename it to `ctr`. The `zsh_autocomplete`
255+
file is also available and can be used similarly for zsh users.
256+
257+
Provide documentation to users to `source` this file into their shell if
258+
you don't place the autocomplete file in a location where it is automatically
259+
loaded for the user's shell environment.
260+
252261
### CRI
253262

254263
`cri` is a [containerd](https://containerd.io/) plugin implementation of the Kubernetes [container runtime interface (CRI)](https://github.com/kubernetes/cri-api/blob/master/pkg/apis/runtime/v1alpha2/api.proto). With it, you are able to use containerd as the container runtime for a Kubernetes cluster.
@@ -283,16 +292,6 @@ A Kubernetes incubator project, [cri-tools](https://github.com/kubernetes-sigs/c
283292
* [Configuring `cri` Plugins](./docs/cri/config.md)
284293
* [Configuring containerd](https://github.com/containerd/containerd/blob/master/docs/man/containerd-config.8.md)
285294

286-
#### Distribution of `ctr` autocomplete for bash and zsh
287-
288-
For bash, copy the `contrib/autocomplete/ctr` script into
289-
`/etc/bash_completion.d/` and rename it to `ctr`. The `zsh_autocomplete`
290-
file is also available and can be used similarly for zsh users.
291-
292-
Provide documentation to users to `source` this file into their shell if
293-
you don't place the autocomplete file in a location where it is automatically
294-
loaded for the user's shell environment.
295-
296295
### Communication
297296

298297
For async communication and long running discussions please use issues and pull requests on the github repo.

container_linux_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func TestRegressionIssue4769(t *testing.T) {
124124
select {
125125
case et := <-eventStream:
126126
if et.Event == nil {
127-
t.Fatal(errors.Errorf("unexpect empty event: %+v", et))
127+
t.Fatal(errors.Errorf("unexpected empty event: %+v", et))
128128
}
129129

130130
v, err := typeurl.UnmarshalAny(et.Event)
@@ -133,7 +133,7 @@ func TestRegressionIssue4769(t *testing.T) {
133133
}
134134

135135
if e, ok := v.(*apievents.TaskExit); !ok {
136-
t.Fatal(errors.Errorf("unexpect event type: %+v", v))
136+
t.Fatal(errors.Errorf("unexpected event type: %+v", v))
137137
} else if e.ExitStatus != 0 {
138138
t.Fatal(errors.Errorf("expect zero exit status, but got %v", e.ExitStatus))
139139
}

docs/man/containerd-config.toml.5.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ settings.
3434

3535
**imports**
3636
: Imports is a list of additional configuration files to include.
37-
This allows to split the main configuration file and keep some sections
37+
This allows one to split the main configuration file and keep some sections
3838
separately (for example vendors may keep a custom runtime configuration in a
3939
separate file without modifying the main `config.toml`).
4040
Imported files will overwrite simple fields like `int` or

docs/remote-snapshotter.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ This is a containerd-defined label which contains ChainID that targets a committ
8484
At this moment, user-defined labels (prefixed by `containerd.io/snapshot/`) will also be merged into the labels option.
8585

8686
```go
87-
// Gets annotations appended to the targetting layer which would contain
87+
// Gets annotations appended to the targeting layer which would contain
8888
// snapshotter-specific information passed by the user.
8989
labels := snapshots.FilterInheritedLabels(desc.Annotations)
9090
if labels == nil {
@@ -98,7 +98,7 @@ labels["containerd.io/snapshot.ref"] = chainID
9898
// snapshotter-specific information passed by the user.
9999
opts := append(rCtx.SnapshotterOpts, snapshots.WithLabels(labels))
100100

101-
// Calls `Prepare` API with target indentifier and snapshotter-specific
101+
// Calls `Prepare` API with target identifier and snapshotter-specific
102102
// information.
103103
mounts, err = sn.Prepare(ctx, key, parent.String(), opts...)
104104
```

images/image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func Platforms(ctx context.Context, provider content.Provider, image ocispec.Des
289289
// If available is true, the caller can assume that required represents the
290290
// complete set of content required for the image.
291291
//
292-
// missing will have the components that are part of required but not avaiiable
292+
// missing will have the components that are part of required but not available
293293
// in the provider.
294294
//
295295
// If there is a problem resolving content, an error will be returned.

namespaces/ttrpc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestCopyTTRPCMetadata(t *testing.T) {
4242

4343
func TestTTRPCNamespaceHeader(t *testing.T) {
4444
ctx := context.Background()
45-
namespace := "test-namepace"
45+
namespace := "test-namespace"
4646
ctx = withTTRPCNamespaceHeader(ctx, namespace)
4747

4848
header, ok := fromTTRPCHeader(ctx)

pkg/cri/opts/spec_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func WithDevices(osi osinterface.OS, config *runtime.ContainerConfig) oci.SpecOp
329329
}
330330
}
331331

332-
// WithCapabilities sets the provided capabilties from the security context
332+
// WithCapabilities sets the provided capabilities from the security context
333333
func WithCapabilities(sc *runtime.LinuxContainerSecurityContext) oci.SpecOpts {
334334
capabilities := sc.GetCapabilities()
335335
if capabilities == nil {

pkg/cri/server/bandwidth/fake_shaper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
"k8s.io/apimachinery/pkg/api/resource"
3939
)
4040

41-
// FakeShaper provides an implementation of the bandwith.Shaper.
41+
// FakeShaper provides an implementation of the bandwidth.Shaper.
4242
// Beware this is implementation has no features besides Reset and GetCIDRs.
4343
type FakeShaper struct {
4444
CIDRs []string

0 commit comments

Comments
 (0)