Skip to content

Commit

Permalink
Add event watching to deploy (#405)
Browse files Browse the repository at this point in the history
* Add event watching to deploy

* Add comment
  • Loading branch information
alexmasi authored Jul 26, 2023
1 parent b3daa7a commit 635256a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
dclient "github.com/docker/docker/client"
"github.com/openconfig/gnmi/errlist"
metallbclientv1 "github.com/openconfig/kne/api/metallb/clientset/v1beta1"
"github.com/openconfig/kne/events"
kexec "github.com/openconfig/kne/exec"
"github.com/openconfig/kne/load"
logshim "github.com/openconfig/kne/logshim"
Expand Down Expand Up @@ -280,6 +281,16 @@ func (d *Deployment) Deploy(ctx context.Context, kubecfg string) (rerr error) {
rerr = w.Cleanup(rerr)
}()
}
// Watch for incoming events to fail early in case of events signaling unrecoverable errors.
if w, err := events.NewWatcher(ctx, kClient, cancel); err != nil {
log.Warningf("Failed to start event watcher: %v", err)
} else {
w.SetProgress(d.Progress)
defer func() {
cancel()
rerr = w.Cleanup(rerr)
}()
}

d.Ingress.SetKClient(kClient)
d.Ingress.SetRCfg(rCfg)
Expand Down

0 comments on commit 635256a

Please sign in to comment.