mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
Update to kube v1.17
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
327fcd1b1b
commit
3af1e26d7c
92
vendor/k8s.io/apimachinery/pkg/runtime/codec.go
generated
vendored
92
vendor/k8s.io/apimachinery/pkg/runtime/codec.go
generated
vendored
@ -19,13 +19,17 @@ package runtime
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/conversion/queryparams"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// codec binds an encoder and decoder.
|
||||
@ -100,10 +104,19 @@ type NoopEncoder struct {
|
||||
|
||||
var _ Serializer = NoopEncoder{}
|
||||
|
||||
const noopEncoderIdentifier Identifier = "noop"
|
||||
|
||||
func (n NoopEncoder) Encode(obj Object, w io.Writer) error {
|
||||
// There is no need to handle runtime.CacheableObject, as we don't
|
||||
// process the obj at all.
|
||||
return fmt.Errorf("encoding is not allowed for this codec: %v", reflect.TypeOf(n.Decoder))
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (n NoopEncoder) Identifier() Identifier {
|
||||
return noopEncoderIdentifier
|
||||
}
|
||||
|
||||
// NoopDecoder converts an Encoder to a Serializer or Codec for code that expects them but only uses encoding.
|
||||
type NoopDecoder struct {
|
||||
Encoder
|
||||
@ -193,19 +206,51 @@ func (c *parameterCodec) EncodeParameters(obj Object, to schema.GroupVersion) (u
|
||||
type base64Serializer struct {
|
||||
Encoder
|
||||
Decoder
|
||||
|
||||
identifier Identifier
|
||||
}
|
||||
|
||||
func NewBase64Serializer(e Encoder, d Decoder) Serializer {
|
||||
return &base64Serializer{e, d}
|
||||
return &base64Serializer{
|
||||
Encoder: e,
|
||||
Decoder: d,
|
||||
identifier: identifier(e),
|
||||
}
|
||||
}
|
||||
|
||||
func identifier(e Encoder) Identifier {
|
||||
result := map[string]string{
|
||||
"name": "base64",
|
||||
}
|
||||
if e != nil {
|
||||
result["encoder"] = string(e.Identifier())
|
||||
}
|
||||
identifier, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed marshaling identifier for base64Serializer: %v", err)
|
||||
}
|
||||
return Identifier(identifier)
|
||||
}
|
||||
|
||||
func (s base64Serializer) Encode(obj Object, stream io.Writer) error {
|
||||
if co, ok := obj.(CacheableObject); ok {
|
||||
return co.CacheEncode(s.Identifier(), s.doEncode, stream)
|
||||
}
|
||||
return s.doEncode(obj, stream)
|
||||
}
|
||||
|
||||
func (s base64Serializer) doEncode(obj Object, stream io.Writer) error {
|
||||
e := base64.NewEncoder(base64.StdEncoding, stream)
|
||||
err := s.Encoder.Encode(obj, e)
|
||||
e.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (s base64Serializer) Identifier() Identifier {
|
||||
return s.identifier
|
||||
}
|
||||
|
||||
func (s base64Serializer) Decode(data []byte, defaults *schema.GroupVersionKind, into Object) (Object, *schema.GroupVersionKind, error) {
|
||||
out := make([]byte, base64.StdEncoding.DecodedLen(len(data)))
|
||||
n, err := base64.StdEncoding.Decode(out, data)
|
||||
@ -238,6 +283,11 @@ var (
|
||||
DisabledGroupVersioner GroupVersioner = disabledGroupVersioner{}
|
||||
)
|
||||
|
||||
const (
|
||||
internalGroupVersionerIdentifier = "internal"
|
||||
disabledGroupVersionerIdentifier = "disabled"
|
||||
)
|
||||
|
||||
type internalGroupVersioner struct{}
|
||||
|
||||
// KindForGroupVersionKinds returns an internal Kind if one is found, or converts the first provided kind to the internal version.
|
||||
@ -253,6 +303,11 @@ func (internalGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersi
|
||||
return schema.GroupVersionKind{}, false
|
||||
}
|
||||
|
||||
// Identifier implements GroupVersioner interface.
|
||||
func (internalGroupVersioner) Identifier() string {
|
||||
return internalGroupVersionerIdentifier
|
||||
}
|
||||
|
||||
type disabledGroupVersioner struct{}
|
||||
|
||||
// KindForGroupVersionKinds returns false for any input.
|
||||
@ -260,19 +315,9 @@ func (disabledGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersi
|
||||
return schema.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 occurred.
|
||||
func (gvs GroupVersioners) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) {
|
||||
for _, gv := range gvs {
|
||||
target, ok := gv.KindForGroupVersionKinds(kinds)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
return target, true
|
||||
}
|
||||
return schema.GroupVersionKind{}, false
|
||||
// Identifier implements GroupVersioner interface.
|
||||
func (disabledGroupVersioner) Identifier() string {
|
||||
return disabledGroupVersionerIdentifier
|
||||
}
|
||||
|
||||
// Assert that schema.GroupVersion and GroupVersions implement GroupVersioner
|
||||
@ -330,3 +375,22 @@ func (v multiGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersio
|
||||
}
|
||||
return schema.GroupVersionKind{}, false
|
||||
}
|
||||
|
||||
// Identifier implements GroupVersioner interface.
|
||||
func (v multiGroupVersioner) Identifier() string {
|
||||
groupKinds := make([]string, 0, len(v.acceptedGroupKinds))
|
||||
for _, gk := range v.acceptedGroupKinds {
|
||||
groupKinds = append(groupKinds, gk.String())
|
||||
}
|
||||
result := map[string]string{
|
||||
"name": "multi",
|
||||
"target": v.target.String(),
|
||||
"accepted": strings.Join(groupKinds, ","),
|
||||
"coerce": strconv.FormatBool(v.coerce),
|
||||
}
|
||||
identifier, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed marshaling Identifier for %#v: %v", v, err)
|
||||
}
|
||||
return string(identifier)
|
||||
}
|
||||
|
99
vendor/k8s.io/apimachinery/pkg/runtime/conversion.go
generated
vendored
99
vendor/k8s.io/apimachinery/pkg/runtime/conversion.go
generated
vendored
@ -61,19 +61,21 @@ var DefaultStringConversions = []interface{}{
|
||||
Convert_Slice_string_To_int64,
|
||||
}
|
||||
|
||||
func Convert_Slice_string_To_string(input *[]string, out *string, s conversion.Scope) error {
|
||||
if len(*input) == 0 {
|
||||
func Convert_Slice_string_To_string(in *[]string, out *string, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
*out = ""
|
||||
return nil
|
||||
}
|
||||
*out = (*input)[0]
|
||||
*out = (*in)[0]
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_Slice_string_To_int(input *[]string, out *int, s conversion.Scope) error {
|
||||
if len(*input) == 0 {
|
||||
func Convert_Slice_string_To_int(in *[]string, out *int, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
*out = 0
|
||||
return nil
|
||||
}
|
||||
str := (*input)[0]
|
||||
str := (*in)[0]
|
||||
i, err := strconv.Atoi(str)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -83,15 +85,16 @@ func Convert_Slice_string_To_int(input *[]string, out *int, s conversion.Scope)
|
||||
}
|
||||
|
||||
// Convert_Slice_string_To_bool will convert a string parameter to boolean.
|
||||
// Only the absence of a value, a value of "false", or a value of "0" resolve to false.
|
||||
// Only the absence of a value (i.e. zero-length slice), a value of "false", or a
|
||||
// value of "0" resolve to false.
|
||||
// Any other value (including empty string) resolves to true.
|
||||
func Convert_Slice_string_To_bool(input *[]string, out *bool, s conversion.Scope) error {
|
||||
if len(*input) == 0 {
|
||||
func Convert_Slice_string_To_bool(in *[]string, out *bool, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
*out = false
|
||||
return nil
|
||||
}
|
||||
switch strings.ToLower((*input)[0]) {
|
||||
case "false", "0":
|
||||
switch {
|
||||
case (*in)[0] == "0", strings.EqualFold((*in)[0], "false"):
|
||||
*out = false
|
||||
default:
|
||||
*out = true
|
||||
@ -99,15 +102,79 @@ func Convert_Slice_string_To_bool(input *[]string, out *bool, s conversion.Scope
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_Slice_string_To_int64(input *[]string, out *int64, s conversion.Scope) error {
|
||||
if len(*input) == 0 {
|
||||
*out = 0
|
||||
// Convert_Slice_string_To_bool will convert a string parameter to boolean.
|
||||
// Only the absence of a value (i.e. zero-length slice), a value of "false", or a
|
||||
// value of "0" resolve to false.
|
||||
// Any other value (including empty string) resolves to true.
|
||||
func Convert_Slice_string_To_Pointer_bool(in *[]string, out **bool, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
boolVar := false
|
||||
*out = &boolVar
|
||||
return nil
|
||||
}
|
||||
str := (*input)[0]
|
||||
i, err := strconv.ParseInt(str, 10, 64)
|
||||
switch {
|
||||
case (*in)[0] == "0", strings.EqualFold((*in)[0], "false"):
|
||||
boolVar := false
|
||||
*out = &boolVar
|
||||
default:
|
||||
boolVar := true
|
||||
*out = &boolVar
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func string_to_int64(in string) (int64, error) {
|
||||
return strconv.ParseInt(in, 10, 64)
|
||||
}
|
||||
|
||||
func Convert_string_To_int64(in *string, out *int64, s conversion.Scope) error {
|
||||
if in == nil {
|
||||
*out = 0
|
||||
return nil
|
||||
}
|
||||
i, err := string_to_int64(*in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*out = i
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_Slice_string_To_int64(in *[]string, out *int64, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
*out = 0
|
||||
return nil
|
||||
}
|
||||
i, err := string_to_int64((*in)[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*out = i
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_string_To_Pointer_int64(in *string, out **int64, s conversion.Scope) error {
|
||||
if in == nil {
|
||||
*out = nil
|
||||
return nil
|
||||
}
|
||||
i, err := string_to_int64(*in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*out = &i
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_Slice_string_To_Pointer_int64(in *[]string, out **int64, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
*out = nil
|
||||
return nil
|
||||
}
|
||||
i, err := string_to_int64((*in)[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*out = &i
|
||||
return nil
|
||||
}
|
||||
|
2
vendor/k8s.io/apimachinery/pkg/runtime/converter.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/converter.go
generated
vendored
@ -94,7 +94,7 @@ func parseBool(key string) bool {
|
||||
}
|
||||
value, err := strconv.ParseBool(key)
|
||||
if err != nil {
|
||||
utilruntime.HandleError(fmt.Errorf("Couldn't parse '%s' as bool for unstructured mismatch detection", key))
|
||||
utilruntime.HandleError(fmt.Errorf("couldn't parse '%s' as bool for unstructured mismatch detection", key))
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
364
vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
generated
vendored
364
vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
generated
vendored
@ -17,27 +17,19 @@ limitations under the License.
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
|
||||
|
||||
/*
|
||||
Package runtime is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
RawExtension
|
||||
TypeMeta
|
||||
Unknown
|
||||
*/
|
||||
package runtime
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import (
|
||||
fmt "fmt"
|
||||
|
||||
import strings "strings"
|
||||
import reflect "reflect"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
reflect "reflect"
|
||||
strings "strings"
|
||||
|
||||
import io "io"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
@ -50,27 +42,132 @@ var _ = math.Inf
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
func (m *RawExtension) Reset() { *m = RawExtension{} }
|
||||
func (*RawExtension) ProtoMessage() {}
|
||||
func (*RawExtension) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
func (m *RawExtension) Reset() { *m = RawExtension{} }
|
||||
func (*RawExtension) ProtoMessage() {}
|
||||
func (*RawExtension) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_9d3c45d7f546725c, []int{0}
|
||||
}
|
||||
func (m *RawExtension) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *RawExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
func (m *RawExtension) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_RawExtension.Merge(m, src)
|
||||
}
|
||||
func (m *RawExtension) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *RawExtension) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_RawExtension.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
func (m *TypeMeta) Reset() { *m = TypeMeta{} }
|
||||
func (*TypeMeta) ProtoMessage() {}
|
||||
func (*TypeMeta) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
|
||||
var xxx_messageInfo_RawExtension proto.InternalMessageInfo
|
||||
|
||||
func (m *Unknown) Reset() { *m = Unknown{} }
|
||||
func (*Unknown) ProtoMessage() {}
|
||||
func (*Unknown) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
|
||||
func (m *TypeMeta) Reset() { *m = TypeMeta{} }
|
||||
func (*TypeMeta) ProtoMessage() {}
|
||||
func (*TypeMeta) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_9d3c45d7f546725c, []int{1}
|
||||
}
|
||||
func (m *TypeMeta) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *TypeMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
func (m *TypeMeta) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TypeMeta.Merge(m, src)
|
||||
}
|
||||
func (m *TypeMeta) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *TypeMeta) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TypeMeta.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TypeMeta proto.InternalMessageInfo
|
||||
|
||||
func (m *Unknown) Reset() { *m = Unknown{} }
|
||||
func (*Unknown) ProtoMessage() {}
|
||||
func (*Unknown) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_9d3c45d7f546725c, []int{2}
|
||||
}
|
||||
func (m *Unknown) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Unknown) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
func (m *Unknown) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Unknown.Merge(m, src)
|
||||
}
|
||||
func (m *Unknown) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *Unknown) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Unknown.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Unknown proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*RawExtension)(nil), "k8s.io.apimachinery.pkg.runtime.RawExtension")
|
||||
proto.RegisterType((*TypeMeta)(nil), "k8s.io.apimachinery.pkg.runtime.TypeMeta")
|
||||
proto.RegisterType((*Unknown)(nil), "k8s.io.apimachinery.pkg.runtime.Unknown")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto", fileDescriptor_9d3c45d7f546725c)
|
||||
}
|
||||
|
||||
var fileDescriptor_9d3c45d7f546725c = []byte{
|
||||
// 378 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x8f, 0x4f, 0xab, 0x13, 0x31,
|
||||
0x14, 0xc5, 0x27, 0xaf, 0x85, 0x3e, 0xd3, 0xc2, 0x93, 0xb8, 0x70, 0x74, 0x91, 0x79, 0x74, 0xe5,
|
||||
0x5b, 0xbc, 0x04, 0x1e, 0x08, 0x6e, 0x3b, 0xa5, 0xa0, 0x88, 0x20, 0xc1, 0x3f, 0xe0, 0xca, 0x74,
|
||||
0x26, 0x4e, 0xc3, 0xd0, 0x9b, 0x21, 0xcd, 0x38, 0x76, 0xe7, 0x47, 0xf0, 0x63, 0x75, 0xd9, 0x65,
|
||||
0x57, 0xc5, 0x8e, 0x1f, 0xc2, 0xad, 0x34, 0x4d, 0x6b, 0xd5, 0x85, 0xbb, 0xe4, 0x9e, 0xf3, 0x3b,
|
||||
0xf7, 0x1e, 0xfc, 0xbc, 0x7c, 0xb6, 0x60, 0xda, 0xf0, 0xb2, 0x9e, 0x2a, 0x0b, 0xca, 0xa9, 0x05,
|
||||
0xff, 0xac, 0x20, 0x37, 0x96, 0x07, 0x41, 0x56, 0x7a, 0x2e, 0xb3, 0x99, 0x06, 0x65, 0x97, 0xbc,
|
||||
0x2a, 0x0b, 0x6e, 0x6b, 0x70, 0x7a, 0xae, 0x78, 0xa1, 0x40, 0x59, 0xe9, 0x54, 0xce, 0x2a, 0x6b,
|
||||
0x9c, 0x21, 0xc9, 0x01, 0x60, 0xe7, 0x00, 0xab, 0xca, 0x82, 0x05, 0xe0, 0xf1, 0x6d, 0xa1, 0xdd,
|
||||
0xac, 0x9e, 0xb2, 0xcc, 0xcc, 0x79, 0x61, 0x0a, 0xc3, 0x3d, 0x37, 0xad, 0x3f, 0xf9, 0x9f, 0xff,
|
||||
0xf8, 0xd7, 0x21, 0x6f, 0x78, 0x83, 0x07, 0x42, 0x36, 0x93, 0x2f, 0x4e, 0xc1, 0x42, 0x1b, 0x20,
|
||||
0x8f, 0x70, 0xc7, 0xca, 0x26, 0x46, 0xd7, 0xe8, 0xc9, 0x20, 0xed, 0xb5, 0xdb, 0xa4, 0x23, 0x64,
|
||||
0x23, 0xf6, 0xb3, 0xe1, 0x47, 0x7c, 0xf9, 0x66, 0x59, 0xa9, 0x57, 0xca, 0x49, 0x72, 0x87, 0xb1,
|
||||
0xac, 0xf4, 0x3b, 0x65, 0xf7, 0x90, 0x77, 0xdf, 0x4b, 0xc9, 0x6a, 0x9b, 0x44, 0xed, 0x36, 0xc1,
|
||||
0xa3, 0xd7, 0x2f, 0x82, 0x22, 0xce, 0x5c, 0xe4, 0x1a, 0x77, 0x4b, 0x0d, 0x79, 0x7c, 0xe1, 0xdd,
|
||||
0x83, 0xe0, 0xee, 0xbe, 0xd4, 0x90, 0x0b, 0xaf, 0x0c, 0x7f, 0x22, 0xdc, 0x7b, 0x0b, 0x25, 0x98,
|
||||
0x06, 0xc8, 0x7b, 0x7c, 0xe9, 0xc2, 0x36, 0x9f, 0xdf, 0xbf, 0xbb, 0x61, 0xff, 0xe9, 0xce, 0x8e,
|
||||
0xe7, 0xa5, 0xf7, 0x43, 0xf8, 0xe9, 0x60, 0x71, 0x0a, 0x3b, 0x36, 0xbc, 0xf8, 0xb7, 0x21, 0x19,
|
||||
0xe1, 0xab, 0xcc, 0x80, 0x53, 0xe0, 0x26, 0x90, 0x99, 0x5c, 0x43, 0x11, 0x77, 0xfc, 0xb1, 0x0f,
|
||||
0x43, 0xde, 0xd5, 0xf8, 0x4f, 0x59, 0xfc, 0xed, 0x27, 0x4f, 0x71, 0x3f, 0x8c, 0xf6, 0xab, 0xe3,
|
||||
0xae, 0xc7, 0x1f, 0x04, 0xbc, 0x3f, 0xfe, 0x2d, 0x89, 0x73, 0x5f, 0x7a, 0xbb, 0xda, 0xd1, 0x68,
|
||||
0xbd, 0xa3, 0xd1, 0x66, 0x47, 0xa3, 0xaf, 0x2d, 0x45, 0xab, 0x96, 0xa2, 0x75, 0x4b, 0xd1, 0xa6,
|
||||
0xa5, 0xe8, 0x7b, 0x4b, 0xd1, 0xb7, 0x1f, 0x34, 0xfa, 0xd0, 0x0b, 0x45, 0x7f, 0x05, 0x00, 0x00,
|
||||
0xff, 0xff, 0xe3, 0x33, 0x18, 0x0b, 0x50, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *RawExtension) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -78,23 +175,29 @@ func (m *RawExtension) Marshal() (dAtA []byte, err error) {
|
||||
}
|
||||
|
||||
func (m *RawExtension) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *RawExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Raw != nil {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i -= len(m.Raw)
|
||||
copy(dAtA[i:], m.Raw)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Raw)))
|
||||
i += copy(dAtA[i:], m.Raw)
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return i, nil
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *TypeMeta) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -102,25 +205,32 @@ func (m *TypeMeta) Marshal() (dAtA []byte, err error) {
|
||||
}
|
||||
|
||||
func (m *TypeMeta) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *TypeMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersion)))
|
||||
i += copy(dAtA[i:], m.APIVersion)
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i -= len(m.Kind)
|
||||
copy(dAtA[i:], m.Kind)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind)))
|
||||
i += copy(dAtA[i:], m.Kind)
|
||||
return i, nil
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
i -= len(m.APIVersion)
|
||||
copy(dAtA[i:], m.APIVersion)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersion)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *Unknown) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -128,45 +238,60 @@ func (m *Unknown) Marshal() (dAtA []byte, err error) {
|
||||
}
|
||||
|
||||
func (m *Unknown) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Unknown) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.TypeMeta.Size()))
|
||||
n1, err := m.TypeMeta.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
if m.Raw != nil {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Raw)))
|
||||
i += copy(dAtA[i:], m.Raw)
|
||||
}
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.ContentEncoding)))
|
||||
i += copy(dAtA[i:], m.ContentEncoding)
|
||||
dAtA[i] = 0x22
|
||||
i++
|
||||
i -= len(m.ContentType)
|
||||
copy(dAtA[i:], m.ContentType)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.ContentType)))
|
||||
i += copy(dAtA[i:], m.ContentType)
|
||||
return i, nil
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
i -= len(m.ContentEncoding)
|
||||
copy(dAtA[i:], m.ContentEncoding)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.ContentEncoding)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
if m.Raw != nil {
|
||||
i -= len(m.Raw)
|
||||
copy(dAtA[i:], m.Raw)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Raw)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
{
|
||||
size, err := m.TypeMeta.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovGenerated(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
return base
|
||||
}
|
||||
func (m *RawExtension) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Raw != nil {
|
||||
@ -177,6 +302,9 @@ func (m *RawExtension) Size() (n int) {
|
||||
}
|
||||
|
||||
func (m *TypeMeta) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.APIVersion)
|
||||
@ -187,6 +315,9 @@ func (m *TypeMeta) Size() (n int) {
|
||||
}
|
||||
|
||||
func (m *Unknown) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = m.TypeMeta.Size()
|
||||
@ -203,14 +334,7 @@ func (m *Unknown) Size() (n int) {
|
||||
}
|
||||
|
||||
func sovGenerated(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
@ -272,7 +396,7 @@ func (m *RawExtension) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -300,7 +424,7 @@ func (m *RawExtension) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= (int(b) & 0x7F) << shift
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -309,6 +433,9 @@ func (m *RawExtension) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -326,6 +453,9 @@ func (m *RawExtension) Unmarshal(dAtA []byte) error {
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -353,7 +483,7 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -381,7 +511,7 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -391,6 +521,9 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -410,7 +543,7 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -420,6 +553,9 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -434,6 +570,9 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -461,7 +600,7 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -489,7 +628,7 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -498,6 +637,9 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -519,7 +661,7 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= (int(b) & 0x7F) << shift
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -528,6 +670,9 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -550,7 +695,7 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -560,6 +705,9 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -579,7 +727,7 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -589,6 +737,9 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -603,6 +754,9 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -669,10 +823,13 @@ func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
iNdEx += length
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
@ -701,6 +858,9 @@ func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
@ -719,35 +879,3 @@ var (
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 378 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x8f, 0x4f, 0xab, 0x13, 0x31,
|
||||
0x14, 0xc5, 0x27, 0xaf, 0x85, 0x3e, 0xd3, 0xc2, 0x93, 0xb8, 0x70, 0x74, 0x91, 0x79, 0x74, 0xe5,
|
||||
0x5b, 0xbc, 0x04, 0x1e, 0x08, 0x6e, 0x3b, 0xa5, 0xa0, 0x88, 0x20, 0xc1, 0x3f, 0xe0, 0xca, 0x74,
|
||||
0x26, 0x4e, 0xc3, 0xd0, 0x9b, 0x21, 0xcd, 0x38, 0x76, 0xe7, 0x47, 0xf0, 0x63, 0x75, 0xd9, 0x65,
|
||||
0x57, 0xc5, 0x8e, 0x1f, 0xc2, 0xad, 0x34, 0x4d, 0x6b, 0xd5, 0x85, 0xbb, 0xe4, 0x9e, 0xf3, 0x3b,
|
||||
0xf7, 0x1e, 0xfc, 0xbc, 0x7c, 0xb6, 0x60, 0xda, 0xf0, 0xb2, 0x9e, 0x2a, 0x0b, 0xca, 0xa9, 0x05,
|
||||
0xff, 0xac, 0x20, 0x37, 0x96, 0x07, 0x41, 0x56, 0x7a, 0x2e, 0xb3, 0x99, 0x06, 0x65, 0x97, 0xbc,
|
||||
0x2a, 0x0b, 0x6e, 0x6b, 0x70, 0x7a, 0xae, 0x78, 0xa1, 0x40, 0x59, 0xe9, 0x54, 0xce, 0x2a, 0x6b,
|
||||
0x9c, 0x21, 0xc9, 0x01, 0x60, 0xe7, 0x00, 0xab, 0xca, 0x82, 0x05, 0xe0, 0xf1, 0x6d, 0xa1, 0xdd,
|
||||
0xac, 0x9e, 0xb2, 0xcc, 0xcc, 0x79, 0x61, 0x0a, 0xc3, 0x3d, 0x37, 0xad, 0x3f, 0xf9, 0x9f, 0xff,
|
||||
0xf8, 0xd7, 0x21, 0x6f, 0x78, 0x83, 0x07, 0x42, 0x36, 0x93, 0x2f, 0x4e, 0xc1, 0x42, 0x1b, 0x20,
|
||||
0x8f, 0x70, 0xc7, 0xca, 0x26, 0x46, 0xd7, 0xe8, 0xc9, 0x20, 0xed, 0xb5, 0xdb, 0xa4, 0x23, 0x64,
|
||||
0x23, 0xf6, 0xb3, 0xe1, 0x47, 0x7c, 0xf9, 0x66, 0x59, 0xa9, 0x57, 0xca, 0x49, 0x72, 0x87, 0xb1,
|
||||
0xac, 0xf4, 0x3b, 0x65, 0xf7, 0x90, 0x77, 0xdf, 0x4b, 0xc9, 0x6a, 0x9b, 0x44, 0xed, 0x36, 0xc1,
|
||||
0xa3, 0xd7, 0x2f, 0x82, 0x22, 0xce, 0x5c, 0xe4, 0x1a, 0x77, 0x4b, 0x0d, 0x79, 0x7c, 0xe1, 0xdd,
|
||||
0x83, 0xe0, 0xee, 0xbe, 0xd4, 0x90, 0x0b, 0xaf, 0x0c, 0x7f, 0x22, 0xdc, 0x7b, 0x0b, 0x25, 0x98,
|
||||
0x06, 0xc8, 0x7b, 0x7c, 0xe9, 0xc2, 0x36, 0x9f, 0xdf, 0xbf, 0xbb, 0x61, 0xff, 0xe9, 0xce, 0x8e,
|
||||
0xe7, 0xa5, 0xf7, 0x43, 0xf8, 0xe9, 0x60, 0x71, 0x0a, 0x3b, 0x36, 0xbc, 0xf8, 0xb7, 0x21, 0x19,
|
||||
0xe1, 0xab, 0xcc, 0x80, 0x53, 0xe0, 0x26, 0x90, 0x99, 0x5c, 0x43, 0x11, 0x77, 0xfc, 0xb1, 0x0f,
|
||||
0x43, 0xde, 0xd5, 0xf8, 0x4f, 0x59, 0xfc, 0xed, 0x27, 0x4f, 0x71, 0x3f, 0x8c, 0xf6, 0xab, 0xe3,
|
||||
0xae, 0xc7, 0x1f, 0x04, 0xbc, 0x3f, 0xfe, 0x2d, 0x89, 0x73, 0x5f, 0x7a, 0xbb, 0xda, 0xd1, 0x68,
|
||||
0xbd, 0xa3, 0xd1, 0x66, 0x47, 0xa3, 0xaf, 0x2d, 0x45, 0xab, 0x96, 0xa2, 0x75, 0x4b, 0xd1, 0xa6,
|
||||
0xa5, 0xe8, 0x7b, 0x4b, 0xd1, 0xb7, 0x1f, 0x34, 0xfa, 0xd0, 0x0b, 0x45, 0x7f, 0x05, 0x00, 0x00,
|
||||
0xff, 0xff, 0xe3, 0x33, 0x18, 0x0b, 0x50, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
66
vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
generated
vendored
66
vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
generated
vendored
@ -37,13 +37,36 @@ type GroupVersioner interface {
|
||||
// Scheme.New(target) and then perform a conversion between the current Go type and the destination Go type.
|
||||
// Sophisticated implementations may use additional information about the input kinds to pick a destination kind.
|
||||
KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (target schema.GroupVersionKind, ok bool)
|
||||
// Identifier returns string representation of the object.
|
||||
// Identifiers of two different encoders should be equal only if for every input
|
||||
// kinds they return the same result.
|
||||
Identifier() string
|
||||
}
|
||||
|
||||
// Identifier represents an identifier.
|
||||
// Identitier of two different objects should be equal if and only if for every
|
||||
// input the output they produce is exactly the same.
|
||||
type Identifier string
|
||||
|
||||
// Encoder writes objects to a serialized form
|
||||
type Encoder interface {
|
||||
// Encode writes an object to a stream. Implementations may return errors if the versions are
|
||||
// incompatible, or if no conversion is defined.
|
||||
Encode(obj Object, w io.Writer) error
|
||||
// Identifier returns an identifier of the encoder.
|
||||
// Identifiers of two different encoders should be equal if and only if for every input
|
||||
// object it will be encoded to the same representation by both of them.
|
||||
//
|
||||
// Identifier is inteted for use with CacheableObject#CacheEncode method. In order to
|
||||
// correctly handle CacheableObject, Encode() method should look similar to below, where
|
||||
// doEncode() is the encoding logic of implemented encoder:
|
||||
// func (e *MyEncoder) Encode(obj Object, w io.Writer) error {
|
||||
// if co, ok := obj.(CacheableObject); ok {
|
||||
// return co.CacheEncode(e.Identifier(), e.doEncode, w)
|
||||
// }
|
||||
// return e.doEncode(obj, w)
|
||||
// }
|
||||
Identifier() Identifier
|
||||
}
|
||||
|
||||
// Decoder attempts to load an object from data.
|
||||
@ -132,6 +155,28 @@ type NegotiatedSerializer interface {
|
||||
DecoderToVersion(serializer Decoder, gv GroupVersioner) Decoder
|
||||
}
|
||||
|
||||
// ClientNegotiator handles turning an HTTP content type into the appropriate encoder.
|
||||
// Use NewClientNegotiator or NewVersionedClientNegotiator to create this interface from
|
||||
// a NegotiatedSerializer.
|
||||
type ClientNegotiator interface {
|
||||
// Encoder returns the appropriate encoder for the provided contentType (e.g. application/json)
|
||||
// and any optional mediaType parameters (e.g. pretty=1), or an error. If no serializer is found
|
||||
// a NegotiateError will be returned. The current client implementations consider params to be
|
||||
// optional modifiers to the contentType and will ignore unrecognized parameters.
|
||||
Encoder(contentType string, params map[string]string) (Encoder, error)
|
||||
// Decoder returns the appropriate decoder for the provided contentType (e.g. application/json)
|
||||
// and any optional mediaType parameters (e.g. pretty=1), or an error. If no serializer is found
|
||||
// a NegotiateError will be returned. The current client implementations consider params to be
|
||||
// optional modifiers to the contentType and will ignore unrecognized parameters.
|
||||
Decoder(contentType string, params map[string]string) (Decoder, error)
|
||||
// StreamDecoder returns the appropriate stream decoder for the provided contentType (e.g.
|
||||
// application/json) and any optional mediaType parameters (e.g. pretty=1), or an error. If no
|
||||
// serializer is found a NegotiateError will be returned. The Serializer and Framer will always
|
||||
// be returned if a Decoder is returned. The current client implementations consider params to be
|
||||
// optional modifiers to the contentType and will ignore unrecognized parameters.
|
||||
StreamDecoder(contentType string, params map[string]string) (Decoder, Serializer, Framer, error)
|
||||
}
|
||||
|
||||
// StorageSerializer is an interface used for obtaining encoders, decoders, and serializers
|
||||
// that can read and write data at rest. This would commonly be used by client tools that must
|
||||
// read files, or server side storage interfaces that persist restful objects.
|
||||
@ -256,6 +301,27 @@ type Object interface {
|
||||
DeepCopyObject() Object
|
||||
}
|
||||
|
||||
// CacheableObject allows an object to cache its different serializations
|
||||
// to avoid performing the same serialization multiple times.
|
||||
type CacheableObject interface {
|
||||
// CacheEncode writes an object to a stream. The <encode> function will
|
||||
// be used in case of cache miss. The <encode> function takes ownership
|
||||
// of the object.
|
||||
// If CacheableObject is a wrapper, then deep-copy of the wrapped object
|
||||
// should be passed to <encode> function.
|
||||
// CacheEncode assumes that for two different calls with the same <id>,
|
||||
// <encode> function will also be the same.
|
||||
CacheEncode(id Identifier, encode func(Object, io.Writer) error, w io.Writer) error
|
||||
// GetObject returns a deep-copy of an object to be encoded - the caller of
|
||||
// GetObject() is the owner of returned object. The reason for making a copy
|
||||
// is to avoid bugs, where caller modifies the object and forgets to copy it,
|
||||
// thus modifying the object for everyone.
|
||||
// The object returned by GetObject should be the same as the one that is supposed
|
||||
// to be passed to <encode> function in CacheEncode method.
|
||||
// If CacheableObject is a wrapper, the copy of wrapped object should be returned.
|
||||
GetObject() Object
|
||||
}
|
||||
|
||||
// Unstructured objects store values as map[string]interface{}, with only values that can be serialized
|
||||
// to JSON allowed.
|
||||
type Unstructured interface {
|
||||
|
146
vendor/k8s.io/apimachinery/pkg/runtime/negotiate.go
generated
vendored
Normal file
146
vendor/k8s.io/apimachinery/pkg/runtime/negotiate.go
generated
vendored
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// NegotiateError is returned when a ClientNegotiator is unable to locate
|
||||
// a serializer for the requested operation.
|
||||
type NegotiateError struct {
|
||||
ContentType string
|
||||
Stream bool
|
||||
}
|
||||
|
||||
func (e NegotiateError) Error() string {
|
||||
if e.Stream {
|
||||
return fmt.Sprintf("no stream serializers registered for %s", e.ContentType)
|
||||
}
|
||||
return fmt.Sprintf("no serializers registered for %s", e.ContentType)
|
||||
}
|
||||
|
||||
type clientNegotiator struct {
|
||||
serializer NegotiatedSerializer
|
||||
encode, decode GroupVersioner
|
||||
}
|
||||
|
||||
func (n *clientNegotiator) Encoder(contentType string, params map[string]string) (Encoder, error) {
|
||||
// TODO: `pretty=1` is handled in NegotiateOutputMediaType, consider moving it to this method
|
||||
// if client negotiators truly need to use it
|
||||
mediaTypes := n.serializer.SupportedMediaTypes()
|
||||
info, ok := SerializerInfoForMediaType(mediaTypes, contentType)
|
||||
if !ok {
|
||||
if len(contentType) != 0 || len(mediaTypes) == 0 {
|
||||
return nil, NegotiateError{ContentType: contentType}
|
||||
}
|
||||
info = mediaTypes[0]
|
||||
}
|
||||
return n.serializer.EncoderForVersion(info.Serializer, n.encode), nil
|
||||
}
|
||||
|
||||
func (n *clientNegotiator) Decoder(contentType string, params map[string]string) (Decoder, error) {
|
||||
mediaTypes := n.serializer.SupportedMediaTypes()
|
||||
info, ok := SerializerInfoForMediaType(mediaTypes, contentType)
|
||||
if !ok {
|
||||
if len(contentType) != 0 || len(mediaTypes) == 0 {
|
||||
return nil, NegotiateError{ContentType: contentType}
|
||||
}
|
||||
info = mediaTypes[0]
|
||||
}
|
||||
return n.serializer.DecoderToVersion(info.Serializer, n.decode), nil
|
||||
}
|
||||
|
||||
func (n *clientNegotiator) StreamDecoder(contentType string, params map[string]string) (Decoder, Serializer, Framer, error) {
|
||||
mediaTypes := n.serializer.SupportedMediaTypes()
|
||||
info, ok := SerializerInfoForMediaType(mediaTypes, contentType)
|
||||
if !ok {
|
||||
if len(contentType) != 0 || len(mediaTypes) == 0 {
|
||||
return nil, nil, nil, NegotiateError{ContentType: contentType, Stream: true}
|
||||
}
|
||||
info = mediaTypes[0]
|
||||
}
|
||||
if info.StreamSerializer == nil {
|
||||
return nil, nil, nil, NegotiateError{ContentType: info.MediaType, Stream: true}
|
||||
}
|
||||
return n.serializer.DecoderToVersion(info.Serializer, n.decode), info.StreamSerializer.Serializer, info.StreamSerializer.Framer, nil
|
||||
}
|
||||
|
||||
// NewClientNegotiator will attempt to retrieve the appropriate encoder, decoder, or
|
||||
// stream decoder for a given content type. Does not perform any conversion, but will
|
||||
// encode the object to the desired group, version, and kind. Use when creating a client.
|
||||
func NewClientNegotiator(serializer NegotiatedSerializer, gv schema.GroupVersion) ClientNegotiator {
|
||||
return &clientNegotiator{
|
||||
serializer: serializer,
|
||||
encode: gv,
|
||||
}
|
||||
}
|
||||
|
||||
// NewInternalClientNegotiator applies the default client rules for connecting to a Kubernetes apiserver
|
||||
// where objects are converted to gv prior to sending and decoded to their internal representation prior
|
||||
// to retrieval.
|
||||
//
|
||||
// DEPRECATED: Internal clients are deprecated and will be removed in a future Kubernetes release.
|
||||
func NewInternalClientNegotiator(serializer NegotiatedSerializer, gv schema.GroupVersion) ClientNegotiator {
|
||||
decode := schema.GroupVersions{
|
||||
{
|
||||
Group: gv.Group,
|
||||
Version: APIVersionInternal,
|
||||
},
|
||||
// always include the legacy group as a decoding target to handle non-error `Status` return types
|
||||
{
|
||||
Group: "",
|
||||
Version: APIVersionInternal,
|
||||
},
|
||||
}
|
||||
return &clientNegotiator{
|
||||
encode: gv,
|
||||
decode: decode,
|
||||
serializer: serializer,
|
||||
}
|
||||
}
|
||||
|
||||
// NewSimpleClientNegotiator will negotiate for a single serializer. This should only be used
|
||||
// for testing or when the caller is taking responsibility for setting the GVK on encoded objects.
|
||||
func NewSimpleClientNegotiator(info SerializerInfo, gv schema.GroupVersion) ClientNegotiator {
|
||||
return &clientNegotiator{
|
||||
serializer: &simpleNegotiatedSerializer{info: info},
|
||||
encode: gv,
|
||||
}
|
||||
}
|
||||
|
||||
type simpleNegotiatedSerializer struct {
|
||||
info SerializerInfo
|
||||
}
|
||||
|
||||
func NewSimpleNegotiatedSerializer(info SerializerInfo) NegotiatedSerializer {
|
||||
return &simpleNegotiatedSerializer{info: info}
|
||||
}
|
||||
|
||||
func (n *simpleNegotiatedSerializer) SupportedMediaTypes() []SerializerInfo {
|
||||
return []SerializerInfo{n.info}
|
||||
}
|
||||
|
||||
func (n *simpleNegotiatedSerializer) EncoderForVersion(e Encoder, _ GroupVersioner) Encoder {
|
||||
return e
|
||||
}
|
||||
|
||||
func (n *simpleNegotiatedSerializer) DecoderToVersion(d Decoder, _gv GroupVersioner) Decoder {
|
||||
return d
|
||||
}
|
30
vendor/k8s.io/apimachinery/pkg/runtime/register.go
generated
vendored
30
vendor/k8s.io/apimachinery/pkg/runtime/register.go
generated
vendored
@ -29,33 +29,3 @@ func (obj *TypeMeta) GroupVersionKind() schema.GroupVersionKind {
|
||||
}
|
||||
|
||||
func (obj *TypeMeta) GetObjectKind() schema.ObjectKind { return obj }
|
||||
|
||||
// GetObjectKind implements Object for VersionedObjects, returning an empty ObjectKind
|
||||
// interface if no objects are provided, or the ObjectKind interface of the object in the
|
||||
// highest array position.
|
||||
func (obj *VersionedObjects) GetObjectKind() schema.ObjectKind {
|
||||
last := obj.Last()
|
||||
if last == nil {
|
||||
return schema.EmptyObjectKind
|
||||
}
|
||||
return last.GetObjectKind()
|
||||
}
|
||||
|
||||
// First returns the leftmost object in the VersionedObjects array, which is usually the
|
||||
// object as serialized on the wire.
|
||||
func (obj *VersionedObjects) First() Object {
|
||||
if len(obj.Objects) == 0 {
|
||||
return nil
|
||||
}
|
||||
return obj.Objects[0]
|
||||
}
|
||||
|
||||
// Last is the rightmost object in the VersionedObjects array, which is the object after
|
||||
// all transformations have been applied. This is the same object that would be returned
|
||||
// by Decode in a normal invocation (without VersionedObjects in the into argument).
|
||||
func (obj *VersionedObjects) Last() Object {
|
||||
if len(obj.Objects) == 0 {
|
||||
return nil
|
||||
}
|
||||
return obj.Objects[len(obj.Objects)-1]
|
||||
}
|
||||
|
22
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
generated
vendored
22
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
generated
vendored
@ -17,19 +17,15 @@ limitations under the License.
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
|
||||
|
||||
/*
|
||||
Package schema is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
*/
|
||||
package schema
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import (
|
||||
fmt "fmt"
|
||||
|
||||
math "math"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
@ -43,10 +39,10 @@ var _ = math.Inf
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto", fileDescriptorGenerated)
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto", fileDescriptor_0462724132518e0d)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
var fileDescriptor_0462724132518e0d = []byte{
|
||||
// 185 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0xcc, 0xaf, 0x6e, 0xc3, 0x30,
|
||||
0x10, 0xc7, 0x71, 0x9b, 0x0c, 0x0c, 0x0e, 0x0e, 0x1c, 0x1c, 0xda, 0x7c, 0x74, 0xb8, 0x2f, 0x50,
|
||||
|
14
vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
generated
vendored
14
vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
generated
vendored
@ -191,6 +191,11 @@ func (gv GroupVersion) String() string {
|
||||
return gv.Version
|
||||
}
|
||||
|
||||
// Identifier implements runtime.GroupVersioner interface.
|
||||
func (gv GroupVersion) Identifier() string {
|
||||
return gv.String()
|
||||
}
|
||||
|
||||
// KindForGroupVersionKinds identifies the preferred GroupVersionKind out of a list. It returns ok false
|
||||
// if none of the options match the group. It prefers a match to group and version over just group.
|
||||
// TODO: Move GroupVersion to a package under pkg/runtime, since it's used by scheme.
|
||||
@ -246,6 +251,15 @@ func (gv GroupVersion) WithResource(resource string) GroupVersionResource {
|
||||
// in fewer places.
|
||||
type GroupVersions []GroupVersion
|
||||
|
||||
// Identifier implements runtime.GroupVersioner interface.
|
||||
func (gv GroupVersions) Identifier() string {
|
||||
groupVersions := make([]string, 0, len(gv))
|
||||
for i := range gv {
|
||||
groupVersions = append(groupVersions, gv[i].String())
|
||||
}
|
||||
return fmt.Sprintf("[%s]", strings.Join(groupVersions, ","))
|
||||
}
|
||||
|
||||
// KindForGroupVersionKinds identifies the preferred GroupVersionKind out of a list. It returns ok false
|
||||
// if none of the options match the group.
|
||||
func (gvs GroupVersions) KindForGroupVersionKinds(kinds []GroupVersionKind) (GroupVersionKind, bool) {
|
||||
|
104
vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
generated
vendored
104
vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
generated
vendored
@ -48,28 +48,40 @@ type serializerType struct {
|
||||
StreamSerializer runtime.Serializer
|
||||
}
|
||||
|
||||
func newSerializersForScheme(scheme *runtime.Scheme, mf json.MetaFactory) []serializerType {
|
||||
jsonSerializer := json.NewSerializer(mf, scheme, scheme, false)
|
||||
jsonPrettySerializer := json.NewSerializer(mf, scheme, scheme, true)
|
||||
yamlSerializer := json.NewYAMLSerializer(mf, scheme, scheme)
|
||||
serializer := protobuf.NewSerializer(scheme, scheme)
|
||||
raw := protobuf.NewRawSerializer(scheme, scheme)
|
||||
func newSerializersForScheme(scheme *runtime.Scheme, mf json.MetaFactory, options CodecFactoryOptions) []serializerType {
|
||||
jsonSerializer := json.NewSerializerWithOptions(
|
||||
mf, scheme, scheme,
|
||||
json.SerializerOptions{Yaml: false, Pretty: false, Strict: options.Strict},
|
||||
)
|
||||
jsonSerializerType := serializerType{
|
||||
AcceptContentTypes: []string{runtime.ContentTypeJSON},
|
||||
ContentType: runtime.ContentTypeJSON,
|
||||
FileExtensions: []string{"json"},
|
||||
EncodesAsText: true,
|
||||
Serializer: jsonSerializer,
|
||||
|
||||
Framer: json.Framer,
|
||||
StreamSerializer: jsonSerializer,
|
||||
}
|
||||
if options.Pretty {
|
||||
jsonSerializerType.PrettySerializer = json.NewSerializerWithOptions(
|
||||
mf, scheme, scheme,
|
||||
json.SerializerOptions{Yaml: false, Pretty: true, Strict: options.Strict},
|
||||
)
|
||||
}
|
||||
|
||||
yamlSerializer := json.NewSerializerWithOptions(
|
||||
mf, scheme, scheme,
|
||||
json.SerializerOptions{Yaml: true, Pretty: false, Strict: options.Strict},
|
||||
)
|
||||
protoSerializer := protobuf.NewSerializer(scheme, scheme)
|
||||
protoRawSerializer := protobuf.NewRawSerializer(scheme, scheme)
|
||||
|
||||
serializers := []serializerType{
|
||||
jsonSerializerType,
|
||||
{
|
||||
AcceptContentTypes: []string{"application/json"},
|
||||
ContentType: "application/json",
|
||||
FileExtensions: []string{"json"},
|
||||
EncodesAsText: true,
|
||||
Serializer: jsonSerializer,
|
||||
PrettySerializer: jsonPrettySerializer,
|
||||
|
||||
Framer: json.Framer,
|
||||
StreamSerializer: jsonSerializer,
|
||||
},
|
||||
{
|
||||
AcceptContentTypes: []string{"application/yaml"},
|
||||
ContentType: "application/yaml",
|
||||
AcceptContentTypes: []string{runtime.ContentTypeYAML},
|
||||
ContentType: runtime.ContentTypeYAML,
|
||||
FileExtensions: []string{"yaml"},
|
||||
EncodesAsText: true,
|
||||
Serializer: yamlSerializer,
|
||||
@ -78,10 +90,10 @@ func newSerializersForScheme(scheme *runtime.Scheme, mf json.MetaFactory) []seri
|
||||
AcceptContentTypes: []string{runtime.ContentTypeProtobuf},
|
||||
ContentType: runtime.ContentTypeProtobuf,
|
||||
FileExtensions: []string{"pb"},
|
||||
Serializer: serializer,
|
||||
Serializer: protoSerializer,
|
||||
|
||||
Framer: protobuf.LengthDelimitedFramer,
|
||||
StreamSerializer: raw,
|
||||
StreamSerializer: protoRawSerializer,
|
||||
},
|
||||
}
|
||||
|
||||
@ -104,14 +116,56 @@ type CodecFactory struct {
|
||||
legacySerializer runtime.Serializer
|
||||
}
|
||||
|
||||
// CodecFactoryOptions holds the options for configuring CodecFactory behavior
|
||||
type CodecFactoryOptions struct {
|
||||
// Strict configures all serializers in strict mode
|
||||
Strict bool
|
||||
// Pretty includes a pretty serializer along with the non-pretty one
|
||||
Pretty bool
|
||||
}
|
||||
|
||||
// CodecFactoryOptionsMutator takes a pointer to an options struct and then modifies it.
|
||||
// Functions implementing this type can be passed to the NewCodecFactory() constructor.
|
||||
type CodecFactoryOptionsMutator func(*CodecFactoryOptions)
|
||||
|
||||
// EnablePretty enables including a pretty serializer along with the non-pretty one
|
||||
func EnablePretty(options *CodecFactoryOptions) {
|
||||
options.Pretty = true
|
||||
}
|
||||
|
||||
// DisablePretty disables including a pretty serializer along with the non-pretty one
|
||||
func DisablePretty(options *CodecFactoryOptions) {
|
||||
options.Pretty = false
|
||||
}
|
||||
|
||||
// EnableStrict enables configuring all serializers in strict mode
|
||||
func EnableStrict(options *CodecFactoryOptions) {
|
||||
options.Strict = true
|
||||
}
|
||||
|
||||
// DisableStrict disables configuring all serializers in strict mode
|
||||
func DisableStrict(options *CodecFactoryOptions) {
|
||||
options.Strict = false
|
||||
}
|
||||
|
||||
// NewCodecFactory provides methods for retrieving serializers for the supported wire formats
|
||||
// and conversion wrappers to define preferred internal and external versions. In the future,
|
||||
// as the internal version is used less, callers may instead use a defaulting serializer and
|
||||
// only convert objects which are shared internally (Status, common API machinery).
|
||||
//
|
||||
// Mutators can be passed to change the CodecFactoryOptions before construction of the factory.
|
||||
// It is recommended to explicitly pass mutators instead of relying on defaults.
|
||||
// By default, Pretty is enabled -- this is conformant with previously supported behavior.
|
||||
//
|
||||
// TODO: allow other codecs to be compiled in?
|
||||
// TODO: accept a scheme interface
|
||||
func NewCodecFactory(scheme *runtime.Scheme) CodecFactory {
|
||||
serializers := newSerializersForScheme(scheme, json.DefaultMetaFactory)
|
||||
func NewCodecFactory(scheme *runtime.Scheme, mutators ...CodecFactoryOptionsMutator) CodecFactory {
|
||||
options := CodecFactoryOptions{Pretty: true}
|
||||
for _, fn := range mutators {
|
||||
fn(&options)
|
||||
}
|
||||
|
||||
serializers := newSerializersForScheme(scheme, json.DefaultMetaFactory, options)
|
||||
return newCodecFactory(scheme, serializers)
|
||||
}
|
||||
|
||||
@ -268,7 +322,3 @@ func (f WithoutConversionCodecFactory) DecoderToVersion(serializer runtime.Decod
|
||||
Decoder: serializer,
|
||||
}
|
||||
}
|
||||
|
||||
// DirectCodecFactory was renamed to WithoutConversionCodecFactory in 1.15.
|
||||
// TODO: remove in 1.16.
|
||||
type DirectCodecFactory = WithoutConversionCodecFactory
|
||||
|
48
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
generated
vendored
48
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
generated
vendored
@ -31,6 +31,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/recognizer"
|
||||
"k8s.io/apimachinery/pkg/util/framer"
|
||||
utilyaml "k8s.io/apimachinery/pkg/util/yaml"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// NewSerializer creates a JSON serializer that handles encoding versioned objects into the proper JSON form. If typer
|
||||
@ -53,13 +54,28 @@ func NewYAMLSerializer(meta MetaFactory, creater runtime.ObjectCreater, typer ru
|
||||
// and are immutable.
|
||||
func NewSerializerWithOptions(meta MetaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper, options SerializerOptions) *Serializer {
|
||||
return &Serializer{
|
||||
meta: meta,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
options: options,
|
||||
meta: meta,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
options: options,
|
||||
identifier: identifier(options),
|
||||
}
|
||||
}
|
||||
|
||||
// identifier computes Identifier of Encoder based on the given options.
|
||||
func identifier(options SerializerOptions) runtime.Identifier {
|
||||
result := map[string]string{
|
||||
"name": "json",
|
||||
"yaml": strconv.FormatBool(options.Yaml),
|
||||
"pretty": strconv.FormatBool(options.Pretty),
|
||||
}
|
||||
identifier, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed marshaling identifier for json Serializer: %v", err)
|
||||
}
|
||||
return runtime.Identifier(identifier)
|
||||
}
|
||||
|
||||
// SerializerOptions holds the options which are used to configure a JSON/YAML serializer.
|
||||
// example:
|
||||
// (1) To configure a JSON serializer, set `Yaml` to `false`.
|
||||
@ -85,6 +101,8 @@ type Serializer struct {
|
||||
options SerializerOptions
|
||||
creater runtime.ObjectCreater
|
||||
typer runtime.ObjectTyper
|
||||
|
||||
identifier runtime.Identifier
|
||||
}
|
||||
|
||||
// Serializer implements Serializer
|
||||
@ -188,16 +206,6 @@ func gvkWithDefaults(actual, defaultGVK schema.GroupVersionKind) schema.GroupVer
|
||||
// On success or most errors, the method will return the calculated schema kind.
|
||||
// The gvk calculate priority will be originalData > default gvk > into
|
||||
func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
|
||||
if versioned, ok := into.(*runtime.VersionedObjects); ok {
|
||||
into = versioned.Last()
|
||||
obj, actual, err := s.Decode(originalData, gvk, into)
|
||||
if err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
versioned.Objects = []runtime.Object{obj}
|
||||
return versioned, actual, nil
|
||||
}
|
||||
|
||||
data := originalData
|
||||
if s.options.Yaml {
|
||||
altered, err := yaml.YAMLToJSON(data)
|
||||
@ -286,6 +294,13 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
||||
|
||||
// Encode serializes the provided object to the given writer.
|
||||
func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if co, ok := obj.(runtime.CacheableObject); ok {
|
||||
return co.CacheEncode(s.Identifier(), s.doEncode, w)
|
||||
}
|
||||
return s.doEncode(obj, w)
|
||||
}
|
||||
|
||||
func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
|
||||
if s.options.Yaml {
|
||||
json, err := caseSensitiveJsonIterator.Marshal(obj)
|
||||
if err != nil {
|
||||
@ -311,6 +326,11 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
return encoder.Encode(obj)
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (s *Serializer) Identifier() runtime.Identifier {
|
||||
return s.identifier
|
||||
}
|
||||
|
||||
// RecognizesData implements the RecognizingDecoder interface.
|
||||
func (s *Serializer) RecognizesData(peek io.Reader) (ok, unknown bool, err error) {
|
||||
if s.options.Yaml {
|
||||
|
80
vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go
generated
vendored
80
vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go
generated
vendored
@ -86,6 +86,8 @@ type Serializer struct {
|
||||
var _ runtime.Serializer = &Serializer{}
|
||||
var _ recognizer.RecognizingDecoder = &Serializer{}
|
||||
|
||||
const serializerIdentifier runtime.Identifier = "protobuf"
|
||||
|
||||
// Decode attempts to convert the provided data into a protobuf message, extract the stored schema kind, apply the provided default
|
||||
// gvk, and then load that data into an object matching the desired schema kind or the provided into. If into is *runtime.Unknown,
|
||||
// the raw data will be extracted and no decoding will be performed. If into is not registered with the typer, then the object will
|
||||
@ -93,23 +95,6 @@ var _ recognizer.RecognizingDecoder = &Serializer{}
|
||||
// not fully qualified with kind/version/group, the type of the into will be used to alter the returned gvk. On success or most
|
||||
// errors, the method will return the calculated schema kind.
|
||||
func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
|
||||
if versioned, ok := into.(*runtime.VersionedObjects); ok {
|
||||
into = versioned.Last()
|
||||
obj, actual, err := s.Decode(originalData, gvk, into)
|
||||
if err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
// the last item in versioned becomes into, so if versioned was not originally empty we reset the object
|
||||
// array so the first position is the decoded object and the second position is the outermost object.
|
||||
// if there were no objects in the versioned list passed to us, only add ourselves.
|
||||
if into != nil && into != obj {
|
||||
versioned.Objects = []runtime.Object{obj, into}
|
||||
} else {
|
||||
versioned.Objects = []runtime.Object{obj}
|
||||
}
|
||||
return versioned, actual, err
|
||||
}
|
||||
|
||||
prefixLen := len(s.prefix)
|
||||
switch {
|
||||
case len(originalData) == 0:
|
||||
@ -176,6 +161,13 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
||||
|
||||
// Encode serializes the provided object to the given writer.
|
||||
func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if co, ok := obj.(runtime.CacheableObject); ok {
|
||||
return co.CacheEncode(s.Identifier(), s.doEncode, w)
|
||||
}
|
||||
return s.doEncode(obj, w)
|
||||
}
|
||||
|
||||
func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
|
||||
prefixSize := uint64(len(s.prefix))
|
||||
|
||||
var unk runtime.Unknown
|
||||
@ -203,7 +195,7 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
switch t := obj.(type) {
|
||||
case bufferedMarshaller:
|
||||
// this path performs a single allocation during write but requires the caller to implement
|
||||
// the more efficient Size and MarshalTo methods
|
||||
// the more efficient Size and MarshalToSizedBuffer methods
|
||||
encodedSize := uint64(t.Size())
|
||||
estimatedSize := prefixSize + estimateUnknownSize(&unk, encodedSize)
|
||||
data := make([]byte, estimatedSize)
|
||||
@ -245,6 +237,11 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (s *Serializer) Identifier() runtime.Identifier {
|
||||
return serializerIdentifier
|
||||
}
|
||||
|
||||
// RecognizesData implements the RecognizingDecoder interface.
|
||||
func (s *Serializer) RecognizesData(peek io.Reader) (bool, bool, error) {
|
||||
prefix := make([]byte, 4)
|
||||
@ -283,6 +280,12 @@ type bufferedMarshaller interface {
|
||||
runtime.ProtobufMarshaller
|
||||
}
|
||||
|
||||
// Like bufferedMarshaller, but is able to marshal backwards, which is more efficient since it doesn't call Size() as frequently.
|
||||
type bufferedReverseMarshaller interface {
|
||||
proto.Sizer
|
||||
runtime.ProtobufReverseMarshaller
|
||||
}
|
||||
|
||||
// estimateUnknownSize returns the expected bytes consumed by a given runtime.Unknown
|
||||
// object with a nil RawJSON struct and the expected size of the provided buffer. The
|
||||
// returned size will not be correct if RawJSOn is set on unk.
|
||||
@ -315,6 +318,8 @@ type RawSerializer struct {
|
||||
|
||||
var _ runtime.Serializer = &RawSerializer{}
|
||||
|
||||
const rawSerializerIdentifier runtime.Identifier = "raw-protobuf"
|
||||
|
||||
// Decode attempts to convert the provided data into a protobuf message, extract the stored schema kind, apply the provided default
|
||||
// gvk, and then load that data into an object matching the desired schema kind or the provided into. If into is *runtime.Unknown,
|
||||
// the raw data will be extracted and no decoding will be performed. If into is not registered with the typer, then the object will
|
||||
@ -326,20 +331,6 @@ func (s *RawSerializer) Decode(originalData []byte, gvk *schema.GroupVersionKind
|
||||
return nil, nil, fmt.Errorf("this serializer requires an object to decode into: %#v", s)
|
||||
}
|
||||
|
||||
if versioned, ok := into.(*runtime.VersionedObjects); ok {
|
||||
into = versioned.Last()
|
||||
obj, actual, err := s.Decode(originalData, gvk, into)
|
||||
if err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
if into != nil && into != obj {
|
||||
versioned.Objects = []runtime.Object{obj, into}
|
||||
} else {
|
||||
versioned.Objects = []runtime.Object{obj}
|
||||
}
|
||||
return versioned, actual, err
|
||||
}
|
||||
|
||||
if len(originalData) == 0 {
|
||||
// TODO: treat like decoding {} from JSON with defaulting
|
||||
return nil, nil, fmt.Errorf("empty data")
|
||||
@ -413,7 +404,27 @@ func unmarshalToObject(typer runtime.ObjectTyper, creater runtime.ObjectCreater,
|
||||
|
||||
// Encode serializes the provided object to the given writer. Overrides is ignored.
|
||||
func (s *RawSerializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if co, ok := obj.(runtime.CacheableObject); ok {
|
||||
return co.CacheEncode(s.Identifier(), s.doEncode, w)
|
||||
}
|
||||
return s.doEncode(obj, w)
|
||||
}
|
||||
|
||||
func (s *RawSerializer) doEncode(obj runtime.Object, w io.Writer) error {
|
||||
switch t := obj.(type) {
|
||||
case bufferedReverseMarshaller:
|
||||
// this path performs a single allocation during write but requires the caller to implement
|
||||
// the more efficient Size and MarshalToSizedBuffer methods
|
||||
encodedSize := uint64(t.Size())
|
||||
data := make([]byte, encodedSize)
|
||||
|
||||
n, err := t.MarshalToSizedBuffer(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = w.Write(data[:n])
|
||||
return err
|
||||
|
||||
case bufferedMarshaller:
|
||||
// this path performs a single allocation during write but requires the caller to implement
|
||||
// the more efficient Size and MarshalTo methods
|
||||
@ -441,6 +452,11 @@ func (s *RawSerializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (s *RawSerializer) Identifier() runtime.Identifier {
|
||||
return rawSerializerIdentifier
|
||||
}
|
||||
|
||||
var LengthDelimitedFramer = lengthDelimitedFramer{}
|
||||
|
||||
type lengthDelimitedFramer struct{}
|
||||
|
88
vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
generated
vendored
88
vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
generated
vendored
@ -17,12 +17,15 @@ limitations under the License.
|
||||
package versioning
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// NewDefaultingCodecForScheme is a convenience method for callers that are using a scheme.
|
||||
@ -62,6 +65,8 @@ func NewCodec(
|
||||
encodeVersion: encodeVersion,
|
||||
decodeVersion: decodeVersion,
|
||||
|
||||
identifier: identifier(encodeVersion, encoder),
|
||||
|
||||
originalSchemeName: originalSchemeName,
|
||||
}
|
||||
return internal
|
||||
@ -78,19 +83,47 @@ type codec struct {
|
||||
encodeVersion runtime.GroupVersioner
|
||||
decodeVersion runtime.GroupVersioner
|
||||
|
||||
identifier runtime.Identifier
|
||||
|
||||
// originalSchemeName is optional, but when filled in it holds the name of the scheme from which this codec originates
|
||||
originalSchemeName string
|
||||
}
|
||||
|
||||
var identifiersMap sync.Map
|
||||
|
||||
type codecIdentifier struct {
|
||||
EncodeGV string `json:"encodeGV,omitempty"`
|
||||
Encoder string `json:"encoder,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// identifier computes Identifier of Encoder based on codec parameters.
|
||||
func identifier(encodeGV runtime.GroupVersioner, encoder runtime.Encoder) runtime.Identifier {
|
||||
result := codecIdentifier{
|
||||
Name: "versioning",
|
||||
}
|
||||
|
||||
if encodeGV != nil {
|
||||
result.EncodeGV = encodeGV.Identifier()
|
||||
}
|
||||
if encoder != nil {
|
||||
result.Encoder = string(encoder.Identifier())
|
||||
}
|
||||
if id, ok := identifiersMap.Load(result); ok {
|
||||
return id.(runtime.Identifier)
|
||||
}
|
||||
identifier, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed marshaling identifier for codec: %v", err)
|
||||
}
|
||||
identifiersMap.Store(result, runtime.Identifier(identifier))
|
||||
return runtime.Identifier(identifier)
|
||||
}
|
||||
|
||||
// Decode attempts a decode of the object, then tries to convert it to the internal version. If into is provided and the decoding is
|
||||
// successful, the returned runtime.Object will be the value passed as into. Note that this may bypass conversion if you pass an
|
||||
// into that matches the serialized version.
|
||||
func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
|
||||
versioned, isVersioned := into.(*runtime.VersionedObjects)
|
||||
if isVersioned {
|
||||
into = versioned.Last()
|
||||
}
|
||||
|
||||
// If the into object is unstructured and expresses an opinion about its group/version,
|
||||
// create a new instance of the type so we always exercise the conversion path (skips short-circuiting on `into == obj`)
|
||||
decodeInto := into
|
||||
@ -115,22 +148,11 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
|
||||
if into != nil {
|
||||
// perform defaulting if requested
|
||||
if c.defaulter != nil {
|
||||
// create a copy to ensure defaulting is not applied to the original versioned objects
|
||||
if isVersioned {
|
||||
versioned.Objects = []runtime.Object{obj.DeepCopyObject()}
|
||||
}
|
||||
c.defaulter.Default(obj)
|
||||
} else {
|
||||
if isVersioned {
|
||||
versioned.Objects = []runtime.Object{obj}
|
||||
}
|
||||
}
|
||||
|
||||
// Short-circuit conversion if the into object is same object
|
||||
if into == obj {
|
||||
if isVersioned {
|
||||
return versioned, gvk, nil
|
||||
}
|
||||
return into, gvk, nil
|
||||
}
|
||||
|
||||
@ -138,19 +160,9 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
|
||||
return nil, gvk, err
|
||||
}
|
||||
|
||||
if isVersioned {
|
||||
versioned.Objects = append(versioned.Objects, into)
|
||||
return versioned, gvk, nil
|
||||
}
|
||||
return into, gvk, nil
|
||||
}
|
||||
|
||||
// Convert if needed.
|
||||
if isVersioned {
|
||||
// create a copy, because ConvertToVersion does not guarantee non-mutation of objects
|
||||
versioned.Objects = []runtime.Object{obj.DeepCopyObject()}
|
||||
}
|
||||
|
||||
// perform defaulting if requested
|
||||
if c.defaulter != nil {
|
||||
c.defaulter.Default(obj)
|
||||
@ -160,18 +172,19 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
|
||||
if err != nil {
|
||||
return nil, gvk, err
|
||||
}
|
||||
if isVersioned {
|
||||
if versioned.Last() != out {
|
||||
versioned.Objects = append(versioned.Objects, out)
|
||||
}
|
||||
return versioned, gvk, nil
|
||||
}
|
||||
return out, gvk, nil
|
||||
}
|
||||
|
||||
// Encode ensures the provided object is output in the appropriate group and version, invoking
|
||||
// conversion if necessary. Unversioned objects (according to the ObjectTyper) are output as is.
|
||||
func (c *codec) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if co, ok := obj.(runtime.CacheableObject); ok {
|
||||
return co.CacheEncode(c.Identifier(), c.doEncode, w)
|
||||
}
|
||||
return c.doEncode(obj, w)
|
||||
}
|
||||
|
||||
func (c *codec) doEncode(obj runtime.Object, w io.Writer) error {
|
||||
switch obj := obj.(type) {
|
||||
case *runtime.Unknown:
|
||||
return c.encoder.Encode(obj, w)
|
||||
@ -231,10 +244,7 @@ func (c *codec) Encode(obj runtime.Object, w io.Writer) error {
|
||||
return c.encoder.Encode(out, w)
|
||||
}
|
||||
|
||||
// DirectEncoder was moved and renamed to runtime.WithVersionEncoder in 1.15.
|
||||
// TODO: remove in 1.16.
|
||||
type DirectEncoder = runtime.WithVersionEncoder
|
||||
|
||||
// DirectDecoder was moved and renamed to runtime.WithoutVersionDecoder in 1.15.
|
||||
// TODO: remove in 1.16.
|
||||
type DirectDecoder = runtime.WithoutVersionDecoder
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (c *codec) Identifier() runtime.Identifier {
|
||||
return c.identifier
|
||||
}
|
||||
|
15
vendor/k8s.io/apimachinery/pkg/runtime/types.go
generated
vendored
15
vendor/k8s.io/apimachinery/pkg/runtime/types.go
generated
vendored
@ -95,7 +95,7 @@ type RawExtension struct {
|
||||
// Raw is the underlying serialization of this object.
|
||||
//
|
||||
// TODO: Determine how to detect ContentType and ContentEncoding of 'Raw' data.
|
||||
Raw []byte `protobuf:"bytes,1,opt,name=raw"`
|
||||
Raw []byte `json:"-" protobuf:"bytes,1,opt,name=raw"`
|
||||
// Object can hold a representation of this extension - useful for working with versioned
|
||||
// structs.
|
||||
Object Object `json:"-"`
|
||||
@ -124,16 +124,3 @@ type Unknown struct {
|
||||
// Unspecified means ContentTypeJSON.
|
||||
ContentType string `protobuf:"bytes,4,opt,name=contentType"`
|
||||
}
|
||||
|
||||
// VersionedObjects is used by Decoders to give callers a way to access all versions
|
||||
// of an object during the decoding process.
|
||||
//
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:deepcopy-gen=true
|
||||
type VersionedObjects struct {
|
||||
// Objects is the set of objects retrieved during decoding, in order of conversion.
|
||||
// The 0 index is the object as serialized on the wire. If conversion has occurred,
|
||||
// other objects may be present. The right most object is the same as would be returned
|
||||
// by a normal Decode call.
|
||||
Objects []Object
|
||||
}
|
||||
|
94
vendor/k8s.io/apimachinery/pkg/runtime/types_proto.go
generated
vendored
94
vendor/k8s.io/apimachinery/pkg/runtime/types_proto.go
generated
vendored
@ -24,46 +24,66 @@ type ProtobufMarshaller interface {
|
||||
MarshalTo(data []byte) (int, error)
|
||||
}
|
||||
|
||||
type ProtobufReverseMarshaller interface {
|
||||
MarshalToSizedBuffer(data []byte) (int, error)
|
||||
}
|
||||
|
||||
// NestedMarshalTo allows a caller to avoid extra allocations during serialization of an Unknown
|
||||
// that will contain an object that implements ProtobufMarshaller.
|
||||
// that will contain an object that implements ProtobufMarshaller or ProtobufReverseMarshaller.
|
||||
func (m *Unknown) NestedMarshalTo(data []byte, b ProtobufMarshaller, size uint64) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
data[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(m.TypeMeta.Size()))
|
||||
n1, err := m.TypeMeta.MarshalTo(data[i:])
|
||||
// Calculate the full size of the message.
|
||||
msgSize := m.Size()
|
||||
if b != nil {
|
||||
msgSize += int(size) + sovGenerated(size) + 1
|
||||
}
|
||||
|
||||
// Reverse marshal the fields of m.
|
||||
i := msgSize
|
||||
i -= len(m.ContentType)
|
||||
copy(data[i:], m.ContentType)
|
||||
i = encodeVarintGenerated(data, i, uint64(len(m.ContentType)))
|
||||
i--
|
||||
data[i] = 0x22
|
||||
i -= len(m.ContentEncoding)
|
||||
copy(data[i:], m.ContentEncoding)
|
||||
i = encodeVarintGenerated(data, i, uint64(len(m.ContentEncoding)))
|
||||
i--
|
||||
data[i] = 0x1a
|
||||
if b != nil {
|
||||
if r, ok := b.(ProtobufReverseMarshaller); ok {
|
||||
n1, err := r.MarshalToSizedBuffer(data[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= int(size)
|
||||
if uint64(n1) != size {
|
||||
// programmer error: the Size() method for protobuf does not match the results of LashramOt, which means the proto
|
||||
// struct returned would be wrong.
|
||||
return 0, fmt.Errorf("the Size() value of %T was %d, but NestedMarshalTo wrote %d bytes to data", b, size, n1)
|
||||
}
|
||||
} else {
|
||||
i -= int(size)
|
||||
n1, err := b.MarshalTo(data[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if uint64(n1) != size {
|
||||
// programmer error: the Size() method for protobuf does not match the results of MarshalTo, which means the proto
|
||||
// struct returned would be wrong.
|
||||
return 0, fmt.Errorf("the Size() value of %T was %d, but NestedMarshalTo wrote %d bytes to data", b, size, n1)
|
||||
}
|
||||
}
|
||||
i = encodeVarintGenerated(data, i, size)
|
||||
i--
|
||||
data[i] = 0x12
|
||||
}
|
||||
n2, err := m.TypeMeta.MarshalToSizedBuffer(data[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
|
||||
if b != nil {
|
||||
data[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, size)
|
||||
n2, err := b.MarshalTo(data[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if uint64(n2) != size {
|
||||
// programmer error: the Size() method for protobuf does not match the results of MarshalTo, which means the proto
|
||||
// struct returned would be wrong.
|
||||
return 0, fmt.Errorf("the Size() value of %T was %d, but NestedMarshalTo wrote %d bytes to data", b, size, n2)
|
||||
}
|
||||
i += n2
|
||||
}
|
||||
|
||||
data[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(len(m.ContentEncoding)))
|
||||
i += copy(data[i:], m.ContentEncoding)
|
||||
|
||||
data[i] = 0x22
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(len(m.ContentType)))
|
||||
i += copy(data[i:], m.ContentType)
|
||||
return i, nil
|
||||
i -= n2
|
||||
i = encodeVarintGenerated(data, i, uint64(n2))
|
||||
i--
|
||||
data[i] = 0xa
|
||||
return msgSize - i, nil
|
||||
}
|
||||
|
33
vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go
generated
vendored
33
vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go
generated
vendored
@ -73,36 +73,3 @@ func (in *Unknown) DeepCopyObject() Object {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VersionedObjects) DeepCopyInto(out *VersionedObjects) {
|
||||
*out = *in
|
||||
if in.Objects != nil {
|
||||
in, out := &in.Objects, &out.Objects
|
||||
*out = make([]Object, len(*in))
|
||||
for i := range *in {
|
||||
if (*in)[i] != nil {
|
||||
(*out)[i] = (*in)[i].DeepCopyObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VersionedObjects.
|
||||
func (in *VersionedObjects) DeepCopy() *VersionedObjects {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VersionedObjects)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new Object.
|
||||
func (in *VersionedObjects) DeepCopyObject() Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user