From 719e86e0b028aee1a42783b8dc68fb2dc5080d52 Mon Sep 17 00:00:00 2001 From: tonic Date: Thu, 23 Jun 2016 17:44:39 +0800 Subject: [PATCH] add upgrade container --- cluster/calcium/create_container.go | 181 ++++++++++++++++++++- cluster/calcium/helper.go | 52 +++++- cluster/cluster.go | 6 +- devtools/client.py | 20 ++- devtools/core_pb2.py | 154 ++++++++++++++++-- rpc/gen/core.pb.go | 241 ++++++++++++++++++++-------- rpc/gen/core.proto | 14 ++ rpc/rpc.go | 19 +++ rpc/transform.go | 10 ++ types/message.go | 8 + 10 files changed, 606 insertions(+), 99 deletions(-) diff --git a/cluster/calcium/create_container.go b/cluster/calcium/create_container.go index 7848a54dd..072760186 100644 --- a/cluster/calcium/create_container.go +++ b/cluster/calcium/create_container.go @@ -5,6 +5,7 @@ import ( "path/filepath" "strings" "sync" + "time" log "github.com/Sirupsen/logrus" enginetypes "github.com/docker/engine-api/types" @@ -19,7 +20,7 @@ import ( // Create Container // Use specs and options to create -// TODO need to call agent's API to create network +// TODO what about networks? func (c *Calcium) CreateContainer(specs types.Specs, opts *types.DeployOptions) (chan *types.CreateContainerMessage, error) { ch := make(chan *types.CreateContainerMessage) @@ -87,11 +88,12 @@ func (c *Calcium) prepareNodes(podname string, quota float64, num int) (map[stri // if public, use only public nodes if q == 0 { - nodes = filterPublicNodes(nodes) + nodes = filterNodes(nodes, true) + } else { + nodes = filterNodes(nodes, false) } cpumap := makeCPUMap(nodes) - // TODO too be simple, just use int type as quota r, err = c.scheduler.SelectNodes(cpumap, q, num) if err != nil { return r, err @@ -113,11 +115,12 @@ func (c *Calcium) prepareNodes(podname string, quota float64, num int) (map[stri return r, err } -// filter only public nodes -func filterPublicNodes(nodes []*types.Node) []*types.Node { +// filter nodes +// public is the flag +func filterNodes(nodes []*types.Node, public bool) []*types.Node { rs := []*types.Node{} for _, node := range nodes { - if node.Public { + if node.Public == public { rs = append(rs, node) } } @@ -126,7 +129,7 @@ func filterPublicNodes(nodes []*types.Node) []*types.Node { // Pull an image // Blocks until it finishes. -func doPullImage(node *types.Node, image string) error { +func pullImage(node *types.Node, image string) error { if image == "" { return fmt.Errorf("No image found for version") } @@ -150,7 +153,7 @@ func (c *Calcium) doCreateContainer(nodename string, cpumap []types.CPUMap, spec return ms } - if err := doPullImage(node, opts.Image); err != nil { + if err := pullImage(node, opts.Image); err != nil { return ms } @@ -341,3 +344,165 @@ func (c *Calcium) makeContainerOptions(quota map[string]int, specs types.Specs, networkConfig := &enginenetwork.NetworkingConfig{} return config, hostConfig, networkConfig, containerName, nil } + +// Upgrade containers +// Use image to run these containers, and copy their settings +// Note, if the image is not correct, container will be started incorrectly +// TODO what about networks? +func (c *Calcium) UpgradeContainer(ids []string, image string) (chan *types.UpgradeContainerMessage, error) { + ch := make(chan *types.UpgradeContainerMessage) + + if len(ids) == 0 { + return ch, fmt.Errorf("No container ids given") + } + + containers, err := c.GetContainers(ids) + if err != nil { + return ch, err + } + + containerMap := make(map[string][]*types.Container) + for _, container := range containers { + containerMap[container.Nodename] = append(containerMap[container.Nodename], container) + } + + go func() { + wg := sync.WaitGroup{} + wg.Add(len(containerMap)) + + for _, containers := range containerMap { + go func(containers []*types.Container, image string) { + defer wg.Done() + + for _, m := range c.doUpgradeContainer(containers, image) { + ch <- m + } + }(containers, image) + + } + + wg.Wait() + close(ch) + }() + + return ch, nil +} + +// upgrade containers on the same node +func (c *Calcium) doUpgradeContainer(containers []*types.Container, image string) []*types.UpgradeContainerMessage { + ms := make([]*types.UpgradeContainerMessage, len(containers)) + for i := 0; i < len(ms); i++ { + ms[i] = &types.UpgradeContainerMessage{} + } + + // TODO ugly + // use the first container to get node + // since all containers here must locate on the same node and pod + t := containers[0] + node, err := c.GetNode(t.Podname, t.Nodename) + if err != nil { + return ms + } + + // prepare new image + if err := pullImage(node, image); err != nil { + return ms + } + + imagesToDelete := make(map[string]struct{}) + engine := node.Engine + + for i, container := range containers { + info, err := container.Inspect() + if err != nil { + ms[i].Error = err.Error() + continue + } + + // stops the old container + timeout := 5 * time.Second + err = engine.ContainerStop(context.Background(), info.ID, &timeout) + if err != nil { + ms[i].Error = err.Error() + continue + } + + // copy config from old container + // and of course with a new name + config, hostConfig, networkConfig, containerName, err := makeContainerConfig(info, image) + if err != nil { + ms[i].Error = err.Error() + continue + } + + // create a container with old config and a new name + newContainer, err := engine.ContainerCreate(context.Background(), config, hostConfig, networkConfig, containerName) + if err != nil { + ms[i].Error = err.Error() + continue + } + + // start this new container + err = engine.ContainerStart(context.Background(), newContainer.ID, enginetypes.ContainerStartOptions{}) + if err != nil { + go engine.ContainerRemove(context.Background(), newContainer.ID, enginetypes.ContainerRemoveOptions{}) + ms[i].Error = err.Error() + continue + } + + // test if container is correctly started + // if not, restore the old container + newInfo, err := engine.ContainerInspect(context.Background(), newContainer.ID) + if err != nil { + ms[i].Error = err.Error() + // restart the old container + engine.ContainerStart(context.Background(), info.ID, enginetypes.ContainerStartOptions{}) + continue + } + + // if so, add a new container in etcd + _, err = c.store.AddContainer(newInfo.ID, container.Podname, container.Nodename, containerName, container.CPU) + if err != nil { + ms[i].Error = err.Error() + continue + } + + // remove the old container on node + rmOpts := enginetypes.ContainerRemoveOptions{ + RemoveVolumes: true, + Force: true, + } + err = engine.ContainerRemove(context.Background(), info.ID, rmOpts) + if err != nil { + ms[i].Error = err.Error() + continue + } + + imagesToDelete[info.Image] = struct{}{} + + // remove the old container in etcd + err = c.store.RemoveContainer(info.ID) + if err != nil { + ms[i].Error = err.Error() + continue + } + + // send back the message + ms[i].ContainerID = info.ID + ms[i].NewContainerID = newContainer.ID + ms[i].NewContainerName = containerName + ms[i].Success = true + } + + // clean all the container images + go func() { + rmiOpts := enginetypes.ImageRemoveOptions{ + Force: false, + PruneChildren: true, + } + for image, _ := range imagesToDelete { + engine.ImageRemove(context.Background(), image, rmiOpts) + } + }() + return ms +} diff --git a/cluster/calcium/helper.go b/cluster/calcium/helper.go index 5d86dd115..708736c69 100644 --- a/cluster/calcium/helper.go +++ b/cluster/calcium/helper.go @@ -1,7 +1,16 @@ package calcium -import "io" -import "io/ioutil" +import ( + "fmt" + "io" + "io/ioutil" + "strings" + + enginetypes "github.com/docker/engine-api/types" + enginecontainer "github.com/docker/engine-api/types/container" + enginenetwork "github.com/docker/engine-api/types/network" + "gitlab.ricebook.net/platform/core/utils" +) // As the name says, // blocks until the stream is empty, until we meet EOF @@ -12,3 +21,42 @@ func ensureReaderClosed(stream io.ReadCloser) { io.Copy(ioutil.Discard, stream) stream.Close() } + +// Copies config from container +// And make a new name for container +func makeContainerConfig(info enginetypes.ContainerJSON, image string) ( + *enginecontainer.Config, + *enginecontainer.HostConfig, + *enginenetwork.NetworkingConfig, + string, + error) { + + // we use `_` to join container name + // since we don't support `_` in entrypoint, and no `_` is in suffix, + // the last part will be suffix and second last part will be entrypoint, + // the rest will be the appname + parts := strings.Split(trimLeftSlash(info.Name), "_") + length := len(parts) + if length < 3 { + return nil, nil, nil, "", fmt.Errorf("Bad container name format: %q", info.Name) + } + + entrypoint := parts[length-2] + appname := strings.Join(parts[:length-2], "_") + + suffix := utils.RandomString(6) + containerName := strings.Join([]string{appname, entrypoint, suffix}, "_") + + config := info.Config + config.Image = image + + hostConfig := info.HostConfig + networkConfig := &enginenetwork.NetworkingConfig{} + return config, hostConfig, networkConfig, containerName, nil +} + +// see https://github.com/docker/docker/issues/6705 +// docker's stupid problem +func trimLeftSlash(name string) string { + return strings.TrimPrefix(name, "/") +} diff --git a/cluster/cluster.go b/cluster/cluster.go index 8f7e803d2..aa8ded25a 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -17,10 +17,8 @@ type Cluster interface { // cluster methods BuildImage(repository, version, uid string) (chan *types.BuildImageMessage, error) - CreateContainer(types.Specs, *types.DeployOptions) (chan *types.CreateContainerMessage, error) - // TODO add them later - // UpdateContainer() error - // MigrateContainer() error + CreateContainer(specs types.Specs, opts *types.DeployOptions) (chan *types.CreateContainerMessage, error) + UpgradeContainer(ids []string, image string) (chan *types.UpgradeContainerMessage, error) RemoveContainer(ids []string) (chan *types.RemoveContainerMessage, error) RemoveImage(podname, nodename string, images []string) (chan *types.RemoveImageMessage, error) } diff --git a/devtools/client.py b/devtools/client.py index 4d5fa753b..5b324b769 100755 --- a/devtools/client.py +++ b/devtools/client.py @@ -188,7 +188,7 @@ def create_container(ctx): podname='dev', entrypoint='log', cpu_quota=0, - count=1, + count=2, env=['ENV_A=1', 'ENV_B=2']) try: @@ -218,6 +218,24 @@ def remove_container(ctx, ids): click.echo(click.style('done', fg='green')) +@cli.command('container:upgrade') +@click.argument('ids', nargs=-1) +@click.argument('image') +@click.pass_context +def upgrade_container(ctx, ids, image): + stub = _get_stub(ctx) + opts = pb.UpgradeOptions(ids=[pb.ContainerID(id=i) for i in ids], image=image) + + try: + for m in stub.UpgradeContainer(opts, 3600): + click.echo('[%s] success:%s, id:%s, name:%s, error:%s' % (m.id, m.success, m.new_id, m.new_name, m.error)) + except AbortionError as e: + click.echo(click.style('abortion error: %s' % e.details, fg='red', bold=True)) + ctx.exit(-1) + + click.echo(click.style('done', fg='green')) + + @cli.command('container:get') @click.argument('ids', nargs=-1) @click.pass_context diff --git a/devtools/core_pb2.py b/devtools/core_pb2.py index cab33d91b..4e4d524d6 100644 --- a/devtools/core_pb2.py +++ b/devtools/core_pb2.py @@ -19,7 +19,7 @@ name='core.proto', package='pb', syntax='proto3', - serialized_pb=_b('\n\ncore.proto\x12\x02pb\"\x07\n\x05\x45mpty\"!\n\x03Pod\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x65sc\x18\x02 \x01(\t\"\x1d\n\x04Pods\x12\x15\n\x04pods\x18\x01 \x03(\x0b\x32\x07.pb.Pod\"\x93\x01\n\x04Node\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x10\n\x08\x65ndpoint\x18\x02 \x01(\t\x12\x0f\n\x07podname\x18\x03 \x01(\t\x12\x0e\n\x06public\x18\x04 \x01(\x08\x12\x1e\n\x03\x63pu\x18\x05 \x03(\x0b\x32\x11.pb.Node.CpuEntry\x1a*\n\x08\x43puEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x03:\x02\x38\x01\" \n\x05Nodes\x12\x17\n\x05nodes\x18\x01 \x03(\x0b\x32\x08.pb.Node\"V\n\tContainer\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07podname\x18\x02 \x01(\t\x12\x10\n\x08nodename\x18\x03 \x01(\t\x12\x0c\n\x04name\x18\x04 \x01(\t\x12\x0c\n\x04info\x18\x05 \x01(\t\"/\n\nContainers\x12!\n\ncontainers\x18\x01 \x03(\x0b\x32\r.pb.Container\"\x19\n\x0b\x43ontainerID\x12\n\n\x02id\x18\x01 \x01(\t\",\n\x0c\x43ontainerIDs\x12\x1c\n\x03ids\x18\x01 \x03(\x0b\x32\x0f.pb.ContainerID\"+\n\rAddPodOptions\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x65sc\x18\x02 \x01(\t\"\x1d\n\rGetPodOptions\x12\x0c\n\x04name\x18\x01 \x01(\t\"U\n\x0e\x41\x64\x64NodeOptions\x12\x10\n\x08nodename\x18\x01 \x01(\t\x12\x10\n\x08\x65ndpoint\x18\x02 \x01(\t\x12\x0f\n\x07podname\x18\x03 \x01(\t\x12\x0e\n\x06public\x18\x04 \x01(\x08\"3\n\x0eGetNodeOptions\x12\x0f\n\x07podname\x18\x01 \x01(\t\x12\x10\n\x08nodename\x18\x02 \x01(\t\"#\n\x10ListNodesOptions\x12\x0f\n\x07podname\x18\x01 \x01(\t\"?\n\x11\x42uildImageOptions\x12\x0c\n\x04repo\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x0b\n\x03uid\x18\x03 \x01(\t\"\xc3\x01\n\rDeployOptions\x12\r\n\x05specs\x18\x01 \x01(\t\x12\x0f\n\x07\x61ppname\x18\x02 \x01(\t\x12\r\n\x05image\x18\x03 \x01(\t\x12\x0f\n\x07podname\x18\x04 \x01(\t\x12\x10\n\x08nodename\x18\x05 \x01(\t\x12\x12\n\nentrypoint\x18\x06 \x01(\t\x12\x11\n\tcpu_quota\x18\x07 \x01(\x01\x12\r\n\x05\x63ount\x18\x08 \x01(\x05\x12\x0b\n\x03\x65nv\x18\t \x03(\t\x12\x10\n\x08networks\x18\n \x03(\t\x12\x0b\n\x03raw\x18\x0b \x01(\x08\"G\n\x12RemoveImageOptions\x12\x0f\n\x07podname\x18\x01 \x01(\t\x12\x10\n\x08nodename\x18\x02 \x01(\t\x12\x0e\n\x06images\x18\x03 \x03(\t\",\n\x0b\x45rrorDetail\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x03\x12\x0f\n\x07message\x18\x02 \x01(\t\"{\n\x11\x42uildImageMessage\x12\x0e\n\x06status\x18\x01 \x01(\t\x12\x10\n\x08progress\x18\x02 \x01(\t\x12\r\n\x05\x65rror\x18\x03 \x01(\t\x12\x0e\n\x06stream\x18\x04 \x01(\t\x12%\n\x0c\x65rror_detail\x18\x05 \x01(\x0b\x32\x0f.pb.ErrorDetail\"\xc4\x01\n\x16\x43reateContainerMessage\x12\x0f\n\x07podname\x18\x01 \x01(\t\x12\x10\n\x08nodename\x18\x02 \x01(\t\x12\n\n\x02id\x18\x03 \x01(\t\x12\x0c\n\x04name\x18\x04 \x01(\t\x12\x0f\n\x07success\x18\x05 \x01(\x08\x12\x30\n\x03\x63pu\x18\x06 \x03(\x0b\x32#.pb.CreateContainerMessage.CpuEntry\x1a*\n\x08\x43puEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x03:\x02\x38\x01\"F\n\x12RemoveImageMessage\x12\r\n\x05image\x18\x01 \x01(\t\x12\x0f\n\x07success\x18\x02 \x01(\x08\x12\x10\n\x08messages\x18\x03 \x03(\t\"F\n\x16RemoveContainerMessage\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07success\x18\x02 \x01(\x08\x12\x0f\n\x07message\x18\x03 \x01(\t2\xf4\x04\n\x07\x43oreRPC\x12!\n\x08ListPods\x12\t.pb.Empty\x1a\x08.pb.Pods\"\x00\x12&\n\x06\x41\x64\x64Pod\x12\x11.pb.AddPodOptions\x1a\x07.pb.Pod\"\x00\x12&\n\x06GetPod\x12\x11.pb.GetPodOptions\x1a\x07.pb.Pod\"\x00\x12)\n\x07\x41\x64\x64Node\x12\x12.pb.AddNodeOptions\x1a\x08.pb.Node\"\x00\x12)\n\x07GetNode\x12\x12.pb.GetNodeOptions\x1a\x08.pb.Node\"\x00\x12\x31\n\x0cListPodNodes\x12\x14.pb.ListNodesOptions\x1a\t.pb.Nodes\"\x00\x12\x30\n\x0cGetContainer\x12\x0f.pb.ContainerID\x1a\r.pb.Container\"\x00\x12\x33\n\rGetContainers\x12\x10.pb.ContainerIDs\x1a\x0e.pb.Containers\"\x00\x12>\n\nBuildImage\x12\x15.pb.BuildImageOptions\x1a\x15.pb.BuildImageMessage\"\x00\x30\x01\x12\x42\n\x0f\x43reateContainer\x12\x11.pb.DeployOptions\x1a\x1a.pb.CreateContainerMessage0\x01\x12\x41\n\x0fRemoveContainer\x12\x10.pb.ContainerIDs\x1a\x1a.pb.RemoveContainerMessage0\x01\x12?\n\x0bRemoveImage\x12\x16.pb.RemoveImageOptions\x1a\x16.pb.RemoveImageMessage0\x01\x62\x06proto3') + serialized_pb=_b('\n\ncore.proto\x12\x02pb\"\x07\n\x05\x45mpty\"!\n\x03Pod\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x65sc\x18\x02 \x01(\t\"\x1d\n\x04Pods\x12\x15\n\x04pods\x18\x01 \x03(\x0b\x32\x07.pb.Pod\"\x93\x01\n\x04Node\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x10\n\x08\x65ndpoint\x18\x02 \x01(\t\x12\x0f\n\x07podname\x18\x03 \x01(\t\x12\x0e\n\x06public\x18\x04 \x01(\x08\x12\x1e\n\x03\x63pu\x18\x05 \x03(\x0b\x32\x11.pb.Node.CpuEntry\x1a*\n\x08\x43puEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x03:\x02\x38\x01\" \n\x05Nodes\x12\x17\n\x05nodes\x18\x01 \x03(\x0b\x32\x08.pb.Node\"V\n\tContainer\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07podname\x18\x02 \x01(\t\x12\x10\n\x08nodename\x18\x03 \x01(\t\x12\x0c\n\x04name\x18\x04 \x01(\t\x12\x0c\n\x04info\x18\x05 \x01(\t\"/\n\nContainers\x12!\n\ncontainers\x18\x01 \x03(\x0b\x32\r.pb.Container\"\x19\n\x0b\x43ontainerID\x12\n\n\x02id\x18\x01 \x01(\t\",\n\x0c\x43ontainerIDs\x12\x1c\n\x03ids\x18\x01 \x03(\x0b\x32\x0f.pb.ContainerID\"+\n\rAddPodOptions\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x65sc\x18\x02 \x01(\t\"\x1d\n\rGetPodOptions\x12\x0c\n\x04name\x18\x01 \x01(\t\"U\n\x0e\x41\x64\x64NodeOptions\x12\x10\n\x08nodename\x18\x01 \x01(\t\x12\x10\n\x08\x65ndpoint\x18\x02 \x01(\t\x12\x0f\n\x07podname\x18\x03 \x01(\t\x12\x0e\n\x06public\x18\x04 \x01(\x08\"3\n\x0eGetNodeOptions\x12\x0f\n\x07podname\x18\x01 \x01(\t\x12\x10\n\x08nodename\x18\x02 \x01(\t\"#\n\x10ListNodesOptions\x12\x0f\n\x07podname\x18\x01 \x01(\t\"?\n\x11\x42uildImageOptions\x12\x0c\n\x04repo\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x0b\n\x03uid\x18\x03 \x01(\t\"\xc3\x01\n\rDeployOptions\x12\r\n\x05specs\x18\x01 \x01(\t\x12\x0f\n\x07\x61ppname\x18\x02 \x01(\t\x12\r\n\x05image\x18\x03 \x01(\t\x12\x0f\n\x07podname\x18\x04 \x01(\t\x12\x10\n\x08nodename\x18\x05 \x01(\t\x12\x12\n\nentrypoint\x18\x06 \x01(\t\x12\x11\n\tcpu_quota\x18\x07 \x01(\x01\x12\r\n\x05\x63ount\x18\x08 \x01(\x05\x12\x0b\n\x03\x65nv\x18\t \x03(\t\x12\x10\n\x08networks\x18\n \x03(\t\x12\x0b\n\x03raw\x18\x0b \x01(\x08\"=\n\x0eUpgradeOptions\x12\x1c\n\x03ids\x18\x01 \x03(\x0b\x32\x0f.pb.ContainerID\x12\r\n\x05image\x18\x02 \x01(\t\"G\n\x12RemoveImageOptions\x12\x0f\n\x07podname\x18\x01 \x01(\t\x12\x10\n\x08nodename\x18\x02 \x01(\t\x12\x0e\n\x06images\x18\x03 \x03(\t\",\n\x0b\x45rrorDetail\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x03\x12\x0f\n\x07message\x18\x02 \x01(\t\"{\n\x11\x42uildImageMessage\x12\x0e\n\x06status\x18\x01 \x01(\t\x12\x10\n\x08progress\x18\x02 \x01(\t\x12\r\n\x05\x65rror\x18\x03 \x01(\t\x12\x0e\n\x06stream\x18\x04 \x01(\t\x12%\n\x0c\x65rror_detail\x18\x05 \x01(\x0b\x32\x0f.pb.ErrorDetail\"\xc4\x01\n\x16\x43reateContainerMessage\x12\x0f\n\x07podname\x18\x01 \x01(\t\x12\x10\n\x08nodename\x18\x02 \x01(\t\x12\n\n\x02id\x18\x03 \x01(\t\x12\x0c\n\x04name\x18\x04 \x01(\t\x12\x0f\n\x07success\x18\x05 \x01(\x08\x12\x30\n\x03\x63pu\x18\x06 \x03(\x0b\x32#.pb.CreateContainerMessage.CpuEntry\x1a*\n\x08\x43puEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x03:\x02\x38\x01\"F\n\x12RemoveImageMessage\x12\r\n\x05image\x18\x01 \x01(\t\x12\x0f\n\x07success\x18\x02 \x01(\x08\x12\x10\n\x08messages\x18\x03 \x03(\t\"F\n\x16RemoveContainerMessage\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07success\x18\x02 \x01(\x08\x12\x0f\n\x07message\x18\x03 \x01(\t\"g\n\x17UpgradeContainerMessage\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06new_id\x18\x02 \x01(\t\x12\x10\n\x08new_name\x18\x03 \x01(\t\x12\r\n\x05\x65rror\x18\x04 \x01(\t\x12\x0f\n\x07success\x18\x05 \x01(\x08\x32\xbb\x05\n\x07\x43oreRPC\x12!\n\x08ListPods\x12\t.pb.Empty\x1a\x08.pb.Pods\"\x00\x12&\n\x06\x41\x64\x64Pod\x12\x11.pb.AddPodOptions\x1a\x07.pb.Pod\"\x00\x12&\n\x06GetPod\x12\x11.pb.GetPodOptions\x1a\x07.pb.Pod\"\x00\x12)\n\x07\x41\x64\x64Node\x12\x12.pb.AddNodeOptions\x1a\x08.pb.Node\"\x00\x12)\n\x07GetNode\x12\x12.pb.GetNodeOptions\x1a\x08.pb.Node\"\x00\x12\x31\n\x0cListPodNodes\x12\x14.pb.ListNodesOptions\x1a\t.pb.Nodes\"\x00\x12\x30\n\x0cGetContainer\x12\x0f.pb.ContainerID\x1a\r.pb.Container\"\x00\x12\x33\n\rGetContainers\x12\x10.pb.ContainerIDs\x1a\x0e.pb.Containers\"\x00\x12>\n\nBuildImage\x12\x15.pb.BuildImageOptions\x1a\x15.pb.BuildImageMessage\"\x00\x30\x01\x12\x42\n\x0f\x43reateContainer\x12\x11.pb.DeployOptions\x1a\x1a.pb.CreateContainerMessage0\x01\x12\x45\n\x10UpgradeContainer\x12\x12.pb.UpgradeOptions\x1a\x1b.pb.UpgradeContainerMessage0\x01\x12\x41\n\x0fRemoveContainer\x12\x10.pb.ContainerIDs\x1a\x1a.pb.RemoveContainerMessage0\x01\x12?\n\x0bRemoveImage\x12\x16.pb.RemoveImageOptions\x1a\x16.pb.RemoveImageMessage0\x01\x62\x06proto3') ) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -734,6 +734,44 @@ ) +_UPGRADEOPTIONS = _descriptor.Descriptor( + name='UpgradeOptions', + full_name='pb.UpgradeOptions', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ids', full_name='pb.UpgradeOptions.ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='image', full_name='pb.UpgradeOptions.image', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1003, + serialized_end=1064, +) + + _REMOVEIMAGEOPTIONS = _descriptor.Descriptor( name='RemoveImageOptions', full_name='pb.RemoveImageOptions', @@ -774,8 +812,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1003, - serialized_end=1074, + serialized_start=1066, + serialized_end=1137, ) @@ -812,8 +850,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1076, - serialized_end=1120, + serialized_start=1139, + serialized_end=1183, ) @@ -871,8 +909,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1122, - serialized_end=1245, + serialized_start=1185, + serialized_end=1308, ) @@ -974,8 +1012,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1248, - serialized_end=1444, + serialized_start=1311, + serialized_end=1507, ) @@ -1019,8 +1057,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1446, - serialized_end=1516, + serialized_start=1509, + serialized_end=1579, ) @@ -1064,8 +1102,67 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1518, - serialized_end=1588, + serialized_start=1581, + serialized_end=1651, +) + + +_UPGRADECONTAINERMESSAGE = _descriptor.Descriptor( + name='UpgradeContainerMessage', + full_name='pb.UpgradeContainerMessage', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='pb.UpgradeContainerMessage.id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='new_id', full_name='pb.UpgradeContainerMessage.new_id', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='new_name', full_name='pb.UpgradeContainerMessage.new_name', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='error', full_name='pb.UpgradeContainerMessage.error', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='success', full_name='pb.UpgradeContainerMessage.success', index=4, + number=5, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1653, + serialized_end=1756, ) _PODS.fields_by_name['pods'].message_type = _POD @@ -1074,6 +1171,7 @@ _NODES.fields_by_name['nodes'].message_type = _NODE _CONTAINERS.fields_by_name['containers'].message_type = _CONTAINER _CONTAINERIDS.fields_by_name['ids'].message_type = _CONTAINERID +_UPGRADEOPTIONS.fields_by_name['ids'].message_type = _CONTAINERID _BUILDIMAGEMESSAGE.fields_by_name['error_detail'].message_type = _ERRORDETAIL _CREATECONTAINERMESSAGE_CPUENTRY.containing_type = _CREATECONTAINERMESSAGE _CREATECONTAINERMESSAGE.fields_by_name['cpu'].message_type = _CREATECONTAINERMESSAGE_CPUENTRY @@ -1093,12 +1191,14 @@ DESCRIPTOR.message_types_by_name['ListNodesOptions'] = _LISTNODESOPTIONS DESCRIPTOR.message_types_by_name['BuildImageOptions'] = _BUILDIMAGEOPTIONS DESCRIPTOR.message_types_by_name['DeployOptions'] = _DEPLOYOPTIONS +DESCRIPTOR.message_types_by_name['UpgradeOptions'] = _UPGRADEOPTIONS DESCRIPTOR.message_types_by_name['RemoveImageOptions'] = _REMOVEIMAGEOPTIONS DESCRIPTOR.message_types_by_name['ErrorDetail'] = _ERRORDETAIL DESCRIPTOR.message_types_by_name['BuildImageMessage'] = _BUILDIMAGEMESSAGE DESCRIPTOR.message_types_by_name['CreateContainerMessage'] = _CREATECONTAINERMESSAGE DESCRIPTOR.message_types_by_name['RemoveImageMessage'] = _REMOVEIMAGEMESSAGE DESCRIPTOR.message_types_by_name['RemoveContainerMessage'] = _REMOVECONTAINERMESSAGE +DESCRIPTOR.message_types_by_name['UpgradeContainerMessage'] = _UPGRADECONTAINERMESSAGE Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), dict( DESCRIPTOR = _EMPTY, @@ -1220,6 +1320,13 @@ )) _sym_db.RegisterMessage(DeployOptions) +UpgradeOptions = _reflection.GeneratedProtocolMessageType('UpgradeOptions', (_message.Message,), dict( + DESCRIPTOR = _UPGRADEOPTIONS, + __module__ = 'core_pb2' + # @@protoc_insertion_point(class_scope:pb.UpgradeOptions) + )) +_sym_db.RegisterMessage(UpgradeOptions) + RemoveImageOptions = _reflection.GeneratedProtocolMessageType('RemoveImageOptions', (_message.Message,), dict( DESCRIPTOR = _REMOVEIMAGEOPTIONS, __module__ = 'core_pb2' @@ -1270,6 +1377,13 @@ )) _sym_db.RegisterMessage(RemoveContainerMessage) +UpgradeContainerMessage = _reflection.GeneratedProtocolMessageType('UpgradeContainerMessage', (_message.Message,), dict( + DESCRIPTOR = _UPGRADECONTAINERMESSAGE, + __module__ = 'core_pb2' + # @@protoc_insertion_point(class_scope:pb.UpgradeContainerMessage) + )) +_sym_db.RegisterMessage(UpgradeContainerMessage) + _NODE_CPUENTRY.has_options = True _NODE_CPUENTRY._options = _descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')) @@ -1303,6 +1417,8 @@ def BuildImage(self, request, context): context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) def CreateContainer(self, request, context): context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def UpgradeContainer(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) def RemoveContainer(self, request, context): context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) def RemoveImage(self, request, context): @@ -1337,6 +1453,8 @@ def BuildImage(self, request, timeout): raise NotImplementedError() def CreateContainer(self, request, timeout): raise NotImplementedError() + def UpgradeContainer(self, request, timeout): + raise NotImplementedError() def RemoveContainer(self, request, timeout): raise NotImplementedError() def RemoveImage(self, request, timeout): @@ -1367,6 +1485,8 @@ def beta_create_CoreRPC_server(servicer, pool=None, pool_size=None, default_time import core_pb2 import core_pb2 import core_pb2 + import core_pb2 + import core_pb2 request_deserializers = { ('pb.CoreRPC', 'AddNode'): core_pb2.AddNodeOptions.FromString, ('pb.CoreRPC', 'AddPod'): core_pb2.AddPodOptions.FromString, @@ -1380,6 +1500,7 @@ def beta_create_CoreRPC_server(servicer, pool=None, pool_size=None, default_time ('pb.CoreRPC', 'ListPods'): core_pb2.Empty.FromString, ('pb.CoreRPC', 'RemoveContainer'): core_pb2.ContainerIDs.FromString, ('pb.CoreRPC', 'RemoveImage'): core_pb2.RemoveImageOptions.FromString, + ('pb.CoreRPC', 'UpgradeContainer'): core_pb2.UpgradeOptions.FromString, } response_serializers = { ('pb.CoreRPC', 'AddNode'): core_pb2.Node.SerializeToString, @@ -1394,6 +1515,7 @@ def beta_create_CoreRPC_server(servicer, pool=None, pool_size=None, default_time ('pb.CoreRPC', 'ListPods'): core_pb2.Pods.SerializeToString, ('pb.CoreRPC', 'RemoveContainer'): core_pb2.RemoveContainerMessage.SerializeToString, ('pb.CoreRPC', 'RemoveImage'): core_pb2.RemoveImageMessage.SerializeToString, + ('pb.CoreRPC', 'UpgradeContainer'): core_pb2.UpgradeContainerMessage.SerializeToString, } method_implementations = { ('pb.CoreRPC', 'AddNode'): face_utilities.unary_unary_inline(servicer.AddNode), @@ -1408,6 +1530,7 @@ def beta_create_CoreRPC_server(servicer, pool=None, pool_size=None, default_time ('pb.CoreRPC', 'ListPods'): face_utilities.unary_unary_inline(servicer.ListPods), ('pb.CoreRPC', 'RemoveContainer'): face_utilities.unary_stream_inline(servicer.RemoveContainer), ('pb.CoreRPC', 'RemoveImage'): face_utilities.unary_stream_inline(servicer.RemoveImage), + ('pb.CoreRPC', 'UpgradeContainer'): face_utilities.unary_stream_inline(servicer.UpgradeContainer), } server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) return beta_implementations.server(method_implementations, options=server_options) @@ -1437,6 +1560,8 @@ def beta_create_CoreRPC_stub(channel, host=None, metadata_transformer=None, pool import core_pb2 import core_pb2 import core_pb2 + import core_pb2 + import core_pb2 request_serializers = { ('pb.CoreRPC', 'AddNode'): core_pb2.AddNodeOptions.SerializeToString, ('pb.CoreRPC', 'AddPod'): core_pb2.AddPodOptions.SerializeToString, @@ -1450,6 +1575,7 @@ def beta_create_CoreRPC_stub(channel, host=None, metadata_transformer=None, pool ('pb.CoreRPC', 'ListPods'): core_pb2.Empty.SerializeToString, ('pb.CoreRPC', 'RemoveContainer'): core_pb2.ContainerIDs.SerializeToString, ('pb.CoreRPC', 'RemoveImage'): core_pb2.RemoveImageOptions.SerializeToString, + ('pb.CoreRPC', 'UpgradeContainer'): core_pb2.UpgradeOptions.SerializeToString, } response_deserializers = { ('pb.CoreRPC', 'AddNode'): core_pb2.Node.FromString, @@ -1464,6 +1590,7 @@ def beta_create_CoreRPC_stub(channel, host=None, metadata_transformer=None, pool ('pb.CoreRPC', 'ListPods'): core_pb2.Pods.FromString, ('pb.CoreRPC', 'RemoveContainer'): core_pb2.RemoveContainerMessage.FromString, ('pb.CoreRPC', 'RemoveImage'): core_pb2.RemoveImageMessage.FromString, + ('pb.CoreRPC', 'UpgradeContainer'): core_pb2.UpgradeContainerMessage.FromString, } cardinalities = { 'AddNode': cardinality.Cardinality.UNARY_UNARY, @@ -1478,6 +1605,7 @@ def beta_create_CoreRPC_stub(channel, host=None, metadata_transformer=None, pool 'ListPods': cardinality.Cardinality.UNARY_UNARY, 'RemoveContainer': cardinality.Cardinality.UNARY_STREAM, 'RemoveImage': cardinality.Cardinality.UNARY_STREAM, + 'UpgradeContainer': cardinality.Cardinality.UNARY_STREAM, } stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) return beta_implementations.dynamic_stub(channel, 'pb.CoreRPC', cardinalities, options=stub_options) diff --git a/rpc/gen/core.pb.go b/rpc/gen/core.pb.go index c5d97b85e..ed67956d5 100644 --- a/rpc/gen/core.pb.go +++ b/rpc/gen/core.pb.go @@ -25,12 +25,14 @@ It has these top-level messages: ListNodesOptions BuildImageOptions DeployOptions + UpgradeOptions RemoveImageOptions ErrorDetail BuildImageMessage CreateContainerMessage RemoveImageMessage RemoveContainerMessage + UpgradeContainerMessage */ package pb @@ -261,6 +263,23 @@ func (m *DeployOptions) String() string { return proto.CompactTextStr func (*DeployOptions) ProtoMessage() {} func (*DeployOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } +type UpgradeOptions struct { + Ids []*ContainerID `protobuf:"bytes,1,rep,name=ids" json:"ids,omitempty"` + Image string `protobuf:"bytes,2,opt,name=image" json:"image,omitempty"` +} + +func (m *UpgradeOptions) Reset() { *m = UpgradeOptions{} } +func (m *UpgradeOptions) String() string { return proto.CompactTextString(m) } +func (*UpgradeOptions) ProtoMessage() {} +func (*UpgradeOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } + +func (m *UpgradeOptions) GetIds() []*ContainerID { + if m != nil { + return m.Ids + } + return nil +} + type RemoveImageOptions struct { Podname string `protobuf:"bytes,1,opt,name=podname" json:"podname,omitempty"` Nodename string `protobuf:"bytes,2,opt,name=nodename" json:"nodename,omitempty"` @@ -270,7 +289,7 @@ type RemoveImageOptions struct { func (m *RemoveImageOptions) Reset() { *m = RemoveImageOptions{} } func (m *RemoveImageOptions) String() string { return proto.CompactTextString(m) } func (*RemoveImageOptions) ProtoMessage() {} -func (*RemoveImageOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } +func (*RemoveImageOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } type ErrorDetail struct { Code int64 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` @@ -280,7 +299,7 @@ type ErrorDetail struct { func (m *ErrorDetail) Reset() { *m = ErrorDetail{} } func (m *ErrorDetail) String() string { return proto.CompactTextString(m) } func (*ErrorDetail) ProtoMessage() {} -func (*ErrorDetail) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } +func (*ErrorDetail) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } type BuildImageMessage struct { Status string `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` @@ -293,7 +312,7 @@ type BuildImageMessage struct { func (m *BuildImageMessage) Reset() { *m = BuildImageMessage{} } func (m *BuildImageMessage) String() string { return proto.CompactTextString(m) } func (*BuildImageMessage) ProtoMessage() {} -func (*BuildImageMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } +func (*BuildImageMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } func (m *BuildImageMessage) GetErrorDetail() *ErrorDetail { if m != nil { @@ -314,7 +333,7 @@ type CreateContainerMessage struct { func (m *CreateContainerMessage) Reset() { *m = CreateContainerMessage{} } func (m *CreateContainerMessage) String() string { return proto.CompactTextString(m) } func (*CreateContainerMessage) ProtoMessage() {} -func (*CreateContainerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } +func (*CreateContainerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } func (m *CreateContainerMessage) GetCpu() map[string]int64 { if m != nil { @@ -332,7 +351,7 @@ type RemoveImageMessage struct { func (m *RemoveImageMessage) Reset() { *m = RemoveImageMessage{} } func (m *RemoveImageMessage) String() string { return proto.CompactTextString(m) } func (*RemoveImageMessage) ProtoMessage() {} -func (*RemoveImageMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } +func (*RemoveImageMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } type RemoveContainerMessage struct { Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` @@ -343,7 +362,20 @@ type RemoveContainerMessage struct { func (m *RemoveContainerMessage) Reset() { *m = RemoveContainerMessage{} } func (m *RemoveContainerMessage) String() string { return proto.CompactTextString(m) } func (*RemoveContainerMessage) ProtoMessage() {} -func (*RemoveContainerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } +func (*RemoveContainerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } + +type UpgradeContainerMessage struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + NewId string `protobuf:"bytes,2,opt,name=new_id,json=newId" json:"new_id,omitempty"` + NewName string `protobuf:"bytes,3,opt,name=new_name,json=newName" json:"new_name,omitempty"` + Error string `protobuf:"bytes,4,opt,name=error" json:"error,omitempty"` + Success bool `protobuf:"varint,5,opt,name=success" json:"success,omitempty"` +} + +func (m *UpgradeContainerMessage) Reset() { *m = UpgradeContainerMessage{} } +func (m *UpgradeContainerMessage) String() string { return proto.CompactTextString(m) } +func (*UpgradeContainerMessage) ProtoMessage() {} +func (*UpgradeContainerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} } func init() { proto.RegisterType((*Empty)(nil), "pb.Empty") @@ -362,12 +394,14 @@ func init() { proto.RegisterType((*ListNodesOptions)(nil), "pb.ListNodesOptions") proto.RegisterType((*BuildImageOptions)(nil), "pb.BuildImageOptions") proto.RegisterType((*DeployOptions)(nil), "pb.DeployOptions") + proto.RegisterType((*UpgradeOptions)(nil), "pb.UpgradeOptions") proto.RegisterType((*RemoveImageOptions)(nil), "pb.RemoveImageOptions") proto.RegisterType((*ErrorDetail)(nil), "pb.ErrorDetail") proto.RegisterType((*BuildImageMessage)(nil), "pb.BuildImageMessage") proto.RegisterType((*CreateContainerMessage)(nil), "pb.CreateContainerMessage") proto.RegisterType((*RemoveImageMessage)(nil), "pb.RemoveImageMessage") proto.RegisterType((*RemoveContainerMessage)(nil), "pb.RemoveContainerMessage") + proto.RegisterType((*UpgradeContainerMessage)(nil), "pb.UpgradeContainerMessage") } // Reference imports to suppress errors if they are not otherwise used. @@ -391,6 +425,7 @@ type CoreRPCClient interface { GetContainers(ctx context.Context, in *ContainerIDs, opts ...grpc.CallOption) (*Containers, error) BuildImage(ctx context.Context, in *BuildImageOptions, opts ...grpc.CallOption) (CoreRPC_BuildImageClient, error) CreateContainer(ctx context.Context, in *DeployOptions, opts ...grpc.CallOption) (CoreRPC_CreateContainerClient, error) + UpgradeContainer(ctx context.Context, in *UpgradeOptions, opts ...grpc.CallOption) (CoreRPC_UpgradeContainerClient, error) RemoveContainer(ctx context.Context, in *ContainerIDs, opts ...grpc.CallOption) (CoreRPC_RemoveContainerClient, error) RemoveImage(ctx context.Context, in *RemoveImageOptions, opts ...grpc.CallOption) (CoreRPC_RemoveImageClient, error) } @@ -539,8 +574,40 @@ func (x *coreRPCCreateContainerClient) Recv() (*CreateContainerMessage, error) { return m, nil } +func (c *coreRPCClient) UpgradeContainer(ctx context.Context, in *UpgradeOptions, opts ...grpc.CallOption) (CoreRPC_UpgradeContainerClient, error) { + stream, err := grpc.NewClientStream(ctx, &_CoreRPC_serviceDesc.Streams[2], c.cc, "/pb.CoreRPC/UpgradeContainer", opts...) + if err != nil { + return nil, err + } + x := &coreRPCUpgradeContainerClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type CoreRPC_UpgradeContainerClient interface { + Recv() (*UpgradeContainerMessage, error) + grpc.ClientStream +} + +type coreRPCUpgradeContainerClient struct { + grpc.ClientStream +} + +func (x *coreRPCUpgradeContainerClient) Recv() (*UpgradeContainerMessage, error) { + m := new(UpgradeContainerMessage) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + func (c *coreRPCClient) RemoveContainer(ctx context.Context, in *ContainerIDs, opts ...grpc.CallOption) (CoreRPC_RemoveContainerClient, error) { - stream, err := grpc.NewClientStream(ctx, &_CoreRPC_serviceDesc.Streams[2], c.cc, "/pb.CoreRPC/RemoveContainer", opts...) + stream, err := grpc.NewClientStream(ctx, &_CoreRPC_serviceDesc.Streams[3], c.cc, "/pb.CoreRPC/RemoveContainer", opts...) if err != nil { return nil, err } @@ -572,7 +639,7 @@ func (x *coreRPCRemoveContainerClient) Recv() (*RemoveContainerMessage, error) { } func (c *coreRPCClient) RemoveImage(ctx context.Context, in *RemoveImageOptions, opts ...grpc.CallOption) (CoreRPC_RemoveImageClient, error) { - stream, err := grpc.NewClientStream(ctx, &_CoreRPC_serviceDesc.Streams[3], c.cc, "/pb.CoreRPC/RemoveImage", opts...) + stream, err := grpc.NewClientStream(ctx, &_CoreRPC_serviceDesc.Streams[4], c.cc, "/pb.CoreRPC/RemoveImage", opts...) if err != nil { return nil, err } @@ -616,6 +683,7 @@ type CoreRPCServer interface { GetContainers(context.Context, *ContainerIDs) (*Containers, error) BuildImage(*BuildImageOptions, CoreRPC_BuildImageServer) error CreateContainer(*DeployOptions, CoreRPC_CreateContainerServer) error + UpgradeContainer(*UpgradeOptions, CoreRPC_UpgradeContainerServer) error RemoveContainer(*ContainerIDs, CoreRPC_RemoveContainerServer) error RemoveImage(*RemoveImageOptions, CoreRPC_RemoveImageServer) error } @@ -810,6 +878,27 @@ func (x *coreRPCCreateContainerServer) Send(m *CreateContainerMessage) error { return x.ServerStream.SendMsg(m) } +func _CoreRPC_UpgradeContainer_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(UpgradeOptions) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(CoreRPCServer).UpgradeContainer(m, &coreRPCUpgradeContainerServer{stream}) +} + +type CoreRPC_UpgradeContainerServer interface { + Send(*UpgradeContainerMessage) error + grpc.ServerStream +} + +type coreRPCUpgradeContainerServer struct { + grpc.ServerStream +} + +func (x *coreRPCUpgradeContainerServer) Send(m *UpgradeContainerMessage) error { + return x.ServerStream.SendMsg(m) +} + func _CoreRPC_RemoveContainer_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(ContainerIDs) if err := stream.RecvMsg(m); err != nil { @@ -900,6 +989,11 @@ var _CoreRPC_serviceDesc = grpc.ServiceDesc{ Handler: _CoreRPC_CreateContainer_Handler, ServerStreams: true, }, + { + StreamName: "UpgradeContainer", + Handler: _CoreRPC_UpgradeContainer_Handler, + ServerStreams: true, + }, { StreamName: "RemoveContainer", Handler: _CoreRPC_RemoveContainer_Handler, @@ -916,67 +1010,72 @@ var _CoreRPC_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("core.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 984 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x56, 0x59, 0x8f, 0xdc, 0x44, - 0x10, 0x8e, 0xc7, 0x73, 0x78, 0x6a, 0xf6, 0x4a, 0x2b, 0xac, 0x2c, 0x23, 0x22, 0xe8, 0x95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, 0xb8, - 0xae, 0x20, 0x76, 0xf7, 0x1d, 0x42, 0x7c, 0x09, 0x0b, 0xa7, 0xeb, 0xd9, 0xf1, 0xb5, 0x71, 0x2f, - 0x90, 0xa1, 0xbc, 0x03, 0x58, 0x4d, 0xd5, 0xaf, 0xea, 0xc3, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, - 0x84, 0xb5, 0xfe, 0x2e, 0xb8, 0x0a, 0x00, 0x00, + // 1064 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x56, 0x5b, 0x6f, 0xdc, 0x44, + 0x14, 0xae, 0xd7, 0x7b, 0x3d, 0x9b, 0x6c, 0xd2, 0x51, 0x1b, 0x16, 0x57, 0x54, 0x30, 0x91, 0xa0, + 0x48, 0x34, 0x2a, 0xa9, 0xb8, 0x08, 0x24, 0x50, 0xbb, 0x09, 0x68, 0x25, 0x28, 0xc5, 0x88, 0x37, + 0xa4, 0xe0, 0xb5, 0x87, 0xc8, 0xea, 0xae, 0x6d, 0x7c, 0x49, 0xb4, 0xfc, 0x05, 0xfe, 0x03, 0xef, + 0xfc, 0x06, 0x9e, 0xf9, 0x55, 0xbc, 0x70, 0xce, 0x5c, 0xbc, 0x63, 0x77, 0x97, 0x88, 0xaa, 0x4f, + 0x9e, 0x73, 0xe6, 0xf8, 0x9b, 0x73, 0xf9, 0xce, 0x9c, 0x01, 0x08, 0xd3, 0x5c, 0x9c, 0x64, 0x79, + 0x5a, 0xa6, 0xac, 0x93, 0x2d, 0xf8, 0x00, 0x7a, 0xe7, 0xab, 0xac, 0x5c, 0xf3, 0x87, 0xe0, 0x3e, + 0x4f, 0x23, 0xc6, 0xa0, 0x9b, 0x04, 0x2b, 0x31, 0x75, 0xde, 0x76, 0x1e, 0x8c, 0x7c, 0xb9, 0x26, + 0x5d, 0x24, 0x8a, 0x70, 0xda, 0x51, 0x3a, 0x5a, 0xf3, 0x63,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0x45, 0x5f, 0x3e, 0xe5, 0x1f, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, + 0xfc, 0x86, 0x42, 0x4c, 0xd8, 0x0b, 0x00, 0x00, } diff --git a/rpc/gen/core.proto b/rpc/gen/core.proto index 53d3fc9a4..0e4657526 100644 --- a/rpc/gen/core.proto +++ b/rpc/gen/core.proto @@ -15,6 +15,7 @@ service CoreRPC { rpc BuildImage(BuildImageOptions) returns (stream BuildImageMessage) {}; rpc CreateContainer(DeployOptions) returns (stream CreateContainerMessage); + rpc UpgradeContainer(UpgradeOptions) returns (stream UpgradeContainerMessage); rpc RemoveContainer(ContainerIDs) returns (stream RemoveContainerMessage); rpc RemoveImage(RemoveImageOptions) returns (stream RemoveImageMessage); } @@ -110,6 +111,11 @@ message DeployOptions { bool raw = 11; } +message UpgradeOptions { + repeated ContainerID ids = 1; + string image = 2; +} + message RemoveImageOptions { string podname = 1; string nodename = 2; @@ -149,3 +155,11 @@ message RemoveContainerMessage { bool success = 2; string message = 3; } + +message UpgradeContainerMessage { + string id = 1; + string new_id = 2; + string new_name = 3; + string error = 4; + bool success = 5; +} diff --git a/rpc/rpc.go b/rpc/rpc.go index a8cd82ad5..184a608d2 100644 --- a/rpc/rpc.go +++ b/rpc/rpc.go @@ -176,6 +176,25 @@ func (v *Virbranium) CreateContainer(opts *pb.DeployOptions, stream pb.CoreRPC_C return nil } +func (v *Virbranium) UpgradeContainer(opts *pb.UpgradeOptions, stream pb.CoreRPC_UpgradeContainerServer) error { + ids := []string{} + for _, id := range opts.Ids { + ids = append(ids, id.Id) + } + + ch, err := v.cluster.UpgradeContainer(ids, opts.Image) + if err != nil { + return err + } + + for m := range ch { + if err := stream.Send(toRPCUpgradeContainerMessage(m)); err != nil { + return err + } + } + return nil +} + func (v *Virbranium) RemoveContainer(cids *pb.ContainerIDs, stream pb.CoreRPC_RemoveContainerServer) error { ids := []string{} for _, id := range cids.Ids { diff --git a/rpc/transform.go b/rpc/transform.go index 03d341bcb..903f8299b 100644 --- a/rpc/transform.go +++ b/rpc/transform.go @@ -85,3 +85,13 @@ func toRPCRemoveContainerMessage(r *types.RemoveContainerMessage) *pb.RemoveCont Message: r.Message, } } + +func toRPCUpgradeContainerMessage(u *types.UpgradeContainerMessage) *pb.UpgradeContainerMessage { + return &pb.UpgradeContainerMessage{ + Id: u.ContainerID, + NewId: u.NewContainerID, + NewName: u.NewContainerName, + Error: u.Error, + Success: u.Success, + } +} diff --git a/types/message.go b/types/message.go index 2be473669..6ab169c41 100644 --- a/types/message.go +++ b/types/message.go @@ -37,3 +37,11 @@ type CreateContainerMessage struct { type PullImageMessage struct { BuildImageMessage } + +type UpgradeContainerMessage struct { + ContainerID string + NewContainerID string + NewContainerName string + Error string + Success bool +}