@@ -18,6 +18,8 @@ package plugins
1818
1919import (
2020 "bytes"
21+ "text/template"
22+
2123 "github.com/Masterminds/sprig"
2224 loggingv1alpha1 "github.com/banzaicloud/logging-operator/pkg/apis/logging/v1alpha1"
2325 "github.com/banzaicloud/logging-operator/pkg/resources/templates"
@@ -26,14 +28,12 @@ import (
2628 corev1 "k8s.io/api/core/v1"
2729 "k8s.io/apimachinery/pkg/runtime"
2830 "sigs.k8s.io/controller-runtime/pkg/client"
29- "text/template"
3031)
3132
3233func generateFluentdConfig (plugin * loggingv1alpha1.Plugin , client client.Client ) (string , string ) {
3334 var finalConfig string
3435 // Generate filters
3536 for _ , filter := range plugin .Spec .Filter {
36- logrus .Info ("Applying filter" )
3737 values , err := GetDefaultValues (filter .Type )
3838 if err != nil {
3939 logrus .Infof ("Error in rendering template: %s" , err )
@@ -92,15 +92,19 @@ func renderPlugin(plugin loggingv1alpha1.FPlugin, baseMap map[string]string, nam
9292}
9393
9494func (r * Reconciler ) appConfigMap () runtime.Object {
95- name , data := generateFluentdConfig (r .Plugin , r .Client )
96- if name != "" {
97- name = name + ".conf"
95+ appConfigData := map [string ]string {}
96+ labels := map [string ]string {}
97+ for _ , plugin := range r .PluginList .Items {
98+ labels = util .MergeLabels (labels , plugin .Labels )
99+ name , data := generateFluentdConfig (& plugin , r .Client )
100+ if name != "" {
101+ name = name + ".conf"
102+ }
103+ appConfigData [name ] = data
98104 }
99105
100106 return & corev1.ConfigMap {
101- ObjectMeta : templates .PluginsObjectMeta (appConfigMapName , util .MergeLabels (r .Plugin .Labels , labelSelector ), r .Plugin ),
102- Data : map [string ]string {
103- name : data ,
104- },
107+ ObjectMeta : templates .PluginsObjectMeta (appConfigMapName , util .MergeLabels (map [string ]string {}, labelSelector ), r .Namespace ),
108+ Data : appConfigData ,
105109 }
106110}
0 commit comments