mirror of
https://github.com/rancher/types.git
synced 2025-10-21 19:01:12 +00:00
Update vendor
This commit is contained in:
2
vendor/github.com/rancher/norman/controller/generic_controller.go
generated
vendored
2
vendor/github.com/rancher/norman/controller/generic_controller.go
generated
vendored
@@ -204,7 +204,7 @@ func (g *genericController) processNextWorkItem() bool {
|
||||
}
|
||||
if _, ok := checkErr.(*ForgetError); err == nil || ok {
|
||||
if ok {
|
||||
logrus.Infof("%v %v completed with dropped err: %v", g.name, key, err)
|
||||
logrus.Debugf("%v %v completed with dropped err: %v", g.name, key, err)
|
||||
}
|
||||
g.queue.Forget(key)
|
||||
return true
|
||||
|
5
vendor/github.com/rancher/norman/generator/controller_template.go
generated
vendored
5
vendor/github.com/rancher/norman/generator/controller_template.go
generated
vendored
@@ -49,6 +49,7 @@ type {{.schema.CodeName}}Lister interface {
|
||||
}
|
||||
|
||||
type {{.schema.CodeName}}Controller interface {
|
||||
Generic() controller.GenericController
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() {{.schema.CodeName}}Lister
|
||||
AddHandler(name string, handler {{.schema.CodeName}}HandlerFunc)
|
||||
@@ -111,6 +112,10 @@ type {{.schema.ID}}Controller struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *{{.schema.ID}}Controller) Generic() controller.GenericController {
|
||||
return c.GenericController
|
||||
}
|
||||
|
||||
func (c *{{.schema.ID}}Controller) Lister() {{.schema.CodeName}}Lister {
|
||||
return &{{.schema.ID}}Lister{
|
||||
controller: c,
|
||||
|
17
vendor/github.com/rancher/norman/objectclient/object_client.go
generated
vendored
17
vendor/github.com/rancher/norman/objectclient/object_client.go
generated
vendored
@@ -94,9 +94,20 @@ func (p *ObjectClient) getAPIPrefix() string {
|
||||
|
||||
func (p *ObjectClient) Create(o runtime.Object) (runtime.Object, error) {
|
||||
ns := p.ns
|
||||
if obj, ok := o.(metav1.Object); ok && obj.GetNamespace() != "" {
|
||||
obj, ok := o.(metav1.Object)
|
||||
if ok && obj.GetNamespace() != "" {
|
||||
ns = obj.GetNamespace()
|
||||
}
|
||||
|
||||
if ok {
|
||||
labels := obj.GetLabels()
|
||||
if labels == nil {
|
||||
labels = make(map[string]string)
|
||||
}
|
||||
labels["cattle.io/creator"] = "norman"
|
||||
obj.SetLabels(labels)
|
||||
}
|
||||
|
||||
if t, err := meta.TypeAccessor(o); err == nil {
|
||||
if t.GetKind() == "" {
|
||||
t.SetKind(p.gvk.Kind)
|
||||
@@ -245,6 +256,10 @@ func (d *structuredDecoder) Decode(data []byte, defaults *schema.GroupVersionKin
|
||||
|
||||
err := json.Unmarshal(data, &into)
|
||||
if err != nil {
|
||||
status := &metav1.Status{}
|
||||
if err := json.Unmarshal(data, status); err == nil && strings.ToLower(status.Kind) == "status" {
|
||||
return status, defaults, nil
|
||||
}
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
|
11
vendor/github.com/rancher/norman/store/proxy/proxy_store.go
generated
vendored
11
vendor/github.com/rancher/norman/store/proxy/proxy_store.go
generated
vendored
@@ -39,7 +39,6 @@ var (
|
||||
)
|
||||
|
||||
type ClientGetter interface {
|
||||
Config(apiContext *types.APIContext, context types.StorageContext) (rest.Config, error)
|
||||
UnversionedClient(apiContext *types.APIContext, context types.StorageContext) (rest.Interface, error)
|
||||
APIExtClient(apiContext *types.APIContext, context types.StorageContext) (clientset.Interface, error)
|
||||
}
|
||||
@@ -244,8 +243,9 @@ func (s *Store) realWatch(apiContext *types.APIContext, schema *types.Schema, op
|
||||
decoder := streaming.NewDecoder(framer, &unstructuredDecoder{})
|
||||
watcher := watch.NewStreamWatcher(restclientwatch.NewDecoder(decoder, &unstructuredDecoder{}))
|
||||
|
||||
watchingContext, cancelWatchingContext := context.WithCancel(apiContext.Request.Context())
|
||||
go func() {
|
||||
<-apiContext.Request.Context().Done()
|
||||
<-watchingContext.Done()
|
||||
logrus.Debugf("stopping watcher for %s", schema.ID)
|
||||
watcher.Stop()
|
||||
}()
|
||||
@@ -262,6 +262,7 @@ func (s *Store) realWatch(apiContext *types.APIContext, schema *types.Schema, op
|
||||
}
|
||||
logrus.Debugf("closing watcher for %s", schema.ID)
|
||||
close(result)
|
||||
cancelWatchingContext()
|
||||
}()
|
||||
|
||||
return result, nil
|
||||
@@ -283,10 +284,11 @@ func getNamespace(apiContext *types.APIContext, opt *types.QueryOptions) string
|
||||
}
|
||||
|
||||
for _, condition := range opt.Conditions {
|
||||
if condition.Field == "namespaceId" && condition.Value != "" {
|
||||
mod := condition.ToCondition().Modifier
|
||||
if condition.Field == "namespaceId" && condition.Value != "" && mod == types.ModifierEQ {
|
||||
return condition.Value
|
||||
}
|
||||
if condition.Field == "namespace" && condition.Value != "" {
|
||||
if condition.Field == "namespace" && condition.Value != "" && mod == types.ModifierEQ {
|
||||
return condition.Value
|
||||
}
|
||||
}
|
||||
@@ -302,6 +304,7 @@ func (s *Store) Create(apiContext *types.APIContext, schema *types.Schema, data
|
||||
namespace, _ := values.GetValueN(data, "metadata", "namespace").(string)
|
||||
|
||||
values.PutValue(data, s.getUser(apiContext), "metadata", "annotations", "field.cattle.io/creatorId")
|
||||
values.PutValue(data, "norman", "metadata", "labels", "cattle.io/creator")
|
||||
|
||||
name, _ := values.GetValueN(data, "metadata", "name").(string)
|
||||
if name == "" {
|
||||
|
8
vendor/github.com/rancher/norman/types/convert/convert.go
generated
vendored
8
vendor/github.com/rancher/norman/types/convert/convert.go
generated
vendored
@@ -44,7 +44,7 @@ func Singular(value interface{}) interface{} {
|
||||
return value
|
||||
}
|
||||
|
||||
func ToString(value interface{}) string {
|
||||
func ToStringNoTrim(value interface{}) string {
|
||||
if t, ok := value.(time.Time); ok {
|
||||
return t.Format(time.RFC3339)
|
||||
}
|
||||
@@ -52,7 +52,11 @@ func ToString(value interface{}) string {
|
||||
if single == nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(fmt.Sprint(single))
|
||||
return fmt.Sprint(single)
|
||||
}
|
||||
|
||||
func ToString(value interface{}) string {
|
||||
return strings.TrimSpace(ToStringNoTrim(value))
|
||||
}
|
||||
|
||||
func ToTimestamp(value interface{}) (int64, error) {
|
||||
|
7
vendor/github.com/rancher/norman/types/schemas.go
generated
vendored
7
vendor/github.com/rancher/norman/types/schemas.go
generated
vendored
@@ -170,7 +170,12 @@ func (s *Schemas) embed(schema *Schema) {
|
||||
newSchema.ResourceFields = map[string]Field{}
|
||||
|
||||
for k, v := range target.ResourceFields {
|
||||
newSchema.ResourceFields[k] = v
|
||||
// We remove the dynamic fields off the existing schema in case
|
||||
// they've been removed from the dynamic schema so they won't
|
||||
// be accidentally left over
|
||||
if !v.DynamicField {
|
||||
newSchema.ResourceFields[k] = v
|
||||
}
|
||||
}
|
||||
for k, v := range schema.ResourceFields {
|
||||
newSchema.ResourceFields[k] = v
|
||||
|
1
vendor/github.com/rancher/norman/types/types.go
generated
vendored
1
vendor/github.com/rancher/norman/types/types.go
generated
vendored
@@ -136,6 +136,7 @@ type Field struct {
|
||||
InvalidChars string `json:"invalidChars,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
CodeName string `json:"-"`
|
||||
DynamicField bool `json:"dynamicField,omitempty"`
|
||||
}
|
||||
|
||||
type Action struct {
|
||||
|
Reference in New Issue
Block a user