Skip to content

Commit

Permalink
Merge pull request #254 from sematext/hotfix-k8s-enrichment-dropping-…
Browse files Browse the repository at this point in the history
…logs
  • Loading branch information
Adnan Rahić authored Sep 1, 2020
2 parents e76ffe4 + 97e2fb6 commit bef4577
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/plugins/output-filter/kubernetes-enrichment.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ function kubernetesOutputFilter (
) {
// we use the config object to track state of each plugin instance
if (!config.client) {
initKubernetesClient(config)
initKubernetesClient(context, config, eventEmitter, data, callback)
} else {
enrichLogs(context, config, eventEmitter, data, callback)
}
}

function initKubernetesClient (config) {
function initKubernetesClient (context, config, eventEmitter, data, callback) {
// do we run in k8s cluster?
config.client = client
config.getPodSpec = function (namespace, podName, cb) {
Expand All @@ -64,6 +64,8 @@ function initKubernetesClient (config) {
.pods(podName)
.get(cb)
}.bind(config)

enrichLogs(context, config, eventEmitter, data, callback)
}

const getPodSpec = async (config, namespace, podName, cb) => {
Expand Down Expand Up @@ -216,6 +218,9 @@ function processAnnotations (
checkLogsReceiverUrl(pod, data, context)
return callback(null, data)
}

// fallback to return data if no pod info found
return callback(null, data)
}

function getPodCacheKey (data) {
Expand Down

0 comments on commit bef4577

Please sign in to comment.