mirror of
https://github.com/alibaba/higress.git
synced 2026-02-06 23:21:08 +08:00
fix mcp service port protocol name (#1383)
This commit is contained in:
@@ -133,6 +133,7 @@ var domainRegex = regexp.MustCompile(`^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-
|
||||
|
||||
func (w *watcher) generateServiceEntry(host string) *v1alpha3.ServiceEntry {
|
||||
endpoints := make([]*v1alpha3.WorkloadEntry, 0)
|
||||
protocol := string(common.ParseProtocol(w.Protocol))
|
||||
for _, ep := range strings.Split(w.Domain, common.CommaSeparator) {
|
||||
var endpoint *v1alpha3.WorkloadEntry
|
||||
if w.Type == string(registry.Static) {
|
||||
@@ -152,7 +153,7 @@ func (w *watcher) generateServiceEntry(host string) *v1alpha3.ServiceEntry {
|
||||
}
|
||||
endpoint = &v1alpha3.WorkloadEntry{
|
||||
Address: pair[0],
|
||||
Ports: map[string]uint32{w.Protocol: uint32(port)},
|
||||
Ports: map[string]uint32{protocol: uint32(port)},
|
||||
}
|
||||
} else if w.Type == string(registry.DNS) {
|
||||
if !domainRegex.MatchString(ep) {
|
||||
@@ -175,8 +176,8 @@ func (w *watcher) generateServiceEntry(host string) *v1alpha3.ServiceEntry {
|
||||
var ports []*v1alpha3.ServicePort
|
||||
ports = append(ports, &v1alpha3.ServicePort{
|
||||
Number: w.Port,
|
||||
Name: w.Protocol,
|
||||
Protocol: string(common.ParseProtocol(w.Protocol)),
|
||||
Name: protocol,
|
||||
Protocol: protocol,
|
||||
})
|
||||
se := &v1alpha3.ServiceEntry{
|
||||
Hosts: []string{host},
|
||||
|
||||
Reference in New Issue
Block a user