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

feat(kuma-cp) domain name support in dataplane.networking.address #965

Merged
merged 11 commits into from
Aug 19, 2020

Conversation

lobkovilya
Copy link
Contributor

@lobkovilya lobkovilya commented Aug 11, 2020

Summary

On Universal deployment, a user has to manually set networking.address for Dataplane resource. It might be inconvenient since the address could be changed eventually. This PR gives an ability to set a domain name as a networking.address. The name will be resolved every time before xds-resource generation. By default names are cached with TTL equals to 10s.

Full changelog

  • domain name in dataplane.networking.address
  • an ability to set dataplane-token via environment variable or command line argument.

Issues resolved

Fix #755 #971

Documentation

@lobkovilya lobkovilya requested a review from a team as a code owner August 11, 2020 09:22
Copy link
Contributor

@nickolaev nickolaev left a comment

Choose a reason for hiding this comment

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

Looks good with a couple of nits from me.

pkg/config/app/kuma-dp/config.go Outdated Show resolved Hide resolved
pkg/core/dns/cache.go Outdated Show resolved Hide resolved
pkg/xds/topology/dataplanes.go Outdated Show resolved Hide resolved
app/kuma-dp/cmd/run.go Outdated Show resolved Hide resolved
pkg/core/dns/cache.go Outdated Show resolved Hide resolved
pkg/core/dns/cache.go Outdated Show resolved Hide resolved
pkg/core/dns/cache_test.go Outdated Show resolved Hide resolved
@@ -15,6 +18,7 @@ var (
NewLogger = kuma_log.NewLogger
SetLogger = kube_log.SetLogger
Now = time.Now
LookupIP = dns.MakeCaching(net.LookupIP, 10*time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

please parametrize this 10 seconds. I have a feeling this will be useful value to change while debugging stuff

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you mean to put this value into Config? Then I probably have to move LookupIP initialization into RuntimeBuilder or something like that, is it okay?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added new parameter - Config.GeneralConfig.DNSCacheTTL, not sure about place for this parameter in the config

pkg/xds/topology/dataplanes.go Outdated Show resolved Hide resolved
if len(ips) == 0 {
return errors.Errorf("can't resolve address %v", dataplane.Spec.Networking.Address)
}
dataplane.Spec.Networking.Address = ips[0].String()
Copy link
Contributor

Choose a reason for hiding this comment

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

please double-check out all usages of Address. I see GetIP() method on Dataplane and we use in Kuma Prometheus SD. What will happen there if we suddenly return hostname, and not IP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I resolve the address as soon as dataplanes are fetched. Only one place has an unresolved host - MADS, but according to the docs https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config, it can accept host:port format

pkg/core/dns/cache.go Outdated Show resolved Hide resolved
pkg/core/dns/cache.go Outdated Show resolved Hide resolved
Signed-off-by: Ilya Lobkov <[email protected]>
Signed-off-by: Ilya Lobkov <[email protected]>
Signed-off-by: Ilya Lobkov <[email protected]>
Signed-off-by: Ilya Lobkov <[email protected]>
Copy link
Contributor

@jakubdyszkiewicz jakubdyszkiewicz left a comment

Choose a reason for hiding this comment

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

Sorry, one more important thing about resolving. Other than this it looks pretty legit 👍

pkg/xds/topology/dataplanes.go Outdated Show resolved Hide resolved
pkg/xds/topology/dataplanes.go Outdated Show resolved Hide resolved
pkg/xds/server/components.go Outdated Show resolved Hide resolved
pkg/xds/topology/dataplanes.go Outdated Show resolved Hide resolved
pkg/config/app/kuma-cp/config.go Show resolved Hide resolved
Signed-off-by: Ilya Lobkov <[email protected]>
Signed-off-by: Ilya Lobkov <[email protected]>
Signed-off-by: Ilya Lobkov <[email protected]>
Signed-off-by: Ilya Lobkov <[email protected]>
@lobkovilya lobkovilya merged commit 19421f8 into master Aug 19, 2020
@lobkovilya lobkovilya deleted the feat/dp-domain-name branch August 19, 2020 15:47
@subnetmarco
Copy link
Contributor

Do we need to update the docs as a result of this PR?

@lobkovilya
Copy link
Contributor Author

Yes, right, I will update it

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.

Support dns names or ip address for "address" field in data plane configuration
4 participants