fix(pkg/kube): only wait for events from Jobs and Pods

Fixes issue of waiting for events from hook objects that are not Jobs or
Pods.

Signed-off-by: Adam Reese <adam@reese.io>
pull/6208/head
Adam Reese 5 years ago
parent ac43d9faf2
commit cc98242feb
No known key found for this signature in database
GPG Key ID: 06F35E60A7A18DD6

@ -368,14 +368,20 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
} }
func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) error { func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) error {
kind := info.Mapping.GroupVersionKind.Kind
switch kind {
case "Job", "Pod":
default:
return nil
}
c.Log("Watching for changes to %s %s with timeout of %v", kind, info.Name, timeout)
w, err := resource.NewHelper(info.Client, info.Mapping).WatchSingle(info.Namespace, info.Name, info.ResourceVersion) w, err := resource.NewHelper(info.Client, info.Mapping).WatchSingle(info.Namespace, info.Name, info.ResourceVersion)
if err != nil { if err != nil {
return err return err
} }
kind := info.Mapping.GroupVersionKind.Kind
c.Log("Watching for changes to %s %s with timeout of %v", kind, info.Name, timeout)
// What we watch for depends on the Kind. // What we watch for depends on the Kind.
// - For a Job, we watch for completion. // - For a Job, we watch for completion.
// - For all else, we watch until Ready. // - For all else, we watch until Ready.

Loading…
Cancel
Save