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 }