Skip to content

Instantly share code, notes, and snippets.

@openstacker
Created May 5, 2019 10:34
Show Gist options
  • Save openstacker/e3504f43a98f4be87af8a45864020534 to your computer and use it in GitHub Desktop.
Save openstacker/e3504f43a98f4be87af8a45864020534 to your computer and use it in GitHub Desktop.
for _, t := range pc {
for _, c := range n.Status.Conditions {
log.Info("Supplied Condition", zap.String("t", string(t.Type)), zap.String("c", string(t.Status)), zap.String("c", string(t.MinimumWaitingTime)))
log.Info("Node Condition", zap.String("c", string(c.Type)), zap.String("s", string(c.Status)), zap.String("t", c.LastTransitionTime.String()))
log.Info("Node", zap.String("node", n.Name))
current := time.Now()
lttDuration := c.LastTransitionTime.Add(time.Duration(t.MinimumWaitingTime) * time.Minute)
log.Info("time", zap.String("current", current.String()), zap.String("ltt", lttDuration.String()))
if c.Type == t.Type && c.Status == t.Status && lttDuration.Before(current) {
log.Info("****selected node****", zap.String("node", n.Name))
return true
}
}
}
return false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment