fix group mapping and encoding order

This commit is contained in:
deads2k
2016-02-08 15:22:01 -05:00
parent a49c363624
commit f89bd83664
2 changed files with 22 additions and 12 deletions

View File

@@ -57,12 +57,20 @@ func NewCodec(
if encodeVersion != nil {
internal.encodeVersion = make(map[string]unversioned.GroupVersion)
for _, v := range encodeVersion {
// first one for a group wins. This is consistent with best to worst order throughout the codebase
if _, ok := internal.encodeVersion[v.Group]; ok {
continue
}
internal.encodeVersion[v.Group] = v
}
}
if decodeVersion != nil {
internal.decodeVersion = make(map[string]unversioned.GroupVersion)
for _, v := range decodeVersion {
// first one for a group wins. This is consistent with best to worst order throughout the codebase
if _, ok := internal.decodeVersion[v.Group]; ok {
continue
}
internal.decodeVersion[v.Group] = v
}
}