Skip to content

Commit

Permalink
filter_kubernetes: add namespace_metadata_only option to (#8695)
Browse files Browse the repository at this point in the history
fix regression in 3.0 from #8279

Signed-off-by: ryanohnemus <[email protected]>
  • Loading branch information
ryanohnemus authored Apr 11, 2024
1 parent dacaafb commit 1233c16
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions plugins/filter_kubernetes/kube_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct flb_kube {
int annotations;
int namespace_labels;
int namespace_annotations;
int namespace_metadata_only;
int dummy_meta;
int tls_debug;
int tls_verify;
Expand Down
2 changes: 1 addition & 1 deletion plugins/filter_kubernetes/kube_meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -2053,7 +2053,7 @@ int flb_kube_meta_get(struct flb_kube *ctx,
data_size, namespace_out_buf, namespace_out_size, namespace_meta);
}

if(ctx->labels == FLB_TRUE || ctx->annotations == FLB_TRUE) {
if(ctx->namespace_metadata_only == FLB_FALSE) {
ret_pod_meta = flb_kube_pod_meta_get(ctx, tag, tag_len, data, data_size,
out_buf, out_size, meta, props);
}
Expand Down
6 changes: 6 additions & 0 deletions plugins/filter_kubernetes/kubernetes.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,12 @@ static struct flb_config_map config_map[] = {
0, FLB_TRUE, offsetof(struct flb_kube, namespace_annotations),
"include Kubernetes namespace annotations on every record"
},
/* Ignore pod metadata entirely, useful for fetching only namespace meta */
{
FLB_CONFIG_MAP_BOOL, "namespace_metadata_only", "false",
0, FLB_TRUE, offsetof(struct flb_kube, namespace_metadata_only),
"ignore pod metadata entirely and only fetch namespace metadata"
},

/*
* The Application may 'propose' special configuration keys
Expand Down

0 comments on commit 1233c16

Please sign in to comment.