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

refactor (2/3): Remove responsibility for target DNS from GSLB assistant #505

Merged
merged 1 commit into from
May 31, 2021

Conversation

kuritka
Copy link
Collaborator

@kuritka kuritka commented May 27, 2021

GSLB assistant with help of OVERRIDE_WITH_FAKE_EXT_DNS decides whether to use mock DNS (localhost:7753) or calculated NSServerName (gslb-ns-uk-cloud.example.com:53).

This PR removes such functionality from gslb assistant. Depresolver getNSName returns NSName based on EdgeDNSServer.
If edgeDNSServer is localhost than nsname is localhost for any region, otherwise proper nsname is returned.
I also removed OVERRIDE_WITH_FAKE_EXT_DNS and introduced EDGE_DNS_SERVER_PORT.
Now we can request edge DNS server on any port. All current settings are backward compatible as default 53 port is used.

Because OverrideWithFakeDNS was removed I had to change Assistant interface contract and regenerate mocks, covered by tests.

Signed-off-by: kuritka [email protected]

Copy link
Member

@ytsarev ytsarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement, just added couple of comments

// assert
assert.NoError(t, err)
assert.Equal(t, config.GetClusterNSName(), edgeDNSServer)
assert.True(t, reflect.DeepEqual(config.GetExternalClusterNSNames(), map[string]string{"uk": edgeDNSServer, "eu": edgeDNSServer}))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"uk" looks unexpected. Typo?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -69,6 +69,7 @@ var predefinedConfig = depresolver.Config{
ClusterGeoTag: "us-west-1",
ExtClustersGeoTags: []string{"us-east-1"},
EdgeDNSServer: "8.8.8.8",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we make localhost here? Or use 53 and override EdgeDNSServerPort in specific tests?
Otherwise 8.8.8.8 with 7753 is actually never working combination.

Copy link
Collaborator Author

@kuritka kuritka May 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ytsarev , thx, amended!

regions:
I moved uk -> za

EdgeDNServer I put there more reasonable domain name. Tests for localhost EdgeDNSServer are already implemented: https://github.com/k8gb-io/k8gb/pull/505/files#diff-384d90ba8267cb88a0aab2845e0778c734551e380ce8040b033b006584153fdeR1418

GSLB assistant decides whether mock DNS (localhost:7753) or calculated NSServerName (gslb-ns-uk-cloud.example.com:53) will be used for DNS exchange.
OVERRIDE_WITH_FAKE_EXT_DNS decides if NSServerNAme or localhost will be used.

This PR removes such functionality from gslb assistant. Depresolver getNSName returns NSName based on EdgeDNSServer.
If edgeDNSServer is localhost than nsname is localhost for any region, otherwise proper nsname is returned.
I also removed OVERRIDE_WITH_FAKE_EXT_DNS and introduced EDGE_DNS_SERVER_PORT with default value 53.
Now we can request DNS on any port.

Signed-off-by: kuritka <[email protected]>
@kuritka kuritka force-pushed the refactor-remove-override-with-fakeDNS branch from 2a075a8 to fde7998 Compare May 31, 2021 08:40
@kuritka kuritka requested a review from ytsarev May 31, 2021 09:12
Copy link
Member

@ytsarev ytsarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool stuff, LGTM

@kuritka kuritka merged commit 932fad9 into master May 31, 2021
@kuritka kuritka deleted the refactor-remove-override-with-fakeDNS branch May 31, 2021 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants