Skip to content

Commit

Permalink
fix deploy wait functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino committed Oct 21, 2022
1 parent b838940 commit ee58749
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/plural/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ func (p *Plural) deploy(c *cli.Context) error {

if man, err := fetchManifest(repo); err == nil && man.Wait {
if kubeConf, err := kubernetes.KubeConfig(); err == nil {
fmt.Println("")
if err := application.Wait(kubeConf, repo); err != nil {
fmt.Printf("Waiting for %s to become ready...\n", repo)
if err := application.SilentWait(kubeConf, repo); err != nil {
return err
}
fmt.Println("")
Expand Down
15 changes: 15 additions & 0 deletions pkg/application/waiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ func Waiter(kubeConf *rest.Config, repo string, appFunc func(app *v1beta1.Applic
}
}

func SilentWait(kubeConf *rest.Config, repo string) error {
timeout := func() error {
return fmt.Errorf("Failed to become ready after 5 minutes, try running `plural watch %s` to get an idea where to debug", repo)
}

return Waiter(kubeConf, repo, func(app *v1beta1.Application) (bool, error) {
cond := findReadiness(app)
if cond.Status == "True" {
fmt.Printf("%s is finally ready!", repo)
return true, nil
}
return false, nil
}, timeout)
}

func Wait(kubeConf *rest.Config, repo string) error {
timeout := func() error {
return fmt.Errorf("Failed to become ready after 5 minutes, try running `plural watch %s` to get an idea where to debug", repo)
Expand Down

0 comments on commit ee58749

Please sign in to comment.