Skip to content

Commit

Permalink
There is no --since-time
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke committed Aug 28, 2023
1 parent ae0b75f commit d42a041
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/node/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ func WaitK0sDynamicConfigReady(ctx context.Context, h *cluster.Host) error {
// WaitEventsScheduled blocks until the node has started scheduling pods or context is cancelled
func WaitEventsScheduled(ctx context.Context, h *cluster.Host) error {
since := time.Now()
sinceStr := since.Format(time.RFC3339)

return retry(ctx, func(_ context.Context) error {
output, err := h.ExecOutput(h.Configurer.KubectlCmdf(h, h.K0sDataDir(), `-n kube-system get events --field-selector reason=Scheduled --since-time="%s"`, sinceStr), exec.Sudo(h))
output, err := h.ExecOutput(h.Configurer.KubectlCmdf(h, h.K0sDataDir(), "-n kube-system get events --field-selector reason=Scheduled"), exec.Sudo(h))
if err != nil {
return fmt.Errorf("failed to get node events: %w", err)
}
Expand All @@ -127,9 +126,10 @@ func WaitEventsScheduled(ctx context.Context, h *cluster.Host) error {
continue
}
if e.EventTime.Before(since) {
log.Debugf("%s: skipping event %s at %s - too old", h, e.Reason, e.EventTime)
log.Debugf("%s: skipping event: %s is too old", h, e.EventTime)
continue
}
log.Debugf("%s: found a 'Scheduled' event occuring after api start-up", h)
return nil
}
return fmt.Errorf("node not scheduled")
Expand Down

0 comments on commit d42a041

Please sign in to comment.