From cbd2b63a789f93d6435f74f9c80148d4cbcd103e Mon Sep 17 00:00:00 2001 From: Qiu Yu Date: Fri, 27 Apr 2018 00:25:54 -0700 Subject: [PATCH] Let pre/post upgrade hook use extended watch --- _proto/hapi/services/tiller.proto | 3 +- pkg/helm/client.go | 47 ++++- pkg/proto/hapi/services/tiller.pb.go | 251 +++++++++++++++------------ pkg/tiller/release_update.go | 80 +++++++-- 4 files changed, 254 insertions(+), 127 deletions(-) diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index eebfbae64e8..9bf937294fb 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. @@ -215,6 +215,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 7923a6bb370..27e2066a5f0 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -443,7 +443,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 936d5a494d2..f072f9aa012 100644 --- a/pkg/proto/hapi/services/tiller.pb.go +++ b/pkg/proto/hapi/services/tiller.pb.go @@ -463,7 +463,8 @@ func (m *UpdateReleaseRequest) GetForce() bool { // 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{} } @@ -478,6 +479,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"` @@ -945,7 +953,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. @@ -1018,17 +1026,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 } @@ -1096,7 +1127,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 } @@ -1140,7 +1171,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. @@ -1216,22 +1247,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 { @@ -1360,10 +1394,6 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ MethodName: "GetReleaseContent", Handler: _ReleaseService_GetReleaseContent_Handler, }, - { - MethodName: "UpdateRelease", - Handler: _ReleaseService_UpdateRelease_Handler, - }, { MethodName: "UninstallRelease", Handler: _ReleaseService_UninstallRelease_Handler, @@ -1387,6 +1417,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, @@ -1404,84 +1439,84 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("hapi/services/tiller.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1252 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdd, 0x72, 0xdb, 0xc4, - 0x17, 0x8f, 0xfc, 0xed, 0xe3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, 0x2b, 0x6b, 0x48, - 0xb1, 0x3e, 0x2c, 0xc4, 0x9b, 0xd8, 0x22, 0xd0, 0xd6, 0x9b, 0x1b, 0xca, 0x51, 0x90, 0xf9, 0x5c, - 0x58, 0x1f, 0x15, 0x63, 0xd6, 0x33, 0xb9, 0xda, 0x45, 0xf2, 0x32, 0x99, 0xd3, 0xf1, 0xf2, 0x32, - 0x99, 0xd7, 0x9c, 0xec, 0x35, 0xe4, 0x02, 0x5c, 0x34, 0x11, 0xf4, 0x30, 0x37, 0x25, 0x7a, 0xef, - 0xb1, 0xfa, 0xd7, 0x33, 0x26, 0x26, 0x96, 0xf0, 0xbf, 0x95, 0xe7, 0x19, 0xe5, 0x80, 0x93, 0x3d, - 0xab, 0x58, 0x4f, 0x0a, 0x72, 0xaf, 0x04, 0x25, 0xfb, 0xd2, 0x15, 0x41, 0xe9, 0x4d, 0xef, 0x8a, - 0xa0, 0x56, 0x5a, 0x9c, 0xbd, 0x86, 0x3c, 0x68, 0x3b, 0x51, 0x20, 0x4d, 0xc7, 0x8d, 0x01, 0xe5, - 0x48, 0x5f, 0xee, 0x6b, 0xd6, 0xa3, 0x02, 0x9c, 0x17, 0x75, 0xf1, 0x14, 0xbe, 0x6f, 0x28, 0xd6, - 0xa3, 0x1a, 0xff, 0x3b, 0xfc, 0xe9, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x97, 0xf1, 0xe6, 0x11, - 0x1b, 0x10, 0x00, 0x00, + // 1255 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x6e, 0x1b, 0x45, + 0x14, 0xce, 0xfa, 0xdf, 0xc7, 0xa9, 0x71, 0x27, 0x4e, 0xbc, 0x59, 0x5a, 0x14, 0x16, 0x41, 0xdd, + 0x42, 0x1d, 0x30, 0x08, 0x09, 0x09, 0x21, 0xa5, 0xa9, 0x49, 0x0a, 0x21, 0x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x42, 0x71, 0x67, 0xb8, 0x2b, 0x4c, 0x9e, 0x0e, 0x86, + 0xbb, 0x2d, 0xc3, 0xfe, 0xdd, 0x80, 0xb6, 0x4e, 0x11, 0x9d, 0x93, 0x80, 0xe2, 0x98, 0xa3, 0x31, + 0x89, 0x82, 0x05, 0x47, 0x7c, 0x82, 0x10, 0x94, 0x02, 0xfc, 0x46, 0x31, 0xc4, 0xc7, 0xb1, 0x26, + 0x23, 0xcc, 0xf5, 0x39, 0x3b, 0x45, 0x47, 0x4c, 0xd0, 0x27, 0x50, 0x93, 0x5b, 0xa7, 0x66, 0x69, + 0xab, 0xd8, 0x6d, 0xf4, 0xd7, 0x75, 0x40, 0x64, 0x44, 0x67, 0xa1, 0x66, 0xef, 0x41, 0x67, 0x0f, + 0xab, 0x4c, 0x04, 0x5e, 0xea, 0xc4, 0xc4, 0x71, 0xdd, 0x19, 0xe6, 0xc9, 0xc4, 0x71, 0xdd, 0x19, + 0x46, 0x26, 0x54, 0xe5, 0x71, 0xe3, 0xe9, 0x94, 0x1d, 0x35, 0xb5, 0x19, 0x98, 0x57, 0x1d, 0xc9, + 0x7d, 0xa5, 0x79, 0xfa, 0x00, 0x4a, 0xf1, 0x45, 0xe1, 0x6e, 0x1a, 0x7d, 0xa4, 0xe7, 0xf9, 0x2c, + 0x98, 0x12, 0x87, 0xcb, 0x75, 0xaa, 0x8a, 0xcb, 0x54, 0xed, 0x27, 0xa3, 0xee, 0x92, 0x80, 0xe1, + 0x80, 0xdd, 0x2e, 0xff, 0x03, 0xd8, 0x4c, 0xf1, 0x24, 0x37, 0xb0, 0x0d, 0x55, 0x99, 0x1a, 0xf7, + 0x96, 0x89, 0xab, 0xd2, 0xb2, 0xff, 0x2e, 0x40, 0xfb, 0x68, 0x3e, 0x71, 0x19, 0x56, 0xa2, 0x6b, + 0x92, 0x7a, 0x00, 0x65, 0x5e, 0x70, 0x24, 0x16, 0x77, 0x85, 0x6f, 0x51, 0x95, 0x76, 0xe3, 0x5f, +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0x60, 0x58, 0x1f, 0xe5, 0x53, 0xd6, 0xb9, 0x5c, 0xae, 0x23, 0x59, 0x5c, 0x66, 0xd4, + 0xbc, 0x2c, 0x2e, 0xb3, 0xca, 0x93, 0xbd, 0x82, 0x5c, 0x80, 0xcb, 0x32, 0x82, 0x1e, 0x64, 0x92, + 0xa2, 0x57, 0x1f, 0xab, 0x7b, 0xb3, 0xe2, 0x22, 0xc4, 0x1c, 0xde, 0x5a, 0x7a, 0xa0, 0x51, 0x06, + 0x38, 0xe9, 0xdd, 0x8a, 0xf5, 0x38, 0xa7, 0xf6, 0xd2, 0xa6, 0x64, 0x65, 0xba, 0x66, 0x53, 0x7a, + 0xd9, 0xbb, 0x66, 0x53, 0x4b, 0x45, 0xce, 0x5e, 0x41, 0x1e, 0x34, 0x9d, 0x28, 0x90, 0xa1, 0xe3, + 0xd2, 0x80, 0x32, 0xac, 0xaf, 0x56, 0x36, 0xeb, 0x61, 0x0e, 0xcd, 0xcb, 0x73, 0xf1, 0x04, 0xbe, + 0xaf, 0x29, 0xd5, 0xe3, 0x0a, 0xff, 0x27, 0xfd, 0xe9, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x9c, + 0x21, 0x1c, 0x57, 0x56, 0x10, 0x00, 0x00, } diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index 6f5d3733122..b8e5b64d53d 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 { @@ -249,9 +257,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" @@ -260,7 +306,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 { @@ -278,7 +324,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 } }