Merge pull request #113244 from SataQiu/print-detail-20221021

kubeadm: print the detailed manifest info when decoding it into runtime.Object fails
This commit is contained in:
Kubernetes Prow Robot 2022-10-21 02:59:50 -07:00 committed by GitHub
commit e876d63ec2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,7 +70,11 @@ func UnmarshalFromYamlForCodecs(buffer []byte, gv schema.GroupVersion, codecs se
}
decoder := codecs.DecoderToVersion(info.Serializer, gv)
return runtime.Decode(decoder, buffer)
obj, err := runtime.Decode(decoder, buffer)
if err != nil {
return nil, errors.Wrapf(err, "failed to decode %s into runtime.Object", buffer)
}
return obj, nil
}
// SplitYAMLDocuments reads the YAML bytes per-document, unmarshals the TypeMeta information from each document