diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index de706bcba..a6d1e5dfd 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -58,7 +58,7 @@ service ReleaseService { } // UpdateRelease updates release content. - rpc UpdateRelease(UpdateReleaseRequest) returns (UpdateReleaseResponse) { + rpc UpdateRelease(UpdateReleaseRequest) returns (stream UpdateReleaseResponse) { // TODO: backward compatibility } // InstallRelease requests installation of a chart as a new release. @@ -218,6 +218,7 @@ message UpdateReleaseRequest { // UpdateReleaseResponse is the response to an update request. message UpdateReleaseResponse { hapi.release.Release release = 1; + hapi.release.WatchFeed watch_feed = 2; // TODO: think about compatibility } message RollbackReleaseRequest { diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 242a33d06..6976170bd 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -444,7 +444,52 @@ func (h *Client) update(ctx context.Context, req *rls.UpdateReleaseRequest) (*rl defer c.Close() rlc := rls.NewReleaseServiceClient(c) - return rlc.UpdateRelease(ctx, req) + + var finalResp *rls.UpdateReleaseResponse + + currentLogHeader := "" + setLogHeader := func(logHeader string) { + if currentLogHeader != logHeader { + if currentLogHeader != "" { + fmt.Println() + } + fmt.Printf("%s\n", logHeader) + currentLogHeader = logHeader + } + } + formatJobHeader := func(jobName string, podName string, containerName string) string { + // tail -f on multiple files prints similar headers + return fmt.Sprintf("==> Job \"%s\", Pod \"%s\", Container \"%s\" <==", jobName, podName, containerName) + } + + stream, err := rlc.UpdateRelease(ctx, req) + for { + resp, err := stream.Recv() + if err == io.EOF { + return finalResp, nil + } + if err != nil { + return resp, err + } + + if resp.WatchFeed.GetJobLogChunk() != nil { + chunk := resp.WatchFeed.GetJobLogChunk() + + setLogHeader(formatJobHeader(chunk.JobName, chunk.PodName, chunk.ContainerName)) + + for _, line := range chunk.LogLines { + fmt.Println(line.Data) + } + } else if resp.WatchFeed.GetJobPodError() != nil { + jobPodError := resp.WatchFeed.GetJobPodError() + + setLogHeader(formatJobHeader(jobPodError.JobName, jobPodError.PodName, jobPodError.ContainerName)) + + fmt.Fprintf(os.Stderr, "Error: %s\n", jobPodError.Message) + } else { + finalResp = resp // TODO verify/debug this code + } + } } // Executes tiller.RollbackRelease RPC. diff --git a/pkg/proto/hapi/services/tiller.pb.go b/pkg/proto/hapi/services/tiller.pb.go index 8168c29f8..db6d61433 100644 --- a/pkg/proto/hapi/services/tiller.pb.go +++ b/pkg/proto/hapi/services/tiller.pb.go @@ -475,7 +475,8 @@ func (m *UpdateReleaseRequest) GetDescription() string { // UpdateReleaseResponse is the response to an update request. type UpdateReleaseResponse struct { - Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` + Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` + WatchFeed *hapi_release6.WatchFeed `protobuf:"bytes,2,opt,name=watch_feed,json=watchFeed" json:"watch_feed,omitempty"` } func (m *UpdateReleaseResponse) Reset() { *m = UpdateReleaseResponse{} } @@ -490,6 +491,13 @@ func (m *UpdateReleaseResponse) GetRelease() *hapi_release5.Release { return nil } +func (m *UpdateReleaseResponse) GetWatchFeed() *hapi_release6.WatchFeed { + if m != nil { + return m.WatchFeed + } + return nil +} + type RollbackReleaseRequest struct { // The name of the release Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` @@ -992,7 +1000,7 @@ type ReleaseServiceClient interface { // GetReleaseContent retrieves the release content (chart + value) for the specified release. GetReleaseContent(ctx context.Context, in *GetReleaseContentRequest, opts ...grpc.CallOption) (*GetReleaseContentResponse, error) // UpdateRelease updates release content. - UpdateRelease(ctx context.Context, in *UpdateReleaseRequest, opts ...grpc.CallOption) (*UpdateReleaseResponse, error) + UpdateRelease(ctx context.Context, in *UpdateReleaseRequest, opts ...grpc.CallOption) (ReleaseService_UpdateReleaseClient, error) // InstallRelease requests installation of a chart as a new release. InstallRelease(ctx context.Context, in *InstallReleaseRequest, opts ...grpc.CallOption) (ReleaseService_InstallReleaseClient, error) // UninstallRelease requests deletion of a named release. @@ -1065,17 +1073,40 @@ func (c *releaseServiceClient) GetReleaseContent(ctx context.Context, in *GetRel return out, nil } -func (c *releaseServiceClient) UpdateRelease(ctx context.Context, in *UpdateReleaseRequest, opts ...grpc.CallOption) (*UpdateReleaseResponse, error) { - out := new(UpdateReleaseResponse) - err := grpc.Invoke(ctx, "/hapi.services.tiller.ReleaseService/UpdateRelease", in, out, c.cc, opts...) +func (c *releaseServiceClient) UpdateRelease(ctx context.Context, in *UpdateReleaseRequest, opts ...grpc.CallOption) (ReleaseService_UpdateReleaseClient, error) { + stream, err := grpc.NewClientStream(ctx, &_ReleaseService_serviceDesc.Streams[1], c.cc, "/hapi.services.tiller.ReleaseService/UpdateRelease", opts...) if err != nil { return nil, err } - return out, nil + x := &releaseServiceUpdateReleaseClient{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 ReleaseService_UpdateReleaseClient interface { + Recv() (*UpdateReleaseResponse, error) + grpc.ClientStream +} + +type releaseServiceUpdateReleaseClient struct { + grpc.ClientStream +} + +func (x *releaseServiceUpdateReleaseClient) Recv() (*UpdateReleaseResponse, error) { + m := new(UpdateReleaseResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil } func (c *releaseServiceClient) InstallRelease(ctx context.Context, in *InstallReleaseRequest, opts ...grpc.CallOption) (ReleaseService_InstallReleaseClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ReleaseService_serviceDesc.Streams[1], c.cc, "/hapi.services.tiller.ReleaseService/InstallRelease", opts...) + stream, err := grpc.NewClientStream(ctx, &_ReleaseService_serviceDesc.Streams[2], c.cc, "/hapi.services.tiller.ReleaseService/InstallRelease", opts...) if err != nil { return nil, err } @@ -1143,7 +1174,7 @@ func (c *releaseServiceClient) GetHistory(ctx context.Context, in *GetHistoryReq } func (c *releaseServiceClient) RunReleaseTest(ctx context.Context, in *TestReleaseRequest, opts ...grpc.CallOption) (ReleaseService_RunReleaseTestClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ReleaseService_serviceDesc.Streams[2], c.cc, "/hapi.services.tiller.ReleaseService/RunReleaseTest", opts...) + stream, err := grpc.NewClientStream(ctx, &_ReleaseService_serviceDesc.Streams[3], c.cc, "/hapi.services.tiller.ReleaseService/RunReleaseTest", opts...) if err != nil { return nil, err } @@ -1187,7 +1218,7 @@ type ReleaseServiceServer interface { // GetReleaseContent retrieves the release content (chart + value) for the specified release. GetReleaseContent(context.Context, *GetReleaseContentRequest) (*GetReleaseContentResponse, error) // UpdateRelease updates release content. - UpdateRelease(context.Context, *UpdateReleaseRequest) (*UpdateReleaseResponse, error) + UpdateRelease(*UpdateReleaseRequest, ReleaseService_UpdateReleaseServer) error // InstallRelease requests installation of a chart as a new release. InstallRelease(*InstallReleaseRequest, ReleaseService_InstallReleaseServer) error // UninstallRelease requests deletion of a named release. @@ -1263,22 +1294,25 @@ func _ReleaseService_GetReleaseContent_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } -func _ReleaseService_UpdateRelease_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateReleaseRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseServiceServer).UpdateRelease(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/hapi.services.tiller.ReleaseService/UpdateRelease", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseServiceServer).UpdateRelease(ctx, req.(*UpdateReleaseRequest)) +func _ReleaseService_UpdateRelease_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(UpdateReleaseRequest) + if err := stream.RecvMsg(m); err != nil { + return err } - return interceptor(ctx, in, info, handler) + return srv.(ReleaseServiceServer).UpdateRelease(m, &releaseServiceUpdateReleaseServer{stream}) +} + +type ReleaseService_UpdateReleaseServer interface { + Send(*UpdateReleaseResponse) error + grpc.ServerStream +} + +type releaseServiceUpdateReleaseServer struct { + grpc.ServerStream +} + +func (x *releaseServiceUpdateReleaseServer) Send(m *UpdateReleaseResponse) error { + return x.ServerStream.SendMsg(m) } func _ReleaseService_InstallRelease_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -1407,10 +1441,6 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ MethodName: "GetReleaseContent", Handler: _ReleaseService_GetReleaseContent_Handler, }, - { - MethodName: "UpdateRelease", - Handler: _ReleaseService_UpdateRelease_Handler, - }, { MethodName: "UninstallRelease", Handler: _ReleaseService_UninstallRelease_Handler, @@ -1434,6 +1464,11 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ Handler: _ReleaseService_ListReleases_Handler, ServerStreams: true, }, + { + StreamName: "UpdateRelease", + Handler: _ReleaseService_UpdateRelease_Handler, + ServerStreams: true, + }, { StreamName: "InstallRelease", Handler: _ReleaseService_InstallRelease_Handler, @@ -1451,87 +1486,88 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("hapi/services/tiller.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1310 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x6d, 0x6f, 0xdc, 0x44, - 0x10, 0x8e, 0xcf, 0xf7, 0x3a, 0x97, 0x1e, 0xd7, 0x6d, 0x9a, 0xb8, 0xa6, 0x45, 0xc1, 0x08, 0x7a, - 0x2d, 0xf4, 0x02, 0x01, 0x21, 0x21, 0x21, 0xa4, 0xf4, 0x1a, 0x92, 0x42, 0x48, 0x25, 0xa7, 0x2f, - 0x12, 0x02, 0x9d, 0x1c, 0x7b, 0xaf, 0x31, 0xf5, 0xd9, 0x87, 0x77, 0x9d, 0x36, 0x1f, 0xf9, 0x00, -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x51, 0x1b, 0x21, 0xf4, 0x56, 0x33, 0x6a, 0xef, 0x65, 0xee, 0xd4, 0xd6, 0xcf, 0xfc, - 0xfe, 0x02, 0xd7, 0x94, 0xa7, 0x1a, 0x55, 0xa0, 0x55, 0xd6, 0x56, 0x99, 0x1f, 0xd7, 0xd2, 0xcd, - 0x7c, 0x45, 0x30, 0x50, 0xcb, 0x1f, 0xaa, 0x30, 0x50, 0xfa, 0x38, 0x99, 0x9f, 0xd4, 0x53, 0x56, - 0x99, 0x2c, 0x56, 0x91, 0x2a, 0x26, 0x2b, 0x6a, 0x62, 0x15, 0x93, 0x55, 0xc5, 0xc9, 0x5a, 0x43, - 0x0e, 0xc0, 0x65, 0x11, 0x41, 0x77, 0x2b, 0x29, 0x51, 0x6b, 0x8f, 0x39, 0x7a, 0xbb, 0x62, 0xe6, - 0x62, 0x01, 0xef, 0x14, 0x9a, 0x01, 0x54, 0x01, 0x4e, 0x79, 0xef, 0x64, 0x3e, 0xa8, 0xa9, 0x5d, - 0x38, 0x94, 0xa8, 0x4b, 0x2b, 0x0e, 0xa5, 0x16, 0xbd, 0x15, 0x87, 0x2a, 0x94, 0x38, 0x6b, 0x0d, - 0xf9, 0x30, 0xb0, 0x93, 0x50, 0xb8, 0x4e, 0x0b, 0x03, 0xaa, 0xd8, 0xbd, 0x5c, 0xd7, 0xcc, 0x7b, - 0x35, 0x34, 0x2f, 0xef, 0xc5, 0x43, 0xf8, 0xb1, 0x2b, 0x55, 0x4f, 0xdb, 0xec, 0x0f, 0xfd, 0xe7, - 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x6e, 0xfd, 0x45, 0xdd, 0x10, 0x00, 0x00, + // 1316 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x6d, 0x6f, 0xdc, 0xc4, + 0x13, 0x8f, 0xcf, 0xf7, 0x38, 0x97, 0xde, 0xff, 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+ 0xa7, 0x4d, 0xf6, 0x5f, 0xc0, 0xa7, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x29, 0x74, 0x9d, 0x48, + 0x18, 0x11, 0x00, 0x00, } diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index 8f3cc4e8e..eca770803 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -20,52 +20,60 @@ import ( "fmt" "strings" - ctx "golang.org/x/net/context" - "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/hooks" + "k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/timeconv" ) // UpdateRelease takes an existing release and new information, and upgrades the release. -func (s *ReleaseServer) UpdateRelease(c ctx.Context, req *services.UpdateReleaseRequest) (*services.UpdateReleaseResponse, error) { +func (s *ReleaseServer) UpdateRelease(req *services.UpdateReleaseRequest, stream services.ReleaseService_UpdateReleaseServer) error { if err := validateReleaseName(req.Name); err != nil { s.Log("updateRelease: Release name is invalid: %s", req.Name) - return nil, err + return err } s.Log("preparing update for %s", req.Name) currentRelease, updatedRelease, err := s.prepareUpdate(req) if err != nil { - if req.Force { - // Use the --force, Luke. - return s.performUpdateForce(req) + if !req.Force { + return err + } + // Use the --force, Luke. + res, err := s.performUpdateForce(req, stream) + if err != nil { + s.Log("failed force update perform step: %s", err) + } + if sendErr := stream.Send(res); sendErr != nil { + return sendErr } - return nil, err } if !req.DryRun { s.Log("creating updated release for %s", req.Name) if err := s.env.Releases.Create(updatedRelease); err != nil { - return nil, err + return err } } s.Log("performing update for %s", req.Name) - res, err := s.performUpdate(currentRelease, updatedRelease, req) + res, err := s.performUpdate(currentRelease, updatedRelease, req, stream) if err != nil { - return res, err + s.Log("failed update perform step: %s", err) + } + if sendErr := stream.Send(res); sendErr != nil { + return sendErr } if !req.DryRun { s.Log("updating status for updated release for %s", req.Name) if err := s.env.Releases.Update(updatedRelease); err != nil { - return res, err + return err } } - return res, nil + return err } // prepareUpdate builds an updated release for an update operation. @@ -143,7 +151,7 @@ func (s *ReleaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele } // performUpdateForce performs the same action as a `helm delete && helm install --replace`. -func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) (*services.UpdateReleaseResponse, error) { +func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest, stream services.ReleaseService_UpdateReleaseServer) (*services.UpdateReleaseResponse, error) { // find the last release with the given name oldRelease, err := s.env.Releases.Last(req.Name) if err != nil { @@ -262,9 +270,47 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( return res, nil } -func (s *ReleaseServer) performUpdate(originalRelease, updatedRelease *release.Release, req *services.UpdateReleaseRequest) (*services.UpdateReleaseResponse, error) { +func (s *ReleaseServer) performUpdate(originalRelease, updatedRelease *release.Release, req *services.UpdateReleaseRequest, stream services.ReleaseService_UpdateReleaseServer) (*services.UpdateReleaseResponse, error) { res := &services.UpdateReleaseResponse{Release: updatedRelease} + watchFeed := &kube.WatchFeedProto{ + WriteJobLogChunkFunc: func(chunk kube.JobLogChunk) error { + chunkResp := &services.UpdateReleaseResponse{ + WatchFeed: &release.WatchFeed{ + JobLogChunk: &release.JobLogChunk{ + JobName: chunk.JobName, + PodName: chunk.PodName, + ContainerName: chunk.ContainerName, + LogLines: make([]*release.LogLine, 0), + }, + }, + } + + for _, line := range chunk.LogLines { + ll := &release.LogLine{ + Timestamp: line.Timestamp, + Data: line.Data, + } + chunkResp.WatchFeed.JobLogChunk.LogLines = append(chunkResp.WatchFeed.JobLogChunk.LogLines, ll) + } + + return stream.Send(chunkResp) + }, + WriteJobPodErrorFunc: func(obj kube.JobPodError) error { + chunkResp := &services.UpdateReleaseResponse{ + WatchFeed: &release.WatchFeed{ + JobPodError: &release.JobPodError{ + JobName: obj.JobName, + PodName: obj.PodName, + ContainerName: obj.ContainerName, + Message: obj.Message, + }, + }, + } + return stream.Send(chunkResp) + }, + } + if req.DryRun { s.Log("dry run for %s", updatedRelease.Name) res.Release.Info.Description = "Dry run complete" @@ -273,7 +319,7 @@ func (s *ReleaseServer) performUpdate(originalRelease, updatedRelease *release.R // pre-upgrade hooks if !req.DisableHooks { - if err := s.execHook(updatedRelease.Hooks, updatedRelease.Name, updatedRelease.Namespace, hooks.PreUpgrade, req.Timeout); err != nil { + if err := s.execHookWithWatchFeed(updatedRelease.Hooks, updatedRelease.Name, updatedRelease.Namespace, hooks.PreUpgrade, req.Timeout, watchFeed); err != nil { return res, err } } else { @@ -291,7 +337,7 @@ func (s *ReleaseServer) performUpdate(originalRelease, updatedRelease *release.R // post-upgrade hooks if !req.DisableHooks { - if err := s.execHook(updatedRelease.Hooks, updatedRelease.Name, updatedRelease.Namespace, hooks.PostUpgrade, req.Timeout); err != nil { + if err := s.execHookWithWatchFeed(updatedRelease.Hooks, updatedRelease.Name, updatedRelease.Namespace, hooks.PostUpgrade, req.Timeout, watchFeed); err != nil { return res, err } }