Skip to content

Commit

Permalink
Merge pull request helm#6907 from thomastaylor312/fix/missing_job
Browse files Browse the repository at this point in the history
fix(kube): Fixes wait for jobs
  • Loading branch information
thomastaylor312 committed Nov 7, 2019
2 parents 751d172 + 77c9734 commit 0ca9534
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/kube/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,13 @@ func getSelectorFromObject(obj runtime.Object) (map[string]string, bool) {
}

func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) error {
lw := cachetools.NewListWatchFromClient(info.Client, info.Mapping.Resource.Resource, info.Namespace, fields.Everything())
// Use a selector on the name of the resource. This should be unique for the
// given version and kind
selector, err := fields.ParseSelector(fmt.Sprintf("metadata.name=%s", info.Name))
if err != nil {
return err
}
lw := cachetools.NewListWatchFromClient(info.Client, info.Mapping.Resource.Resource, info.Namespace, selector)

kind := info.Mapping.GroupVersionKind.Kind
c.Log("Watching for changes to %s %s with timeout of %v", kind, info.Name, timeout)
Expand All @@ -850,7 +856,7 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err

ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), timeout)
defer cancel()
_, err := watchtools.ListWatchUntil(ctx, lw, func(e watch.Event) (bool, error) {
_, err = watchtools.ListWatchUntil(ctx, lw, func(e watch.Event) (bool, error) {
switch e.Type {
case watch.Added, watch.Modified:
// For things like a secret or a config map, this is the best indicator
Expand Down

0 comments on commit 0ca9534

Please sign in to comment.