@@ -62,16 +62,16 @@ func (b *RouteMgrImpl) onUpsertedHTTPRoute(routeKey k8stypes.NamespacedName, rou
6262}
6363
6464func (b * RouteMgrImpl ) onUpsertedTLSRoute (routeKey k8stypes.NamespacedName , route * tree.TLSRoute ,
65- sni * maps.MapData , acceptedHostnamesForRoute []string ,
65+ mapSNI , mapSNIDomainWildcardMap * maps.MapData , acceptedHostnamesForRoute []string ,
6666) error {
6767 if route .Valid {
68- return b .onValidTLSRouteUpserted (routeKey , route , sni , acceptedHostnamesForRoute )
68+ return b .onValidTLSRouteUpserted (routeKey , route , mapSNI , mapSNIDomainWildcardMap , acceptedHostnamesForRoute )
6969 }
70- return b .onInvalidTLSRouteUpserted (routeKey , route , sni )
70+ return b .onInvalidTLSRouteUpserted (routeKey , route , mapSNI , mapSNIDomainWildcardMap )
7171}
7272
7373func (b * RouteMgrImpl ) onValidTLSRouteUpserted (_ k8stypes.NamespacedName ,
74- tlsRoute * tree.TLSRoute , mapSNI * maps.MapData , acceptedHostnamesForRoute []string ,
74+ tlsRoute * tree.TLSRoute , mapSNI , mapSNIDomainWildcardMap * maps.MapData , acceptedHostnamesForRoute []string ,
7575) error {
7676 for _ , tlsRouteRule := range tlsRoute .Rules {
7777 // if !rule.Valid {
@@ -136,7 +136,11 @@ func (b *RouteMgrImpl) onValidTLSRouteUpserted(_ k8stypes.NamespacedName,
136136
137137 for _ , hostname := range acceptedHostnamesForRoute {
138138 if tlsRouteRule .Valid {
139- mapSNI .AddData (string (hostname ), routeValue )
139+ if isDomainWildcard (string (hostname )) {
140+ mapSNIDomainWildcardMap .AddData (string (hostname ), routeValue )
141+ } else {
142+ mapSNI .AddData (string (hostname ), routeValue )
143+ }
140144 hostnamesInserted [string (hostname )] = struct {}{}
141145 } else if _ , ok := hostnamesInserted [string (hostname )]; ! ok {
142146 mapSNI .DeleteData (string (hostname ))
@@ -146,17 +150,21 @@ func (b *RouteMgrImpl) onValidTLSRouteUpserted(_ k8stypes.NamespacedName,
146150 return nil
147151}
148152
149- func (RouteMgrImpl ) onInvalidTLSRouteUpserted (_ k8stypes.NamespacedName , _ * tree.TLSRoute , _ * maps.MapData ) error {
153+ func (RouteMgrImpl ) onInvalidTLSRouteUpserted (_ k8stypes.NamespacedName , _ * tree.TLSRoute , _ , _ * maps.MapData ) error {
150154 // TODO we might need to remove it from the maps
151155 return nil
152156}
153157
154158func (RouteMgrImpl ) onDeletedTLSRoute (_ k8stypes.NamespacedName , route * tree.TLSRoute ,
155- mapSNI * maps.MapData ,
159+ mapSNI * maps.MapData , mapSNIDomainWildcard * maps. MapData ,
156160) error {
157161 hostnames := route .K8sResource .Spec .Hostnames
158162 for _ , hostname := range hostnames {
159- mapSNI .DeleteData (string (hostname ))
163+ if isDomainWildcard (string (hostname )) {
164+ mapSNIDomainWildcard .DeleteData (string (hostname ))
165+ } else {
166+ mapSNI .DeleteData (string (hostname ))
167+ }
160168 }
161169 return nil
162170}
0 commit comments