Skip to content

Commit dc50f71

Browse files
committed
Normalize resource key before grouping manifests to convert default namespace to empty
Signed-off-by: Yoshiki Fujikane <[email protected]>
1 parent b9d333f commit dc50f71

File tree

1 file changed

+4
-4
lines changed
  • pkg/app/pipedv1/plugin/kubernetes_multicluster/provider

1 file changed

+4
-4
lines changed

pkg/app/pipedv1/plugin/kubernetes_multicluster/provider/diff.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,26 +136,26 @@ func DiffList(liveManifests, desiredManifests []Manifest, logger *zap.Logger, op
136136
func groupManifests(olds, news []Manifest) (adds, deletes, newChanges, oldChanges []Manifest) {
137137
// Sort the manifests before comparing.
138138
sort.Slice(news, func(i, j int) bool {
139-
return news[i].Key().String() < news[j].Key().String()
139+
return news[i].Key().normalize().String() < news[j].Key().normalize().String()
140140
})
141141
sort.Slice(olds, func(i, j int) bool {
142-
return olds[i].Key().String() < olds[j].Key().String()
142+
return olds[i].Key().normalize().String() < olds[j].Key().normalize().String()
143143
})
144144

145145
var n, o int
146146
for {
147147
if n >= len(news) || o >= len(olds) {
148148
break
149149
}
150-
if news[n].Key().String() == olds[o].Key().String() {
150+
if news[n].Key().normalize().String() == olds[o].Key().normalize().String() {
151151
newChanges = append(newChanges, news[n])
152152
oldChanges = append(oldChanges, olds[o])
153153
n++
154154
o++
155155
continue
156156
}
157157
// Has in news but not in olds so this should be a added one.
158-
if news[n].Key().String() < olds[o].Key().String() {
158+
if news[n].Key().normalize().String() < olds[o].Key().normalize().String() {
159159
adds = append(adds, news[n])
160160
n++
161161
continue

0 commit comments

Comments
 (0)