diff --git a/vendor.conf b/vendor.conf index c3b43278..d8f29a9e 100644 --- a/vendor.conf +++ b/vendor.conf @@ -27,5 +27,5 @@ github.com/beorn7/perks 3a771d992973f24aa725d07868b467d1ddfceafb github.com/matttproud/golang_protobuf_extensions c12348ce28de40eed0136aa2b644d0ee0650e56c github.com/mattn/go-colorable efa589957cd060542a26d2dd7832fd6a6c6c3ade github.com/mattn/go-isatty 6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c -github.com/rancher/norman 0557aa4ff31a3a0f007dcb1b684894f23cda390c +github.com/rancher/norman ea122abac582d745a00dba0aaf946c29ee8d9d90 github.com/rancher/types 3d66c9393f0e3472c8eaec8e5dbc41155155a021 diff --git a/vendor/github.com/rancher/norman/.drone.yml b/vendor/github.com/rancher/norman/.drone.yml index 8f5c37cd..a9b80360 100644 --- a/vendor/github.com/rancher/norman/.drone.yml +++ b/vendor/github.com/rancher/norman/.drone.yml @@ -1,9 +1,23 @@ --- -pipeline: - build: - privileged: true - image: rancher/dapper:1.11.2 - volumes: - - /var/run/docker.sock:/var/run/docker.sock - commands: - - dapper ci +kind: pipeline +name: default + +platform: + os: linux + arch: amd64 + +steps: +- name: build + pull: default + image: rancher/dapper:1.11.2 + commands: + - dapper ci + privileged: true + volumes: + - name: socket + path: /var/run/docker.sock + +volumes: +- name: socket + host: + path: /var/run/docker.sock diff --git a/vendor/github.com/rancher/norman/controller/generic_controller.go b/vendor/github.com/rancher/norman/controller/generic_controller.go index c5213175..02fed9c9 100644 --- a/vendor/github.com/rancher/norman/controller/generic_controller.go +++ b/vendor/github.com/rancher/norman/controller/generic_controller.go @@ -304,7 +304,7 @@ func filterConflictsError(err error) error { var newErrors []error for _, err := range errs.Errors { if !ignoreError(err, true) { - newErrors = append(newErrors) + newErrors = append(newErrors, err) } } return types.NewErrors(newErrors...) diff --git a/vendor/github.com/rancher/norman/httperror/error.go b/vendor/github.com/rancher/norman/httperror/error.go index 73b10acd..84938d6d 100644 --- a/vendor/github.com/rancher/norman/httperror/error.go +++ b/vendor/github.com/rancher/norman/httperror/error.go @@ -105,6 +105,14 @@ func IsAPIError(err error) bool { return ok } +func IsNotFound(err error) bool { + if apiError, ok := err.(*APIError); ok { + return apiError.Code.Status == 404 + } + + return false +} + func IsConflict(err error) bool { if apiError, ok := err.(*APIError); ok { return apiError.Code.Status == 409 diff --git a/vendor/github.com/rancher/norman/objectclient/object_client.go b/vendor/github.com/rancher/norman/objectclient/object_client.go index 01d1b930..9a09bf0e 100644 --- a/vendor/github.com/rancher/norman/objectclient/object_client.go +++ b/vendor/github.com/rancher/norman/objectclient/object_client.go @@ -102,6 +102,13 @@ func (p *ObjectClient) Create(o runtime.Object) (runtime.Object, error) { labels := obj.GetLabels() if labels == nil { labels = make(map[string]string) + } else { + ls := make(map[string]string) + for k, v := range labels { + ls[k] = v + } + labels = ls + } labels["cattle.io/creator"] = "norman" obj.SetLabels(labels) diff --git a/vendor/github.com/rancher/norman/resource/resource.go b/vendor/github.com/rancher/norman/resource/resource.go new file mode 100644 index 00000000..8ed4eb47 --- /dev/null +++ b/vendor/github.com/rancher/norman/resource/resource.go @@ -0,0 +1,38 @@ +package resource + +import ( + "sync" + + "k8s.io/apimachinery/pkg/runtime/schema" +) + +//rancherTypes is a set of all types generated by rancher +var ( + rancherTypes = struct { + sync.RWMutex + m map[schema.GroupVersionResource]bool + }{m: make(map[schema.GroupVersionResource]bool)} +) + +//Get returns a copy of the set of rancherTypes +func Get() map[schema.GroupVersionResource]bool { + rancherTypes.RLock() + defer rancherTypes.RUnlock() + targetMap := make(map[schema.GroupVersionResource]bool, len(rancherTypes.m)) + for key, value := range rancherTypes.m { + targetMap[key] = value + } + return targetMap +} + +//Put adds an object to the set and panic on collision +func Put(key schema.GroupVersionResource) { + rancherTypes.Lock() + defer rancherTypes.Unlock() + _, exists := rancherTypes.m[key] + if exists { + //only used in an init function + panic("key exists in rancherTypes") + } + rancherTypes.m[key] = true +} diff --git a/vendor/github.com/rancher/norman/restwatch/rest.go b/vendor/github.com/rancher/norman/restwatch/rest.go index 25092052..52d14591 100644 --- a/vendor/github.com/rancher/norman/restwatch/rest.go +++ b/vendor/github.com/rancher/norman/restwatch/rest.go @@ -21,7 +21,7 @@ func UnversionedRESTClientFor(config *rest.Config) (rest.Interface, error) { } newConfig := *config - newConfig.Timeout = time.Hour + newConfig.Timeout = 30 * time.Minute watchClient, err := rest.UnversionedRESTClientFor(&newConfig) if err != nil { return nil, err diff --git a/vendor/github.com/rancher/norman/types/schemas.go b/vendor/github.com/rancher/norman/types/schemas.go index 0e72a178..2afee0aa 100644 --- a/vendor/github.com/rancher/norman/types/schemas.go +++ b/vendor/github.com/rancher/norman/types/schemas.go @@ -108,10 +108,16 @@ func (s *Schemas) removeReferences(schema *Schema) { func (s *Schemas) AddSchema(schema Schema) *Schemas { s.Lock() defer s.Unlock() - return s.doAddSchema(schema) + return s.doAddSchema(schema, false) } -func (s *Schemas) doAddSchema(schema Schema) *Schemas { +func (s *Schemas) ForceAddSchema(schema Schema) *Schemas { + s.Lock() + defer s.Unlock() + return s.doAddSchema(schema, true) +} + +func (s *Schemas) doAddSchema(schema Schema, replace bool) *Schemas { s.setupDefaults(&schema) if s.AddHook != nil { @@ -125,9 +131,20 @@ func (s *Schemas) doAddSchema(schema Schema) *Schemas { s.versions = append(s.versions, schema.Version) } - if _, ok := schemas[schema.ID]; !ok { + if _, ok := schemas[schema.ID]; !ok || + (replace && schema.DynamicSchemaVersion != schemas[schema.ID].DynamicSchemaVersion) { schemas[schema.ID] = &schema - s.schemas = append(s.schemas, &schema) + + if replace { + for i, candidate := range s.schemas { + if candidate.ID == schema.ID { + s.schemas[i] = &schema + break + } + } + } else { + s.schemas = append(s.schemas, &schema) + } if !schema.Embed { s.addReferences(&schema) @@ -159,7 +176,7 @@ func (s *Schemas) removeEmbed(schema *Schema) { } s.doRemoveSchema(*target) - s.doAddSchema(newSchema) + s.doAddSchema(newSchema, false) } func (s *Schemas) embed(schema *Schema) { @@ -184,7 +201,7 @@ func (s *Schemas) embed(schema *Schema) { } s.doRemoveSchema(*target) - s.doAddSchema(newSchema) + s.doAddSchema(newSchema, false) } func (s *Schemas) addReferences(schema *Schema) { diff --git a/vendor/github.com/rancher/norman/types/server_types.go b/vendor/github.com/rancher/norman/types/server_types.go index 7fede86f..7e36aa22 100644 --- a/vendor/github.com/rancher/norman/types/server_types.go +++ b/vendor/github.com/rancher/norman/types/server_types.go @@ -184,6 +184,8 @@ type QueryOptions struct { Pagination *Pagination Conditions []*QueryCondition Options map[string]string + // Set namespaces to an empty array will result in an empty response + Namespaces []string } type ReferenceValidator interface { diff --git a/vendor/github.com/rancher/norman/types/types.go b/vendor/github.com/rancher/norman/types/types.go index 21106f5a..9edfd764 100644 --- a/vendor/github.com/rancher/norman/types/types.go +++ b/vendor/github.com/rancher/norman/types/types.go @@ -94,25 +94,26 @@ var NamespaceScope TypeScope = "namespace" type TypeScope string type Schema struct { - ID string `json:"id,omitempty"` - Embed bool `json:"embed,omitempty"` - EmbedType string `json:"embedType,omitempty"` - CodeName string `json:"-"` - CodeNamePlural string `json:"-"` - PkgName string `json:"-"` - Type string `json:"type,omitempty"` - BaseType string `json:"baseType,omitempty"` - Links map[string]string `json:"links"` - Version APIVersion `json:"version"` - PluralName string `json:"pluralName,omitempty"` - ResourceMethods []string `json:"resourceMethods,omitempty"` - ResourceFields map[string]Field `json:"resourceFields"` - ResourceActions map[string]Action `json:"resourceActions,omitempty"` - CollectionMethods []string `json:"collectionMethods,omitempty"` - CollectionFields map[string]Field `json:"collectionFields,omitempty"` - CollectionActions map[string]Action `json:"collectionActions,omitempty"` - CollectionFilters map[string]Filter `json:"collectionFilters,omitempty"` - Scope TypeScope `json:"-"` + ID string `json:"id,omitempty"` + Embed bool `json:"embed,omitempty"` + EmbedType string `json:"embedType,omitempty"` + CodeName string `json:"-"` + CodeNamePlural string `json:"-"` + PkgName string `json:"-"` + Type string `json:"type,omitempty"` + BaseType string `json:"baseType,omitempty"` + Links map[string]string `json:"links"` + Version APIVersion `json:"version"` + PluralName string `json:"pluralName,omitempty"` + ResourceMethods []string `json:"resourceMethods,omitempty"` + ResourceFields map[string]Field `json:"resourceFields"` + ResourceActions map[string]Action `json:"resourceActions,omitempty"` + CollectionMethods []string `json:"collectionMethods,omitempty"` + CollectionFields map[string]Field `json:"collectionFields,omitempty"` + CollectionActions map[string]Action `json:"collectionActions,omitempty"` + CollectionFilters map[string]Filter `json:"collectionFilters,omitempty"` + DynamicSchemaVersion string `json:"dynamicSchemaVersion,omitempty"` + Scope TypeScope `json:"-"` InternalSchema *Schema `json:"-"` Mapper Mapper `json:"-"` diff --git a/vendor/github.com/rancher/norman/vendor.conf b/vendor/github.com/rancher/norman/vendor.conf index afb270b4..fed23e84 100644 --- a/vendor/github.com/rancher/norman/vendor.conf +++ b/vendor/github.com/rancher/norman/vendor.conf @@ -5,4 +5,6 @@ k8s.io/kubernetes v1.12.2-lite1 https github.com/maruel/panicparse c0182c169410cfa80c7e8f046dad208eaef91338 bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5 +golang.org/x/tools 202502a5a9245830b5ec7b877e26b67760da8e67 github.com/gorilla/mux v1.6.1 +github.com/matryer/moq ee5226d4300902ed04c84bde4837cb123d936feb https://github.com/rancher/moq \ No newline at end of file