Skip to content

Commit dbe85c1

Browse files
committed
in_kubernetes_events: add support for configuring input upstream network setup
- pass the input net_setup into network_init to reuse configured options - apply flb_input_upstream_set so the upstream inherits the input context
1 parent 4f8c50b commit dbe85c1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

plugins/in_kubernetes_events/kubernetes_events_conf.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static int flb_kubernetes_event_db_close(struct flb_sqldb *db)
8989

9090
#endif
9191

92-
static int network_init(struct k8s_events *ctx, struct flb_config *config)
92+
static int network_init(struct k8s_events *ctx, struct flb_config *config, struct flb_net_setup *net)
9393
{
9494
int io_type = FLB_IO_TCP;
9595

@@ -128,6 +128,13 @@ static int network_init(struct k8s_events *ctx, struct flb_config *config)
128128
return -1;
129129
}
130130

131+
if (flb_input_upstream_set(ctx->upstream, ctx->ins) != 0) {
132+
flb_plg_error(ctx->ins, "network upstream setup failed");
133+
flb_upstream_destroy(ctx->upstream);
134+
ctx->upstream = NULL;
135+
return -1;
136+
}
137+
131138
return 0;
132139
}
133140

@@ -218,7 +225,7 @@ struct k8s_events *k8s_events_conf_create(struct flb_input_instance *ins)
218225
flb_plg_info(ctx->ins, "API server: %s", ctx->kube_url);
219226

220227
/* network setup */
221-
ret = network_init(ctx, ins->config);
228+
ret = network_init(ctx, ins->config, &ins->net_setup);
222229
if (ret == -1) {
223230
k8s_events_conf_destroy(ctx);
224231
return NULL;

0 commit comments

Comments
 (0)