Remvoe go1.7 from travis

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-02-21 16:35:42 -08:00
parent 3101be93bc
commit fceafeb4d6
6 changed files with 14 additions and 40 deletions

View file

@ -4,7 +4,6 @@ sudo: required
language: go
go:
- 1.7.x
- 1.8.x
- tip

View file

@ -1,6 +1,6 @@
# containerd Plugin Model
With go 1.8 we now have dynamically loaded plugins via go packages. This seems to be a very easy and clean way to extent containerd. It does have the drawback of only working on Linux right now but there is where we see the most need for swapping out defaults.
With go 1.8 we now have dynamically loaded plugins via go packages. This seems to be a very easy and clean way to extend containerd. It does have the drawback of only working on Linux right now but this is where we see the most need for swapping out defaults.
## core
@ -19,44 +19,11 @@ The core should be comprised of the following:
The runtime code in the core provides API to create, list, and manage containers on the system. It provides a runtime type that is responsible for creating, deleting, and loading containers.
```go
type Runtime interface {
Create(ctx context.Context, id string, opts CreateOpts) (Container, error)
Containers() ([]Container, error)
Delete(ctx context.Context, c Container) error
}
```
There is a common `Container` interface with common methods for interacting with the container as well as platform specific container interfaces.
```go
type Container interface {
Info() ContainerInfo
Start(context.Context) error
State(context.Context) (State, error)
Events(context.Context) (<-chan ContainerEvent, error)
Kill(context.Context) error
}
type LinuxContainer interface {
Pause(context.Context) error
Resume(context.Context) error
Exec(context.Context, ExecOpts) (uint32, error)
Signal(c context.Context, pid uint32, s os.Signal) error
}
type WindowsContainer interface {
Exec(context.Context, ExecOpts) (uint32, error)
Signal(c context.Context, pid uint32, s os.Signal) error
}
```
### Monitoring
The monitoring subsystem is a way to collect events and metrics from various subsystems.
With the monitoring subsystem you can monitor various types, subsystems, and objects within the core.
This can be use to collect metrics for containers and monitor OOM events when supported.
This can be used to collect metrics for containers and monitor OOM events when supported.
An example of this is a prometheus monitor that exports container metrics such as cpu, memory, io, and network information.
```go

5
linux/main.go Normal file
View file

@ -0,0 +1,5 @@
package main
func main() {
panic("build as plugin not executable")
}

View file

@ -31,12 +31,13 @@ func init() {
}
func New(ic *containerd.InitContext) (interface{}, error) {
if err := os.MkdirAll(ic.State, 0700); err != nil {
path := filepath.Join(ic.State, runtimeName)
if err := os.MkdirAll(path, 0700); err != nil {
return nil, err
}
c, cancel := context.WithCancel(ic.Context)
return &Runtime{
root: ic.State,
root: path,
events: make(chan *containerd.Event, 2048),
eventsContext: c,
eventsCancel: cancel,

View file

@ -46,13 +46,13 @@ var register = struct {
r: make(map[string]*Registration),
}
// Load loads all plugins at the provided that into containerd
// Load loads all plugins at the provided path into containerd
func Load(path string) (err error) {
defer func() {
if v := recover(); v != nil {
rerr, ok := v.(error)
if !ok {
panic(v)
rerr = fmt.Errorf("%s", v)
}
err = rerr
}

View file

@ -133,6 +133,8 @@ func (s *Service) Delete(ctx context.Context, r *api.DeleteRequest) (*google_pro
func (s *Service) List(ctx context.Context, r *api.ListRequest) (*api.ListResponse, error) {
resp := &api.ListResponse{}
s.mu.Lock()
defer s.mu.Unlock()
for _, c := range s.containers {
state, err := c.State(ctx)
if err != nil {