Update go dependencies (#4322)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-07-17 09:21:14 -04:00 committed by GitHub
parent 28cc3bb5e2
commit a54ab3341e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
507 changed files with 50566 additions and 40414 deletions

View file

@ -284,7 +284,7 @@ func (b *Builder) WithScheme(scheme *runtime.Scheme, decodingVersions ...schema.
// if you specified versions, you're specifying a desire for external types, which you don't want to round-trip through
// internal types
if len(decodingVersions) > 0 {
negotiatedSerializer = &serializer.DirectCodecFactory{CodecFactory: codecFactory}
negotiatedSerializer = codecFactory.WithoutConversion()
}
b.negotiatedSerializer = negotiatedSerializer

View file

@ -41,11 +41,13 @@ func (dynamicCodec) Decode(data []byte, gvk *schema.GroupVersionKind, obj runtim
return nil, nil, err
}
if _, ok := obj.(*metav1.Status); !ok && strings.ToLower(gvk.Kind) == "status" {
obj = &metav1.Status{}
err := json.Unmarshal(data, obj)
if err != nil {
return nil, nil, err
if strings.ToLower(gvk.Kind) == "status" && gvk.Version == "v1" && (gvk.Group == "" || gvk.Group == "meta.k8s.io") {
if _, ok := obj.(*metav1.Status); !ok {
obj = &metav1.Status{}
err := json.Unmarshal(data, obj)
if err != nil {
return nil, nil, err
}
}
}
@ -56,18 +58,12 @@ func (dynamicCodec) Encode(obj runtime.Object, w io.Writer) error {
return unstructured.UnstructuredJSONScheme.Encode(obj, w)
}
// ContentConfig returns a rest.ContentConfig for dynamic types. It includes enough codecs to act as a "normal"
// UnstructuredPlusDefaultContentConfig returns a rest.ContentConfig for dynamic types. It includes enough codecs to act as a "normal"
// serializer for the rest.client with options, status and the like.
func UnstructuredPlusDefaultContentConfig() rest.ContentConfig {
var jsonInfo runtime.SerializerInfo
// TODO: scheme.Codecs here should become "pkg/apis/server/scheme" which is the minimal core you need
// to talk to a kubernetes server
for _, info := range scheme.Codecs.SupportedMediaTypes() {
if info.MediaType == runtime.ContentTypeJSON {
jsonInfo = info
break
}
}
jsonInfo, _ := runtime.SerializerInfoForMediaType(scheme.Codecs.SupportedMediaTypes(), runtime.ContentTypeJSON)
jsonInfo.Serializer = dynamicCodec{}
jsonInfo.PrettySerializer = nil

View file

@ -169,7 +169,12 @@ func (i *Info) String() string {
// Namespaced returns true if the object belongs to a namespace
func (i *Info) Namespaced() bool {
return i.Mapping != nil && i.Mapping.Scope.Name() == meta.RESTScopeNameNamespace
if i.Mapping != nil {
// if we have RESTMapper info, use it
return i.Mapping.Scope.Name() == meta.RESTScopeNameNamespace
}
// otherwise, use the presence of a namespace in the info as an indicator
return len(i.Namespace) > 0
}
// Watch returns server changes to this object after it was retrieved.