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

fix(kuma-cp) allocate a new VIP for ExternalService host #2302

Merged
merged 2 commits into from
Jul 8, 2021

Conversation

lobkovilya
Copy link
Contributor

Summary

Kuma allocates VIP on every new service. Every ExternalService represents a single Kuma service. If we have 2 ExternalServices:

type: ExternalService
mesh: default
name: external-service-1
tags:
  kuma.io/service: external-service-1
networking:
  address: host.com:80
---
type: ExternalService
mesh: default
name: external-service-2
tags:
  kuma.io/service: external-service-2
networking:
  address: host.com:81

Then 2 VIPs will be allocated: external-service-1: 240.0.0.1, external-service-2: 240.0.0.2.
It will work fine while we consume services using .mesh domain. But if we'd like to consume services using host.com. Built-in DNS feature will resolve host.com either to 240.0.0.1 or 240.0.0.2, so one of the services won't work properly.

Current PR introduces a new type of entry - host entry. Alongside service entries, Kuma will allocate host.com: 240.0.0.3.

Full changelog

  • [Implement ...]
  • [Fix ...]

Issues resolved

Fix #2176

Documentation

Testing

  • Unit tests
  • E2E tests
  • Manual testing on Universal
  • Manual testing on Kubernetes

Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
@lobkovilya lobkovilya requested a review from a team as a code owner July 5, 2021 15:00
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.

some minors, looks good

externalServices []*core_mesh.ExternalServiceResource,
) []*mesh_proto.Dataplane_Networking_Outbound {
type vipEntry struct {
ip string
port uint32
host bool
Copy link
Contributor

Choose a reason for hiding this comment

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

how about EntryType?

if err := json.Unmarshal([]byte(config), &v); err == nil {
return v, nil
}
backwardCompatible := map[string]string{}
Copy link
Contributor

Choose a reason for hiding this comment

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

drop the "canonical" backwards compatibility comment.

@@ -109,6 +110,48 @@ networking:
Expect(stdout).ToNot(ContainSubstring("HTTPS"))
})

It("should route to external-service", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

there is already such It in this file. Can you add some comments on what is going on in this test?

// given two external services that point to the same hostname but different port

// when access first external service with .mesh
// then

/// when access first external service using hostname
// then

// when access second external service name using .mesh
// then

/// when access second external service using the same hostname as first but with different port
// then

something like that

Signed-off-by: lobkovilya <ilya.lobkov@konghq.com>
@codecov-commenter
Copy link

Codecov Report

Merging #2302 (c87e631) into master (6dd1ae1) will increase coverage by 0.28%.
The diff coverage is 50.37%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2302      +/-   ##
==========================================
+ Coverage   51.65%   51.94%   +0.28%     
==========================================
  Files         910      914       +4     
  Lines       41098    41200     +102     
==========================================
+ Hits        21229    21401     +172     
+ Misses      17833    17733     -100     
- Partials     2036     2066      +30     
Impacted Files Coverage Δ
...e2e/externalservices/externalservices_universal.go 0.00% <0.00%> (ø)
...ramework/deployments/externalservice/deployment.go 0.00% <0.00%> (ø)
...ramework/deployments/externalservice/kubernetes.go 0.00% <ø> (ø)
...framework/deployments/externalservice/universal.go 0.00% <0.00%> (ø)
test/framework/interface.go 0.00% <ø> (ø)
test/framework/k8s_cluster.go 0.00% <0.00%> (ø)
test/framework/k8s_clusters.go 0.00% <0.00%> (ø)
test/framework/universal_cluster.go 0.00% <0.00%> (ø)
test/framework/universal_clusters.go 0.00% <0.00%> (ø)
pkg/xds/generator/dns_generator.go 79.41% <54.54%> (-7.26%) ⬇️
... and 31 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6dd1ae1...c87e631. Read the comment docs.

@lobkovilya lobkovilya merged commit 90b1c93 into master Jul 8, 2021
@lobkovilya lobkovilya deleted the fix/es-dns-collision branch July 8, 2021 08:47
mergify bot pushed a commit that referenced this pull request Jul 8, 2021
bartsmykla pushed a commit that referenced this pull request Jul 9, 2021
(cherry picked from commit 90b1c93)

Co-authored-by: Ilya Lobkov <ilya.lobkov@konghq.com>
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.

Builtin DNS clash with multiple external services defined with the same host and different ports
3 participants