Skip to content

Commit d94499c

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 0dfe9ee + 85d808d commit d94499c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1412
-297
lines changed

CHANGELOG.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,105 @@
11
# CHANGELOG
22

3+
## 0.3.0 (2018-03-30)
4+
5+
**IMPORTANT**: Pouch 0.3.0 has met almost all your basic needs for kubernetes:
6+
7+
1. Sandbox/Container lifecycle management
8+
2. Image management
9+
3. Network management with CNI
10+
4. Container streaming: exec/attach/portforward
11+
5. Container logging
12+
6. Security Context: RunAsUser, Apparmor,Seccomp,Sysctl
13+
7. Validation test of cri-tools: 51/55 Pass
14+
15+
**IMPORTANT**:
16+
Kubernetes 1.10 was released recently and the CRI of it has updated from v1alpha1 to v1alpha2.
17+
Pouch will first try to fully support CRI v1alpha1 and then CRI v1alpha2.
18+
So kubernetes 1.9.X is recommended now
19+
20+
### Remote API && Client
21+
22+
* `inspect` now support input multi items [\#989](https://github.com/alibaba/pouch/pull/989)
23+
* Refactor make route code much more simplified [\#988](https://github.com/alibaba/pouch/pull/988)
24+
* Fix `restart` router miss versionMatcher [\#986](https://github.com/alibaba/pouch/pull/986)
25+
* Add kernel value in `pouch version` command [\#942](https://github.com/alibaba/pouch/pull/942)
26+
* Make `pouch info` print more pretty [\#941](https://github.com/alibaba/pouch/pull/941)
27+
* Add `no-trunc` flag to `pouch ps` [\#909](https://github.com/alibaba/pouch/pull/909)
28+
* New `restart` command that allow restarting an running container [\#890](https://github.com/alibaba/pouch/pull/890)
29+
* New `upgrade` command that allow upgrading image and resources of a container [\#852](https://github.com/alibaba/pouch/pull/852)
30+
* New `top` command that allow showing processes informations in container [\#878](https://github.com/alibaba/pouch/pull/878)
31+
* Add `--format` flag to `pouch image inspect` and `pouch network inspect` commands [\#871](https://github.com/alibaba/pouch/pull/871)
32+
* New `pouch info` command to print all informations about th pouch daemon [\#859](https://github.com/alibaba/pouch/pull/859)
33+
* New `pouch logs` command that allow printing logs of container [\#886](https://github.com/alibaba/pouch/pull/886)
34+
* Using the default registry when execute `logout`command if not specified one [\#902](https://github.com/alibaba/pouch/pull/902)
35+
* New `resize` command that allow changing the height and width of TTY of an running container [\#879](https://github.com/alibaba/pouch/pull/879)
36+
37+
### Pouch Daemon
38+
39+
* New `update` API that allow updating `labels` and `image-proxy` parameters of pouch daemon [\#987](https://github.com/alibaba/pouch/pull/987)
40+
* Add `--label` flag to `pouchd` [\#982](https://github.com/alibaba/pouch/pull/982)
41+
42+
### Runtime
43+
44+
* Change container parameter's json name from `ID` to `Id` to be compatible with Moby API [\#1002](https://github.com/alibaba/pouch/pull/1002)
45+
* Fix errors checked by markdownlint [\#974](https://github.com/alibaba/pouch/pull/974)
46+
* Refactor the pouch ctrd layer client interface [\#971](https://github.com/alibaba/pouch/pull/971)
47+
* Refactor the `pkg` package that let's client package independent to other inner pkgs [\#962](https://github.com/alibaba/pouch/pull/962)
48+
* Add circleci to pouch to validate markdown files [\#961](https://github.com/alibaba/pouch/pull/961)
49+
* Fix log initialization of `libnetwork` in pouch [\#956](https://github.com/alibaba/pouch/pull/956)
50+
* Fix the import path of package `logrus` [\#953](https://github.com/alibaba/pouch/pull/953)
51+
* Fix should checking `kernelVersion.Kernel` not `kernelVersion.Major` when setting disk quota driver [\#946](https://github.com/alibaba/pouch/pull/946)
52+
* New `restart` interface that allow restarting an running container [\#944](https://github.com/alibaba/pouch/pull/944)
53+
* Refactor modify logic in complement image fullname [\#940](https://github.com/alibaba/pouch/pull/940)
54+
* Add `--oom-kill-disable` and `--oom-score-adj` flags to `pouch create` [\#934](https://github.com/alibaba/pouch/pull/934)
55+
* New `resize` API that allow changing the height and width of TTY of an running container [\#931](https://github.com/alibaba/pouch/pull/931)
56+
* Fix execute `pouch images` command panic when pulling an image failed before [\#926](https://github.com/alibaba/pouch/pull/926)
57+
* New `upgrade` API that allow upgrading the image and resource of a container [\#923](https://github.com/alibaba/pouch/pull/923)
58+
* New plugin framework to support executing custom codes at plugin points [\#919](https://github.com/alibaba/pouch/pull/919)
59+
* Add default registry namespace [\#911](https://github.com/alibaba/pouch/pull/911)
60+
* New `top` API that allow showing the processes informations in an running container [\#900](https://github.com/alibaba/pouch/pull/900)
61+
* Fix `cgroup-parent` should always be abs [\#896](https://github.com/alibaba/pouch/pull/896)
62+
* Refactor set lxcfs service managed by systemd [\#885](https://github.com/alibaba/pouch/pull/885)
63+
* Add version information in restful api url [\#869](https://github.com/alibaba/pouch/pull/869)
64+
* Add `repoTags` and `repoDigests` in `ImageInfo` struct [\#721](https://github.com/alibaba/pouch/pull/721)
65+
66+
### Documentation
67+
68+
* Add introduction document to diskquota [\#972](https://github.com/alibaba/pouch/pull/972)
69+
* Improve test guidance doc [\#856](https://github.com/alibaba/pouch/pull/856)
70+
71+
### Storage
72+
73+
* Add `--volume` flag to `pouch create` to support bind mounts for files [\#937](https://github.com/alibaba/pouch/pull/937)
74+
* Fix volume can be removed when using by container [\#888](https://github.com/alibaba/pouch/pull/888)
75+
* Add disk quota for container's rootfs [\#876](https://github.com/alibaba/pouch/pull/876)
76+
77+
### Kubernetes
78+
79+
* With this PR, we can get the error informations when stream server handles `exec` or `attach` commands occured errors [\#1007](https://github.com/alibaba/pouch/pull/1007)
80+
* Add websocket support for cri stream server [\#985](https://github.com/alibaba/pouch/pull/985)
81+
* Fix handle image format 'namespace/name:tag' correctly [\#981](https://github.com/alibaba/pouch/pull/981)
82+
* Fix pull image and get its status with RefDigest [\#973](https://github.com/alibaba/pouch/pull/973)
83+
* Store sandbox config informations for cri manager [\#955](https://github.com/alibaba/pouch/pull/955)
84+
* Seperate stdout & stderr of container io and support host network mode for sandbox [\#945](https://github.com/alibaba/pouch/pull/945)
85+
* Implement ReadOnlyRootfs and add `no-new-privilegs` support to cri manager [\#935](https://github.com/alibaba/pouch/pull/935)
86+
* Add support getting the logs of container to cri manager [\#928](https://github.com/alibaba/pouch/pull/928)
87+
* Add support setting pod dns configuration to cri manager [\#912](https://github.com/alibaba/pouch/pull/912)
88+
* Wrap cri manager to log every cri operation [\#899](https://github.com/alibaba/pouch/pull/899)
89+
* Fix inspect image by image id with prefix [\#895](https://github.com/alibaba/pouch/pull/895)
90+
* Implement exec and attach method of stream server [\#854](https://github.com/alibaba/pouch/pull/854)
91+
* Add `--group-add` flag to `pouch create` command and supplemental groups for cri manager [\#753](https://github.com/alibaba/pouch/pull/753)
92+
93+
### Test
94+
95+
* Add mock test for `rename` client [\#1021](https://github.com/alibaba/pouch/pull/1021)
96+
* Add mock test for `version` client [\#1004](https://github.com/alibaba/pouch/pull/1004)
97+
* Add test cases for `imageCache.get` [\#979](https://github.com/alibaba/pouch/pull/979)
98+
* Add mock test for client package [\#965](https://github.com/alibaba/pouch/pull/965)
99+
* Add test case for `login/logout` command [\#908](https://github.com/alibaba/pouch/pull/908)
100+
* Add related functions for test pouch daemon [\#884](https://github.com/alibaba/pouch/pull/884)
101+
* Print error log in CI for debug [\#883](https://github.com/alibaba/pouch/pull/883)
102+
3103
## 0.2.1 (2018-03-09)
4104

5105
### Network

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- [Features](#features)
1616
- [Architecture](#architecture)
1717
- [Getting Started](#getting-started)
18+
- [Deploying Kubernetes with Pouch](#deploying-kubernetes-with-pouch)
1819
- User Manual
1920
- [CLI Manual](docs/commandline)
2021
- [API Manual](docs/api)
@@ -37,6 +38,7 @@ Pouch's most important features are:
3738
- **P2P distribution**: Pouch utilizes [Dragonfly](https://github.com/alibaba/dragonfly), a P2P-base distribution system, to achieve lightning-fast container image distribution at enterprise's large scale.
3839
- **Kernel compatibility**: Enables OCI-compatible runtimes to work on old kernel versions, like linux kernel 2.6.32+.
3940
- **Standard compatibility**: Pouch keeps embracing container ecosystem to support industry standard, such as CNI, CSI and so on.
41+
- **Kubernetes compatibility**: Pouch has natively implemented Kubernetes Container Runtime Interface(CRI). It will be smooth to migrate from other Kubernetes container runtime to Pouch.
4042

4143
## Architecture
4244

@@ -66,6 +68,10 @@ Pouch offers a more "application centric" approach for application development:
6668

6769
You can easily setup a basic Pouch environment, see [INSTALLATION.md](INSTALLATION.md). You'll need to install a few packages before starting `pouchd`, which starts a container management service. The service can be accessed through the `pouch` CLI or RPC calls. For more details, please refer to [CLI Manual](docs/commandline) and [API Manual](docs/api).
6870

71+
## Deploying Kubernetes With Pouch
72+
73+
After installing Pouch on your machine, maybe it is the exiciting moment for you to power your Kubernetes cluster by Pouch. There is an easy guide for you to quickly experience this amazing combination [Kubernetes + Pouch](docs/kubernetes/pouch_with_kubernetes_deploying.md).
74+
6975
## Contributing
7076

7177
You are warmly welcomed to hack on Pouch. We have prepared a detailed guide [CONTRIBUTING.md](CONTRIBUTING.md).

cli/image_inspect.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (i *ImageInspectCommand) Init(c *Cli) {
2727
Long: imageInspectDescription,
2828
Args: cobra.MinimumNArgs(1),
2929
RunE: func(cmd *cobra.Command, args []string) error {
30-
return inspect.MultiInspect(args, i.runInspect)
30+
return i.runInspect(args)
3131
},
3232
Example: i.example(),
3333
}
@@ -43,13 +43,12 @@ func (i *ImageInspectCommand) addFlags() {
4343
func (i *ImageInspectCommand) runInspect(args []string) error {
4444
ctx := context.Background()
4545
apiClient := i.cli.Client()
46-
name := args[0]
4746

4847
getRefFunc := func(ref string) (interface{}, error) {
4948
return apiClient.ImageInspect(ctx, ref)
5049
}
5150

52-
return inspect.Inspect(os.Stdout, name, i.format, getRefFunc)
51+
return inspect.MultiInspect(os.Stdout, args, i.format, getRefFunc)
5352
}
5453

5554
// example shows examples in inspect command, and is used in auto-generated cli docs.

cli/inspect.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (p *InspectCommand) Init(c *Cli) {
2727
Long: inspectDescription,
2828
Args: cobra.MinimumNArgs(1),
2929
RunE: func(cmd *cobra.Command, args []string) error {
30-
return inspect.MultiInspect(args, p.runInspect)
30+
return p.runInspect(args)
3131
},
3232
Example: inspectExample(),
3333
}
@@ -43,13 +43,12 @@ func (p *InspectCommand) addFlags() {
4343
func (p *InspectCommand) runInspect(args []string) error {
4444
ctx := context.Background()
4545
apiClient := p.cli.Client()
46-
name := args[0]
4746

4847
getRefFunc := func(ref string) (interface{}, error) {
4948
return apiClient.ContainerGet(ctx, ref)
5049
}
5150

52-
return inspect.Inspect(os.Stdout, name, p.format, getRefFunc)
51+
return inspect.MultiInspect(os.Stdout, args, p.format, getRefFunc)
5352
}
5453

5554
// inspectExample shows examples in inspect command, and is used in auto-generated cli docs.

cli/inspect/inspector.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ package inspect
33
import (
44
"bytes"
55
"encoding/json"
6+
"fmt"
67
"io"
78
"strings"
89
"text/template"
910

11+
"github.com/alibaba/pouch/pkg/utils"
1012
"github.com/alibaba/pouch/pkg/utils/templates"
1113

1214
"github.com/pkg/errors"
@@ -62,7 +64,7 @@ func Inspect(out io.Writer, ref string, tmplStr string, getRef GetRefFunc) error
6264

6365
element, err := getRef(ref)
6466
if err != nil {
65-
return errors.Errorf("Template parsing error: %v", err)
67+
return errors.Errorf("Fetch object error: %v", err)
6668
}
6769

6870
if err := inspector.Inspect(element); err != nil {
@@ -76,23 +78,28 @@ func Inspect(out io.Writer, ref string, tmplStr string, getRef GetRefFunc) error
7678
return nil
7779
}
7880

79-
// RunInspectFunc is a function which used by MultiInspect
80-
type RunInspectFunc func(args []string) error
81-
82-
// MultiInspect Apply function to every item of ref.
83-
func MultiInspect(refs []string, inspect RunInspectFunc) error {
84-
var inspectErrors []string
81+
// MultiInspect fetches objects with multiple references.
82+
func MultiInspect(out io.Writer, refs []string, tmplStr string, getRef GetRefFunc) error {
83+
var errs []error
8584
for _, ref := range refs {
86-
err := inspect([]string{ref})
85+
err := Inspect(out, ref, tmplStr, getRef)
8786
if err != nil {
88-
inspectErrors = append(inspectErrors, err.Error())
87+
errs = append(errs, err)
8988
}
9089
}
91-
if len(inspectErrors) == 0 {
90+
if len(errs) == 0 {
9291
return nil
9392
}
9493

95-
return errors.New(strings.Join(inspectErrors, "Error: "))
94+
formatErrMsg := func(idx int, err error) (string, error) {
95+
errMsg := err.Error()
96+
errMsg = strings.TrimRight(errMsg, "\n")
97+
if idx != 0 {
98+
errMsg = fmt.Sprintf("Error: %s", errMsg)
99+
}
100+
return errMsg, nil
101+
}
102+
return utils.CombineErrors(errs, formatErrMsg)
96103
}
97104

98105
// Inspect executes the inspect template.

cli/network.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func (n *NetworkInspectCommand) Init(c *Cli) {
267267
Long: networkInspectDescription,
268268
Args: cobra.MinimumNArgs(1),
269269
RunE: func(cmd *cobra.Command, args []string) error {
270-
return inspect.MultiInspect(args, n.runNetworkInspect)
270+
return n.runNetworkInspect(args)
271271
},
272272
Example: networkInspectExample(),
273273
}
@@ -283,16 +283,14 @@ func (n *NetworkInspectCommand) addFlags() {
283283

284284
// runNetworkInspect is the entry of NetworkInspectCommand command.
285285
func (n *NetworkInspectCommand) runNetworkInspect(args []string) error {
286-
name := args[0]
287-
288286
ctx := context.Background()
289287
apiClient := n.cli.Client()
290288

291289
getRefFunc := func(ref string) (interface{}, error) {
292290
return apiClient.NetworkInspect(ctx, ref)
293291
}
294292

295-
return inspect.Inspect(os.Stdout, name, n.format, getRefFunc)
293+
return inspect.MultiInspect(os.Stdout, args, n.format, getRefFunc)
296294
}
297295

298296
// networkInspectExample shows examples in network inspect command, and is used in auto-generated cli docs.

cli/volume.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func (v *VolumeInspectCommand) Init(c *Cli) {
228228
Long: volumeInspectDescription,
229229
Args: cobra.MinimumNArgs(1),
230230
RunE: func(cmd *cobra.Command, args []string) error {
231-
return inspect.MultiInspect(args, v.runVolumeInspect)
231+
return v.runVolumeInspect(args)
232232
},
233233
Example: volumeInspectExample(),
234234
}
@@ -242,18 +242,14 @@ func (v *VolumeInspectCommand) addFlags() {
242242

243243
// runVolumeInspect is the entry of VolumeInspectCommand command.
244244
func (v *VolumeInspectCommand) runVolumeInspect(args []string) error {
245-
name := args[0]
246-
247-
logrus.Debugf("inspect a volume: %s", name)
248-
249245
ctx := context.Background()
250246
apiClient := v.cli.Client()
251247

252248
getRefFunc := func(ref string) (interface{}, error) {
253249
return apiClient.VolumeInspect(ctx, ref)
254250
}
255251

256-
return inspect.Inspect(os.Stdout, name, v.format, getRefFunc)
252+
return inspect.MultiInspect(os.Stdout, args, v.format, getRefFunc)
257253
}
258254

259255
// volumeInspectExample shows examples in volume inspect command, and is used in auto-generated cli docs.

client/network.go

Lines changed: 0 additions & 63 deletions
This file was deleted.

client/network_create.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package client
2+
3+
import (
4+
"context"
5+
6+
"github.com/alibaba/pouch/apis/types"
7+
)
8+
9+
// NetworkCreate creates a network.
10+
func (client *APIClient) NetworkCreate(ctx context.Context, req *types.NetworkCreateConfig) (*types.NetworkCreateResp, error) {
11+
resp, err := client.post(ctx, "/networks/create", nil, req, nil)
12+
if err != nil {
13+
return nil, err
14+
}
15+
16+
network := &types.NetworkCreateResp{}
17+
18+
err = decodeBody(network, resp.Body)
19+
ensureCloseReader(resp)
20+
21+
return network, err
22+
}

0 commit comments

Comments
 (0)