Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws: make sure to set io timeouts for ec2 provider #9693

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 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,19 @@ 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->net_setup.connect_timeout = FLB_AWS_IMDS_TIMEOUT;
ins->net_setup.io_timeout = FLB_AWS_IMDS_TIMEOUT;
ins->net_setup.keepalive = FLB_FALSE; /* On timeout, the connection is broken */

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

/* Reset */
ins->net_setup.keepalive = FLB_TRUE;
ins->net_setup.io_timeout = 0;
ins->net_setup.connect_timeout = 10;

ins->use_tls = FLB_TRUE;
}

Expand Down
Loading