From 41284ea044d8f300b1f333cdfb887169328f3471 Mon Sep 17 00:00:00 2001 From: Balint Molnar Date: Tue, 25 Jun 2019 11:45:17 +0200 Subject: [PATCH] Do not remove the generated app-config if fluentd resource updated --- pkg/resources/fluentd/appconfigmap.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/resources/fluentd/appconfigmap.go b/pkg/resources/fluentd/appconfigmap.go index adab2beab..fd096cf8b 100644 --- a/pkg/resources/fluentd/appconfigmap.go +++ b/pkg/resources/fluentd/appconfigmap.go @@ -17,15 +17,23 @@ package fluentd import ( + "context" + "github.com/banzaicloud/logging-operator/pkg/resources/templates" "github.com/banzaicloud/logging-operator/pkg/util" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" ) func (r *Reconciler) appconfigMap() runtime.Object { - return &corev1.ConfigMap{ - ObjectMeta: templates.FluentdObjectMeta(appConfigMapName, util.MergeLabels(r.Fluentd.Labels, labelSelector), r.Fluentd), - Data: map[string]string{}, + current := &corev1.ConfigMap{} + err := r.Client.Get(context.TODO(), types.NamespacedName{Namespace: r.Fluentd.Namespace, Name: appConfigMapName}, current) + if err != nil { + return &corev1.ConfigMap{ + ObjectMeta: templates.FluentdObjectMeta(appConfigMapName, util.MergeLabels(r.Fluentd.Labels, labelSelector), r.Fluentd), + Data: map[string]string{}, + } } + return current }