Skip to content

Commit

Permalink
filter_kubernetes: make pod meta fetching optional
Browse files Browse the repository at this point in the history
now that you can fetch namespace labels/annotations OR
pod labels/annotations, do not attempt to fetch pod
labels/annotations if neither of them are requested via config

re-pushing via force to kick of PR checks.

Signed-off-by: ryanohnemus <[email protected]>
  • Loading branch information
ryanohnemus committed Jan 20, 2024
1 parent d86aab7 commit bed4933
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugins/filter_kubernetes/kube_meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -2046,16 +2046,18 @@ int flb_kube_meta_get(struct flb_kube *ctx,
)
{
int ret_namespace_meta = -1;
int ret_pod_meta;
int ret_pod_meta = -1;

if(ctx->namespace_labels == FLB_TRUE || ctx->namespace_annotations == FLB_TRUE) {
ret_namespace_meta = flb_kube_namespace_meta_get(ctx, tag, tag_len, data,
data_size, namespace_out_buf, namespace_out_size, namespace_meta);
}

ret_pod_meta = flb_kube_pod_meta_get(ctx, tag, tag_len, data, data_size,
out_buf, out_size, meta, props);

if(ctx->labels == FLB_TRUE || ctx->annotations == FLB_TRUE) {
ret_pod_meta = flb_kube_pod_meta_get(ctx, tag, tag_len, data, data_size,
out_buf, out_size, meta, props);
}

// If we get metadata from either namespace or pod info, return success
if( ret_pod_meta == 0 || ret_namespace_meta == 0) {
return 0;
Expand Down

0 comments on commit bed4933

Please sign in to comment.