-
Notifications
You must be signed in to change notification settings - Fork 17
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: support Consul as ServiceRegistry #695
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #695 +/- ##
==========================================
+ Coverage 88.14% 88.36% +0.22%
==========================================
Files 119 119
Lines 5837 5941 +104
==========================================
+ Hits 5145 5250 +105
+ Misses 500 493 -7
- Partials 192 198 +6 ☔ View full report in Codecov by Sentry. |
7909392
to
6bc3642
Compare
feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry feat: add consul as serviceRegistry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the test is not stable? I rerun it and it fails.
|
||
service := map[string]any{ | ||
"Node": "node1", // 指定节点名称 | ||
"Address": ip, // 节点IP地址 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use English comment
|
||
serviceID := name + ip + port | ||
body := map[string]any{ | ||
"Node": "node1", // 指定节点名称 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
@@ -17,6 +17,23 @@ services: | |||
- "8849:8848" | |||
networks: | |||
service: | |||
consul: | |||
image: docker.m.daocloud.io/library/consul:1.10.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use the latest image (1.15.4)?
if err != nil { | ||
reg.logger.Errorf("failed to subscribe service, err: %v, service: %v", err, service.ServiceName) | ||
delete(serviceMap, service) | ||
delete(reg.watchingServices, service) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to delete service from reg.watchingServices if _, ok := reg.watchingServices[service]; !ok
var host string | ||
suffix := strings.Join([]string{reg.client.NameSpace, reg.client.DataCenter, reg.name, RegistryType}, ".") | ||
suffix = strings.ReplaceAll(suffix, "_", "-") | ||
if len(tag) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Join an empty string is harmless as we will remove the repeated dots below. We can remove an extra branch.
name: "test_registry", | ||
} | ||
|
||
// 测试用例 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use English
Merged. Thanks! |
ref #259