Introduce a new interface for WaitForDelete() to avoid breaking backwards compatibility

Signed-off-by: Mike Ng <ming@redhat.com>
pull/9702/head
Mike Ng 3 years ago
parent 655bdcd2fd
commit d51a61f9ab

@ -120,8 +120,10 @@ func (u *Uninstall) Run(name string) (*release.UninstallReleaseResponse, error)
res.Info = kept
if u.Wait {
if err := u.cfg.KubeClient.WaitForDelete(deletedResources, u.Timeout); err != nil {
errs = append(errs, err)
if kubeClient, ok := u.cfg.KubeClient.(kube.ClientInterface); ok {
if err := kubeClient.WaitForDelete(deletedResources, u.Timeout); err != nil {
errs = append(errs, err)
}
}
}

@ -162,7 +162,7 @@ func (c *Client) WaitWithJobs(resources ResourceList, timeout time.Duration) err
return w.waitForResources(resources)
}
// Wait up to the given timeout for the specified resources to be deleted
// WaitForDelete wait up to the given timeout for the specified resources to be deleted.
func (c *Client) WaitForDelete(resources ResourceList, timeout time.Duration) error {
w := waiter{
log: c.Log,

@ -36,8 +36,6 @@ type Interface interface {
// WaitWithJobs wait up to the given timeout for the specified resources to be ready, including jobs.
WaitWithJobs(resources ResourceList, timeout time.Duration) error
WaitForDelete(resources ResourceList, timeout time.Duration) error
// Delete destroys one or more resources.
Delete(resources ResourceList) (*Result, []error)
@ -72,4 +70,13 @@ type Interface interface {
IsReachable() error
}
// ClientInterface is introduced to avoid breaking backwards compatibility for Interface implementers.
//
// TODO Helm 4: Remove ClientInterface and integrate its method(s) into the Interface.
type ClientInterface interface {
// WaitForDelete wait up to the given timeout for the specified resources to be deleted.
WaitForDelete(resources ResourceList, timeout time.Duration) error
}
var _ Interface = (*Client)(nil)
var _ ClientInterface = (*Client)(nil)

Loading…
Cancel
Save