本文整理匯總了Golang中k8s/io/kubernetes/federation/pkg/federation-controller/util.FederatedReadOnlyStore類的典型用法代碼示例。如果您正苦於以下問題:Golang FederatedReadOnlyStore類的具體用法?Golang FederatedReadOnlyStore怎麽用?Golang FederatedReadOnlyStore使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FederatedReadOnlyStore類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: WaitForStoreUpdate
// Ensure a key is in the store before returning (or timeout w/ error)
func WaitForStoreUpdate(store util.FederatedReadOnlyStore, clusterName, key string, timeout time.Duration) error {
retryInterval := 100 * time.Millisecond
err := wait.PollImmediate(retryInterval, timeout, func() (bool, error) {
_, found, err := store.GetByKey(clusterName, key)
return found, err
})
return err
}
示例2: WaitForStatusUpdate
// Wait for ingress status to be updated to match the desiredStatus.
func WaitForStatusUpdate(t *testing.T, store util.FederatedReadOnlyStore, clusterName, key string, desiredStatus apiv1.LoadBalancerStatus, timeout time.Duration) error {
retryInterval := 100 * time.Millisecond
err := wait.PollImmediate(retryInterval, timeout, func() (bool, error) {
obj, found, err := store.GetByKey(clusterName, key)
if !found || err != nil {
return false, err
}
ingress := obj.(*extensionsv1beta1.Ingress)
return reflect.DeepEqual(ingress.Status.LoadBalancer, desiredStatus), nil
})
return err
}
示例3: WaitForSecretStoreUpdate
// Wait till the store is updated with latest secret.
func WaitForSecretStoreUpdate(store util.FederatedReadOnlyStore, clusterName, key string, desiredSecret *api_v1.Secret, timeout time.Duration) error {
retryInterval := 100 * time.Millisecond
err := wait.PollImmediate(retryInterval, timeout, func() (bool, error) {
obj, found, err := store.GetByKey(clusterName, key)
if !found || err != nil {
return false, err
}
equal := secretsEqual(*obj.(*api_v1.Secret), *desiredSecret)
return equal, err
})
return err
}
示例4: WaitForIngressInClusterStore
// Wait for the cluster ingress to appear in cluster store.
func WaitForIngressInClusterStore(store util.FederatedReadOnlyStore, clusterName, key string) error {
retryInterval := 100 * time.Millisecond
timeout := wait.ForeverTestTimeout
err := wait.PollImmediate(retryInterval, timeout, func() (bool, error) {
_, found, err := store.GetByKey(clusterName, key)
if found && err == nil {
return true, nil
}
if errors.IsNotFound(err) {
return false, nil
}
return false, err
})
return err
}
示例5: WaitForStoreUpdateChecking
// Ensure a key is in the store before returning (or timeout w/ error)
func WaitForStoreUpdateChecking(store util.FederatedReadOnlyStore, clusterName, key string, timeout time.Duration,
checkFunction CheckingFunction) error {
retryInterval := 500 * time.Millisecond
var lastError error
err := wait.PollImmediate(retryInterval, timeout, func() (bool, error) {
item, found, err := store.GetByKey(clusterName, key)
if err != nil || !found {
return found, err
}
runtimeObj := item.(runtime.Object)
lastError = checkFunction(runtimeObj)
glog.V(2).Infof("Check function failed for %s %v %v", key, runtimeObj, lastError)
return lastError == nil, nil
})
return err
}
示例6: WaitForSecretStoreUpdate
// Wait till the store is updated with latest secret.
func WaitForSecretStoreUpdate(store util.FederatedReadOnlyStore, clusterName, key string, desiredSecret *apiv1.Secret, timeout time.Duration) error {
retryInterval := 200 * time.Millisecond
err := wait.PollImmediate(retryInterval, timeout, func() (bool, error) {
obj, found, err := store.GetByKey(clusterName, key)
if !found || err != nil {
glog.Infof("%s is not in the store", key)
return false, err
}
equal := secretsEqual(*obj.(*apiv1.Secret), *desiredSecret)
if !equal {
glog.Infof("wrong content in the store expected:\n%v\nactual:\n%v\n", *desiredSecret, *obj.(*apiv1.Secret))
}
return equal, err
})
return err
}