|
|
@ -51,14 +51,15 @@ func (h *Client) Option(opts ...Option) *Client {
|
|
|
|
|
|
|
|
|
|
|
|
// ListReleases lists the current releases.
|
|
|
|
// ListReleases lists the current releases.
|
|
|
|
func (h *Client) ListReleases(opts ...ReleaseListOption) (*rls.ListReleasesResponse, error) {
|
|
|
|
func (h *Client) ListReleases(opts ...ReleaseListOption) (*rls.ListReleasesResponse, error) {
|
|
|
|
|
|
|
|
reqOpts := h.opts
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&reqOpts)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
req := &h.opts.listReq
|
|
|
|
req := &reqOpts.listReq
|
|
|
|
ctx := NewContext()
|
|
|
|
ctx := NewContext()
|
|
|
|
|
|
|
|
|
|
|
|
if h.opts.before != nil {
|
|
|
|
if reqOpts.before != nil {
|
|
|
|
if err := h.opts.before(ctx, req); err != nil {
|
|
|
|
if err := reqOpts.before(ctx, req); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -79,19 +80,20 @@ func (h *Client) InstallRelease(chstr, ns string, opts ...InstallOption) (*rls.I
|
|
|
|
// InstallReleaseFromChart installs a new chart and returns the release response.
|
|
|
|
// InstallReleaseFromChart installs a new chart and returns the release response.
|
|
|
|
func (h *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ...InstallOption) (*rls.InstallReleaseResponse, error) {
|
|
|
|
func (h *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ...InstallOption) (*rls.InstallReleaseResponse, error) {
|
|
|
|
// apply the install options
|
|
|
|
// apply the install options
|
|
|
|
|
|
|
|
reqOpts := h.opts
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&reqOpts)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
req := &h.opts.instReq
|
|
|
|
req := &reqOpts.instReq
|
|
|
|
req.Chart = chart
|
|
|
|
req.Chart = chart
|
|
|
|
req.Namespace = ns
|
|
|
|
req.Namespace = ns
|
|
|
|
req.DryRun = h.opts.dryRun
|
|
|
|
req.DryRun = reqOpts.dryRun
|
|
|
|
req.DisableHooks = h.opts.disableHooks
|
|
|
|
req.DisableHooks = reqOpts.disableHooks
|
|
|
|
req.ReuseName = h.opts.reuseName
|
|
|
|
req.ReuseName = reqOpts.reuseName
|
|
|
|
ctx := NewContext()
|
|
|
|
ctx := NewContext()
|
|
|
|
|
|
|
|
|
|
|
|
if h.opts.before != nil {
|
|
|
|
if reqOpts.before != nil {
|
|
|
|
if err := h.opts.before(ctx, req); err != nil {
|
|
|
|
if err := reqOpts.before(ctx, req); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -110,11 +112,12 @@ func (h *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ...
|
|
|
|
// DeleteRelease uninstalls a named release and returns the response.
|
|
|
|
// DeleteRelease uninstalls a named release and returns the response.
|
|
|
|
func (h *Client) DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.UninstallReleaseResponse, error) {
|
|
|
|
func (h *Client) DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.UninstallReleaseResponse, error) {
|
|
|
|
// apply the uninstall options
|
|
|
|
// apply the uninstall options
|
|
|
|
|
|
|
|
reqOpts := h.opts
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&reqOpts)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if h.opts.dryRun {
|
|
|
|
if reqOpts.dryRun {
|
|
|
|
// In the dry run case, just see if the release exists
|
|
|
|
// In the dry run case, just see if the release exists
|
|
|
|
r, err := h.ReleaseContent(rlsName)
|
|
|
|
r, err := h.ReleaseContent(rlsName)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -123,13 +126,13 @@ func (h *Client) DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.Unins
|
|
|
|
return &rls.UninstallReleaseResponse{Release: r.Release}, nil
|
|
|
|
return &rls.UninstallReleaseResponse{Release: r.Release}, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
req := &h.opts.uninstallReq
|
|
|
|
req := &reqOpts.uninstallReq
|
|
|
|
req.Name = rlsName
|
|
|
|
req.Name = rlsName
|
|
|
|
req.DisableHooks = h.opts.disableHooks
|
|
|
|
req.DisableHooks = reqOpts.disableHooks
|
|
|
|
ctx := NewContext()
|
|
|
|
ctx := NewContext()
|
|
|
|
|
|
|
|
|
|
|
|
if h.opts.before != nil {
|
|
|
|
if reqOpts.before != nil {
|
|
|
|
if err := h.opts.before(ctx, req); err != nil {
|
|
|
|
if err := reqOpts.before(ctx, req); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -149,24 +152,24 @@ func (h *Client) UpdateRelease(rlsName string, chstr string, opts ...UpdateOptio
|
|
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
reqOpts := h.opts
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&reqOpts)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
req := &h.opts.updateReq
|
|
|
|
req := &reqOpts.updateReq
|
|
|
|
req.Chart = chart
|
|
|
|
req.Chart = chart
|
|
|
|
req.DryRun = h.opts.dryRun
|
|
|
|
req.DryRun = reqOpts.dryRun
|
|
|
|
req.Name = rlsName
|
|
|
|
req.Name = rlsName
|
|
|
|
req.DisableHooks = h.opts.disableHooks
|
|
|
|
req.DisableHooks = reqOpts.disableHooks
|
|
|
|
req.Recreate = h.opts.recreate
|
|
|
|
req.Recreate = reqOpts.recreate
|
|
|
|
req.Force = h.opts.force
|
|
|
|
req.Force = reqOpts.force
|
|
|
|
req.ResetValues = h.opts.resetValues
|
|
|
|
req.ResetValues = reqOpts.resetValues
|
|
|
|
req.ReuseValues = h.opts.reuseValues
|
|
|
|
req.ReuseValues = reqOpts.reuseValues
|
|
|
|
ctx := NewContext()
|
|
|
|
ctx := NewContext()
|
|
|
|
|
|
|
|
|
|
|
|
if h.opts.before != nil {
|
|
|
|
if reqOpts.before != nil {
|
|
|
|
if err := h.opts.before(ctx, req); err != nil {
|
|
|
|
if err := reqOpts.before(ctx, req); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -184,14 +187,15 @@ func (h *Client) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts
|
|
|
|
|
|
|
|
|
|
|
|
// 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) {
|
|
|
|
|
|
|
|
reqOpts := h.opts
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&reqOpts)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
req := &rls.GetVersionRequest{}
|
|
|
|
req := &rls.GetVersionRequest{}
|
|
|
|
ctx := NewContext()
|
|
|
|
ctx := NewContext()
|
|
|
|
|
|
|
|
|
|
|
|
if h.opts.before != nil {
|
|
|
|
if reqOpts.before != nil {
|
|
|
|
if err := h.opts.before(ctx, req); err != nil {
|
|
|
|
if err := reqOpts.before(ctx, req); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -200,19 +204,20 @@ func (h *Client) GetVersion(opts ...VersionOption) (*rls.GetVersionResponse, err
|
|
|
|
|
|
|
|
|
|
|
|
// 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) {
|
|
|
|
|
|
|
|
reqOpts := h.opts
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&reqOpts)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
req := &h.opts.rollbackReq
|
|
|
|
req := &reqOpts.rollbackReq
|
|
|
|
req.Recreate = h.opts.recreate
|
|
|
|
req.Recreate = reqOpts.recreate
|
|
|
|
req.Force = h.opts.force
|
|
|
|
req.Force = reqOpts.force
|
|
|
|
req.DisableHooks = h.opts.disableHooks
|
|
|
|
req.DisableHooks = reqOpts.disableHooks
|
|
|
|
req.DryRun = h.opts.dryRun
|
|
|
|
req.DryRun = reqOpts.dryRun
|
|
|
|
req.Name = rlsName
|
|
|
|
req.Name = rlsName
|
|
|
|
ctx := NewContext()
|
|
|
|
ctx := NewContext()
|
|
|
|
|
|
|
|
|
|
|
|
if h.opts.before != nil {
|
|
|
|
if reqOpts.before != nil {
|
|
|
|
if err := h.opts.before(ctx, req); err != nil {
|
|
|
|
if err := reqOpts.before(ctx, req); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -221,15 +226,16 @@ func (h *Client) RollbackRelease(rlsName string, opts ...RollbackOption) (*rls.R
|
|
|
|
|
|
|
|
|
|
|
|
// ReleaseStatus returns the given release's status.
|
|
|
|
// ReleaseStatus returns the given release's status.
|
|
|
|
func (h *Client) ReleaseStatus(rlsName string, opts ...StatusOption) (*rls.GetReleaseStatusResponse, error) {
|
|
|
|
func (h *Client) ReleaseStatus(rlsName string, opts ...StatusOption) (*rls.GetReleaseStatusResponse, error) {
|
|
|
|
|
|
|
|
reqOpts := h.opts
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&reqOpts)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
req := &h.opts.statusReq
|
|
|
|
req := &reqOpts.statusReq
|
|
|
|
req.Name = rlsName
|
|
|
|
req.Name = rlsName
|
|
|
|
ctx := NewContext()
|
|
|
|
ctx := NewContext()
|
|
|
|
|
|
|
|
|
|
|
|
if h.opts.before != nil {
|
|
|
|
if reqOpts.before != nil {
|
|
|
|
if err := h.opts.before(ctx, req); err != nil {
|
|
|
|
if err := reqOpts.before(ctx, req); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -238,15 +244,16 @@ func (h *Client) ReleaseStatus(rlsName string, opts ...StatusOption) (*rls.GetRe
|
|
|
|
|
|
|
|
|
|
|
|
// ReleaseContent returns the configuration for a given release.
|
|
|
|
// ReleaseContent returns the configuration for a given release.
|
|
|
|
func (h *Client) ReleaseContent(rlsName string, opts ...ContentOption) (*rls.GetReleaseContentResponse, error) {
|
|
|
|
func (h *Client) ReleaseContent(rlsName string, opts ...ContentOption) (*rls.GetReleaseContentResponse, error) {
|
|
|
|
|
|
|
|
reqOpts := h.opts
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&reqOpts)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
req := &h.opts.contentReq
|
|
|
|
req := &reqOpts.contentReq
|
|
|
|
req.Name = rlsName
|
|
|
|
req.Name = rlsName
|
|
|
|
ctx := NewContext()
|
|
|
|
ctx := NewContext()
|
|
|
|
|
|
|
|
|
|
|
|
if h.opts.before != nil {
|
|
|
|
if reqOpts.before != nil {
|
|
|
|
if err := h.opts.before(ctx, req); err != nil {
|
|
|
|
if err := reqOpts.before(ctx, req); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -255,16 +262,17 @@ func (h *Client) ReleaseContent(rlsName string, opts ...ContentOption) (*rls.Get
|
|
|
|
|
|
|
|
|
|
|
|
// ReleaseHistory returns a release's revision history.
|
|
|
|
// ReleaseHistory returns a release's revision history.
|
|
|
|
func (h *Client) ReleaseHistory(rlsName string, opts ...HistoryOption) (*rls.GetHistoryResponse, error) {
|
|
|
|
func (h *Client) ReleaseHistory(rlsName string, opts ...HistoryOption) (*rls.GetHistoryResponse, error) {
|
|
|
|
|
|
|
|
reqOpts := h.opts
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&reqOpts)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
req := &h.opts.histReq
|
|
|
|
req := &reqOpts.histReq
|
|
|
|
req.Name = rlsName
|
|
|
|
req.Name = rlsName
|
|
|
|
ctx := NewContext()
|
|
|
|
ctx := NewContext()
|
|
|
|
|
|
|
|
|
|
|
|
if h.opts.before != nil {
|
|
|
|
if reqOpts.before != nil {
|
|
|
|
if err := h.opts.before(ctx, req); err != nil {
|
|
|
|
if err := reqOpts.before(ctx, req); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -273,11 +281,12 @@ func (h *Client) ReleaseHistory(rlsName string, opts ...HistoryOption) (*rls.Get
|
|
|
|
|
|
|
|
|
|
|
|
// 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) {
|
|
|
|
|
|
|
|
reqOpts := h.opts
|
|
|
|
for _, opt := range opts {
|
|
|
|
for _, opt := range opts {
|
|
|
|
opt(&h.opts)
|
|
|
|
opt(&reqOpts)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
req := &h.opts.testReq
|
|
|
|
req := &reqOpts.testReq
|
|
|
|
req.Name = rlsName
|
|
|
|
req.Name = rlsName
|
|
|
|
ctx := NewContext()
|
|
|
|
ctx := NewContext()
|
|
|
|
|
|
|
|
|
|
|
|