|
|
@ -17,17 +17,13 @@ limitations under the License.
|
|
|
|
package helm // import "k8s.io/helm/pkg/helm"
|
|
|
|
package helm // import "k8s.io/helm/pkg/helm"
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
"google.golang.org/grpc/credentials"
|
|
|
|
|
|
|
|
"google.golang.org/grpc/keepalive"
|
|
|
|
"google.golang.org/grpc/keepalive"
|
|
|
|
|
|
|
|
|
|
|
|
healthpb "google.golang.org/grpc/health/grpc_health_v1"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"k8s.io/helm/pkg/chartutil"
|
|
|
|
"k8s.io/helm/pkg/chartutil"
|
|
|
|
"k8s.io/helm/pkg/proto/hapi/chart"
|
|
|
|
"k8s.io/helm/pkg/proto/hapi/chart"
|
|
|
|
"k8s.io/helm/pkg/proto/hapi/release"
|
|
|
|
"k8s.io/helm/pkg/proto/hapi/release"
|
|
|
@ -292,12 +288,7 @@ func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error)
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)),
|
|
|
|
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch {
|
|
|
|
opts = append(opts, grpc.WithInsecure())
|
|
|
|
case h.opts.useTLS:
|
|
|
|
|
|
|
|
opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(h.opts.tlsConfig)))
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
opts = append(opts, grpc.WithInsecure())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx, cancel := context.WithTimeout(ctx, h.opts.connectTimeout)
|
|
|
|
ctx, cancel := context.WithTimeout(ctx, h.opts.connectTimeout)
|
|
|
|
defer cancel()
|
|
|
|
defer cancel()
|
|
|
|
if conn, err = grpc.DialContext(ctx, h.opts.host, opts...); err != nil {
|
|
|
|
if conn, err = grpc.DialContext(ctx, h.opts.host, opts...); err != nil {
|
|
|
@ -397,30 +388,6 @@ func (h *Client) status(ctx context.Context, req *rls.GetReleaseStatusRequest) (
|
|
|
|
return rlc.GetReleaseStatus(ctx, req)
|
|
|
|
return rlc.GetReleaseStatus(ctx, req)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Executes tiller.GetReleaseContent RPC.
|
|
|
|
|
|
|
|
func (h *Client) content(ctx context.Context, req *rls.GetReleaseContentRequest) (*rls.GetReleaseContentResponse, error) {
|
|
|
|
|
|
|
|
c, err := h.connect(ctx)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
defer c.Close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rlc := rls.NewReleaseServiceClient(c)
|
|
|
|
|
|
|
|
return rlc.GetReleaseContent(ctx, req)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Executes tiller.GetVersion RPC.
|
|
|
|
|
|
|
|
func (h *Client) version(ctx context.Context, req *rls.GetVersionRequest) (*rls.GetVersionResponse, error) {
|
|
|
|
|
|
|
|
c, err := h.connect(ctx)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
defer c.Close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rlc := rls.NewReleaseServiceClient(c)
|
|
|
|
|
|
|
|
return rlc.GetVersion(ctx, req)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Executes tiller.GetHistory RPC.
|
|
|
|
// Executes tiller.GetHistory RPC.
|
|
|
|
func (h *Client) history(ctx context.Context, req *rls.GetHistoryRequest) (*rls.GetHistoryResponse, error) {
|
|
|
|
func (h *Client) history(ctx context.Context, req *rls.GetHistoryRequest) (*rls.GetHistoryResponse, error) {
|
|
|
|
c, err := h.connect(ctx)
|
|
|
|
c, err := h.connect(ctx)
|
|
|
@ -470,26 +437,3 @@ func (h *Client) test(ctx context.Context, req *rls.TestReleaseRequest) (<-chan
|
|
|
|
|
|
|
|
|
|
|
|
return ch, errc
|
|
|
|
return ch, errc
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Executes tiller.Ping RPC.
|
|
|
|
|
|
|
|
func (h *Client) ping(ctx context.Context) error {
|
|
|
|
|
|
|
|
c, err := h.connect(ctx)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
defer c.Close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
healthClient := healthpb.NewHealthClient(c)
|
|
|
|
|
|
|
|
resp, err := healthClient.Check(ctx, &healthpb.HealthCheckRequest{Service: "Tiller"})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
switch resp.GetStatus() {
|
|
|
|
|
|
|
|
case healthpb.HealthCheckResponse_SERVING:
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
case healthpb.HealthCheckResponse_NOT_SERVING:
|
|
|
|
|
|
|
|
return fmt.Errorf("tiller is not serving requests at this time, Please try again later")
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return fmt.Errorf("tiller healthcheck returned an unknown status")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|