From a9d3c0043edda9a190c11ae0f938bceb3f0c39a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20=C3=81lvarez?= Date: Mon, 27 May 2024 08:50:01 +0200 Subject: [PATCH] Fix fleet example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Iván Álvarez --- examples/fleet/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/fleet/main.go b/examples/fleet/main.go index 40d8a2debe..ee107ddf01 100644 --- a/examples/fleet/main.go +++ b/examples/fleet/main.go @@ -97,7 +97,7 @@ func main() { if err := client.Get(ctx, req.NamespacedName, pod); err != nil { return reconcile.Result{}, err } - log.Info("Reconciling pod", "ns", pod.GetNamespace(), "name", pod.Name, "uuid", pod.UID) + log.Info("Reconciling pod", "cluster", cl.Name(), "ns", pod.GetNamespace(), "name", pod.Name, "uuid", pod.UID) // Print any annotations that start with fleet. for k, v := range pod.Labels { @@ -171,6 +171,7 @@ func (k *KindClusterProvider) Run(ctx context.Context, mgr manager.Manager) erro } k.lock.RLock() if _, ok := k.clusters[clusterName]; ok { + k.lock.RUnlock() continue } k.lock.RUnlock() @@ -247,6 +248,8 @@ func (k *KindClusterProvider) Run(ctx context.Context, mgr manager.Manager) erro delete(k.clusters, name) delete(k.cancelFns, name) k.lock.Unlock() + + k.log.Info("Cluster removed", "cluster", name) } }