From b5676d3353b13747b7601fd775b1ac42d651a706 Mon Sep 17 00:00:00 2001 From: mgianluc Date: Mon, 28 Oct 2024 12:30:54 +0100 Subject: [PATCH] (feat) when updating Secret with kubeconfig add entry Instead of resetting the Data section, just add/update the entry with kubeconfig. --- lib/clusterproxy/clusterproxy.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/clusterproxy/clusterproxy.go b/lib/clusterproxy/clusterproxy.go index 2d86a25..05cc7d4 100644 --- a/lib/clusterproxy/clusterproxy.go +++ b/lib/clusterproxy/clusterproxy.go @@ -241,9 +241,11 @@ func UpdateSveltosSecretData(ctx context.Context, logger logr.Logger, c client.C clusterNamespace, secretName)) } - secret.Data = map[string][]byte{ - kubeconfigKey: []byte(kubeconfig), + if secret.Data == nil { + secret.Data = map[string][]byte{} } + secret.Data[kubeconfigKey] = []byte(kubeconfig) + return c.Update(ctx, secret) }