Update ingress godeps
This commit is contained in:
parent
d43021b3f1
commit
28db8fb16d
1068 changed files with 461467 additions and 117300 deletions
94
vendor/k8s.io/kubernetes/pkg/runtime/codec.go
generated
vendored
94
vendor/k8s.io/kubernetes/pkg/runtime/codec.go
generated
vendored
|
|
@ -80,12 +80,14 @@ func EncodeOrDie(e Encoder, obj Object) string {
|
|||
// invokes the ObjectCreator to instantiate a new gvk. Returns an error if the typer cannot find the object.
|
||||
func UseOrCreateObject(t ObjectTyper, c ObjectCreater, gvk unversioned.GroupVersionKind, obj Object) (Object, error) {
|
||||
if obj != nil {
|
||||
into, _, err := t.ObjectKinds(obj)
|
||||
kinds, _, err := t.ObjectKinds(obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if gvk == into[0] {
|
||||
return obj, nil
|
||||
for _, kind := range kinds {
|
||||
if gvk == kind {
|
||||
return obj, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return c.New(gvk)
|
||||
|
|
@ -143,16 +145,16 @@ func (c *parameterCodec) DecodeParameters(parameters url.Values, from unversione
|
|||
}
|
||||
targetGVK := targetGVKs[0]
|
||||
if targetGVK.GroupVersion() == from {
|
||||
return c.convertor.Convert(¶meters, into)
|
||||
return c.convertor.Convert(¶meters, into, nil)
|
||||
}
|
||||
input, err := c.creator.New(from.WithKind(targetGVK.Kind))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := c.convertor.Convert(¶meters, input); err != nil {
|
||||
if err := c.convertor.Convert(¶meters, input, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
return c.convertor.Convert(input, into)
|
||||
return c.convertor.Convert(input, into, nil)
|
||||
}
|
||||
|
||||
// EncodeParameters converts the provided object into the to version, then converts that object to url.Values.
|
||||
|
|
@ -196,3 +198,83 @@ func (s base64Serializer) Decode(data []byte, defaults *unversioned.GroupVersion
|
|||
}
|
||||
return s.Serializer.Decode(out[:n], defaults, into)
|
||||
}
|
||||
|
||||
var (
|
||||
// InternalGroupVersioner will always prefer the internal version for a given group version kind.
|
||||
InternalGroupVersioner GroupVersioner = internalGroupVersioner{}
|
||||
// DisabledGroupVersioner will reject all kinds passed to it.
|
||||
DisabledGroupVersioner GroupVersioner = disabledGroupVersioner{}
|
||||
)
|
||||
|
||||
type internalGroupVersioner struct{}
|
||||
|
||||
// KindForGroupVersionKinds returns an internal Kind if one is found, or converts the first provided kind to the internal version.
|
||||
func (internalGroupVersioner) KindForGroupVersionKinds(kinds []unversioned.GroupVersionKind) (unversioned.GroupVersionKind, bool) {
|
||||
for _, kind := range kinds {
|
||||
if kind.Version == APIVersionInternal {
|
||||
return kind, true
|
||||
}
|
||||
}
|
||||
for _, kind := range kinds {
|
||||
return unversioned.GroupVersionKind{Group: kind.Group, Version: APIVersionInternal, Kind: kind.Kind}, true
|
||||
}
|
||||
return unversioned.GroupVersionKind{}, false
|
||||
}
|
||||
|
||||
type disabledGroupVersioner struct{}
|
||||
|
||||
// KindForGroupVersionKinds returns false for any input.
|
||||
func (disabledGroupVersioner) KindForGroupVersionKinds(kinds []unversioned.GroupVersionKind) (unversioned.GroupVersionKind, bool) {
|
||||
return unversioned.GroupVersionKind{}, false
|
||||
}
|
||||
|
||||
// GroupVersioners implements GroupVersioner and resolves to the first exact match for any kind.
|
||||
type GroupVersioners []GroupVersioner
|
||||
|
||||
// KindForGroupVersionKinds returns the first match of any of the group versioners, or false if no match occured.
|
||||
func (gvs GroupVersioners) KindForGroupVersionKinds(kinds []unversioned.GroupVersionKind) (unversioned.GroupVersionKind, bool) {
|
||||
for _, gv := range gvs {
|
||||
target, ok := gv.KindForGroupVersionKinds(kinds)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
return target, true
|
||||
}
|
||||
return unversioned.GroupVersionKind{}, false
|
||||
}
|
||||
|
||||
// Assert that unversioned.GroupVersion and GroupVersions implement GroupVersioner
|
||||
var _ GroupVersioner = unversioned.GroupVersion{}
|
||||
var _ GroupVersioner = unversioned.GroupVersions{}
|
||||
var _ GroupVersioner = multiGroupVersioner{}
|
||||
|
||||
type multiGroupVersioner struct {
|
||||
target unversioned.GroupVersion
|
||||
acceptedGroupKinds []unversioned.GroupKind
|
||||
}
|
||||
|
||||
// NewMultiGroupVersioner returns the provided group version for any kind that matches one of the provided group kinds.
|
||||
// Kind may be empty in the provided group kind, in which case any kind will match.
|
||||
func NewMultiGroupVersioner(gv unversioned.GroupVersion, groupKinds ...unversioned.GroupKind) GroupVersioner {
|
||||
if len(groupKinds) == 0 || (len(groupKinds) == 1 && groupKinds[0].Group == gv.Group) {
|
||||
return gv
|
||||
}
|
||||
return multiGroupVersioner{target: gv, acceptedGroupKinds: groupKinds}
|
||||
}
|
||||
|
||||
// KindForGroupVersionKinds returns the target group version if any kind matches any of the original group kinds. It will
|
||||
// use the originating kind where possible.
|
||||
func (v multiGroupVersioner) KindForGroupVersionKinds(kinds []unversioned.GroupVersionKind) (unversioned.GroupVersionKind, bool) {
|
||||
for _, src := range kinds {
|
||||
for _, kind := range v.acceptedGroupKinds {
|
||||
if kind.Group != src.Group {
|
||||
continue
|
||||
}
|
||||
if len(kind.Kind) > 0 && kind.Kind != src.Kind {
|
||||
continue
|
||||
}
|
||||
return v.target.WithKind(src.Kind), true
|
||||
}
|
||||
}
|
||||
return unversioned.GroupVersionKind{}, false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue