v1beta1 should return Minion as kind, rather than Node

This changes the internal name logic (for conversion) to prefer the
internal registered preferred name for a resource, and then makes
v1beta1 and v1beta2 prefer Minion.

Fixes #3010
This commit is contained in:
Clayton Coleman
2014-12-17 19:55:56 -05:00
parent edfae8660e
commit 7fde4583f2
6 changed files with 66 additions and 15 deletions

View File

@@ -72,14 +72,21 @@ func (s *Scheme) Log(l DebugLogger) {
s.converter.Debug = l
}
// nameFunc returns the name of the type that we wish to use for encoding. Defaults to
// the go name of the type if the type is not registered.
// nameFunc returns the name of the type that we wish to use to determine when two types attempt
// a conversion. Defaults to the go name of the type if the type is not registered.
func (s *Scheme) nameFunc(t reflect.Type) string {
// find the preferred names for this type
names, ok := s.typeToKind[t]
if !ok {
return t.Name()
}
if internal, ok := s.versionMap[""]; ok {
for _, name := range names {
if t, ok := internal[name]; ok {
return s.typeToKind[t][0]
}
}
}
return names[0]
}