Skip to content

Commit

Permalink
re-create k8s client in case of failure
Browse files Browse the repository at this point in the history
  • Loading branch information
neoaggelos committed Apr 17, 2024
1 parent 710370c commit b2b9b94
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/k8s/pkg/k8sd/controllers/node_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ func (c *NodeConfigurationController) Run(ctx context.Context) {
// wait for microcluster node to be ready
c.waitReady()

client, err := c.retryNewK8sClient(ctx)
if err != nil {
log.Println(fmt.Errorf("failed to create a Kubernetes client: %w", err))
}

for {
client, err := c.retryNewK8sClient(ctx)
if err != nil {
log.Println(fmt.Errorf("failed to create a Kubernetes client: %w", err))
}

if err := client.WatchConfigMap(ctx, "kube-system", "k8sd-config", func(configMap *v1.ConfigMap) error { return c.reconcile(ctx, configMap) }); err != nil {
// This also can fail during bootstrapping/start up when api-server is not ready
// So the watch requests get connection refused replies
Expand Down

0 comments on commit b2b9b94

Please sign in to comment.