-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use existing "VerifyInstallation" to wait for completion of KUDO init (…
…#1662) Signed-off-by: Andreas Neumann <[email protected]>
- Loading branch information
1 parent
ad70978
commit 8358371
Showing
6 changed files
with
48 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,22 @@ | ||
package setup | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/kudobuilder/kudo/pkg/engine/health" | ||
"github.com/kudobuilder/kudo/pkg/kudoctl/kube" | ||
|
||
"k8s.io/apimachinery/pkg/util/wait" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/client-go/kubernetes" | ||
appsv1 "k8s.io/client-go/kubernetes/typed/apps/v1" | ||
|
||
"github.com/kudobuilder/kudo/pkg/kudoctl/kudoinit" | ||
) | ||
|
||
// WatchKUDOUntilReady waits for the KUDO pod to become available. | ||
// WatchKUDOUntilReady waits for the KUDO installation to become available. | ||
// | ||
// Returns no error if it exists. If the timeout was reached and it could not find the pod, it returns error. | ||
func WatchKUDOUntilReady(client kubernetes.Interface, opts kudoinit.Options, timeout int64) error { | ||
func WatchKUDOUntilReady(v kudoinit.InstallVerifier, client *kube.Client, timeout int64) error { | ||
return wait.PollImmediate(500*time.Millisecond, time.Duration(timeout)*time.Second, | ||
func() (bool, error) { return verifyKudoStatefulset(client.AppsV1(), opts.Namespace) }) | ||
} | ||
|
||
func verifyKudoStatefulset(client appsv1.StatefulSetsGetter, namespace string) (bool, error) { | ||
ss, err := client.StatefulSets(namespace).Get(context.TODO(), kudoinit.DefaultManagerName, metav1.GetOptions{}) | ||
if err != nil || ss == nil { | ||
return false, err | ||
} | ||
err = health.IsHealthy(ss) | ||
if err != nil { | ||
return false, nil | ||
} | ||
return true, nil | ||
func() (bool, error) { | ||
return VerifyExistingInstallation(v, client, nil) | ||
}, | ||
) | ||
} |