Add merge support for serviceaccounts

All properties from a backup will be merged into the ServiceAccount
except for the default token secret.

Signed-off-by: Nolan Brubaker <nolan@heptio.com>
This commit is contained in:
Nolan Brubaker
2018-06-15 12:40:59 -04:00
parent 0396ca1dee
commit e7d00cf5fd
9 changed files with 1054 additions and 87 deletions
+11
View File
@@ -122,3 +122,14 @@ func Exists(root map[string]interface{}, path string) bool {
_, err := GetValue(root, path)
return err == nil
}
// MergeMaps takes two map[string]string and merges missing keys from the second into the first.
// If a key already exists, its value is not overwritten.
func MergeMaps(first, second map[string]string) {
for k, v := range second {
_, ok := first[k]
if !ok {
first[k] = v
}
}
}