本文整理汇总了Golang中k8s/io/kubernetes/pkg/client/cache.Reflector.LastSyncResourceVersion方法的典型用法代码示例。如果您正苦于以下问题:Golang Reflector.LastSyncResourceVersion方法的具体用法?Golang Reflector.LastSyncResourceVersion怎么用?Golang Reflector.LastSyncResourceVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类k8s/io/kubernetes/pkg/client/cache.Reflector
的用法示例。
在下文中一共展示了Reflector.LastSyncResourceVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: sendWatchReadiness
// Ensures given event queue is ready for watching new changes
// and unblock other end of the ready channel
func sendWatchReadiness(reflector *cache.Reflector, ready chan<- bool) {
// timeout: 1min
retries := 120
retryInterval := 500 * time.Millisecond
// Try every retryInterval and bail-out if it exceeds max retries
for i := 0; i < retries; i++ {
// Reflector does list and watch of the resource
// when listing of the resource is done, resourceVersion will be populated
// and the event queue will be ready to watch any new changes
version := reflector.LastSyncResourceVersion()
if len(version) > 0 {
ready <- true
return
}
time.Sleep(retryInterval)
}
log.Fatalf("SDN event queue is not ready for watching new changes(timeout: 1min)")
}