Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Commit

Permalink
Something needs to be updated because of new Helm version (#154)
Browse files Browse the repository at this point in the history
* add extra status for listing SummarizeReleases.

* Using stream gRPC to receive data for listing SummarizeReleases.

* change the value of MaxCallRecvMsgSize from default 4MB to 20MB to match Tiller's config.
  • Loading branch information
joy717 authored and tamalsaha committed Mar 5, 2019
1 parent 3046916 commit 00ec6dd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
5 changes: 5 additions & 0 deletions pkg/connectors/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import (

const (
defaultTillerPort = 44134
// maxReceiveMsgSize uses 20MB as the default message size limit.
// the gRPC's default size is 4MB.
// Since Tiller has been change the messages' size to 20MB, so we should make this value to 20MB.
maxReceiveMsgSize = 1024 * 1024 * 20
)

var (
Expand All @@ -38,6 +42,7 @@ func Connect(cfg Config) (conn *grpc.ClientConn, err error) {
grpc.WithBlock(), // required for timeout
grpc.WithUnaryInterceptor(grpc_glog.UnaryClientInterceptor(glogEntry, optsGLog...)),
grpc.WithStreamInterceptor(grpc_glog.StreamClientInterceptor(glogEntry, optsGLog...)),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxReceiveMsgSize)),
}
if cfg.InsecureSkipVerify {
opts = append(opts, grpc.WithInsecure())
Expand Down
24 changes: 19 additions & 5 deletions pkg/release/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
hrls "k8s.io/helm/pkg/proto/hapi/release"
rls "k8s.io/helm/pkg/proto/hapi/services"
"k8s.io/helm/pkg/version"
"io"
)

type Server struct {
Expand Down Expand Up @@ -51,6 +52,9 @@ func (s *Server) SummarizeReleases(ctx context.Context, req *proto.SummarizeRele
hrls.Status_SUPERSEDED,
hrls.Status_FAILED,
hrls.Status_DELETING,
hrls.Status_PENDING_INSTALL,
hrls.Status_PENDING_UPGRADE,
hrls.Status_PENDING_ROLLBACK,
}
} else { // convert status(string) to status-code(int32)
for _, status := range req.StatusCodes {
Expand All @@ -66,14 +70,24 @@ func (s *Server) SummarizeReleases(ctx context.Context, req *proto.SummarizeRele
return nil, err
}

listRes, err := listClient.Recv()
if err != nil {
return nil, err
var resp *rls.ListReleasesResponse
for {
r, err := listClient.Recv()
if err == io.EOF {
break
}
if err != nil {
return nil, err
}
if resp == nil {
resp = r
continue
}
resp.Releases = append(resp.Releases, r.GetReleases()...)
}

var releases []*proto.ReleaseSummary

for _, item := range listRes.Releases {
for _, item := range resp.Releases {
releases = append(releases, &proto.ReleaseSummary{
Namespace: item.Namespace,
Name: item.Name,
Expand Down

0 comments on commit 00ec6dd

Please sign in to comment.