Skip to content

Commit 75196cc

Browse files
committed
fix: sort snis
Signed-off-by: ashing <[email protected]>
1 parent b1694d0 commit 75196cc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/provider/adc/translator/gateway.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"encoding/json"
1818
"encoding/pem"
1919
"fmt"
20+
"slices"
2021

2122
"github.com/api7/gopkg/pkg/log"
2223
"github.com/pkg/errors"
@@ -44,9 +45,7 @@ func (t *Translator) TranslateGateway(tctx *provider.TranslateContext, obj *gate
4445
result.SSL = append(result.SSL, ssl...)
4546
}
4647
}
47-
log.Debugw("translate gateway result.SSL", zap.Any("result.SSL", len(result.SSL)))
4848
result.SSL = mergeSSLWithSameID(result.SSL)
49-
log.Debugw("after merging SSL with same ID", zap.Any("result.SSL", len(result.SSL)))
5049

5150
rk := provider.ResourceKind{
5251
Kind: obj.Kind,
@@ -264,9 +263,12 @@ func mergeSSLWithSameID(sslList []*adctypes.SSL) []*adctypes.SSL {
264263
for sni := range sniMap {
265264
newSnis = append(newSnis, sni)
266265
}
266+
267+
slices.Sort(newSnis)
267268
// update existing ssl object
268269
existing.Snis = newSnis
269270
} else {
271+
slices.Sort(ssl.Snis)
270272
// if new ssl id, add to map
271273
sslMap[ssl.ID] = ssl
272274
}

0 commit comments

Comments
 (0)