Fetch the repository succeeded.
package compose
import (
"time"
"github.com/pkg/errors"
"github.com/rancher/norman/clientbase"
managementClient "github.com/rancher/types/client/management/v3"
)
var (
// WaitCondition is a set of function that can be customized to wait for a resource
WaitCondition = map[string]func(baseClient *clientbase.APIBaseClient, id, schemaType string) error{}
)
func WaitCluster(baseClient *clientbase.APIBaseClient, id, schemaType string) error {
start := time.Now()
for {
respObj := managementClient.Cluster{}
if err := baseClient.ByID(schemaType, id, &respObj); err != nil {
return err
}
for _, cond := range respObj.Conditions {
if cond.Type == "Ready" && cond.Status == "True" {
return nil
}
}
time.Sleep(time.Second * 10)
if time.Now().After(start.Add(time.Minute * 30)) {
return errors.Errorf("Timeout wait for cluster %s to be ready", id)
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。