Handle vendor change in k8s.io/apimachinery/pkg/util/clock

clock.Clock used to have Tick() method, but is now replaced with
NewTicker() method to prevent leaking. Changed NPD code to adapt to it.

See https://github.com/kubernetes/apimachinery/commit/10ebc22e for more
detail.
This commit is contained in:
Xuewei Zhang
2019-09-13 17:41:38 -07:00
parent 3fc6c7f306
commit e1939ebc03

View File

@@ -110,10 +110,11 @@ func (c *conditionManager) GetConditions() []types.Condition {
}
func (c *conditionManager) syncLoop() {
updateCh := c.clock.Tick(updatePeriod)
ticker := c.clock.NewTicker(updatePeriod)
defer ticker.Stop()
for {
select {
case <-updateCh:
case <-ticker.C():
if c.needUpdates() || c.needResync() || c.needHeartbeat() {
c.sync()
}