mirror of
https://github.com/alibaba/higress.git
synced 2026-04-21 20:17:29 +08:00
refactor registry & add direct service discovery through staticIP or DNS (#261)
This commit is contained in:
@@ -710,6 +710,7 @@ func (m *IngressConfig) convertIstioWasmPlugin(obj *higressext.WasmPlugin) (*ext
|
||||
if !obj.DefaultConfigDisable {
|
||||
result.PluginConfig = obj.DefaultConfig
|
||||
}
|
||||
hasValidRule := false
|
||||
if len(obj.MatchRules) > 0 {
|
||||
if result.PluginConfig == nil {
|
||||
result.PluginConfig = &types.Struct{
|
||||
@@ -769,14 +770,20 @@ func (m *IngressConfig) convertIstioWasmPlugin(obj *higressext.WasmPlugin) (*ext
|
||||
Kind: v,
|
||||
})
|
||||
}
|
||||
result.PluginConfig.Fields["_rules_"] = &types.Value{
|
||||
Kind: &types.Value_ListValue{
|
||||
ListValue: &types.ListValue{
|
||||
Values: ruleValues,
|
||||
if len(ruleValues) > 0 {
|
||||
hasValidRule = true
|
||||
result.PluginConfig.Fields["_rules_"] = &types.Value{
|
||||
Kind: &types.Value_ListValue{
|
||||
ListValue: &types.ListValue{
|
||||
Values: ruleValues,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
if !hasValidRule && obj.DefaultConfigDisable {
|
||||
return nil, nil
|
||||
}
|
||||
return result, nil
|
||||
|
||||
}
|
||||
@@ -807,6 +814,14 @@ func (m *IngressConfig) AddOrUpdateWasmPlugin(clusterNamespacedName util.Cluster
|
||||
IngressLog.Errorf("invalid wasmPlugin:%s, err:%v", clusterNamespacedName.Name, err)
|
||||
return
|
||||
}
|
||||
if istioWasmPlugin == nil {
|
||||
IngressLog.Infof("wasmPlugin:%s will not be transferred to istio since config disabled",
|
||||
clusterNamespacedName.Name)
|
||||
m.mutex.Lock()
|
||||
delete(m.wasmPlugins, clusterNamespacedName.Name)
|
||||
m.mutex.Unlock()
|
||||
return
|
||||
}
|
||||
IngressLog.Debugf("wasmPlugin:%s convert to istioWasmPlugin:%v", clusterNamespacedName.Name, istioWasmPlugin)
|
||||
m.mutex.Lock()
|
||||
m.wasmPlugins[clusterNamespacedName.Name] = istioWasmPlugin
|
||||
|
||||
Reference in New Issue
Block a user