This commit is contained in:
co63oc
2024-06-26 19:47:39 +08:00
committed by GitHub
parent 4ca2d23404
commit 9c6ea109f8
7 changed files with 24 additions and 24 deletions

View File

@@ -175,7 +175,7 @@ func promptInstall(writer io.Writer, profileName string) bool {
func promptProfileName(writer io.Writer) string { func promptProfileName(writer io.Writer) string {
answer := "" answer := ""
fmt.Fprintf(writer, "\nPlease select higress install configration profile:\n") fmt.Fprintf(writer, "\nPlease select higress install configuration profile:\n")
fmt.Fprintf(writer, "\n1.Install higress to local kubernetes cluster like kind etc.\n") fmt.Fprintf(writer, "\n1.Install higress to local kubernetes cluster like kind etc.\n")
fmt.Fprintf(writer, "\n2.Install higress to kubernetes cluster\n") fmt.Fprintf(writer, "\n2.Install higress to kubernetes cluster\n")
fmt.Fprintf(writer, "\n3.Install higress to local docker environment\n") fmt.Fprintf(writer, "\n3.Install higress to local docker environment\n")

View File

@@ -918,7 +918,7 @@ func (m *IngressConfig) AddOrUpdateWasmPlugin(clusterNamespacedName util.Cluster
Labels: map[string]string{constants.AlwaysPushLabel: "true"}, Labels: map[string]string{constants.AlwaysPushLabel: "true"},
} }
for _, f := range m.wasmPluginHandlers { for _, f := range m.wasmPluginHandlers {
IngressLog.Debug("WasmPlugin triggerd update") IngressLog.Debug("WasmPlugin triggered update")
f(config.Config{Meta: metadata}, config.Config{Meta: metadata}, model.EventUpdate) f(config.Config{Meta: metadata}, config.Config{Meta: metadata}, model.EventUpdate)
} }
istioWasmPlugin, err := m.convertIstioWasmPlugin(&wasmPlugin.Spec) istioWasmPlugin, err := m.convertIstioWasmPlugin(&wasmPlugin.Spec)
@@ -960,7 +960,7 @@ func (m *IngressConfig) DeleteWasmPlugin(clusterNamespacedName util.ClusterNames
Labels: map[string]string{constants.AlwaysPushLabel: "true"}, Labels: map[string]string{constants.AlwaysPushLabel: "true"},
} }
for _, f := range m.wasmPluginHandlers { for _, f := range m.wasmPluginHandlers {
IngressLog.Debug("WasmPlugin triggerd update") IngressLog.Debug("WasmPlugin triggered update")
f(config.Config{Meta: metadata}, config.Config{Meta: metadata}, model.EventDelete) f(config.Config{Meta: metadata}, config.Config{Meta: metadata}, model.EventDelete)
} }
} }
@@ -987,7 +987,7 @@ func (m *IngressConfig) AddOrUpdateMcpBridge(clusterNamespacedName util.ClusterN
Labels: map[string]string{constants.AlwaysPushLabel: "true"}, Labels: map[string]string{constants.AlwaysPushLabel: "true"},
} }
for _, f := range m.serviceEntryHandlers { for _, f := range m.serviceEntryHandlers {
IngressLog.Debug("McpBridge triggerd serviceEntry update") IngressLog.Debug("McpBridge triggered serviceEntry update")
f(config.Config{Meta: metadata}, config.Config{Meta: metadata}, model.EventUpdate) f(config.Config{Meta: metadata}, config.Config{Meta: metadata}, model.EventUpdate)
} }
}, m.localKubeClient, m.namespace) }, m.localKubeClient, m.namespace)
@@ -1042,7 +1042,7 @@ func (m *IngressConfig) AddOrUpdateHttp2Rpc(clusterNamespacedName util.ClusterNa
} }
func (m *IngressConfig) DeleteHttp2Rpc(clusterNamespacedName util.ClusterNamespacedName) { func (m *IngressConfig) DeleteHttp2Rpc(clusterNamespacedName util.ClusterNamespacedName) {
IngressLog.Infof("Http2Rpc triggerd deleted event %s", clusterNamespacedName.Name) IngressLog.Infof("Http2Rpc triggered deleted event %s", clusterNamespacedName.Name)
if clusterNamespacedName.Namespace != m.namespace { if clusterNamespacedName.Namespace != m.namespace {
return return
} }
@@ -1054,7 +1054,7 @@ func (m *IngressConfig) DeleteHttp2Rpc(clusterNamespacedName util.ClusterNamespa
} }
m.mutex.Unlock() m.mutex.Unlock()
if hit { if hit {
IngressLog.Infof("Http2Rpc triggerd deleted event executed %s", clusterNamespacedName.Name) IngressLog.Infof("Http2Rpc triggered deleted event executed %s", clusterNamespacedName.Name)
push := func(kind config.GroupVersionKind) { push := func(kind config.GroupVersionKind) {
m.XDSUpdater.ConfigUpdate(&model.PushRequest{ m.XDSUpdater.ConfigUpdate(&model.PushRequest{
Full: true, Full: true,
@@ -1160,13 +1160,13 @@ func (m *IngressConfig) constructHttp2RpcEnvoyFilter(http2rpcConfig *annotations
IngressLog.Infof("Found http2rpc mappings %v", mappings) IngressLog.Infof("Found http2rpc mappings %v", mappings)
if _, exist := mappings[http2rpcConfig.Name]; !exist { if _, exist := mappings[http2rpcConfig.Name]; !exist {
IngressLog.Errorf("Http2RpcConfig name %s, not found Http2Rpc CRD", http2rpcConfig.Name) IngressLog.Errorf("Http2RpcConfig name %s, not found Http2Rpc CRD", http2rpcConfig.Name)
return nil, errors.New("invalid http2rpcConfig has no useable http2rpc") return nil, errors.New("invalid http2rpcConfig has no usable http2rpc")
} }
http2rpcCRD := mappings[http2rpcConfig.Name] http2rpcCRD := mappings[http2rpcConfig.Name]
if http2rpcCRD.GetDubbo() == nil { if http2rpcCRD.GetDubbo() == nil {
IngressLog.Errorf("Http2RpcConfig name %s, only support Http2Rpc CRD Dubbo Service type", http2rpcConfig.Name) IngressLog.Errorf("Http2RpcConfig name %s, only support Http2Rpc CRD Dubbo Service type", http2rpcConfig.Name)
return nil, errors.New("invalid http2rpcConfig has no useable http2rpc") return nil, errors.New("invalid http2rpcConfig has no usable http2rpc")
} }
httpRoute := route.HTTPRoute httpRoute := route.HTTPRoute
@@ -1293,7 +1293,7 @@ func (m *IngressConfig) constructHttp2RpcMethods(dubbo *higressv1.DubboService)
var method = make(map[string]interface{}) var method = make(map[string]interface{})
method["name"] = serviceMethod.GetServiceMethod() method["name"] = serviceMethod.GetServiceMethod()
var params []interface{} var params []interface{}
// paramFromEntireBody is for methods with single parameter. So when paramFromEntireBody exists, we just ignore parmas. // paramFromEntireBody is for methods with single parameter. So when paramFromEntireBody exists, we just ignore params.
var paramFromEntireBody = serviceMethod.GetParamFromEntireBody() var paramFromEntireBody = serviceMethod.GetParamFromEntireBody()
if paramFromEntireBody != nil { if paramFromEntireBody != nil {
var param = make(map[string]interface{}) var param = make(map[string]interface{})

View File

@@ -31,7 +31,7 @@ import (
) )
const ( const (
ConuslHealthPassing = "passing" ConsulHealthPassing = "passing"
DefaultRefreshInterval = time.Second * 30 DefaultRefreshInterval = time.Second * 30
DefaultRefreshIntervalLimit = time.Second * 10 DefaultRefreshIntervalLimit = time.Second * 10
) )
@@ -315,7 +315,7 @@ func (w *watcher) generateServiceEntry(host string, services []*consulapi.Servic
for _, service := range services { for _, service := range services {
// service status: maintenance > critical > warning > passing // service status: maintenance > critical > warning > passing
if service.Checks.AggregatedStatus() != ConuslHealthPassing { if service.Checks.AggregatedStatus() != ConsulHealthPassing {
continue continue
} }

View File

@@ -42,7 +42,7 @@ func NewEurekaHttpClient(config EurekaHttpConfig) EurekaHttpClient {
type EurekaHttpConfig struct { type EurekaHttpConfig struct {
BaseUrl string BaseUrl string
ConnectTimeoutSeconds int // default 30 ConnectTimeoutSeconds int // default 30
PollInterval int //default 30 PollInterval int // default 30
Retries int // default 3 Retries int // default 3
RetryDelayTime int // default 100ms RetryDelayTime int // default 100ms
EnableDelta bool EnableDelta bool
@@ -101,7 +101,7 @@ func (e *eurekaHttpClient) ScheduleAppUpdates(name string, stop <-chan struct{})
func (e *eurekaHttpClient) GetDelta() (*Applications, error) { func (e *eurekaHttpClient) GetDelta() (*Applications, error) {
if !e.EnableDelta { if !e.EnableDelta {
return nil, fmt.Errorf("failed to get DeltaAppliation, enableDelta is false") return nil, fmt.Errorf("failed to get DeltaApplication, enableDelta is false")
} }
return e.getApplications("/apps/delta") return e.getApplications("/apps/delta")
} }
@@ -119,7 +119,7 @@ func (c *eurekaHttpClient) getApplications(path string) (*Applications, error) {
var rj fargo.GetAppsResponseJson var rj fargo.GetAppsResponseJson
if err = json.Unmarshal(res, &rj); err != nil { if err = json.Unmarshal(res, &rj); err != nil {
log.Errorf("Failed to unmarshal response body to fargo.GetAppResponseJosn, error: %v", err) log.Errorf("Failed to unmarshal response body to fargo.GetAppResponseJson, error: %v", err)
return nil, err return nil, err
} }

View File

@@ -30,7 +30,7 @@ type Cache interface {
UpdateServiceEntryWrapper(service string, data *ServiceEntryWrapper) UpdateServiceEntryWrapper(service string, data *ServiceEntryWrapper)
DeleteServiceEntryWrapper(service string) DeleteServiceEntryWrapper(service string)
PurgeStaleService() PurgeStaleService()
UpdateServiceEntryEnpointWrapper(service, ip, regionId, zoneId, protocol string, labels map[string]string) UpdateServiceEntryEndpointWrapper(service, ip, regionId, zoneId, protocol string, labels map[string]string)
GetServiceByEndpoints(requestVersions, endpoints map[string]bool, versionKey string, protocol common.Protocol) map[string][]string GetServiceByEndpoints(requestVersions, endpoints map[string]bool, versionKey string, protocol common.Protocol) map[string][]string
GetAllServiceEntry() []*v1alpha3.ServiceEntry GetAllServiceEntry() []*v1alpha3.ServiceEntry
GetAllServiceEntryWrapper() []*ServiceEntryWrapper GetAllServiceEntryWrapper() []*ServiceEntryWrapper
@@ -58,7 +58,7 @@ type store struct {
deferedDelete map[string]struct{} deferedDelete map[string]struct{}
} }
func (s *store) UpdateServiceEntryEnpointWrapper(service, ip, regionId, zoneId, protocol string, labels map[string]string) { func (s *store) UpdateServiceEntryEndpointWrapper(service, ip, regionId, zoneId, protocol string, labels map[string]string) {
s.mux.Lock() s.mux.Lock()
defer s.mux.Unlock() defer s.mux.Unlock()
if se, exist := s.sew[service]; exist { if se, exist := s.sew[service]; exist {

View File

@@ -66,7 +66,7 @@ type watcher struct {
isStop bool isStop bool
addrProvider *address.NacosAddressProvider addrProvider *address.NacosAddressProvider
updateCacheWhenEmpty bool updateCacheWhenEmpty bool
nacosClietConfig *constant.ClientConfig nacosClientConfig *constant.ClientConfig
authOption provider.AuthOption authOption provider.AuthOption
} }
@@ -94,7 +94,7 @@ func NewWatcher(cache memory.Cache, opts ...WatcherOption) (provider.Watcher, er
log.Infof("new nacos2 watcher with config Name:%s", w.Name) log.Infof("new nacos2 watcher with config Name:%s", w.Name)
w.nacosClietConfig = constant.NewClientConfig( w.nacosClientConfig = constant.NewClientConfig(
constant.WithTimeoutMs(DefaultNacosTimeout), constant.WithTimeoutMs(DefaultNacosTimeout),
constant.WithLogLevel(DefaultNacosLogLevel), constant.WithLogLevel(DefaultNacosLogLevel),
constant.WithLogDir(DefaultNacosLogDir), constant.WithLogDir(DefaultNacosLogDir),
@@ -129,7 +129,7 @@ func NewWatcher(cache memory.Cache, opts ...WatcherOption) (provider.Watcher, er
success := make(chan struct{}) success := make(chan struct{})
go func() { go func() {
namingClient, err := clients.NewNamingClient(vo.NacosClientParam{ namingClient, err := clients.NewNamingClient(vo.NacosClientParam{
ClientConfig: w.nacosClietConfig, ClientConfig: w.nacosClientConfig,
ServerConfigs: sc, ServerConfigs: sc,
}) })
if err == nil { if err == nil {
@@ -267,7 +267,7 @@ func (w *watcher) updateNacosClient() {
defer w.mutex.Unlock() defer w.mutex.Unlock()
w.Domain = addr w.Domain = addr
namingClient, err := clients.NewNamingClient(vo.NacosClientParam{ namingClient, err := clients.NewNamingClient(vo.NacosClientParam{
ClientConfig: w.nacosClietConfig, ClientConfig: w.nacosClientConfig,
ServerConfigs: []constant.ServerConfig{ ServerConfigs: []constant.ServerConfig{
*constant.NewServerConfig(addr, uint64(w.Port)), *constant.NewServerConfig(addr, uint64(w.Port)),
}, },

View File

@@ -241,7 +241,7 @@ func (w *watcher) fetchAllServices(firstFetch ...bool) error {
case SpringCloudService: case SpringCloudService:
serviceConfig.UrlIndex = path.Join(serviceInfo.rootPath, serviceInfo.service) serviceConfig.UrlIndex = path.Join(serviceInfo.rootPath, serviceInfo.service)
default: default:
return errors.New("unkown type") return errors.New("unknown type")
} }
serviceConfigs = append(serviceConfigs, serviceConfig) serviceConfigs = append(serviceConfigs, serviceConfig)
} }
@@ -275,7 +275,7 @@ func (w *watcher) ListenService() {
} }
log.Errorf("[Zookeeper][ListenService] Get children of path zkRootPath with watcher failed, err:%v, index:%s", err, listIndex.UrlIndex) log.Errorf("[Zookeeper][ListenService] Get children of path zkRootPath with watcher failed, err:%v, index:%s", err, listIndex.UrlIndex)
// May be the provider does not ready yet, sleep failTimes * ConnDelay senconds to wait // May be the provider does not ready yet, sleep failTimes * ConnDelay seconds to wait
after := time.After(timeSecondDuration(failTimes * ConnDelay)) after := time.After(timeSecondDuration(failTimes * ConnDelay))
select { select {
case <-after: case <-after:
@@ -384,7 +384,7 @@ func (w *watcher) GetInterfaceConfig(event Event) (string, *InterfaceConfig, err
} }
} }
func (w *watcher) GetSpringCloudConfig(intefaceName string, content []byte) (string, *InterfaceConfig, error) { func (w *watcher) GetSpringCloudConfig(interfaceName string, content []byte) (string, *InterfaceConfig, error) {
var instance SpringCloudInstance var instance SpringCloudInstance
err := json.Unmarshal(content, &instance) err := json.Unmarshal(content, &instance)
if err != nil { if err != nil {
@@ -392,7 +392,7 @@ func (w *watcher) GetSpringCloudConfig(intefaceName string, content []byte) (str
return "", nil, err return "", nil, err
} }
var config InterfaceConfig var config InterfaceConfig
host := intefaceName host := interfaceName
config.Host = host config.Host = host
config.Protocol = common.HTTP.String() config.Protocol = common.HTTP.String()
if len(instance.Payload.Metadata) > 0 && instance.Payload.Metadata["protocol"] != "" { if len(instance.Payload.Metadata) > 0 && instance.Payload.Metadata["protocol"] != "" {