1
0
mirror of https://github.com/rancher/types.git synced 2025-08-01 21:07:41 +00:00

Update vendor

This commit is contained in:
Darren Shepherd 2018-02-13 16:45:28 -07:00
parent d19b4a471e
commit 9e096de9f5
4 changed files with 38 additions and 6 deletions

View File

@ -5,4 +5,4 @@ k8s.io/kubernetes v1.8.3
bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git
golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5
github.com/rancher/norman 722cedfe014fbfe9f1e5572b5582960f7eb3a2fb
github.com/rancher/norman c814e62e436aeaeaf51ae3da439e520068494a7b

View File

@ -31,6 +31,22 @@ func (u *UnstructuredObjectFactory) List() runtime.Object {
return &unstructured.UnstructuredList{}
}
type GenericClient interface {
UnstructuredClient() GenericClient
GroupVersionKind() schema.GroupVersionKind
Create(o runtime.Object) (runtime.Object, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (runtime.Object, error)
Get(name string, opts metav1.GetOptions) (runtime.Object, error)
Update(name string, o runtime.Object) (runtime.Object, error)
DeleteNamespaced(namespace, name string, opts *metav1.DeleteOptions) error
Delete(name string, opts *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (runtime.Object, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOptions *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Patch(name string, o runtime.Object, data []byte, subresources ...string) (runtime.Object, error)
ObjectFactory() ObjectFactory
}
type ObjectClient struct {
restClient rest.Interface
resource *metav1.APIResource
@ -49,7 +65,7 @@ func NewObjectClient(namespace string, restClient rest.Interface, apiResource *m
}
}
func (p *ObjectClient) UnstructuredClient() *ObjectClient {
func (p *ObjectClient) UnstructuredClient() GenericClient {
return &ObjectClient{
restClient: p.restClient,
resource: p.resource,
@ -230,6 +246,10 @@ func (p *ObjectClient) Patch(name string, o runtime.Object, data []byte, subreso
return result, err
}
func (p *ObjectClient) ObjectFactory() ObjectFactory {
return p.Factory
}
type dynamicDecoder struct {
factory ObjectFactory
dec *json.Decoder

View File

@ -10,8 +10,11 @@ import (
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/types"
"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
)
@ -31,6 +34,12 @@ type GenericController interface {
Start(ctx context.Context, threadiness int) error
}
type Backend interface {
List(opts metav1.ListOptions) (runtime.Object, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
ObjectFactory() clientbase.ObjectFactory
}
type handlerDef struct {
name string
handler HandlerFunc
@ -46,13 +55,13 @@ type genericController struct {
synced bool
}
func NewGenericController(name string, objectClient *clientbase.ObjectClient) GenericController {
func NewGenericController(name string, genericClient Backend) GenericController {
informer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: objectClient.List,
WatchFunc: objectClient.Watch,
ListFunc: genericClient.List,
WatchFunc: genericClient.Watch,
},
objectClient.Factory.Object(), resyncPeriod, cache.Indexers{})
genericClient.ObjectFactory().Object(), resyncPeriod, cache.Indexers{})
rl := workqueue.NewMaxOfRateLimiter(
workqueue.NewItemExponentialFailureRateLimiter(500*time.Millisecond, 1000*time.Second),

View File

@ -267,6 +267,9 @@ func (s *Schemas) readFields(schema *Schema, t reflect.Type) error {
if fieldType.Kind() == reflect.Ptr {
schemaField.Nullable = true
fieldType = fieldType.Elem()
} else if fieldType.Kind() == reflect.Bool {
schemaField.Nullable = false
schemaField.Default = false
}
if err := applyTag(&field, &schemaField); err != nil {