@@ -21,6 +21,7 @@ import (
2121
2222 "emperror.dev/errors"
2323 "github.com/cisco-open/operator-tools/pkg/reconciler"
24+ "github.com/cisco-open/operator-tools/pkg/utils"
2425 "github.com/spf13/cast"
2526 corev1 "k8s.io/api/core/v1"
2627 apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -49,9 +50,11 @@ func (r *Reconciler) appConfigSecret() (runtime.Object, reconciler.DesiredState,
4950 } else {
5051 data [AppConfigKey ] = []byte (* r .config )
5152 }
53+ meta := r .FluentdObjectMeta (AppSecretConfigName , ComponentFluentd )
54+ meta .Labels = utils .MergeLabels (meta .Labels , map [string ]string {"logging.banzaicloud.io/watch" : "enabled" })
5255
5356 return & corev1.Secret {
54- ObjectMeta : r . FluentdObjectMeta ( AppSecretConfigName , ComponentFluentd ) ,
57+ ObjectMeta : meta ,
5558 Data : data ,
5659 }, reconciler .StatePresent , nil
5760}
@@ -214,8 +217,11 @@ func (r *Reconciler) newCheckSecret(hashKey string, fluentdSpec v1beta1.FluentdS
214217 data [ConfigCheckKey ] = []byte (* r .config )
215218 }
216219 data ["fluent.conf" ] = []byte (fluentdConfigCheckTemplate )
220+ meta := r .FluentdObjectMeta (fmt .Sprintf ("fluentd-configcheck-%s" , hashKey ), ComponentConfigCheck )
221+ meta .Labels = utils .MergeLabels (meta .Labels , map [string ]string {"logging.banzaicloud.io/watch" : "enabled" })
222+
217223 return & corev1.Secret {
218- ObjectMeta : r . FluentdObjectMeta ( fmt . Sprintf ( "fluentd-configcheck-%s" , hashKey ), ComponentConfigCheck ) ,
224+ ObjectMeta : meta ,
219225 Data : data ,
220226 }, nil
221227}
@@ -229,8 +235,11 @@ func (r *Reconciler) newCheckSecretAppConfig(hashKey string, fluentdSpec v1beta1
229235 } else {
230236 data [ConfigCheckKey ] = []byte (* r .config )
231237 }
238+ meta := r .FluentdObjectMeta (fmt .Sprintf ("fluentd-configcheck-app-%s" , hashKey ), ComponentConfigCheck )
239+ meta .Labels = utils .MergeLabels (meta .Labels , map [string ]string {"logging.banzaicloud.io/watch" : "enabled" })
240+
232241 return & corev1.Secret {
233- ObjectMeta : r . FluentdObjectMeta ( fmt . Sprintf ( "fluentd-configcheck-app-%s" , hashKey ), ComponentConfigCheck ) ,
242+ ObjectMeta : meta ,
234243 Data : data ,
235244 }, nil
236245}
@@ -242,6 +251,10 @@ func (r *Reconciler) newCheckOutputSecret(hashKey string) (*corev1.Secret, error
242251 }
243252 if secret , ok := obj .(* corev1.Secret ); ok {
244253 secret .ObjectMeta = r .FluentdObjectMeta (fmt .Sprintf ("fluentd-configcheck-output-%s" , hashKey ), ComponentConfigCheck )
254+ secret .ObjectMeta .Labels = utils .MergeLabels (
255+ secret .ObjectMeta .Labels ,
256+ map [string ]string {"logging.banzaicloud.io/watch" : "enabled" },
257+ )
245258 return secret , nil
246259 }
247260 return nil , errors .New ("output secret is invalid, unable to create output secret for config check" )
0 commit comments