mirror of
https://github.com/alibaba/higress.git
synced 2026-05-29 23:27:28 +08:00
get upstream serviceSource from RouteCluster information and update docs (#337)
This commit is contained in:
@@ -17,6 +17,8 @@ package wrapper
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm"
|
||||
)
|
||||
|
||||
type Cluster interface {
|
||||
@@ -24,6 +26,25 @@ type Cluster interface {
|
||||
HostName() string
|
||||
}
|
||||
|
||||
type RouteCluster struct {
|
||||
Host string
|
||||
}
|
||||
|
||||
func (c RouteCluster) ClusterName() string {
|
||||
routeName, err := proxywasm.GetProperty([]string{"cluster_name"})
|
||||
if err != nil {
|
||||
proxywasm.LogErrorf("get route cluster failed, err:%v", err)
|
||||
}
|
||||
return string(routeName)
|
||||
}
|
||||
|
||||
func (c RouteCluster) HostName() string {
|
||||
if c.Host != "" {
|
||||
return c.Host
|
||||
}
|
||||
return GetRequestHost()
|
||||
}
|
||||
|
||||
type K8sCluster struct {
|
||||
ServiceName string
|
||||
Namespace string
|
||||
|
||||
Reference in New Issue
Block a user