diff --git a/api/v1alpha1/clustertemplateinstance_utils.go b/api/v1alpha1/clustertemplateinstance_utils.go index 7f3d6dc..31a01bc 100644 --- a/api/v1alpha1/clustertemplateinstance_utils.go +++ b/api/v1alpha1/clustertemplateinstance_utils.go @@ -237,6 +237,9 @@ func (i *ClusterTemplateInstance) labelDestionationNamespace(ctx context.Context } if l, lOk := ns.Labels["argocd.argoproj.io/managed-by"]; !lOk || l != argoCDNamespace { + if ns.Labels == nil { + ns.Labels = map[string]string{} + } ns.Labels["argocd.argoproj.io/managed-by"] = argoCDNamespace if err := k8sClient.Update(ctx, ns); err != nil { return err