本文整理匯總了Golang中k8s/io/kubernetes/pkg/client/unversioned.Client.ResourceQuotas方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.ResourceQuotas方法的具體用法?Golang Client.ResourceQuotas怎麽用?Golang Client.ResourceQuotas使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/kubernetes/pkg/client/unversioned.Client
的用法示例。
在下文中一共展示了Client.ResourceQuotas方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: waitForResourceQuota
// wait for resource quota status to show the expected used resources value
func waitForResourceQuota(c *client.Client, ns, quotaName string, used api.ResourceList) error {
return wait.Poll(framework.Poll, resourceQuotaTimeout, func() (bool, error) {
resourceQuota, err := c.ResourceQuotas(ns).Get(quotaName)
if err != nil {
return false, err
}
// used may not yet be calculated
if resourceQuota.Status.Used == nil {
return false, nil
}
// verify that the quota shows the expected used resource values
for k, v := range used {
if actualValue, found := resourceQuota.Status.Used[k]; !found || (actualValue.Cmp(v) != 0) {
framework.Logf("resource %s, expected %s, actual %s", k, v.String(), actualValue.String())
return false, nil
}
}
return true, nil
})
}
示例2: deleteResourceQuota
// deleteResourceQuota with the specified name
func deleteResourceQuota(c *client.Client, namespace, name string) error {
return c.ResourceQuotas(namespace).Delete(name)
}
示例3: createResourceQuota
// createResourceQuota in the specified namespace
func createResourceQuota(c *client.Client, namespace string, resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error) {
return c.ResourceQuotas(namespace).Create(resourceQuota)
}