|
|
@ -29,7 +29,7 @@ import (
|
|
|
|
rls "k8s.io/helm/pkg/proto/hapi/services"
|
|
|
|
rls "k8s.io/helm/pkg/proto/hapi/services"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Client manages client side of the helm-tiller protocol
|
|
|
|
// Client manages client side of the Helm-Tiller protocol.
|
|
|
|
type Client struct {
|
|
|
|
type Client struct {
|
|
|
|
opts options
|
|
|
|
opts options
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -40,7 +40,7 @@ func NewClient(opts ...Option) *Client {
|
|
|
|
return c.Option(opts...)
|
|
|
|
return c.Option(opts...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Option configures the Helm client with the provided options
|
|
|
|
// Option configures the Helm client with the provided options.
|
|
|
|
func (h *Client) Option(opts ...Option) *Client {
|
|
|
|
func (h *Client) Option(opts ...Option) *Client {
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&h.opts)
|
|
|
@ -64,7 +64,7 @@ func (h *Client) ListReleases(opts ...ReleaseListOption) (*rls.ListReleasesRespo
|
|
|
|
return h.list(ctx, req)
|
|
|
|
return h.list(ctx, req)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// InstallRelease loads a chart from chstr, installs it and returns the release response.
|
|
|
|
// InstallRelease loads a chart from chstr, installs it, and returns the release response.
|
|
|
|
func (h *Client) InstallRelease(chstr, ns string, opts ...InstallOption) (*rls.InstallReleaseResponse, error) {
|
|
|
|
func (h *Client) InstallRelease(chstr, ns string, opts ...InstallOption) (*rls.InstallReleaseResponse, error) {
|
|
|
|
// load the chart to install
|
|
|
|
// load the chart to install
|
|
|
|
chart, err := chartutil.Load(chstr)
|
|
|
|
chart, err := chartutil.Load(chstr)
|
|
|
@ -135,7 +135,7 @@ func (h *Client) DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.Unins
|
|
|
|
return h.delete(ctx, req)
|
|
|
|
return h.delete(ctx, req)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UpdateRelease loads a chart from chstr and updates a release to a new/different chart
|
|
|
|
// UpdateRelease loads a chart from chstr and updates a release to a new/different chart.
|
|
|
|
func (h *Client) UpdateRelease(rlsName string, chstr string, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error) {
|
|
|
|
func (h *Client) UpdateRelease(rlsName string, chstr string, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error) {
|
|
|
|
// load the chart to update
|
|
|
|
// load the chart to update
|
|
|
|
chart, err := chartutil.Load(chstr)
|
|
|
|
chart, err := chartutil.Load(chstr)
|
|
|
@ -146,7 +146,7 @@ func (h *Client) UpdateRelease(rlsName string, chstr string, opts ...UpdateOptio
|
|
|
|
return h.UpdateReleaseFromChart(rlsName, chart, opts...)
|
|
|
|
return h.UpdateReleaseFromChart(rlsName, chart, opts...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UpdateReleaseFromChart updates a release to a new/different chart
|
|
|
|
// UpdateReleaseFromChart updates a release to a new/different chart.
|
|
|
|
func (h *Client) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error) {
|
|
|
|
func (h *Client) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error) {
|
|
|
|
|
|
|
|
|
|
|
|
// apply the update options
|
|
|
|
// apply the update options
|
|
|
@ -181,7 +181,7 @@ func (h *Client) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts
|
|
|
|
return h.update(ctx, req)
|
|
|
|
return h.update(ctx, req)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetVersion returns the server version
|
|
|
|
// GetVersion returns the server version.
|
|
|
|
func (h *Client) GetVersion(opts ...VersionOption) (*rls.GetVersionResponse, error) {
|
|
|
|
func (h *Client) GetVersion(opts ...VersionOption) (*rls.GetVersionResponse, error) {
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&h.opts)
|
|
|
@ -197,7 +197,7 @@ func (h *Client) GetVersion(opts ...VersionOption) (*rls.GetVersionResponse, err
|
|
|
|
return h.version(ctx, req)
|
|
|
|
return h.version(ctx, req)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RollbackRelease rolls back a release to the previous version
|
|
|
|
// RollbackRelease rolls back a release to the previous version.
|
|
|
|
func (h *Client) RollbackRelease(rlsName string, opts ...RollbackOption) (*rls.RollbackReleaseResponse, error) {
|
|
|
|
func (h *Client) RollbackRelease(rlsName string, opts ...RollbackOption) (*rls.RollbackReleaseResponse, error) {
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&h.opts)
|
|
|
@ -270,7 +270,7 @@ func (h *Client) ReleaseHistory(rlsName string, opts ...HistoryOption) (*rls.Get
|
|
|
|
return h.history(ctx, req)
|
|
|
|
return h.history(ctx, req)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RunReleaseTest executes a pre-defined test on a release
|
|
|
|
// RunReleaseTest executes a pre-defined test on a release.
|
|
|
|
func (h *Client) RunReleaseTest(rlsName string, opts ...ReleaseTestOption) (<-chan *rls.TestReleaseResponse, <-chan error) {
|
|
|
|
func (h *Client) RunReleaseTest(rlsName string, opts ...ReleaseTestOption) (<-chan *rls.TestReleaseResponse, <-chan error) {
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&h.opts)
|
|
|
@ -283,7 +283,7 @@ func (h *Client) RunReleaseTest(rlsName string, opts ...ReleaseTestOption) (<-ch
|
|
|
|
return h.test(ctx, req)
|
|
|
|
return h.test(ctx, req)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// connect returns a grpc connection to tiller or error. The grpc dial options
|
|
|
|
// connect returns a gRPC connection to Tiller or error. The gRPC dial options
|
|
|
|
// are constructed here.
|
|
|
|
// are constructed here.
|
|
|
|
func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) {
|
|
|
|
func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) {
|
|
|
|
opts := []grpc.DialOption{
|
|
|
|
opts := []grpc.DialOption{
|
|
|
|