Skip to content

Commit

Permalink
feat: avoid use empty configmaps (vmware#396)
Browse files Browse the repository at this point in the history
Avoid use empty configmaps in fluentd

Signed-off-by: jcriadomarco <jcriadomarco@vmware.com>
  • Loading branch information
javiercri authored and lynn-e committed Jun 27, 2023
1 parent 0976eb8 commit 835624a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion config-reloader/datasource/kube_informer.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ func (d *kubeInformerConnection) GetNamespaces(ctx context.Context) ([]*Namespac
if err != nil {
return nil, err
}

if configdata == "" {
logrus.Infof("Skipping namespace: %v because is empty", ns)
continue
}
fragment, err := fluentd.ParseString(configdata)
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions config-reloader/datasource/kubedatasource/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func (c *ConfigMapDS) readConfig(configmaps []*core.ConfigMap) string {
logrus.Debugf("Loaded config data from config map: %s/%s", cm.ObjectMeta.Namespace, cm.ObjectMeta.Name)
} else {
logrus.Warnf("cannot find entry %s in configmap %s/%s", entryName, cm.ObjectMeta.Namespace, cm.ObjectMeta.Name)
return ""
}
}
return strings.Join(configdata, "\n")
Expand Down

0 comments on commit 835624a

Please sign in to comment.