fix rds cache (#815)

This commit is contained in:
澄潭
2024-02-02 16:42:25 +08:00
committed by GitHub
parent 29c95ea557
commit e43f5d106f

View File

@@ -0,0 +1,41 @@
diff -Naur istio/pilot/pkg/xds/discovery.go istio-new/pilot/pkg/xds/discovery.go
--- istio/pilot/pkg/xds/discovery.go 2024-02-02 16:26:49.000000000 +0800
+++ istio-new/pilot/pkg/xds/discovery.go 2024-02-02 15:38:53.000000000 +0800
@@ -18,6 +18,7 @@
"context"
"fmt"
"strconv"
+ "strings"
"sync"
"time"
@@ -41,6 +42,7 @@
"istio.io/istio/pilot/pkg/util/sets"
v3 "istio.io/istio/pilot/pkg/xds/v3"
"istio.io/istio/pkg/cluster"
+ "istio.io/istio/pkg/config/constants"
"istio.io/istio/pkg/security"
)
@@ -332,6 +334,21 @@
} else {
// Otherwise, just clear the updated configs
s.Cache.Clear(req.ConfigsUpdated)
+ //Added by ingress
+ trimKeyMap := make(map[model.ConfigKey]struct{})
+ for configKey := range req.ConfigsUpdated {
+ if strings.HasPrefix(configKey.Name, constants.IstioIngressGatewayName+"-") {
+ trimKeyMap[model.ConfigKey{
+ Kind: configKey.Kind,
+ Name: strings.TrimPrefix(configKey.Name, constants.IstioIngressGatewayName+"-"),
+ Namespace: configKey.Namespace,
+ }] = struct{}{}
+ }
+ }
+ if len(trimKeyMap) > 0 {
+ s.Cache.Clear(trimKeyMap)
+ }
+ //End added by ingress
}
}