diff --git a/vendor.conf b/vendor.conf index 59685261..bb50091b 100644 --- a/vendor.conf +++ b/vendor.conf @@ -3,5 +3,5 @@ github.com/rancher/types k8s.io/kubernetes v1.8.3 transitive=true,staging=true bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git -github.com/rancher/norman eef2c6ee6e9445c5c45613ab0001f99ab79476ff +github.com/rancher/norman e656484b264ad1d6d4c4b1f1bd5112f9eb0def0b golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5 diff --git a/vendor/github.com/rancher/norman/generator/controller_template.go b/vendor/github.com/rancher/norman/generator/controller_template.go index 77126f66..50e96893 100644 --- a/vendor/github.com/rancher/norman/generator/controller_template.go +++ b/vendor/github.com/rancher/norman/generator/controller_template.go @@ -81,7 +81,13 @@ func (l *{{.schema.ID}}Lister) List(namespace string, selector labels.Selector) } func (l *{{.schema.ID}}Lister) Get(namespace, name string) (*{{.prefix}}{{.schema.CodeName}}, error) { - obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name) + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) if err != nil { return nil, err } diff --git a/vendor/github.com/rancher/norman/types/definition/definition.go b/vendor/github.com/rancher/norman/types/definition/definition.go index 1e32b12f..40912afb 100644 --- a/vendor/github.com/rancher/norman/types/definition/definition.go +++ b/vendor/github.com/rancher/norman/types/definition/definition.go @@ -32,7 +32,11 @@ func SubType(fieldType string) string { } func GetType(data map[string]interface{}) string { - parts := strings.Split(GetFullType(data), "/") + return GetShortTypeFromFull(GetFullType(data)) +} + +func GetShortTypeFromFull(fullType string) string { + parts := strings.Split(fullType, "/") return parts[len(parts)-1] } diff --git a/vendor/github.com/rancher/norman/types/reflection.go b/vendor/github.com/rancher/norman/types/reflection.go index 37ceadff..060f9803 100644 --- a/vendor/github.com/rancher/norman/types/reflection.go +++ b/vendor/github.com/rancher/norman/types/reflection.go @@ -176,9 +176,9 @@ func (s *Schemas) importType(version *APIVersion, t reflect.Type, overrides ...r s.setupFilters(schema) schema.Mapper = mapper - s.AddSchema(schema) + s.AddSchema(*schema) - return schema, s.Err() + return s.Schema(&schema.Version, schema.ID), s.Err() } func jsonName(f reflect.StructField) string { diff --git a/vendor/github.com/rancher/norman/types/schemas.go b/vendor/github.com/rancher/norman/types/schemas.go index 43613cac..f0b4509e 100644 --- a/vendor/github.com/rancher/norman/types/schemas.go +++ b/vendor/github.com/rancher/norman/types/schemas.go @@ -54,12 +54,12 @@ func (s *Schemas) SubContextSchemas() map[string]*Schema { func (s *Schemas) AddSchemas(schema *Schemas) *Schemas { for _, schema := range schema.Schemas() { - s.AddSchema(schema) + s.AddSchema(*schema) } return s } -func (s *Schemas) AddSchema(schema *Schema) *Schemas { +func (s *Schemas) AddSchema(schema Schema) *Schemas { schema.Type = "/meta/schemas/schema" if schema.ID == "" { s.errors = append(s.errors, fmt.Errorf("ID is not set on schema: %v", schema)) @@ -90,12 +90,12 @@ func (s *Schemas) AddSchema(schema *Schema) *Schemas { } if _, ok := schemas[schema.ID]; !ok { - schemas[schema.ID] = schema - s.schemas = append(s.schemas, schema) + schemas[schema.ID] = &schema + s.schemas = append(s.schemas, &schema) } if schema.SubContext != "" { - s.schemasBySubContext[schema.SubContext] = schema + s.schemasBySubContext[schema.SubContext] = &schema } return s