generated from linz/template-javascript-hello-world
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#### Motivation Inside kubernetes dns resolution uses `ndots: 5` this means any dns requests that has less than 5 dots will go through all the search domains before looking up the actual domain. AWS s3 has 4 dots. We are seeing 10-20 DNS requests per s3 DNS request due to the number of search domains as well as IPV6 requests. #### Modification Any DNS requests to S3 are modified to have a trailing "." to force the DNS lookup to be fully qualified. #### Checklist _If not applicable, provide explanation of why._ - [x] Tests updated - [ ] Docs updated - [x] Issue linked in Title
- Loading branch information
Showing
2 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import assert from 'node:assert'; | ||
import { describe, it } from 'node:test'; | ||
|
||
import { FinalizeHandler, MetadataBearer } from '@smithy/types'; | ||
|
||
import { fqdn } from '../fs.register.js'; | ||
|
||
describe('fqdnMiddleware', () => { | ||
const fakeNext: FinalizeHandler<object, MetadataBearer> = () => { | ||
return Promise.resolve({ output: { $metadata: {} }, response: {} }); | ||
}; | ||
const fakeRequest = { input: {}, request: { hostname: 'nz-imagery.s3.ap-southeast-2.amazonaws.com' } }; | ||
|
||
it('should add FQDN to s3 requests', () => { | ||
fakeRequest.request.hostname = 'nz-imagery.s3.ap-southeast-2.amazonaws.com'; | ||
fqdn(fakeNext, {})(fakeRequest); | ||
assert.equal(fakeRequest.request.hostname, 'nz-imagery.s3.ap-southeast-2.amazonaws.com.'); | ||
}); | ||
|
||
it('should not add for other services', () => { | ||
fakeRequest.request.hostname = 'logs.ap-southeast-2.amazonaws.com'; | ||
fqdn(fakeNext, {})(fakeRequest); | ||
assert.equal(fakeRequest.request.hostname, 'logs.ap-southeast-2.amazonaws.com'); | ||
}); | ||
|
||
it('should not add for other regions', () => { | ||
fakeRequest.request.hostname = 'nz-imagery.s3.us-east-1.amazonaws.com'; | ||
fqdn(fakeNext, {})(fakeRequest); | ||
assert.equal(fakeRequest.request.hostname, 'nz-imagery.s3.us-east-1.amazonaws.com'); | ||
}); | ||
|
||
it('should not add for unknown hosts', () => { | ||
fakeRequest.request.hostname = 'google.com'; | ||
fqdn(fakeNext, {})(fakeRequest); | ||
assert.equal(fakeRequest.request.hostname, 'google.com'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters