Skip to content

Commit

Permalink
aws: make sure to set io timeouts for ec2 provider
Browse files Browse the repository at this point in the history
Signed-off-by: James M Leddy <[email protected]>
  • Loading branch information
jmleddy committed Dec 5, 2024
1 parent 3e96ec5 commit ffdff27
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/aws/flb_aws_credentials_ec2.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,17 @@ void upstream_set_fn_ec2(struct flb_aws_provider *provider,
flb_debug("[aws_credentials] upstream_set called on the EC2 provider");
/* Make sure TLS is set to false before setting upstream, then reset it */
ins->use_tls = FLB_FALSE;

/* IMDSv2 token request will timeout if hops = 1 and running within container */
ins->io_timeout = FLB_AWS_IMDS_TIMEOUT;
ins->keepalive = FLB_FALSE; /* On timeout, the connection is broken */

flb_output_upstream_set(implementation->client->upstream, ins);

/* Reset */
ins->keepalive = FLB_TRUE;
ins->io_timeout = 0;

ins->use_tls = FLB_TRUE;
}

Expand Down

0 comments on commit ffdff27

Please sign in to comment.