Skip to content

Commit

Permalink
fix busy loop in node config controller (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
neoaggelos authored Apr 16, 2024
1 parent 39586c6 commit 2e258c2
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/k8s/pkg/utils/k8s/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ func (c *Client) WatchConfigMap(ctx context.Context, namespace string, name stri
select {
case <-ctx.Done():
return nil
case evt := <-w.ResultChan():
if evt.Object != nil {
configMap, ok := evt.Object.(*v1.ConfigMap)
if !ok {
return fmt.Errorf("expected a ConfigMap but received %#v", evt.Object)
}
case evt, ok := <-w.ResultChan():
if !ok {
return fmt.Errorf("watch closed")
}
configMap, ok := evt.Object.(*v1.ConfigMap)
if !ok {
return fmt.Errorf("expected a ConfigMap but received %#v", evt.Object)
}

if err := reconcile(configMap); err != nil {
log.Println(fmt.Errorf("failed to reconcile configmap, namespace: %s name: %s: %w", namespace, name, err))
}
if err := reconcile(configMap); err != nil {
log.Println(fmt.Errorf("failed to reconcile configmap, namespace: %s name: %s: %w", namespace, name, err))
}
}
}
Expand Down

0 comments on commit 2e258c2

Please sign in to comment.