Update ingress godeps

This commit is contained in:
Manuel de Brito Fontes 2016-08-10 14:53:55 -04:00
parent d43021b3f1
commit 28db8fb16d
1068 changed files with 461467 additions and 117300 deletions

View file

@ -212,6 +212,10 @@ func (b *Builder) ResourceNames(resource string, names ...string) *Builder {
b.resourceTuples = append(b.resourceTuples, tuple)
continue
}
if len(resource) == 0 {
b.errs = append(b.errs, fmt.Errorf("the argument %q must be RESOURCE/NAME", name))
continue
}
// Use the given default type to create a resource tuple
b.resourceTuples = append(b.resourceTuples, resourceTuple{Resource: resource, Name: name})
@ -333,7 +337,7 @@ func (b *Builder) ResourceTypeOrNameArgs(allowEmptySelector bool, args ...string
}
case len(args) == 0:
default:
b.errs = append(b.errs, fmt.Errorf("when passing arguments, must be resource or resource and name"))
b.errs = append(b.errs, fmt.Errorf("arguments must consist of a resource or a resource and name"))
}
return b
}
@ -362,7 +366,12 @@ func hasCombinedTypeArgs(args []string) (bool, error) {
case hasSlash > 0 && hasSlash == len(args):
return true, nil
case hasSlash > 0 && hasSlash != len(args):
return true, fmt.Errorf("when passing arguments in resource/name form, all arguments must include the resource")
baseCmd := "cmd"
if len(os.Args) > 0 {
baseCmdSlice := strings.Split(os.Args[0], "/")
baseCmd = baseCmdSlice[len(baseCmdSlice)-1]
}
return true, fmt.Errorf("there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. '%s get resource/<resource_name>' instead of '%s get resource resource/<resource_name>'", baseCmd, baseCmd)
default:
return false, nil
}
@ -449,7 +458,7 @@ func (b *Builder) mappingFor(resourceArg string) (*meta.RESTMapping, error) {
if fullySpecifiedGVR != nil {
gvk, _ = b.mapper.KindFor(*fullySpecifiedGVR)
}
if gvk.IsEmpty() {
if gvk.Empty() {
var err error
gvk, err = b.mapper.KindFor(groupResource.WithVersion(""))
if err != nil {

View file

@ -22,7 +22,6 @@ import (
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/registry/thirdpartyresourcedata"
"k8s.io/kubernetes/pkg/runtime"
)
@ -54,20 +53,8 @@ func (m *Mapper) InfoForData(data []byte, source string) (*Info, error) {
if err != nil {
return nil, fmt.Errorf("unable to decode %q: %v", source, err)
}
var obj runtime.Object
var versioned runtime.Object
if isThirdParty, gvkOut, err := thirdpartyresourcedata.IsThirdPartyObject(data, gvk); err != nil {
return nil, err
} else if isThirdParty {
obj, err = runtime.Decode(thirdpartyresourcedata.NewDecoder(nil, gvkOut.Kind), data)
versioned = obj
gvk = gvkOut
} else {
obj, versioned = versions.Last(), versions.First()
}
if err != nil {
return nil, fmt.Errorf("unable to decode %q: %v [%v]", source, err, gvk)
}
obj, versioned := versions.Last(), versions.First()
mapping, err := m.RESTMapping(gvk.GroupKind(), gvk.Version)
if err != nil {
return nil, fmt.Errorf("unable to recognize %q: %v", source, err)

View file

@ -250,7 +250,7 @@ func AsVersionedObjects(infos []*Info, version unversioned.GroupVersion, encoder
// objects that are not part of api.Scheme must be converted to JSON
// TODO: convert to map[string]interface{}, attach to runtime.Unknown?
if !version.IsEmpty() {
if !version.Empty() {
if _, _, err := api.Scheme.ObjectKinds(info.Object); runtime.IsNotRegisteredError(err) {
// TODO: ideally this would encode to version, but we don't expose multiple codecs here.
data, err := runtime.Encode(encoder, info.Object)
@ -274,13 +274,13 @@ func AsVersionedObjects(infos []*Info, version unversioned.GroupVersion, encoder
// tryConvert attempts to convert the given object to the provided versions in order. This function assumes
// the object is in internal version.
func tryConvert(convertor runtime.ObjectConvertor, object runtime.Object, versions ...unversioned.GroupVersion) (runtime.Object, error) {
func tryConvert(converter runtime.ObjectConvertor, object runtime.Object, versions ...unversioned.GroupVersion) (runtime.Object, error) {
var last error
for _, version := range versions {
if version.IsEmpty() {
if version.Empty() {
return object, nil
}
obj, err := convertor.ConvertToVersion(object, version)
obj, err := converter.ConvertToVersion(object, version)
if err != nil {
last = err
continue

View file

@ -207,10 +207,6 @@ func ValidateSchema(data []byte, schema validation.Schema) error {
if schema == nil {
return nil
}
data, err := yaml.ToJSON(data)
if err != nil {
return fmt.Errorf("error converting to YAML: %v", err)
}
if err := schema.ValidateBytes(data); err != nil {
return fmt.Errorf("error validating data: %v; %s", err, stopValidateMessage)
}
@ -389,7 +385,7 @@ func (v FlattenListVisitor) Visit(fn VisitorFunc) error {
// If we have a GroupVersionKind on the list, prioritize that when asking for info on the objects contained in the list
var preferredGVKs []unversioned.GroupVersionKind
if info.Mapping != nil && !info.Mapping.GroupVersionKind.IsEmpty() {
if info.Mapping != nil && !info.Mapping.GroupVersionKind.Empty() {
preferredGVKs = append(preferredGVKs, info.Mapping.GroupVersionKind)
}
@ -431,7 +427,7 @@ func FileVisitorForSTDIN(mapper *Mapper, schema validation.Schema) Visitor {
}
// ExpandPathsToFileVisitors will return a slice of FileVisitors that will handle files from the provided path.
// After FileVisitors open the files, they will pass a io.Reader to a StreamVisitor to do the reading. (stdin
// After FileVisitors open the files, they will pass an io.Reader to a StreamVisitor to do the reading. (stdin
// is also taken care of). Paths argument also accepts a single file, and will return a single visitor
func ExpandPathsToFileVisitors(mapper *Mapper, paths string, recursive bool, extensions []string, schema validation.Schema) ([]Visitor, error) {
var visitors []Visitor
@ -622,13 +618,7 @@ func RetrieveLatest(info *Info, err error) error {
if info.Namespaced() && len(info.Namespace) == 0 {
return fmt.Errorf("no namespace set on resource %s %q", info.Mapping.Resource, info.Name)
}
obj, err := NewHelper(info.Client, info.Mapping).Get(info.Namespace, info.Name, info.Export)
if err != nil {
return err
}
info.Object = obj
info.ResourceVersion, _ = info.Mapping.MetadataAccessor.ResourceVersion(obj)
return nil
return info.Get()
}
// RetrieveLazy updates the object if it has not been loaded yet.