Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #381 #402

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/fluent/plugin/kubernetes_metadata_cache_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ def get_pod_metadata(key, namespace_name, pod_name, time, batch_miss_cache) # ru
ids = { pod_id: pod_metadata['pod_id'], namespace_id: namespace_metadata['namespace_id'] }
if !ids[:pod_id].nil? && !ids[:namespace_id].nil?
# pod found and namespace found
metadata = pod_metadata
metadata.merge!(namespace_metadata)
metadata = pod_metadata.merge(namespace_metadata)
else
if ids[:pod_id].nil? && !ids[:namespace_id].nil? # rubocop:disable Style/IfInsideElse
# pod not found, but namespace found
Expand All @@ -55,7 +54,7 @@ def get_pod_metadata(key, namespace_name, pod_name, time, batch_miss_cache) # ru
{ 'pod_id' => ids[:pod_id] }
end
end
metadata.merge!(namespace_metadata)
metadata = metadata.merge(namespace_metadata)
else
if !ids[:pod_id].nil? && ids[:namespace_id].nil? # rubocop:disable Metrics/BlockNesting
# pod found, but namespace NOT found
Expand Down Expand Up @@ -94,7 +93,7 @@ def get_pod_metadata(key, namespace_name, pod_name, time, batch_miss_cache) # ru
end
m.nil? || m.empty? ? { 'namespace_id' => ids[:namespace_id] } : m
end
metadata.merge!(namespace_metadata)
metadata = metadata.merge(namespace_metadata)
end

# remove namespace info that is only used for comparison
Expand Down
Loading