mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-17 00:23:52 +00:00
feature: cleanup serviceAccount
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
// DiffNamespacedNames returns the namespaced names that are in target but not in reference.
|
||||
func DiffNamespacedNames(target, reference []types.NamespacedName) []types.NamespacedName {
|
||||
referenceSet := make(map[types.NamespacedName]struct{})
|
||||
|
||||
for _, item := range reference {
|
||||
referenceSet[item] = struct{}{}
|
||||
}
|
||||
|
||||
diff := []types.NamespacedName{}
|
||||
for _, item := range target {
|
||||
if _, exists := referenceSet[item]; !exists {
|
||||
diff = append(diff, item)
|
||||
}
|
||||
}
|
||||
|
||||
return diff
|
||||
}
|
||||
Reference in New Issue
Block a user