diff --git a/fluent-plugin-enhance-k8s-metadata/lib/sumologic/kubernetes/service_monitor.rb b/fluent-plugin-enhance-k8s-metadata/lib/sumologic/kubernetes/service_monitor.rb index 9f628eca..5a683b00 100644 --- a/fluent-plugin-enhance-k8s-metadata/lib/sumologic/kubernetes/service_monitor.rb +++ b/fluent-plugin-enhance-k8s-metadata/lib/sumologic/kubernetes/service_monitor.rb @@ -45,7 +45,7 @@ def get_current_service_snapshot_resource_version result['items'].each do |endpoint| service = endpoint['metadata']['name'] - get_pods_for_service(endpoint).each {|pod| new_snapshot_pods_to_services[pod] << service} + get_pods_for_service(endpoint).each {|pod| new_snapshot_pods_to_services[pod] << service unless new_snapshot_pods_to_services[pod].include? service} end log.debug "Reinitializing @pods_to_services to #{new_snapshot_pods_to_services}"