mirror of
https://github.com/helm/helm.git
synced 2026-04-15 21:59:50 -04:00
remove WaitAndGetCompletedPodPhase function
Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com>
This commit is contained in:
parent
73545f9a3e
commit
fc6c5e5edb
1 changed files with 0 additions and 33 deletions
|
|
@ -29,7 +29,6 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
jsonpatch "github.com/evanphx/json-patch"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
|
@ -765,38 +764,6 @@ func scrubValidationError(err error) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// WaitAndGetCompletedPodPhase waits up to a timeout until a pod enters a completed phase
|
||||
// and returns said phase (PodSucceeded or PodFailed qualify).
|
||||
func (c *Client) WaitAndGetCompletedPodPhase(name string, timeout time.Duration) (v1.PodPhase, error) {
|
||||
client, err := c.getKubeClient()
|
||||
if err != nil {
|
||||
return v1.PodUnknown, err
|
||||
}
|
||||
to := int64(timeout)
|
||||
watcher, err := client.CoreV1().Pods(c.namespace()).Watch(context.Background(), metav1.ListOptions{
|
||||
FieldSelector: fmt.Sprintf("metadata.name=%s", name),
|
||||
TimeoutSeconds: &to,
|
||||
})
|
||||
if err != nil {
|
||||
return v1.PodUnknown, err
|
||||
}
|
||||
|
||||
for event := range watcher.ResultChan() {
|
||||
p, ok := event.Object.(*v1.Pod)
|
||||
if !ok {
|
||||
return v1.PodUnknown, fmt.Errorf("%s not a pod", name)
|
||||
}
|
||||
switch p.Status.Phase {
|
||||
case v1.PodFailed:
|
||||
return v1.PodFailed, nil
|
||||
case v1.PodSucceeded:
|
||||
return v1.PodSucceeded, nil
|
||||
}
|
||||
}
|
||||
|
||||
return v1.PodUnknown, err
|
||||
}
|
||||
|
||||
type joinedErrors struct {
|
||||
errs []error
|
||||
sep string
|
||||
|
|
|
|||
Loading…
Reference in a new issue