ref(pkg/helm): cleanup unused code

pull/3945/head
Adam Reese 6 years ago
parent 9409adfa8d
commit dbf1ed0ba4
No known key found for this signature in database
GPG Key ID: 06F35E60A7A18DD6

@ -17,17 +17,13 @@ limitations under the License.
package helm // import "k8s.io/helm/pkg/helm"
import (
"fmt"
"io"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/proto/hapi/chart"
"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)),
}
switch {
case h.opts.useTLS:
opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(h.opts.tlsConfig)))
default:
opts = append(opts, grpc.WithInsecure())
}
opts = append(opts, grpc.WithInsecure())
ctx, cancel := context.WithTimeout(ctx, h.opts.connectTimeout)
defer cancel()
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)
}
// 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.
func (h *Client) history(ctx context.Context, req *rls.GetHistoryRequest) (*rls.GetHistoryResponse, error) {
c, err := h.connect(ctx)
@ -470,26 +437,3 @@ func (h *Client) test(ctx context.Context, req *rls.TestReleaseRequest) (<-chan
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")
}
}

@ -86,18 +86,3 @@ func (h Home) Plugins() string {
func (h Home) Archive() string {
return h.Path("cache", "archive")
}
// TLSCaCert returns the path to fetch the CA certificate.
func (h Home) TLSCaCert() string {
return h.Path("ca.pem")
}
// TLSCert returns the path to fetch the client certificate.
func (h Home) TLSCert() string {
return h.Path("cert.pem")
}
// TLSKey returns the path to fetch the client public key.
func (h Home) TLSKey() string {
return h.Path("key.pem")
}

@ -38,9 +38,6 @@ func TestHelmHome(t *testing.T) {
isEq(t, hh.CacheIndex("t"), "/r/repository/cache/t-index.yaml")
isEq(t, hh.Starters(), "/r/starters")
isEq(t, hh.Archive(), "/r/cache/archive")
isEq(t, hh.TLSCaCert(), "/r/ca.pem")
isEq(t, hh.TLSCert(), "/r/cert.pem")
isEq(t, hh.TLSKey(), "/r/key.pem")
}
func TestHelmHome_expand(t *testing.T) {

@ -35,7 +35,4 @@ func TestHelmHome(t *testing.T) {
isEq(t, hh.CacheIndex("t"), "r:\\repository\\cache\\t-index.yaml")
isEq(t, hh.Starters(), "r:\\starters")
isEq(t, hh.Archive(), "r:\\cache\\archive")
isEq(t, hh.TLSCaCert(), "r:\\ca.pem")
isEq(t, hh.TLSCert(), "r:\\cert.pem")
isEq(t, hh.TLSKey(), "r:\\key.pem")
}

@ -17,7 +17,6 @@ limitations under the License.
package helm
import (
"crypto/tls"
"time"
"github.com/golang/protobuf/proto"
@ -41,8 +40,6 @@ type options struct {
host string
// if set dry-run helm client calls
dryRun bool
// if set enable TLS on helm client calls
useTLS bool
// if set, re-use an existing name
reuseName bool
// if set, performs pod restart during upgrade/rollback
@ -51,10 +48,6 @@ type options struct {
force bool
// if set, skip running hooks
disableHooks bool
// name of release
releaseName string
// tls.Config to use for rpc if tls enabled
tlsConfig *tls.Config
// release list options are applied directly to the list releases request
listReq rls.ListReleasesRequest
// release install options are applied directly to the install release request
@ -90,14 +83,6 @@ func Host(host string) Option {
}
}
// WithTLS specifies the tls configuration if the helm client is enabled to use TLS.
func WithTLS(cfg *tls.Config) Option {
return func(opts *options) {
opts.useTLS = true
opts.tlsConfig = cfg
}
}
// BeforeCall returns an option that allows intercepting a helm client rpc
// before being sent OTA to tiller. The intercepting function should return
// an error to indicate that the call should not proceed or nil otherwise.

Loading…
Cancel
Save