本文整理匯總了Golang中k8s/io/kubernetes/pkg/apis/apps.PetSet.Status方法的典型用法代碼示例。如果您正苦於以下問題:Golang PetSet.Status方法的具體用法?Golang PetSet.Status怎麽用?Golang PetSet.Status使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/kubernetes/pkg/apis/apps.PetSet
的用法示例。
在下文中一共展示了PetSet.Status方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: updatePetCount
// updatePetCount attempts to update the Status.Replicas of the given PetSet, with a single GET/PUT retry.
func updatePetCount(psClient appsclientset.PetSetsGetter, ps apps.PetSet, numPets int) (updateErr error) {
if ps.Status.Replicas == numPets || psClient == nil {
return nil
}
var getErr error
for i, ps := 0, &ps; ; i++ {
glog.V(4).Infof(fmt.Sprintf("Updating replica count for PetSet: %s/%s, ", ps.Namespace, ps.Name) +
fmt.Sprintf("replicas %d->%d (need %d), ", ps.Status.Replicas, numPets, ps.Spec.Replicas))
ps.Status = apps.PetSetStatus{Replicas: numPets}
_, updateErr = psClient.PetSets(ps.Namespace).UpdateStatus(ps)
if updateErr == nil || i >= statusUpdateRetries {
return updateErr
}
if ps, getErr = psClient.PetSets(ps.Namespace).Get(ps.Name); getErr != nil {
return getErr
}
}
}