mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 10:53:34 +00:00
Migrate from snapClient.VolumesnapshotV1alpha1Client to
snapClient.SnapshotV1alpha1Client and also update kube dependency Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
3bc6771df8
commit
22ff5c0911
49
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
49
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
@ -394,7 +394,11 @@ func NewGenericServerResponse(code int, verb string, qualifiedResource schema.Gr
|
||||
case http.StatusNotAcceptable:
|
||||
reason = metav1.StatusReasonNotAcceptable
|
||||
// the server message has details about what types are acceptable
|
||||
message = serverMessage
|
||||
if len(serverMessage) == 0 || serverMessage == "unknown" {
|
||||
message = "the server was unable to respond with a content type that the client supports"
|
||||
} else {
|
||||
message = serverMessage
|
||||
}
|
||||
case http.StatusUnsupportedMediaType:
|
||||
reason = metav1.StatusReasonUnsupportedMediaType
|
||||
// the server message has details about what types are acceptable
|
||||
@ -617,3 +621,46 @@ func ReasonForError(err error) metav1.StatusReason {
|
||||
}
|
||||
return metav1.StatusReasonUnknown
|
||||
}
|
||||
|
||||
// ErrorReporter converts generic errors into runtime.Object errors without
|
||||
// requiring the caller to take a dependency on meta/v1 (where Status lives).
|
||||
// This prevents circular dependencies in core watch code.
|
||||
type ErrorReporter struct {
|
||||
code int
|
||||
verb string
|
||||
reason string
|
||||
}
|
||||
|
||||
// NewClientErrorReporter will respond with valid v1.Status objects that report
|
||||
// unexpected server responses. Primarily used by watch to report errors when
|
||||
// we attempt to decode a response from the server and it is not in the form
|
||||
// we expect. Because watch is a dependency of the core api, we can't return
|
||||
// meta/v1.Status in that package and so much inject this interface to convert a
|
||||
// generic error as appropriate. The reason is passed as a unique status cause
|
||||
// on the returned status, otherwise the generic "ClientError" is returned.
|
||||
func NewClientErrorReporter(code int, verb string, reason string) *ErrorReporter {
|
||||
return &ErrorReporter{
|
||||
code: code,
|
||||
verb: verb,
|
||||
reason: reason,
|
||||
}
|
||||
}
|
||||
|
||||
// AsObject returns a valid error runtime.Object (a v1.Status) for the given
|
||||
// error, using the code and verb of the reporter type. The error is set to
|
||||
// indicate that this was an unexpected server response.
|
||||
func (r *ErrorReporter) AsObject(err error) runtime.Object {
|
||||
status := NewGenericServerResponse(r.code, r.verb, schema.GroupResource{}, "", err.Error(), 0, true)
|
||||
if status.ErrStatus.Details == nil {
|
||||
status.ErrStatus.Details = &metav1.StatusDetails{}
|
||||
}
|
||||
reason := r.reason
|
||||
if len(reason) == 0 {
|
||||
reason = "ClientError"
|
||||
}
|
||||
status.ErrStatus.Details.Causes = append(status.ErrStatus.Details.Causes, metav1.StatusCause{
|
||||
Type: metav1.CauseType(reason),
|
||||
Message: err.Error(),
|
||||
})
|
||||
return &status.ErrStatus
|
||||
}
|
||||
|
66
vendor/k8s.io/apimachinery/pkg/api/meta/help.go
generated
vendored
66
vendor/k8s.io/apimachinery/pkg/api/meta/help.go
generated
vendored
@ -17,30 +17,76 @@ limitations under the License.
|
||||
package meta
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// IsListType returns true if the provided Object has a slice called Items
|
||||
var (
|
||||
// isListCache maintains a cache of types that are checked for lists
|
||||
// which is used by IsListType.
|
||||
// TODO: remove and replace with an interface check
|
||||
isListCache = struct {
|
||||
lock sync.RWMutex
|
||||
byType map[reflect.Type]bool
|
||||
}{
|
||||
byType: make(map[reflect.Type]bool, 1024),
|
||||
}
|
||||
)
|
||||
|
||||
// IsListType returns true if the provided Object has a slice called Items.
|
||||
// TODO: Replace the code in this check with an interface comparison by
|
||||
// creating and enforcing that lists implement a list accessor.
|
||||
func IsListType(obj runtime.Object) bool {
|
||||
// if we're a runtime.Unstructured, check whether this is a list.
|
||||
// TODO: refactor GetItemsPtr to use an interface that returns []runtime.Object
|
||||
if unstructured, ok := obj.(runtime.Unstructured); ok {
|
||||
return unstructured.IsList()
|
||||
switch t := obj.(type) {
|
||||
case runtime.Unstructured:
|
||||
return t.IsList()
|
||||
}
|
||||
t := reflect.TypeOf(obj)
|
||||
|
||||
isListCache.lock.RLock()
|
||||
ok, exists := isListCache.byType[t]
|
||||
isListCache.lock.RUnlock()
|
||||
|
||||
if !exists {
|
||||
_, err := getItemsPtr(obj)
|
||||
ok = err == nil
|
||||
|
||||
// cache only the first 1024 types
|
||||
isListCache.lock.Lock()
|
||||
if len(isListCache.byType) < 1024 {
|
||||
isListCache.byType[t] = ok
|
||||
}
|
||||
isListCache.lock.Unlock()
|
||||
}
|
||||
|
||||
_, err := GetItemsPtr(obj)
|
||||
return err == nil
|
||||
return ok
|
||||
}
|
||||
|
||||
var (
|
||||
errExpectFieldItems = errors.New("no Items field in this object")
|
||||
errExpectSliceItems = errors.New("Items field must be a slice of objects")
|
||||
)
|
||||
|
||||
// GetItemsPtr returns a pointer to the list object's Items member.
|
||||
// If 'list' doesn't have an Items member, it's not really a list type
|
||||
// and an error will be returned.
|
||||
// This function will either return a pointer to a slice, or an error, but not both.
|
||||
// TODO: this will be replaced with an interface in the future
|
||||
func GetItemsPtr(list runtime.Object) (interface{}, error) {
|
||||
obj, err := getItemsPtr(list)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%T is not a list: %v", list, err)
|
||||
}
|
||||
return obj, nil
|
||||
}
|
||||
|
||||
// getItemsPtr returns a pointer to the list object's Items member or an error.
|
||||
func getItemsPtr(list runtime.Object) (interface{}, error) {
|
||||
v, err := conversion.EnforcePtr(list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -48,19 +94,19 @@ func GetItemsPtr(list runtime.Object) (interface{}, error) {
|
||||
|
||||
items := v.FieldByName("Items")
|
||||
if !items.IsValid() {
|
||||
return nil, fmt.Errorf("no Items field in %#v", list)
|
||||
return nil, errExpectFieldItems
|
||||
}
|
||||
switch items.Kind() {
|
||||
case reflect.Interface, reflect.Ptr:
|
||||
target := reflect.TypeOf(items.Interface()).Elem()
|
||||
if target.Kind() != reflect.Slice {
|
||||
return nil, fmt.Errorf("items: Expected slice, got %s", target.Kind())
|
||||
return nil, errExpectSliceItems
|
||||
}
|
||||
return items.Interface(), nil
|
||||
case reflect.Slice:
|
||||
return items.Addr().Interface(), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("items: Expected slice, got %s", items.Kind())
|
||||
return nil, errExpectSliceItems
|
||||
}
|
||||
}
|
||||
|
||||
|
7
vendor/k8s.io/apimachinery/pkg/api/meta/meta.go
generated
vendored
7
vendor/k8s.io/apimachinery/pkg/api/meta/meta.go
generated
vendored
@ -21,7 +21,6 @@ import (
|
||||
"reflect"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@ -114,12 +113,12 @@ func Accessor(obj interface{}) (metav1.Object, error) {
|
||||
|
||||
// AsPartialObjectMetadata takes the metav1 interface and returns a partial object.
|
||||
// TODO: consider making this solely a conversion action.
|
||||
func AsPartialObjectMetadata(m metav1.Object) *metav1beta1.PartialObjectMetadata {
|
||||
func AsPartialObjectMetadata(m metav1.Object) *metav1.PartialObjectMetadata {
|
||||
switch t := m.(type) {
|
||||
case *metav1.ObjectMeta:
|
||||
return &metav1beta1.PartialObjectMetadata{ObjectMeta: *t}
|
||||
return &metav1.PartialObjectMetadata{ObjectMeta: *t}
|
||||
default:
|
||||
return &metav1beta1.PartialObjectMetadata{
|
||||
return &metav1.PartialObjectMetadata{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: m.GetName(),
|
||||
GenerateName: m.GetGenerateName(),
|
||||
|
4
vendor/k8s.io/apimachinery/pkg/api/resource/math.go
generated
vendored
4
vendor/k8s.io/apimachinery/pkg/api/resource/math.go
generated
vendored
@ -194,9 +194,9 @@ func negativeScaleInt64(base int64, scale Scale) (result int64, exact bool) {
|
||||
}
|
||||
if fraction {
|
||||
if base > 0 {
|
||||
value += 1
|
||||
value++
|
||||
} else {
|
||||
value += -1
|
||||
value--
|
||||
}
|
||||
}
|
||||
return value, !fraction
|
||||
|
6
vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
generated
vendored
6
vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
generated
vendored
@ -584,6 +584,12 @@ func (q *Quantity) Neg() {
|
||||
q.d.Dec.Neg(q.d.Dec)
|
||||
}
|
||||
|
||||
// Equal checks equality of two Quantities. This is useful for testing with
|
||||
// cmp.Equal.
|
||||
func (q Quantity) Equal(v Quantity) bool {
|
||||
return q.Cmp(v) == 0
|
||||
}
|
||||
|
||||
// int64QuantityExpectedBytes is the expected width in bytes of the canonical string representation
|
||||
// of most Quantity values.
|
||||
const int64QuantityExpectedBytes = 18
|
||||
|
12
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go
generated
vendored
12
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go
generated
vendored
@ -89,12 +89,12 @@ func addToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion)
|
||||
&metav1beta1.PartialObjectMetadata{},
|
||||
&metav1beta1.PartialObjectMetadataList{},
|
||||
)
|
||||
scheme.AddKnownTypes(metav1beta1.SchemeGroupVersion,
|
||||
&metav1beta1.Table{},
|
||||
&metav1beta1.TableOptions{},
|
||||
&metav1beta1.PartialObjectMetadata{},
|
||||
&metav1beta1.PartialObjectMetadataList{},
|
||||
)
|
||||
if err := metav1beta1.AddMetaToScheme(scheme); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := metav1.AddMetaToScheme(scheme); err != nil {
|
||||
return err
|
||||
}
|
||||
// Allow delete options to be decoded across all version in this scheme (we may want to be more clever than this)
|
||||
scheme.AddUnversionedTypes(SchemeGroupVersion,
|
||||
&metav1.DeleteOptions{},
|
||||
|
9
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go
generated
vendored
9
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go
generated
vendored
@ -35,6 +35,15 @@ type ListOptions struct {
|
||||
FieldSelector fields.Selector
|
||||
// If true, watch for changes to this list
|
||||
Watch bool
|
||||
// allowWatchBookmarks requests watch events with type "BOOKMARK".
|
||||
// Servers that do not implement bookmarks may ignore this flag and
|
||||
// bookmarks are sent at the server's discretion. Clients should not
|
||||
// assume bookmarks are returned at any specific interval, nor may they
|
||||
// assume the server will send any BOOKMARK event during a session.
|
||||
// If this is not a watch, this field is ignored.
|
||||
// If the feature gate WatchBookmarks is not enabled in apiserver,
|
||||
// this field is ignored.
|
||||
AllowWatchBookmarks bool
|
||||
// When specified with a watch call, shows changes that occur after that particular version of a resource.
|
||||
// Defaults to changes from the beginning of history.
|
||||
// When specified for list:
|
||||
|
2
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go
generated
vendored
@ -118,6 +118,7 @@ func autoConvert_internalversion_ListOptions_To_v1_ListOptions(in *ListOptions,
|
||||
return err
|
||||
}
|
||||
out.Watch = in.Watch
|
||||
out.AllowWatchBookmarks = in.AllowWatchBookmarks
|
||||
out.ResourceVersion = in.ResourceVersion
|
||||
out.TimeoutSeconds = (*int64)(unsafe.Pointer(in.TimeoutSeconds))
|
||||
out.Limit = in.Limit
|
||||
@ -133,6 +134,7 @@ func autoConvert_v1_ListOptions_To_internalversion_ListOptions(in *v1.ListOption
|
||||
return err
|
||||
}
|
||||
out.Watch = in.Watch
|
||||
out.AllowWatchBookmarks = in.AllowWatchBookmarks
|
||||
out.ResourceVersion = in.ResourceVersion
|
||||
out.TimeoutSeconds = (*int64)(unsafe.Pointer(in.TimeoutSeconds))
|
||||
out.Limit = in.Limit
|
||||
|
2
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go
generated
vendored
@ -28,7 +28,7 @@ import (
|
||||
func (in *List) DeepCopyInto(out *List) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]runtime.Object, len(*in))
|
||||
|
10
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion.go
generated
vendored
10
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion.go
generated
vendored
@ -77,6 +77,8 @@ func AddConversionFuncs(scheme *runtime.Scheme) error {
|
||||
Convert_Slice_string_To_Slice_int32,
|
||||
|
||||
Convert_Slice_string_To_v1_DeletionPropagation,
|
||||
|
||||
Convert_Slice_string_To_v1_IncludeObjectPolicy,
|
||||
)
|
||||
}
|
||||
|
||||
@ -317,3 +319,11 @@ func Convert_Slice_string_To_v1_DeletionPropagation(input *[]string, out *Deleti
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_Slice_string_To_v1_IncludeObjectPolicy allows converting a URL query parameter value
|
||||
func Convert_Slice_string_To_v1_IncludeObjectPolicy(input *[]string, out *IncludeObjectPolicy, s conversion.Scope) error {
|
||||
if len(*input) > 0 {
|
||||
*out = IncludeObjectPolicy((*input)[0])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
46
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/deepcopy.go
generated
vendored
Normal file
46
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/deepcopy.go
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
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 v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
func (in *TableRow) DeepCopy() *TableRow {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
out := new(TableRow)
|
||||
|
||||
if in.Cells != nil {
|
||||
out.Cells = make([]interface{}, len(in.Cells))
|
||||
for i := range in.Cells {
|
||||
out.Cells[i] = runtime.DeepCopyJSONValue(in.Cells[i])
|
||||
}
|
||||
}
|
||||
|
||||
if in.Conditions != nil {
|
||||
out.Conditions = make([]TableRowCondition, len(in.Conditions))
|
||||
for i := range in.Conditions {
|
||||
in.Conditions[i].DeepCopyInto(&out.Conditions[i])
|
||||
}
|
||||
}
|
||||
|
||||
in.Object.DeepCopyInto(&out.Object)
|
||||
return out
|
||||
}
|
883
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
generated
vendored
883
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
6
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go
generated
vendored
6
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go
generated
vendored
@ -94,6 +94,8 @@ type ListInterface interface {
|
||||
SetSelfLink(selfLink string)
|
||||
GetContinue() string
|
||||
SetContinue(c string)
|
||||
GetRemainingItemCount() *int64
|
||||
SetRemainingItemCount(c *int64)
|
||||
}
|
||||
|
||||
// Type exposes the type and APIVersion of versioned or internal API objects.
|
||||
@ -105,12 +107,16 @@ type Type interface {
|
||||
SetKind(kind string)
|
||||
}
|
||||
|
||||
var _ ListInterface = &ListMeta{}
|
||||
|
||||
func (meta *ListMeta) GetResourceVersion() string { return meta.ResourceVersion }
|
||||
func (meta *ListMeta) SetResourceVersion(version string) { meta.ResourceVersion = version }
|
||||
func (meta *ListMeta) GetSelfLink() string { return meta.SelfLink }
|
||||
func (meta *ListMeta) SetSelfLink(selfLink string) { meta.SelfLink = selfLink }
|
||||
func (meta *ListMeta) GetContinue() string { return meta.Continue }
|
||||
func (meta *ListMeta) SetContinue(c string) { meta.Continue = c }
|
||||
func (meta *ListMeta) GetRemainingItemCount() *int64 { return meta.RemainingItemCount }
|
||||
func (meta *ListMeta) SetRemainingItemCount(c *int64) { meta.RemainingItemCount = c }
|
||||
|
||||
func (obj *TypeMeta) GetObjectKind() schema.ObjectKind { return obj }
|
||||
|
||||
|
31
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
generated
vendored
31
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
generated
vendored
@ -41,11 +41,6 @@ func (t *MicroTime) DeepCopyInto(out *MicroTime) {
|
||||
*out = *t
|
||||
}
|
||||
|
||||
// String returns the representation of the time.
|
||||
func (t MicroTime) String() string {
|
||||
return t.Time.String()
|
||||
}
|
||||
|
||||
// NewMicroTime returns a wrapped instance of the provided time
|
||||
func NewMicroTime(time time.Time) MicroTime {
|
||||
return MicroTime{time}
|
||||
@ -72,22 +67,40 @@ func (t *MicroTime) IsZero() bool {
|
||||
|
||||
// Before reports whether the time instant t is before u.
|
||||
func (t *MicroTime) Before(u *MicroTime) bool {
|
||||
return t.Time.Before(u.Time)
|
||||
if t != nil && u != nil {
|
||||
return t.Time.Before(u.Time)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Equal reports whether the time instant t is equal to u.
|
||||
func (t *MicroTime) Equal(u *MicroTime) bool {
|
||||
return t.Time.Equal(u.Time)
|
||||
if t == nil && u == nil {
|
||||
return true
|
||||
}
|
||||
if t != nil && u != nil {
|
||||
return t.Time.Equal(u.Time)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// BeforeTime reports whether the time instant t is before second-lever precision u.
|
||||
func (t *MicroTime) BeforeTime(u *Time) bool {
|
||||
return t.Time.Before(u.Time)
|
||||
if t != nil && u != nil {
|
||||
return t.Time.Before(u.Time)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// EqualTime reports whether the time instant t is equal to second-lever precision u.
|
||||
func (t *MicroTime) EqualTime(u *Time) bool {
|
||||
return t.Time.Equal(u.Time)
|
||||
if t == nil && u == nil {
|
||||
return true
|
||||
}
|
||||
if t != nil && u != nil {
|
||||
return t.Time.Equal(u.Time)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// UnixMicro returns the local time corresponding to the given Unix time
|
||||
|
17
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/register.go
generated
vendored
17
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/register.go
generated
vendored
@ -94,6 +94,23 @@ func init() {
|
||||
&PatchOptions{},
|
||||
)
|
||||
|
||||
if err := AddMetaToScheme(scheme); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// register manually. This usually goes through the SchemeBuilder, which we cannot use here.
|
||||
utilruntime.Must(RegisterDefaults(scheme))
|
||||
}
|
||||
|
||||
func AddMetaToScheme(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&Table{},
|
||||
&TableOptions{},
|
||||
&PartialObjectMetadata{},
|
||||
&PartialObjectMetadataList{},
|
||||
)
|
||||
|
||||
return scheme.AddConversionFuncs(
|
||||
Convert_Slice_string_To_v1_IncludeObjectPolicy,
|
||||
)
|
||||
}
|
||||
|
20
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
generated
vendored
20
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
generated
vendored
@ -20,7 +20,7 @@ import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/google/gofuzz"
|
||||
fuzz "github.com/google/gofuzz"
|
||||
)
|
||||
|
||||
// Time is a wrapper around time.Time which supports correct
|
||||
@ -41,11 +41,6 @@ func (t *Time) DeepCopyInto(out *Time) {
|
||||
*out = *t
|
||||
}
|
||||
|
||||
// String returns the representation of the time.
|
||||
func (t Time) String() string {
|
||||
return t.Time.String()
|
||||
}
|
||||
|
||||
// NewTime returns a wrapped instance of the provided time
|
||||
func NewTime(time time.Time) Time {
|
||||
return Time{time}
|
||||
@ -72,7 +67,10 @@ func (t *Time) IsZero() bool {
|
||||
|
||||
// Before reports whether the time instant t is before u.
|
||||
func (t *Time) Before(u *Time) bool {
|
||||
return t.Time.Before(u.Time)
|
||||
if t != nil && u != nil {
|
||||
return t.Time.Before(u.Time)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Equal reports whether the time instant t is equal to u.
|
||||
@ -147,8 +145,12 @@ func (t Time) MarshalJSON() ([]byte, error) {
|
||||
// Encode unset/nil objects as JSON's "null".
|
||||
return []byte("null"), nil
|
||||
}
|
||||
|
||||
return json.Marshal(t.UTC().Format(time.RFC3339))
|
||||
buf := make([]byte, 0, len(time.RFC3339)+2)
|
||||
buf = append(buf, '"')
|
||||
// time cannot contain non escapable JSON characters
|
||||
buf = t.UTC().AppendFormat(buf, time.RFC3339)
|
||||
buf = append(buf, '"')
|
||||
return buf, nil
|
||||
}
|
||||
|
||||
// OpenAPISchemaType is used by the kube-openapi generator when constructing
|
||||
|
190
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
generated
vendored
190
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
generated
vendored
@ -81,6 +81,21 @@ type ListMeta struct {
|
||||
// identical to the value in the first response, unless you have received this token from an error
|
||||
// message.
|
||||
Continue string `json:"continue,omitempty" protobuf:"bytes,3,opt,name=continue"`
|
||||
|
||||
// remainingItemCount is the number of subsequent items in the list which are not included in this
|
||||
// list response. If the list request contained label or field selectors, then the number of
|
||||
// remaining items is unknown and the field will be left unset and omitted during serialization.
|
||||
// If the list is complete (either because it is not chunking or because this is the last chunk),
|
||||
// then there are no more remaining items and this field will be left unset and omitted during
|
||||
// serialization.
|
||||
// Servers older than v1.15 do not set this field.
|
||||
// The intended use of the remainingItemCount is *estimating* the size of a collection. Clients
|
||||
// should not rely on the remainingItemCount to be set or to be exact.
|
||||
//
|
||||
// This field is alpha and can be changed or removed without notice.
|
||||
//
|
||||
// +optional
|
||||
RemainingItemCount *int64 `json:"remainingItemCount,omitempty" protobuf:"bytes,4,opt,name=remainingItemCount"`
|
||||
}
|
||||
|
||||
// These are internal finalizer values for Kubernetes-like APIs, must be qualified name unless defined here
|
||||
@ -349,6 +364,20 @@ type ListOptions struct {
|
||||
// add, update, and remove notifications. Specify resourceVersion.
|
||||
// +optional
|
||||
Watch bool `json:"watch,omitempty" protobuf:"varint,3,opt,name=watch"`
|
||||
// allowWatchBookmarks requests watch events with type "BOOKMARK".
|
||||
// Servers that do not implement bookmarks may ignore this flag and
|
||||
// bookmarks are sent at the server's discretion. Clients should not
|
||||
// assume bookmarks are returned at any specific interval, nor may they
|
||||
// assume the server will send any BOOKMARK event during a session.
|
||||
// If this is not a watch, this field is ignored.
|
||||
// If the feature gate WatchBookmarks is not enabled in apiserver,
|
||||
// this field is ignored.
|
||||
//
|
||||
// This field is alpha and can be changed or removed without notice.
|
||||
//
|
||||
// +optional
|
||||
AllowWatchBookmarks bool `json:"allowWatchBookmarks,omitempty" protobuf:"varint,9,opt,name=allowWatchBookmarks"`
|
||||
|
||||
// When specified with a watch call, shows changes that occur after that particular version of a resource.
|
||||
// Defaults to changes from the beginning of history.
|
||||
// When specified for list:
|
||||
@ -1128,3 +1157,164 @@ type Fields struct {
|
||||
// The exact format is defined in k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/internal
|
||||
Map map[string]Fields `json:",inline" protobuf:"bytes,1,rep,name=map"`
|
||||
}
|
||||
|
||||
// TODO: Table does not generate to protobuf because of the interface{} - fix protobuf
|
||||
// generation to support a meta type that can accept any valid JSON. This can be introduced
|
||||
// in a v1 because clients a) receive an error if they try to access proto today, and b)
|
||||
// once introduced they would be able to gracefully switch over to using it.
|
||||
|
||||
// Table is a tabular representation of a set of API resources. The server transforms the
|
||||
// object into a set of preferred columns for quickly reviewing the objects.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +protobuf=false
|
||||
type Table struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
// columnDefinitions describes each column in the returned items array. The number of cells per row
|
||||
// will always match the number of column definitions.
|
||||
ColumnDefinitions []TableColumnDefinition `json:"columnDefinitions"`
|
||||
// rows is the list of items in the table.
|
||||
Rows []TableRow `json:"rows"`
|
||||
}
|
||||
|
||||
// TableColumnDefinition contains information about a column returned in the Table.
|
||||
// +protobuf=false
|
||||
type TableColumnDefinition struct {
|
||||
// name is a human readable name for the column.
|
||||
Name string `json:"name"`
|
||||
// type is an OpenAPI type definition for this column, such as number, integer, string, or
|
||||
// array.
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
|
||||
Type string `json:"type"`
|
||||
// format is an optional OpenAPI type modifier for this column. A format modifies the type and
|
||||
// imposes additional rules, like date or time formatting for a string. The 'name' format is applied
|
||||
// to the primary identifier column which has type 'string' to assist in clients identifying column
|
||||
// is the resource name.
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
|
||||
Format string `json:"format"`
|
||||
// description is a human readable description of this column.
|
||||
Description string `json:"description"`
|
||||
// priority is an integer defining the relative importance of this column compared to others. Lower
|
||||
// numbers are considered higher priority. Columns that may be omitted in limited space scenarios
|
||||
// should be given a higher priority.
|
||||
Priority int32 `json:"priority"`
|
||||
}
|
||||
|
||||
// TableRow is an individual row in a table.
|
||||
// +protobuf=false
|
||||
type TableRow struct {
|
||||
// cells will be as wide as the column definitions array and may contain strings, numbers (float64 or
|
||||
// int64), booleans, simple maps, lists, or null. See the type field of the column definition for a
|
||||
// more detailed description.
|
||||
Cells []interface{} `json:"cells"`
|
||||
// conditions describe additional status of a row that are relevant for a human user. These conditions
|
||||
// apply to the row, not to the object, and will be specific to table output. The only defined
|
||||
// condition type is 'Completed', for a row that indicates a resource that has run to completion and
|
||||
// can be given less visual priority.
|
||||
// +optional
|
||||
Conditions []TableRowCondition `json:"conditions,omitempty"`
|
||||
// This field contains the requested additional information about each object based on the includeObject
|
||||
// policy when requesting the Table. If "None", this field is empty, if "Object" this will be the
|
||||
// default serialization of the object for the current API version, and if "Metadata" (the default) will
|
||||
// contain the object metadata. Check the returned kind and apiVersion of the object before parsing.
|
||||
// The media type of the object will always match the enclosing list - if this as a JSON table, these
|
||||
// will be JSON encoded objects.
|
||||
// +optional
|
||||
Object runtime.RawExtension `json:"object,omitempty"`
|
||||
}
|
||||
|
||||
// TableRowCondition allows a row to be marked with additional information.
|
||||
// +protobuf=false
|
||||
type TableRowCondition struct {
|
||||
// Type of row condition. The only defined value is 'Completed' indicating that the
|
||||
// object this row represents has reached a completed state and may be given less visual
|
||||
// priority than other rows. Clients are not required to honor any conditions but should
|
||||
// be consistent where possible about handling the conditions.
|
||||
Type RowConditionType `json:"type"`
|
||||
// Status of the condition, one of True, False, Unknown.
|
||||
Status ConditionStatus `json:"status"`
|
||||
// (brief) machine readable reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// Human readable message indicating details about last transition.
|
||||
// +optional
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
type RowConditionType string
|
||||
|
||||
// These are valid conditions of a row. This list is not exhaustive and new conditions may be
|
||||
// included by other resources.
|
||||
const (
|
||||
// RowCompleted means the underlying resource has reached completion and may be given less
|
||||
// visual priority than other resources.
|
||||
RowCompleted RowConditionType = "Completed"
|
||||
)
|
||||
|
||||
type ConditionStatus string
|
||||
|
||||
// These are valid condition statuses. "ConditionTrue" means a resource is in the condition.
|
||||
// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes
|
||||
// can't decide if a resource is in the condition or not. In the future, we could add other
|
||||
// intermediate conditions, e.g. ConditionDegraded.
|
||||
const (
|
||||
ConditionTrue ConditionStatus = "True"
|
||||
ConditionFalse ConditionStatus = "False"
|
||||
ConditionUnknown ConditionStatus = "Unknown"
|
||||
)
|
||||
|
||||
// IncludeObjectPolicy controls which portion of the object is returned with a Table.
|
||||
type IncludeObjectPolicy string
|
||||
|
||||
const (
|
||||
// IncludeNone returns no object.
|
||||
IncludeNone IncludeObjectPolicy = "None"
|
||||
// IncludeMetadata serializes the object containing only its metadata field.
|
||||
IncludeMetadata IncludeObjectPolicy = "Metadata"
|
||||
// IncludeObject contains the full object.
|
||||
IncludeObject IncludeObjectPolicy = "Object"
|
||||
)
|
||||
|
||||
// TableOptions are used when a Table is requested by the caller.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type TableOptions struct {
|
||||
TypeMeta `json:",inline"`
|
||||
|
||||
// NoHeaders is only exposed for internal callers. It is not included in our OpenAPI definitions
|
||||
// and may be removed as a field in a future release.
|
||||
NoHeaders bool `json:"-"`
|
||||
|
||||
// includeObject decides whether to include each object along with its columnar information.
|
||||
// Specifying "None" will return no object, specifying "Object" will return the full object contents, and
|
||||
// specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind
|
||||
// in version v1beta1 of the meta.k8s.io API group.
|
||||
IncludeObject IncludeObjectPolicy `json:"includeObject,omitempty" protobuf:"bytes,1,opt,name=includeObject,casttype=IncludeObjectPolicy"`
|
||||
}
|
||||
|
||||
// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients
|
||||
// to get access to a particular ObjectMeta schema without knowing the details of the version.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type PartialObjectMetadata struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
}
|
||||
|
||||
// PartialObjectMetadataList contains a list of objects containing only their metadata
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type PartialObjectMetadataList struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// items contains each of the included items.
|
||||
Items []PartialObjectMetadata `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
101
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
generated
vendored
101
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
generated
vendored
@ -197,10 +197,11 @@ func (List) SwaggerDoc() map[string]string {
|
||||
}
|
||||
|
||||
var map_ListMeta = map[string]string{
|
||||
"": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.",
|
||||
"selfLink": "selfLink is a URL representing this object. Populated by the system. Read-only.",
|
||||
"resourceVersion": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency",
|
||||
"continue": "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.",
|
||||
"": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.",
|
||||
"selfLink": "selfLink is a URL representing this object. Populated by the system. Read-only.",
|
||||
"resourceVersion": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency",
|
||||
"continue": "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.",
|
||||
"remainingItemCount": "remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.\n\nThis field is alpha and can be changed or removed without notice.",
|
||||
}
|
||||
|
||||
func (ListMeta) SwaggerDoc() map[string]string {
|
||||
@ -208,14 +209,15 @@ func (ListMeta) SwaggerDoc() map[string]string {
|
||||
}
|
||||
|
||||
var map_ListOptions = map[string]string{
|
||||
"": "ListOptions is the query options to a standard REST list call.",
|
||||
"labelSelector": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
|
||||
"fieldSelector": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
|
||||
"watch": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
|
||||
"resourceVersion": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
|
||||
"timeoutSeconds": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.",
|
||||
"limit": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.",
|
||||
"continue": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
|
||||
"": "ListOptions is the query options to a standard REST list call.",
|
||||
"labelSelector": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
|
||||
"fieldSelector": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
|
||||
"watch": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
|
||||
"allowWatchBookmarks": "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.\n\nThis field is alpha and can be changed or removed without notice.",
|
||||
"resourceVersion": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
|
||||
"timeoutSeconds": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.",
|
||||
"limit": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.",
|
||||
"continue": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
|
||||
}
|
||||
|
||||
func (ListOptions) SwaggerDoc() map[string]string {
|
||||
@ -274,6 +276,25 @@ func (OwnerReference) SwaggerDoc() map[string]string {
|
||||
return map_OwnerReference
|
||||
}
|
||||
|
||||
var map_PartialObjectMetadata = map[string]string{
|
||||
"": "PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients to get access to a particular ObjectMeta schema without knowing the details of the version.",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
|
||||
}
|
||||
|
||||
func (PartialObjectMetadata) SwaggerDoc() map[string]string {
|
||||
return map_PartialObjectMetadata
|
||||
}
|
||||
|
||||
var map_PartialObjectMetadataList = map[string]string{
|
||||
"": "PartialObjectMetadataList contains a list of objects containing only their metadata",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"items": "items contains each of the included items.",
|
||||
}
|
||||
|
||||
func (PartialObjectMetadataList) SwaggerDoc() map[string]string {
|
||||
return map_PartialObjectMetadataList
|
||||
}
|
||||
|
||||
var map_Patch = map[string]string{
|
||||
"": "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.",
|
||||
}
|
||||
@ -361,6 +382,62 @@ func (StatusDetails) SwaggerDoc() map[string]string {
|
||||
return map_StatusDetails
|
||||
}
|
||||
|
||||
var map_Table = map[string]string{
|
||||
"": "Table is a tabular representation of a set of API resources. The server transforms the object into a set of preferred columns for quickly reviewing the objects.",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"columnDefinitions": "columnDefinitions describes each column in the returned items array. The number of cells per row will always match the number of column definitions.",
|
||||
"rows": "rows is the list of items in the table.",
|
||||
}
|
||||
|
||||
func (Table) SwaggerDoc() map[string]string {
|
||||
return map_Table
|
||||
}
|
||||
|
||||
var map_TableColumnDefinition = map[string]string{
|
||||
"": "TableColumnDefinition contains information about a column returned in the Table.",
|
||||
"name": "name is a human readable name for the column.",
|
||||
"type": "type is an OpenAPI type definition for this column, such as number, integer, string, or array. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.",
|
||||
"format": "format is an optional OpenAPI type modifier for this column. A format modifies the type and imposes additional rules, like date or time formatting for a string. The 'name' format is applied to the primary identifier column which has type 'string' to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.",
|
||||
"description": "description is a human readable description of this column.",
|
||||
"priority": "priority is an integer defining the relative importance of this column compared to others. Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a higher priority.",
|
||||
}
|
||||
|
||||
func (TableColumnDefinition) SwaggerDoc() map[string]string {
|
||||
return map_TableColumnDefinition
|
||||
}
|
||||
|
||||
var map_TableOptions = map[string]string{
|
||||
"": "TableOptions are used when a Table is requested by the caller.",
|
||||
"includeObject": "includeObject decides whether to include each object along with its columnar information. Specifying \"None\" will return no object, specifying \"Object\" will return the full object contents, and specifying \"Metadata\" (the default) will return the object's metadata in the PartialObjectMetadata kind in version v1beta1 of the meta.k8s.io API group.",
|
||||
}
|
||||
|
||||
func (TableOptions) SwaggerDoc() map[string]string {
|
||||
return map_TableOptions
|
||||
}
|
||||
|
||||
var map_TableRow = map[string]string{
|
||||
"": "TableRow is an individual row in a table.",
|
||||
"cells": "cells will be as wide as the column definitions array and may contain strings, numbers (float64 or int64), booleans, simple maps, lists, or null. See the type field of the column definition for a more detailed description.",
|
||||
"conditions": "conditions describe additional status of a row that are relevant for a human user. These conditions apply to the row, not to the object, and will be specific to table output. The only defined condition type is 'Completed', for a row that indicates a resource that has run to completion and can be given less visual priority.",
|
||||
"object": "This field contains the requested additional information about each object based on the includeObject policy when requesting the Table. If \"None\", this field is empty, if \"Object\" this will be the default serialization of the object for the current API version, and if \"Metadata\" (the default) will contain the object metadata. Check the returned kind and apiVersion of the object before parsing. The media type of the object will always match the enclosing list - if this as a JSON table, these will be JSON encoded objects.",
|
||||
}
|
||||
|
||||
func (TableRow) SwaggerDoc() map[string]string {
|
||||
return map_TableRow
|
||||
}
|
||||
|
||||
var map_TableRowCondition = map[string]string{
|
||||
"": "TableRowCondition allows a row to be marked with additional information.",
|
||||
"type": "Type of row condition. The only defined value is 'Completed' indicating that the object this row represents has reached a completed state and may be given less visual priority than other rows. Clients are not required to honor any conditions but should be consistent where possible about handling the conditions.",
|
||||
"status": "Status of the condition, one of True, False, Unknown.",
|
||||
"reason": "(brief) machine readable reason for the condition's last transition.",
|
||||
"message": "Human readable message indicating details about last transition.",
|
||||
}
|
||||
|
||||
func (TableRowCondition) SwaggerDoc() map[string]string {
|
||||
return map_TableRowCondition
|
||||
}
|
||||
|
||||
var map_TypeMeta = map[string]string{
|
||||
"": "TypeMeta describes an individual object in an API response or request with strings representing the type of the object and its API schema version. Structures that are versioned or persisted should inline TypeMeta.",
|
||||
"kind": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
|
16
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
generated
vendored
16
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
generated
vendored
@ -275,6 +275,22 @@ func getNestedString(obj map[string]interface{}, fields ...string) string {
|
||||
return val
|
||||
}
|
||||
|
||||
func getNestedInt64(obj map[string]interface{}, fields ...string) int64 {
|
||||
val, found, err := NestedInt64(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return 0
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
func getNestedInt64Pointer(obj map[string]interface{}, fields ...string) *int64 {
|
||||
val, found, err := NestedInt64(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return nil
|
||||
}
|
||||
return &val
|
||||
}
|
||||
|
||||
func jsonPath(fields []string) string {
|
||||
return "." + strings.Join(fields, ".")
|
||||
}
|
||||
|
23
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
generated
vendored
23
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
generated
vendored
@ -47,6 +47,7 @@ type Unstructured struct {
|
||||
|
||||
var _ metav1.Object = &Unstructured{}
|
||||
var _ runtime.Unstructured = &Unstructured{}
|
||||
var _ metav1.ListInterface = &Unstructured{}
|
||||
|
||||
func (obj *Unstructured) GetObjectKind() schema.ObjectKind { return obj }
|
||||
|
||||
@ -126,6 +127,16 @@ func (u *Unstructured) UnmarshalJSON(b []byte) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// NewEmptyInstance returns a new instance of the concrete type containing only kind/apiVersion and no other data.
|
||||
// This should be called instead of reflect.New() for unstructured types because the go type alone does not preserve kind/apiVersion info.
|
||||
func (in *Unstructured) NewEmptyInstance() runtime.Unstructured {
|
||||
out := new(Unstructured)
|
||||
if in != nil {
|
||||
out.GetObjectKind().SetGroupVersionKind(in.GetObjectKind().GroupVersionKind())
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (in *Unstructured) DeepCopy() *Unstructured {
|
||||
if in == nil {
|
||||
return nil
|
||||
@ -319,6 +330,18 @@ func (u *Unstructured) SetContinue(c string) {
|
||||
u.setNestedField(c, "metadata", "continue")
|
||||
}
|
||||
|
||||
func (u *Unstructured) GetRemainingItemCount() *int64 {
|
||||
return getNestedInt64Pointer(u.Object, "metadata", "remainingItemCount")
|
||||
}
|
||||
|
||||
func (u *Unstructured) SetRemainingItemCount(c *int64) {
|
||||
if c == nil {
|
||||
RemoveNestedField(u.Object, "metadata", "remainingItemCount")
|
||||
} else {
|
||||
u.setNestedField(*c, "metadata", "remainingItemCount")
|
||||
}
|
||||
}
|
||||
|
||||
func (u *Unstructured) GetCreationTimestamp() metav1.Time {
|
||||
var timestamp metav1.Time
|
||||
timestamp.UnmarshalQueryParameter(getNestedString(u.Object, "metadata", "creationTimestamp"))
|
||||
|
22
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go
generated
vendored
22
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go
generated
vendored
@ -52,6 +52,16 @@ func (u *UnstructuredList) EachListItem(fn func(runtime.Object) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewEmptyInstance returns a new instance of the concrete type containing only kind/apiVersion and no other data.
|
||||
// This should be called instead of reflect.New() for unstructured types because the go type alone does not preserve kind/apiVersion info.
|
||||
func (u *UnstructuredList) NewEmptyInstance() runtime.Unstructured {
|
||||
out := new(UnstructuredList)
|
||||
if u != nil {
|
||||
out.SetGroupVersionKind(u.GroupVersionKind())
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// UnstructuredContent returns a map contain an overlay of the Items field onto
|
||||
// the Object field. Items always overwrites overlay.
|
||||
func (u *UnstructuredList) UnstructuredContent() map[string]interface{} {
|
||||
@ -166,6 +176,18 @@ func (u *UnstructuredList) SetContinue(c string) {
|
||||
u.setNestedField(c, "metadata", "continue")
|
||||
}
|
||||
|
||||
func (u *UnstructuredList) GetRemainingItemCount() *int64 {
|
||||
return getNestedInt64Pointer(u.Object, "metadata", "remainingItemCount")
|
||||
}
|
||||
|
||||
func (u *UnstructuredList) SetRemainingItemCount(c *int64) {
|
||||
if c == nil {
|
||||
RemoveNestedField(u.Object, "metadata", "remainingItemCount")
|
||||
} else {
|
||||
u.setNestedField(*c, "metadata", "remainingItemCount")
|
||||
}
|
||||
}
|
||||
|
||||
func (u *UnstructuredList) SetGroupVersionKind(gvk schema.GroupVersionKind) {
|
||||
u.SetAPIVersion(gvk.GroupVersion().String())
|
||||
u.SetKind(gvk.Kind)
|
||||
|
10
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructuredscheme/scheme.go
generated
vendored
10
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructuredscheme/scheme.go
generated
vendored
@ -51,6 +51,8 @@ func (s unstructuredNegotiatedSerializer) SupportedMediaTypes() []runtime.Serial
|
||||
return []runtime.SerializerInfo{
|
||||
{
|
||||
MediaType: "application/json",
|
||||
MediaTypeType: "application",
|
||||
MediaTypeSubType: "json",
|
||||
EncodesAsText: true,
|
||||
Serializer: json.NewSerializer(json.DefaultMetaFactory, s.creator, s.typer, false),
|
||||
PrettySerializer: json.NewSerializer(json.DefaultMetaFactory, s.creator, s.typer, true),
|
||||
@ -61,9 +63,11 @@ func (s unstructuredNegotiatedSerializer) SupportedMediaTypes() []runtime.Serial
|
||||
},
|
||||
},
|
||||
{
|
||||
MediaType: "application/yaml",
|
||||
EncodesAsText: true,
|
||||
Serializer: json.NewYAMLSerializer(json.DefaultMetaFactory, s.creator, s.typer),
|
||||
MediaType: "application/yaml",
|
||||
MediaTypeType: "application",
|
||||
MediaTypeSubType: "yaml",
|
||||
EncodesAsText: true,
|
||||
Serializer: json.NewYAMLSerializer(json.DefaultMetaFactory, s.creator, s.typer),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
11
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go
generated
vendored
11
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go
generated
vendored
@ -158,3 +158,14 @@ func ValidateDryRun(fldPath *field.Path, dryRun []string) field.ErrorList {
|
||||
}
|
||||
|
||||
const UninitializedStatusUpdateErrorMsg string = `must not update status when the object is uninitialized`
|
||||
|
||||
// ValidateTableOptions returns any invalid flags on TableOptions.
|
||||
func ValidateTableOptions(opts *metav1.TableOptions) field.ErrorList {
|
||||
var allErrs field.ErrorList
|
||||
switch opts.IncludeObject {
|
||||
case metav1.IncludeMetadata, metav1.IncludeNone, metav1.IncludeObject, "":
|
||||
default:
|
||||
allErrs = append(allErrs, field.Invalid(field.NewPath("includeObject"), opts.IncludeObject, "must be 'Metadata', 'Object', 'None', or empty"))
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
170
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
generated
vendored
170
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
generated
vendored
@ -572,7 +572,7 @@ func (in *LabelSelectorRequirement) DeepCopy() *LabelSelectorRequirement {
|
||||
func (in *List) DeepCopyInto(out *List) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]runtime.RawExtension, len(*in))
|
||||
@ -604,6 +604,11 @@ func (in *List) DeepCopyObject() runtime.Object {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ListMeta) DeepCopyInto(out *ListMeta) {
|
||||
*out = *in
|
||||
if in.RemainingItemCount != nil {
|
||||
in, out := &in.RemainingItemCount, &out.RemainingItemCount
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -772,6 +777,65 @@ func (in *OwnerReference) DeepCopy() *OwnerReference {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PartialObjectMetadata) DeepCopyInto(out *PartialObjectMetadata) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartialObjectMetadata.
|
||||
func (in *PartialObjectMetadata) DeepCopy() *PartialObjectMetadata {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PartialObjectMetadata)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PartialObjectMetadata) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]PartialObjectMetadata, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartialObjectMetadataList.
|
||||
func (in *PartialObjectMetadataList) DeepCopy() *PartialObjectMetadataList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PartialObjectMetadataList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PartialObjectMetadataList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Patch) DeepCopyInto(out *Patch) {
|
||||
*out = *in
|
||||
@ -890,7 +954,7 @@ func (in *ServerAddressByClientCIDR) DeepCopy() *ServerAddressByClientCIDR {
|
||||
func (in *Status) DeepCopyInto(out *Status) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Details != nil {
|
||||
in, out := &in.Details, &out.Details
|
||||
*out = new(StatusDetails)
|
||||
@ -954,6 +1018,108 @@ func (in *StatusDetails) DeepCopy() *StatusDetails {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Table) DeepCopyInto(out *Table) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.ColumnDefinitions != nil {
|
||||
in, out := &in.ColumnDefinitions, &out.ColumnDefinitions
|
||||
*out = make([]TableColumnDefinition, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Rows != nil {
|
||||
in, out := &in.Rows, &out.Rows
|
||||
*out = make([]TableRow, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Table.
|
||||
func (in *Table) DeepCopy() *Table {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Table)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Table) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableColumnDefinition) DeepCopyInto(out *TableColumnDefinition) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableColumnDefinition.
|
||||
func (in *TableColumnDefinition) DeepCopy() *TableColumnDefinition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableColumnDefinition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableOptions) DeepCopyInto(out *TableOptions) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableOptions.
|
||||
func (in *TableOptions) DeepCopy() *TableOptions {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableOptions)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *TableOptions) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableRow) DeepCopyInto(out *TableRow) {
|
||||
clone := in.DeepCopy()
|
||||
*out = *clone
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableRowCondition) DeepCopyInto(out *TableRowCondition) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableRowCondition.
|
||||
func (in *TableRowCondition) DeepCopy() *TableRowCondition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableRowCondition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Time.
|
||||
func (in *Time) DeepCopy() *Time {
|
||||
if in == nil {
|
||||
|
27
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/deepcopy.go
generated
vendored
27
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/deepcopy.go
generated
vendored
@ -15,30 +15,3 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import "k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
func (in *TableRow) DeepCopy() *TableRow {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
out := new(TableRow)
|
||||
|
||||
if in.Cells != nil {
|
||||
out.Cells = make([]interface{}, len(in.Cells))
|
||||
for i := range in.Cells {
|
||||
out.Cells[i] = runtime.DeepCopyJSONValue(in.Cells[i])
|
||||
}
|
||||
}
|
||||
|
||||
if in.Conditions != nil {
|
||||
out.Conditions = make([]TableRowCondition, len(in.Conditions))
|
||||
for i := range in.Conditions {
|
||||
in.Conditions[i].DeepCopyInto(&out.Conditions[i])
|
||||
}
|
||||
}
|
||||
|
||||
in.Object.DeepCopyInto(&out.Object)
|
||||
return out
|
||||
}
|
||||
|
305
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go
generated
vendored
305
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go
generated
vendored
@ -24,9 +24,7 @@ limitations under the License.
|
||||
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
PartialObjectMetadata
|
||||
PartialObjectMetadataList
|
||||
TableOptions
|
||||
*/
|
||||
package v1beta1
|
||||
|
||||
@ -34,6 +32,8 @@ import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
import k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
import strings "strings"
|
||||
import reflect "reflect"
|
||||
|
||||
@ -50,51 +50,15 @@ var _ = math.Inf
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
func (m *PartialObjectMetadata) Reset() { *m = PartialObjectMetadata{} }
|
||||
func (*PartialObjectMetadata) ProtoMessage() {}
|
||||
func (*PartialObjectMetadata) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
|
||||
func (m *PartialObjectMetadataList) Reset() { *m = PartialObjectMetadataList{} }
|
||||
func (*PartialObjectMetadataList) ProtoMessage() {}
|
||||
func (*PartialObjectMetadataList) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptorGenerated, []int{1}
|
||||
return fileDescriptorGenerated, []int{0}
|
||||
}
|
||||
|
||||
func (m *TableOptions) Reset() { *m = TableOptions{} }
|
||||
func (*TableOptions) ProtoMessage() {}
|
||||
func (*TableOptions) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*PartialObjectMetadata)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1beta1.PartialObjectMetadata")
|
||||
proto.RegisterType((*PartialObjectMetadataList)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1beta1.PartialObjectMetadataList")
|
||||
proto.RegisterType((*TableOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1beta1.TableOptions")
|
||||
}
|
||||
func (m *PartialObjectMetadata) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *PartialObjectMetadata) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.ObjectMeta.Size()))
|
||||
n1, err := m.ObjectMeta.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *PartialObjectMetadataList) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
@ -122,28 +86,14 @@ func (m *PartialObjectMetadataList) MarshalTo(dAtA []byte) (int, error) {
|
||||
i += n
|
||||
}
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *TableOptions) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *TableOptions) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
dAtA[i] = 0xa
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.IncludeObject)))
|
||||
i += copy(dAtA[i:], m.IncludeObject)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.ListMeta.Size()))
|
||||
n1, err := m.ListMeta.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
return i, nil
|
||||
}
|
||||
|
||||
@ -156,14 +106,6 @@ func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func (m *PartialObjectMetadata) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
l = m.ObjectMeta.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *PartialObjectMetadataList) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
@ -173,13 +115,7 @@ func (m *PartialObjectMetadataList) Size() (n int) {
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *TableOptions) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.IncludeObject)
|
||||
l = m.ListMeta.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
return n
|
||||
}
|
||||
@ -197,32 +133,13 @@ func sovGenerated(x uint64) (n int) {
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (this *PartialObjectMetadata) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&PartialObjectMetadata{`,
|
||||
`ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *PartialObjectMetadataList) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&PartialObjectMetadataList{`,
|
||||
`Items:` + strings.Replace(fmt.Sprintf("%v", this.Items), "PartialObjectMetadata", "PartialObjectMetadata", 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *TableOptions) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&TableOptions{`,
|
||||
`IncludeObject:` + fmt.Sprintf("%v", this.IncludeObject) + `,`,
|
||||
`Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "PartialObjectMetadata", "k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadata", 1), `&`, ``, 1) + `,`,
|
||||
`ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
@ -235,86 +152,6 @@ func valueToStringGenerated(v interface{}) string {
|
||||
pv := reflect.Indirect(rv).Interface()
|
||||
return fmt.Sprintf("*%v", pv)
|
||||
}
|
||||
func (m *PartialObjectMetadata) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: PartialObjectMetadata: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PartialObjectMetadata: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *PartialObjectMetadataList) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
@ -370,66 +207,16 @@ func (m *PartialObjectMetadataList) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Items = append(m.Items, &PartialObjectMetadata{})
|
||||
m.Items = append(m.Items, k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadata{})
|
||||
if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *TableOptions) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: TableOptions: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: TableOptions: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field IncludeObject", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
@ -439,20 +226,21 @@ func (m *TableOptions) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.IncludeObject = IncludeObjectPolicy(dAtA[iNdEx:postIndex])
|
||||
if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
@ -585,29 +373,26 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 375 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xcd, 0x0a, 0xd3, 0x40,
|
||||
0x10, 0xc7, 0xb3, 0x48, 0xd1, 0x6e, 0xed, 0x25, 0x22, 0xd4, 0x1e, 0x36, 0xa5, 0xa7, 0x0a, 0x76,
|
||||
0xd7, 0x16, 0x11, 0x8f, 0x92, 0x5b, 0x41, 0x69, 0x09, 0x9e, 0x3c, 0xb9, 0x49, 0xc6, 0x74, 0xcd,
|
||||
0xc7, 0x86, 0xec, 0xa6, 0xd0, 0x8b, 0xf8, 0x08, 0x3e, 0x56, 0x8f, 0x3d, 0xf6, 0x14, 0x6c, 0x7c,
|
||||
0x0b, 0x4f, 0x92, 0x0f, 0xec, 0x87, 0x15, 0x7b, 0x9b, 0xf9, 0x0f, 0xbf, 0x5f, 0x66, 0xb2, 0xd8,
|
||||
0x09, 0xdf, 0x28, 0x2a, 0x24, 0x0b, 0x73, 0x17, 0xb2, 0x04, 0x34, 0x28, 0xb6, 0x81, 0xc4, 0x97,
|
||||
0x19, 0x6b, 0x07, 0x3c, 0x15, 0x31, 0xf7, 0xd6, 0x22, 0x81, 0x6c, 0xcb, 0xd2, 0x30, 0xa8, 0x02,
|
||||
0xc5, 0x62, 0xd0, 0x9c, 0x6d, 0x66, 0x2e, 0x68, 0x3e, 0x63, 0x01, 0x24, 0x90, 0x71, 0x0d, 0x3e,
|
||||
0x4d, 0x33, 0xa9, 0xa5, 0xf9, 0xbc, 0x41, 0xe9, 0x39, 0x4a, 0xd3, 0x30, 0xa8, 0x02, 0x45, 0x2b,
|
||||
0x94, 0xb6, 0xe8, 0x70, 0x1a, 0x08, 0xbd, 0xce, 0x5d, 0xea, 0xc9, 0x98, 0x05, 0x32, 0x90, 0xac,
|
||||
0x36, 0xb8, 0xf9, 0xe7, 0xba, 0xab, 0x9b, 0xba, 0x6a, 0xcc, 0xc3, 0x57, 0xf7, 0x2c, 0x75, 0xbd,
|
||||
0xcf, 0xf0, 0x9f, 0xa7, 0x64, 0x79, 0xa2, 0x45, 0x0c, 0x7f, 0x01, 0xaf, 0xff, 0x07, 0x28, 0x6f,
|
||||
0x0d, 0x31, 0xbf, 0xe6, 0xc6, 0x5b, 0xfc, 0x74, 0xc5, 0x33, 0x2d, 0x78, 0xb4, 0x74, 0xbf, 0x80,
|
||||
0xa7, 0xdf, 0x83, 0xe6, 0x3e, 0xd7, 0xdc, 0xfc, 0x84, 0x1f, 0xc5, 0x6d, 0x3d, 0x40, 0x23, 0x34,
|
||||
0xe9, 0xcd, 0x5f, 0xd2, 0x7b, 0x7e, 0x12, 0x3d, 0x79, 0x6c, 0x73, 0x57, 0x58, 0x46, 0x59, 0x58,
|
||||
0xf8, 0x94, 0x39, 0x7f, 0xac, 0xe3, 0xaf, 0xf8, 0xd9, 0xcd, 0x4f, 0xbf, 0x13, 0x4a, 0x9b, 0x1c,
|
||||
0x77, 0x84, 0x86, 0x58, 0x0d, 0xd0, 0xe8, 0xc1, 0xa4, 0x37, 0x7f, 0x4b, 0xef, 0x7e, 0x20, 0x7a,
|
||||
0x53, 0x6a, 0x77, 0xcb, 0xc2, 0xea, 0x2c, 0x2a, 0xa5, 0xd3, 0x98, 0xc7, 0x2e, 0x7e, 0xfc, 0x81,
|
||||
0xbb, 0x11, 0x2c, 0x53, 0x2d, 0x64, 0xa2, 0x4c, 0x07, 0xf7, 0x45, 0xe2, 0x45, 0xb9, 0x0f, 0x0d,
|
||||
0x5a, 0x9f, 0xdd, 0xb5, 0x5f, 0xb4, 0x47, 0xf4, 0x17, 0xe7, 0xc3, 0x5f, 0x85, 0xf5, 0xe4, 0x22,
|
||||
0x58, 0xc9, 0x48, 0x78, 0x5b, 0xe7, 0x52, 0x61, 0x4f, 0x77, 0x47, 0x62, 0xec, 0x8f, 0xc4, 0x38,
|
||||
0x1c, 0x89, 0xf1, 0xad, 0x24, 0x68, 0x57, 0x12, 0xb4, 0x2f, 0x09, 0x3a, 0x94, 0x04, 0xfd, 0x28,
|
||||
0x09, 0xfa, 0xfe, 0x93, 0x18, 0x1f, 0x1f, 0xb6, 0xab, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf3,
|
||||
0xe1, 0xde, 0x86, 0xdb, 0x02, 0x00, 0x00,
|
||||
// 322 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x41, 0x4b, 0xf3, 0x30,
|
||||
0x18, 0xc7, 0x9b, 0xf7, 0x65, 0x38, 0x3a, 0x04, 0xd9, 0x69, 0xee, 0x90, 0x0d, 0x4f, 0xf3, 0xb0,
|
||||
0x84, 0x0d, 0x11, 0xc1, 0xdb, 0x6e, 0x82, 0xa2, 0xec, 0x28, 0x1e, 0x4c, 0xbb, 0xc7, 0x2e, 0xd6,
|
||||
0x34, 0x25, 0x79, 0x3a, 0xf0, 0xe6, 0x47, 0xf0, 0x63, 0xed, 0xb8, 0xe3, 0x40, 0x18, 0xae, 0x7e,
|
||||
0x11, 0x49, 0x57, 0x45, 0xa6, 0x62, 0x6f, 0x7d, 0xfe, 0xcd, 0xef, 0x97, 0x7f, 0x12, 0x7f, 0x1c,
|
||||
0x9f, 0x58, 0x26, 0x35, 0x8f, 0xb3, 0x00, 0x4c, 0x02, 0x08, 0x96, 0xcf, 0x20, 0x99, 0x68, 0xc3,
|
||||
0xcb, 0x1f, 0x22, 0x95, 0x4a, 0x84, 0x53, 0x99, 0x80, 0x79, 0xe4, 0x69, 0x1c, 0xb9, 0xc0, 0x72,
|
||||
0x05, 0x28, 0xf8, 0x6c, 0x10, 0x00, 0x8a, 0x01, 0x8f, 0x20, 0x01, 0x23, 0x10, 0x26, 0x2c, 0x35,
|
||||
0x1a, 0x75, 0xf3, 0x70, 0x83, 0xb2, 0xaf, 0x28, 0x4b, 0xe3, 0xc8, 0x05, 0x96, 0x39, 0x94, 0x95,
|
||||
0x68, 0xbb, 0x1f, 0x49, 0x9c, 0x66, 0x01, 0x0b, 0xb5, 0xe2, 0x91, 0x8e, 0x34, 0x2f, 0x0c, 0x41,
|
||||
0x76, 0x57, 0x4c, 0xc5, 0x50, 0x7c, 0x6d, 0xcc, 0xed, 0xa3, 0x2a, 0xa5, 0xb6, 0xfb, 0xb4, 0x7f,
|
||||
0x3d, 0x8a, 0xc9, 0x12, 0x94, 0x0a, 0xbe, 0x01, 0xc7, 0x7f, 0x01, 0x36, 0x9c, 0x82, 0x12, 0xdb,
|
||||
0xdc, 0xc1, 0x0b, 0xf1, 0xf7, 0xaf, 0x84, 0x41, 0x29, 0x1e, 0x2e, 0x83, 0x7b, 0x08, 0xf1, 0x02,
|
||||
0x50, 0x4c, 0x04, 0x8a, 0x73, 0x69, 0xb1, 0x79, 0xeb, 0xd7, 0x24, 0x82, 0xb2, 0x2d, 0xd2, 0xfd,
|
||||
0xdf, 0x6b, 0x0c, 0x4f, 0x59, 0x95, 0x6b, 0x62, 0x3f, 0xfa, 0x46, 0xbb, 0xf3, 0x55, 0xc7, 0xcb,
|
||||
0x57, 0x9d, 0xda, 0x99, 0x33, 0x8e, 0x37, 0xe2, 0xe6, 0x8d, 0x5f, 0x57, 0xe5, 0x8a, 0xd6, 0xbf,
|
||||
0x2e, 0xe9, 0x35, 0x86, 0xac, 0xda, 0x26, 0xae, 0x9f, 0x73, 0x8f, 0xf6, 0x4a, 0x6f, 0xfd, 0x23,
|
||||
0x19, 0x7f, 0x1a, 0x47, 0xfd, 0xf9, 0x9a, 0x7a, 0x8b, 0x35, 0xf5, 0x96, 0x6b, 0xea, 0x3d, 0xe5,
|
||||
0x94, 0xcc, 0x73, 0x4a, 0x16, 0x39, 0x25, 0xcb, 0x9c, 0x92, 0xd7, 0x9c, 0x92, 0xe7, 0x37, 0xea,
|
||||
0x5d, 0xef, 0x94, 0x4f, 0xfb, 0x1e, 0x00, 0x00, 0xff, 0xff, 0x10, 0x2f, 0x48, 0xbd, 0x5a, 0x02,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
12
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/register.go
generated
vendored
12
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/register.go
generated
vendored
@ -39,6 +39,12 @@ var scheme = runtime.NewScheme()
|
||||
var ParameterCodec = runtime.NewParameterCodec(scheme)
|
||||
|
||||
func init() {
|
||||
if err := AddMetaToScheme(scheme); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func AddMetaToScheme(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&Table{},
|
||||
&TableOptions{},
|
||||
@ -46,11 +52,9 @@ func init() {
|
||||
&PartialObjectMetadataList{},
|
||||
)
|
||||
|
||||
if err := scheme.AddConversionFuncs(
|
||||
return scheme.AddConversionFuncs(
|
||||
Convert_Slice_string_To_v1beta1_IncludeObjectPolicy,
|
||||
); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
)
|
||||
|
||||
// register manually. This usually goes through the SchemeBuilder, which we cannot use here.
|
||||
//scheme.AddGeneratedDeepCopyFuncs(GetGeneratedDeepCopyFuncs()...)
|
||||
|
143
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types.go
generated
vendored
143
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types.go
generated
vendored
@ -18,144 +18,67 @@ limitations under the License.
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// TODO: Table does not generate to protobuf because of the interface{} - fix protobuf
|
||||
// generation to support a meta type that can accept any valid JSON.
|
||||
|
||||
// Table is a tabular representation of a set of API resources. The server transforms the
|
||||
// object into a set of preferred columns for quickly reviewing the objects.
|
||||
// +protobuf=false
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type Table struct {
|
||||
v1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
v1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
// columnDefinitions describes each column in the returned items array. The number of cells per row
|
||||
// will always match the number of column definitions.
|
||||
ColumnDefinitions []TableColumnDefinition `json:"columnDefinitions"`
|
||||
// rows is the list of items in the table.
|
||||
Rows []TableRow `json:"rows"`
|
||||
}
|
||||
// +protobuf=false
|
||||
type Table = v1.Table
|
||||
|
||||
// TableColumnDefinition contains information about a column returned in the Table.
|
||||
// +protobuf=false
|
||||
type TableColumnDefinition struct {
|
||||
// name is a human readable name for the column.
|
||||
Name string `json:"name"`
|
||||
// type is an OpenAPI type definition for this column.
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
|
||||
Type string `json:"type"`
|
||||
// format is an optional OpenAPI type definition for this column. The 'name' format is applied
|
||||
// to the primary identifier column to assist in clients identifying column is the resource name.
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
|
||||
Format string `json:"format"`
|
||||
// description is a human readable description of this column.
|
||||
Description string `json:"description"`
|
||||
// priority is an integer defining the relative importance of this column compared to others. Lower
|
||||
// numbers are considered higher priority. Columns that may be omitted in limited space scenarios
|
||||
// should be given a higher priority.
|
||||
Priority int32 `json:"priority"`
|
||||
}
|
||||
type TableColumnDefinition = v1.TableColumnDefinition
|
||||
|
||||
// TableRow is an individual row in a table.
|
||||
// +protobuf=false
|
||||
type TableRow struct {
|
||||
// cells will be as wide as headers and may contain strings, numbers (float64 or int64), booleans, simple
|
||||
// maps, or lists, or null. See the type field of the column definition for a more detailed description.
|
||||
Cells []interface{} `json:"cells"`
|
||||
// conditions describe additional status of a row that are relevant for a human user.
|
||||
// +optional
|
||||
Conditions []TableRowCondition `json:"conditions,omitempty"`
|
||||
// This field contains the requested additional information about each object based on the includeObject
|
||||
// policy when requesting the Table. If "None", this field is empty, if "Object" this will be the
|
||||
// default serialization of the object for the current API version, and if "Metadata" (the default) will
|
||||
// contain the object metadata. Check the returned kind and apiVersion of the object before parsing.
|
||||
// +optional
|
||||
Object runtime.RawExtension `json:"object,omitempty"`
|
||||
}
|
||||
type TableRow = v1.TableRow
|
||||
|
||||
// TableRowCondition allows a row to be marked with additional information.
|
||||
// +protobuf=false
|
||||
type TableRowCondition struct {
|
||||
// Type of row condition.
|
||||
Type RowConditionType `json:"type"`
|
||||
// Status of the condition, one of True, False, Unknown.
|
||||
Status ConditionStatus `json:"status"`
|
||||
// (brief) machine readable reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// Human readable message indicating details about last transition.
|
||||
// +optional
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
type TableRowCondition = v1.TableRowCondition
|
||||
|
||||
type RowConditionType string
|
||||
type RowConditionType = v1.RowConditionType
|
||||
|
||||
// These are valid conditions of a row. This list is not exhaustive and new conditions may be
|
||||
// included by other resources.
|
||||
const (
|
||||
// RowCompleted means the underlying resource has reached completion and may be given less
|
||||
// visual priority than other resources.
|
||||
RowCompleted RowConditionType = "Completed"
|
||||
)
|
||||
type ConditionStatus = v1.ConditionStatus
|
||||
|
||||
type ConditionStatus string
|
||||
|
||||
// These are valid condition statuses. "ConditionTrue" means a resource is in the condition.
|
||||
// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes
|
||||
// can't decide if a resource is in the condition or not. In the future, we could add other
|
||||
// intermediate conditions, e.g. ConditionDegraded.
|
||||
const (
|
||||
ConditionTrue ConditionStatus = "True"
|
||||
ConditionFalse ConditionStatus = "False"
|
||||
ConditionUnknown ConditionStatus = "Unknown"
|
||||
)
|
||||
|
||||
// IncludeObjectPolicy controls which portion of the object is returned with a Table.
|
||||
type IncludeObjectPolicy string
|
||||
|
||||
const (
|
||||
// IncludeNone returns no object.
|
||||
IncludeNone IncludeObjectPolicy = "None"
|
||||
// IncludeMetadata serializes the object containing only its metadata field.
|
||||
IncludeMetadata IncludeObjectPolicy = "Metadata"
|
||||
// IncludeObject contains the full object.
|
||||
IncludeObject IncludeObjectPolicy = "Object"
|
||||
)
|
||||
type IncludeObjectPolicy = v1.IncludeObjectPolicy
|
||||
|
||||
// TableOptions are used when a Table is requested by the caller.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type TableOptions struct {
|
||||
v1.TypeMeta `json:",inline"`
|
||||
// includeObject decides whether to include each object along with its columnar information.
|
||||
// Specifying "None" will return no object, specifying "Object" will return the full object contents, and
|
||||
// specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind
|
||||
// in version v1beta1 of the meta.k8s.io API group.
|
||||
IncludeObject IncludeObjectPolicy `json:"includeObject,omitempty" protobuf:"bytes,1,opt,name=includeObject,casttype=IncludeObjectPolicy"`
|
||||
}
|
||||
type TableOptions = v1.TableOptions
|
||||
|
||||
// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients
|
||||
// to get access to a particular ObjectMeta schema without knowing the details of the version.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type PartialObjectMetadata struct {
|
||||
v1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
}
|
||||
type PartialObjectMetadata = v1.PartialObjectMetadata
|
||||
|
||||
// PartialObjectMetadataList contains a list of objects containing only their metadata
|
||||
// IMPORTANT: PartialObjectMetadataList has different protobuf field ids in v1beta1 than
|
||||
// v1 because ListMeta was accidentally omitted prior to 1.15. Therefore this type must
|
||||
// remain independent of v1.PartialObjectMetadataList to preserve mappings.
|
||||
|
||||
// PartialObjectMetadataList contains a list of objects containing only their metadata.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type PartialObjectMetadataList struct {
|
||||
v1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
v1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,2,opt,name=metadata"`
|
||||
|
||||
// items contains each of the included items.
|
||||
Items []*PartialObjectMetadata `json:"items" protobuf:"bytes,1,rep,name=items"`
|
||||
Items []v1.PartialObjectMetadata `json:"items" protobuf:"bytes,1,rep,name=items"`
|
||||
}
|
||||
|
||||
const (
|
||||
RowCompleted = v1.RowCompleted
|
||||
|
||||
ConditionTrue = v1.ConditionTrue
|
||||
ConditionFalse = v1.ConditionFalse
|
||||
ConditionUnknown = v1.ConditionUnknown
|
||||
|
||||
IncludeNone = v1.IncludeNone
|
||||
IncludeMetadata = v1.IncludeMetadata
|
||||
IncludeObject = v1.IncludeObject
|
||||
)
|
||||
|
70
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go
generated
vendored
70
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go
generated
vendored
@ -27,78 +27,14 @@ package v1beta1
|
||||
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
|
||||
var map_PartialObjectMetadata = map[string]string{
|
||||
"": "PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients to get access to a particular ObjectMeta schema without knowing the details of the version.",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
|
||||
}
|
||||
|
||||
func (PartialObjectMetadata) SwaggerDoc() map[string]string {
|
||||
return map_PartialObjectMetadata
|
||||
}
|
||||
|
||||
var map_PartialObjectMetadataList = map[string]string{
|
||||
"": "PartialObjectMetadataList contains a list of objects containing only their metadata",
|
||||
"items": "items contains each of the included items.",
|
||||
"": "PartialObjectMetadataList contains a list of objects containing only their metadata.",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"items": "items contains each of the included items.",
|
||||
}
|
||||
|
||||
func (PartialObjectMetadataList) SwaggerDoc() map[string]string {
|
||||
return map_PartialObjectMetadataList
|
||||
}
|
||||
|
||||
var map_Table = map[string]string{
|
||||
"": "Table is a tabular representation of a set of API resources. The server transforms the object into a set of preferred columns for quickly reviewing the objects.",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"columnDefinitions": "columnDefinitions describes each column in the returned items array. The number of cells per row will always match the number of column definitions.",
|
||||
"rows": "rows is the list of items in the table.",
|
||||
}
|
||||
|
||||
func (Table) SwaggerDoc() map[string]string {
|
||||
return map_Table
|
||||
}
|
||||
|
||||
var map_TableColumnDefinition = map[string]string{
|
||||
"": "TableColumnDefinition contains information about a column returned in the Table.",
|
||||
"name": "name is a human readable name for the column.",
|
||||
"type": "type is an OpenAPI type definition for this column. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.",
|
||||
"format": "format is an optional OpenAPI type definition for this column. The 'name' format is applied to the primary identifier column to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.",
|
||||
"description": "description is a human readable description of this column.",
|
||||
"priority": "priority is an integer defining the relative importance of this column compared to others. Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a higher priority.",
|
||||
}
|
||||
|
||||
func (TableColumnDefinition) SwaggerDoc() map[string]string {
|
||||
return map_TableColumnDefinition
|
||||
}
|
||||
|
||||
var map_TableOptions = map[string]string{
|
||||
"": "TableOptions are used when a Table is requested by the caller.",
|
||||
"includeObject": "includeObject decides whether to include each object along with its columnar information. Specifying \"None\" will return no object, specifying \"Object\" will return the full object contents, and specifying \"Metadata\" (the default) will return the object's metadata in the PartialObjectMetadata kind in version v1beta1 of the meta.k8s.io API group.",
|
||||
}
|
||||
|
||||
func (TableOptions) SwaggerDoc() map[string]string {
|
||||
return map_TableOptions
|
||||
}
|
||||
|
||||
var map_TableRow = map[string]string{
|
||||
"": "TableRow is an individual row in a table.",
|
||||
"cells": "cells will be as wide as headers and may contain strings, numbers (float64 or int64), booleans, simple maps, or lists, or null. See the type field of the column definition for a more detailed description.",
|
||||
"conditions": "conditions describe additional status of a row that are relevant for a human user.",
|
||||
"object": "This field contains the requested additional information about each object based on the includeObject policy when requesting the Table. If \"None\", this field is empty, if \"Object\" this will be the default serialization of the object for the current API version, and if \"Metadata\" (the default) will contain the object metadata. Check the returned kind and apiVersion of the object before parsing.",
|
||||
}
|
||||
|
||||
func (TableRow) SwaggerDoc() map[string]string {
|
||||
return map_TableRow
|
||||
}
|
||||
|
||||
var map_TableRowCondition = map[string]string{
|
||||
"": "TableRowCondition allows a row to be marked with additional information.",
|
||||
"type": "Type of row condition.",
|
||||
"status": "Status of the condition, one of True, False, Unknown.",
|
||||
"reason": "(brief) machine readable reason for the condition's last transition.",
|
||||
"message": "Human readable message indicating details about last transition.",
|
||||
}
|
||||
|
||||
func (TableRowCondition) SwaggerDoc() map[string]string {
|
||||
return map_TableRowCondition
|
||||
}
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS END HERE
|
||||
|
138
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.deepcopy.go
generated
vendored
138
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.deepcopy.go
generated
vendored
@ -21,48 +21,20 @@ limitations under the License.
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PartialObjectMetadata) DeepCopyInto(out *PartialObjectMetadata) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartialObjectMetadata.
|
||||
func (in *PartialObjectMetadata) DeepCopy() *PartialObjectMetadata {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PartialObjectMetadata)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PartialObjectMetadata) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]*PartialObjectMetadata, len(*in))
|
||||
*out = make([]v1.PartialObjectMetadata, len(*in))
|
||||
for i := range *in {
|
||||
if (*in)[i] != nil {
|
||||
in, out := &(*in)[i], &(*out)[i]
|
||||
*out = new(PartialObjectMetadata)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
@ -85,105 +57,3 @@ func (in *PartialObjectMetadataList) DeepCopyObject() runtime.Object {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Table) DeepCopyInto(out *Table) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.ColumnDefinitions != nil {
|
||||
in, out := &in.ColumnDefinitions, &out.ColumnDefinitions
|
||||
*out = make([]TableColumnDefinition, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Rows != nil {
|
||||
in, out := &in.Rows, &out.Rows
|
||||
*out = make([]TableRow, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Table.
|
||||
func (in *Table) DeepCopy() *Table {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Table)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Table) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableColumnDefinition) DeepCopyInto(out *TableColumnDefinition) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableColumnDefinition.
|
||||
func (in *TableColumnDefinition) DeepCopy() *TableColumnDefinition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableColumnDefinition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableOptions) DeepCopyInto(out *TableOptions) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableOptions.
|
||||
func (in *TableOptions) DeepCopy() *TableOptions {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableOptions)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *TableOptions) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableRow) DeepCopyInto(out *TableRow) {
|
||||
clone := in.DeepCopy()
|
||||
*out = *clone
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableRowCondition) DeepCopyInto(out *TableRowCondition) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableRowCondition.
|
||||
func (in *TableRowCondition) DeepCopy() *TableRowCondition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableRowCondition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
4
vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go
generated
vendored
4
vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go
generated
vendored
@ -54,10 +54,6 @@ func jsonTag(field reflect.StructField) (string, bool) {
|
||||
return tag, omitempty
|
||||
}
|
||||
|
||||
func formatValue(value interface{}) string {
|
||||
return fmt.Sprintf("%v", value)
|
||||
}
|
||||
|
||||
func isPointerKind(kind reflect.Kind) bool {
|
||||
return kind == reflect.Ptr
|
||||
}
|
||||
|
2
vendor/k8s.io/apimachinery/pkg/labels/labels.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/labels/labels.go
generated
vendored
@ -172,7 +172,7 @@ func ConvertSelectorToLabelsMap(selector string) (Set, error) {
|
||||
return labelsMap, err
|
||||
}
|
||||
value := strings.TrimSpace(l[1])
|
||||
if err := validateLabelValue(value); err != nil {
|
||||
if err := validateLabelValue(key, value); err != nil {
|
||||
return labelsMap, err
|
||||
}
|
||||
labelsMap[key] = value
|
||||
|
6
vendor/k8s.io/apimachinery/pkg/labels/selector.go
generated
vendored
6
vendor/k8s.io/apimachinery/pkg/labels/selector.go
generated
vendored
@ -162,7 +162,7 @@ func NewRequirement(key string, op selection.Operator, vals []string) (*Requirem
|
||||
}
|
||||
|
||||
for i := range vals {
|
||||
if err := validateLabelValue(vals[i]); err != nil {
|
||||
if err := validateLabelValue(key, vals[i]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@ -837,9 +837,9 @@ func validateLabelKey(k string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateLabelValue(v string) error {
|
||||
func validateLabelValue(k, v string) error {
|
||||
if errs := validation.IsValidLabelValue(v); len(errs) != 0 {
|
||||
return fmt.Errorf("invalid label value: %q: %s", v, strings.Join(errs, "; "))
|
||||
return fmt.Errorf("invalid label value: %q: at key: %q: %s", v, k, strings.Join(errs, "; "))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
29
vendor/k8s.io/apimachinery/pkg/runtime/error.go
generated
vendored
29
vendor/k8s.io/apimachinery/pkg/runtime/error.go
generated
vendored
@ -120,3 +120,32 @@ func IsMissingVersion(err error) bool {
|
||||
_, ok := err.(*missingVersionErr)
|
||||
return ok
|
||||
}
|
||||
|
||||
// strictDecodingError is a base error type that is returned by a strict Decoder such
|
||||
// as UniversalStrictDecoder.
|
||||
type strictDecodingError struct {
|
||||
message string
|
||||
data string
|
||||
}
|
||||
|
||||
// NewStrictDecodingError creates a new strictDecodingError object.
|
||||
func NewStrictDecodingError(message string, data string) error {
|
||||
return &strictDecodingError{
|
||||
message: message,
|
||||
data: data,
|
||||
}
|
||||
}
|
||||
|
||||
func (e *strictDecodingError) Error() string {
|
||||
return fmt.Sprintf("strict decoder error for %s: %s", e.data, e.message)
|
||||
}
|
||||
|
||||
// IsStrictDecodingError returns true if the error indicates that the provided object
|
||||
// strictness violations.
|
||||
func IsStrictDecodingError(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
_, ok := err.(*strictDecodingError)
|
||||
return ok
|
||||
}
|
||||
|
53
vendor/k8s.io/apimachinery/pkg/runtime/helper.go
generated
vendored
53
vendor/k8s.io/apimachinery/pkg/runtime/helper.go
generated
vendored
@ -51,7 +51,7 @@ func UnsafeObjectConvertor(scheme *Scheme) ObjectConvertor {
|
||||
func SetField(src interface{}, v reflect.Value, fieldName string) error {
|
||||
field := v.FieldByName(fieldName)
|
||||
if !field.IsValid() {
|
||||
return fmt.Errorf("couldn't find %v field in %#v", fieldName, v.Interface())
|
||||
return fmt.Errorf("couldn't find %v field in %T", fieldName, v.Interface())
|
||||
}
|
||||
srcValue := reflect.ValueOf(src)
|
||||
if srcValue.Type().AssignableTo(field.Type()) {
|
||||
@ -70,7 +70,7 @@ func SetField(src interface{}, v reflect.Value, fieldName string) error {
|
||||
func Field(v reflect.Value, fieldName string, dest interface{}) error {
|
||||
field := v.FieldByName(fieldName)
|
||||
if !field.IsValid() {
|
||||
return fmt.Errorf("couldn't find %v field in %#v", fieldName, v.Interface())
|
||||
return fmt.Errorf("couldn't find %v field in %T", fieldName, v.Interface())
|
||||
}
|
||||
destValue, err := conversion.EnforcePtr(dest)
|
||||
if err != nil {
|
||||
@ -93,7 +93,7 @@ func Field(v reflect.Value, fieldName string, dest interface{}) error {
|
||||
func FieldPtr(v reflect.Value, fieldName string, dest interface{}) error {
|
||||
field := v.FieldByName(fieldName)
|
||||
if !field.IsValid() {
|
||||
return fmt.Errorf("couldn't find %v field in %#v", fieldName, v.Interface())
|
||||
return fmt.Errorf("couldn't find %v field in %T", fieldName, v.Interface())
|
||||
}
|
||||
v, err := conversion.EnforcePtr(dest)
|
||||
if err != nil {
|
||||
@ -210,3 +210,50 @@ type defaultFramer struct{}
|
||||
|
||||
func (defaultFramer) NewFrameReader(r io.ReadCloser) io.ReadCloser { return r }
|
||||
func (defaultFramer) NewFrameWriter(w io.Writer) io.Writer { return w }
|
||||
|
||||
// WithVersionEncoder serializes an object and ensures the GVK is set.
|
||||
type WithVersionEncoder struct {
|
||||
Version GroupVersioner
|
||||
Encoder
|
||||
ObjectTyper
|
||||
}
|
||||
|
||||
// Encode does not do conversion. It sets the gvk during serialization.
|
||||
func (e WithVersionEncoder) Encode(obj Object, stream io.Writer) error {
|
||||
gvks, _, err := e.ObjectTyper.ObjectKinds(obj)
|
||||
if err != nil {
|
||||
if IsNotRegisteredError(err) {
|
||||
return e.Encoder.Encode(obj, stream)
|
||||
}
|
||||
return err
|
||||
}
|
||||
kind := obj.GetObjectKind()
|
||||
oldGVK := kind.GroupVersionKind()
|
||||
gvk := gvks[0]
|
||||
if e.Version != nil {
|
||||
preferredGVK, ok := e.Version.KindForGroupVersionKinds(gvks)
|
||||
if ok {
|
||||
gvk = preferredGVK
|
||||
}
|
||||
}
|
||||
kind.SetGroupVersionKind(gvk)
|
||||
err = e.Encoder.Encode(obj, stream)
|
||||
kind.SetGroupVersionKind(oldGVK)
|
||||
return err
|
||||
}
|
||||
|
||||
// WithoutVersionDecoder clears the group version kind of a deserialized object.
|
||||
type WithoutVersionDecoder struct {
|
||||
Decoder
|
||||
}
|
||||
|
||||
// Decode does not do conversion. It removes the gvk during deserialization.
|
||||
func (d WithoutVersionDecoder) Decode(data []byte, defaults *schema.GroupVersionKind, into Object) (Object, *schema.GroupVersionKind, error) {
|
||||
obj, gvk, err := d.Decoder.Decode(data, defaults, into)
|
||||
if obj != nil {
|
||||
kind := obj.GetObjectKind()
|
||||
// clearing the gvk is just a convention of a codec
|
||||
kind.SetGroupVersionKind(schema.GroupVersionKind{})
|
||||
}
|
||||
return obj, gvk, err
|
||||
}
|
||||
|
26
vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
generated
vendored
26
vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
generated
vendored
@ -91,6 +91,10 @@ type Framer interface {
|
||||
type SerializerInfo struct {
|
||||
// MediaType is the value that represents this serializer over the wire.
|
||||
MediaType string
|
||||
// MediaTypeType is the first part of the MediaType ("application" in "application/json").
|
||||
MediaTypeType string
|
||||
// MediaTypeSubType is the second part of the MediaType ("json" in "application/json").
|
||||
MediaTypeSubType string
|
||||
// EncodesAsText indicates this serializer can be encoded to UTF-8 safely.
|
||||
EncodesAsText bool
|
||||
// Serializer is the individual object serializer for this media type.
|
||||
@ -206,6 +210,25 @@ type ObjectCreater interface {
|
||||
New(kind schema.GroupVersionKind) (out Object, err error)
|
||||
}
|
||||
|
||||
// EquivalentResourceMapper provides information about resources that address the same underlying data as a specified resource
|
||||
type EquivalentResourceMapper interface {
|
||||
// EquivalentResourcesFor returns a list of resources that address the same underlying data as resource.
|
||||
// If subresource is specified, only equivalent resources which also have the same subresource are included.
|
||||
// The specified resource can be included in the returned list.
|
||||
EquivalentResourcesFor(resource schema.GroupVersionResource, subresource string) []schema.GroupVersionResource
|
||||
// KindFor returns the kind expected by the specified resource[/subresource].
|
||||
// A zero value is returned if the kind is unknown.
|
||||
KindFor(resource schema.GroupVersionResource, subresource string) schema.GroupVersionKind
|
||||
}
|
||||
|
||||
// EquivalentResourceRegistry provides an EquivalentResourceMapper interface,
|
||||
// and allows registering known resource[/subresource] -> kind
|
||||
type EquivalentResourceRegistry interface {
|
||||
EquivalentResourceMapper
|
||||
// RegisterKindFor registers the existence of the specified resource[/subresource] along with its expected kind.
|
||||
RegisterKindFor(resource schema.GroupVersionResource, subresource string, kind schema.GroupVersionKind)
|
||||
}
|
||||
|
||||
// ResourceVersioner provides methods for setting and retrieving
|
||||
// the resource version from an API object.
|
||||
type ResourceVersioner interface {
|
||||
@ -237,6 +260,9 @@ type Object interface {
|
||||
// to JSON allowed.
|
||||
type Unstructured interface {
|
||||
Object
|
||||
// NewEmptyInstance returns a new instance of the concrete type containing only kind/apiVersion and no other data.
|
||||
// This should be called instead of reflect.New() for unstructured types because the go type alone does not preserve kind/apiVersion info.
|
||||
NewEmptyInstance() Unstructured
|
||||
// UnstructuredContent returns a non-nil map with this object's contents. Values may be
|
||||
// []interface{}, map[string]interface{}, or any primitive type. Contents are typically serialized to
|
||||
// and from JSON. SetUnstructuredContent should be used to mutate the contents.
|
||||
|
98
vendor/k8s.io/apimachinery/pkg/runtime/mapper.go
generated
vendored
Normal file
98
vendor/k8s.io/apimachinery/pkg/runtime/mapper.go
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
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 (
|
||||
"sync"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
type equivalentResourceRegistry struct {
|
||||
// keyFunc computes a key for the specified resource (this allows honoring colocated resources across API groups).
|
||||
// if null, or if "" is returned, resource.String() is used as the key
|
||||
keyFunc func(resource schema.GroupResource) string
|
||||
// resources maps key -> subresource -> equivalent resources (subresource is not included in the returned resources).
|
||||
// main resources are stored with subresource="".
|
||||
resources map[string]map[string][]schema.GroupVersionResource
|
||||
// kinds maps resource -> subresource -> kind
|
||||
kinds map[schema.GroupVersionResource]map[string]schema.GroupVersionKind
|
||||
// keys caches the computed key for each GroupResource
|
||||
keys map[schema.GroupResource]string
|
||||
|
||||
mutex sync.RWMutex
|
||||
}
|
||||
|
||||
var _ EquivalentResourceMapper = (*equivalentResourceRegistry)(nil)
|
||||
var _ EquivalentResourceRegistry = (*equivalentResourceRegistry)(nil)
|
||||
|
||||
// NewEquivalentResourceRegistry creates a resource registry that considers all versions of a GroupResource to be equivalent.
|
||||
func NewEquivalentResourceRegistry() EquivalentResourceRegistry {
|
||||
return &equivalentResourceRegistry{}
|
||||
}
|
||||
|
||||
// NewEquivalentResourceRegistryWithIdentity creates a resource mapper with a custom identity function.
|
||||
// If "" is returned by the function, GroupResource#String is used as the identity.
|
||||
// GroupResources with the same identity string are considered equivalent.
|
||||
func NewEquivalentResourceRegistryWithIdentity(keyFunc func(schema.GroupResource) string) EquivalentResourceRegistry {
|
||||
return &equivalentResourceRegistry{keyFunc: keyFunc}
|
||||
}
|
||||
|
||||
func (r *equivalentResourceRegistry) EquivalentResourcesFor(resource schema.GroupVersionResource, subresource string) []schema.GroupVersionResource {
|
||||
r.mutex.RLock()
|
||||
defer r.mutex.RUnlock()
|
||||
return r.resources[r.keys[resource.GroupResource()]][subresource]
|
||||
}
|
||||
func (r *equivalentResourceRegistry) KindFor(resource schema.GroupVersionResource, subresource string) schema.GroupVersionKind {
|
||||
r.mutex.RLock()
|
||||
defer r.mutex.RUnlock()
|
||||
return r.kinds[resource][subresource]
|
||||
}
|
||||
func (r *equivalentResourceRegistry) RegisterKindFor(resource schema.GroupVersionResource, subresource string, kind schema.GroupVersionKind) {
|
||||
r.mutex.Lock()
|
||||
defer r.mutex.Unlock()
|
||||
if r.kinds == nil {
|
||||
r.kinds = map[schema.GroupVersionResource]map[string]schema.GroupVersionKind{}
|
||||
}
|
||||
if r.kinds[resource] == nil {
|
||||
r.kinds[resource] = map[string]schema.GroupVersionKind{}
|
||||
}
|
||||
r.kinds[resource][subresource] = kind
|
||||
|
||||
// get the shared key of the parent resource
|
||||
key := ""
|
||||
gr := resource.GroupResource()
|
||||
if r.keyFunc != nil {
|
||||
key = r.keyFunc(gr)
|
||||
}
|
||||
if key == "" {
|
||||
key = gr.String()
|
||||
}
|
||||
|
||||
if r.keys == nil {
|
||||
r.keys = map[schema.GroupResource]string{}
|
||||
}
|
||||
r.keys[gr] = key
|
||||
|
||||
if r.resources == nil {
|
||||
r.resources = map[string]map[string][]schema.GroupVersionResource{}
|
||||
}
|
||||
if r.resources[key] == nil {
|
||||
r.resources[key] = map[string][]schema.GroupVersionResource{}
|
||||
}
|
||||
r.resources[key][subresource] = append(r.resources[key][subresource], resource)
|
||||
}
|
53
vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
generated
vendored
53
vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
generated
vendored
@ -17,9 +17,13 @@ limitations under the License.
|
||||
package serializer
|
||||
|
||||
import (
|
||||
"mime"
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/json"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/protobuf"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/recognizer"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/versioning"
|
||||
)
|
||||
@ -48,6 +52,8 @@ func newSerializersForScheme(scheme *runtime.Scheme, mf json.MetaFactory) []seri
|
||||
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)
|
||||
|
||||
serializers := []serializerType{
|
||||
{
|
||||
@ -68,6 +74,15 @@ func newSerializersForScheme(scheme *runtime.Scheme, mf json.MetaFactory) []seri
|
||||
EncodesAsText: true,
|
||||
Serializer: yamlSerializer,
|
||||
},
|
||||
{
|
||||
AcceptContentTypes: []string{runtime.ContentTypeProtobuf},
|
||||
ContentType: runtime.ContentTypeProtobuf,
|
||||
FileExtensions: []string{"pb"},
|
||||
Serializer: serializer,
|
||||
|
||||
Framer: protobuf.LengthDelimitedFramer,
|
||||
StreamSerializer: raw,
|
||||
},
|
||||
}
|
||||
|
||||
for _, fn := range serializerExtensions {
|
||||
@ -120,6 +135,15 @@ func newCodecFactory(scheme *runtime.Scheme, serializers []serializerType) Codec
|
||||
Serializer: d.Serializer,
|
||||
PrettySerializer: d.PrettySerializer,
|
||||
}
|
||||
|
||||
mediaType, _, err := mime.ParseMediaType(info.MediaType)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
parts := strings.SplitN(mediaType, "/", 2)
|
||||
info.MediaTypeType = parts[0]
|
||||
info.MediaTypeSubType = parts[1]
|
||||
|
||||
if d.StreamSerializer != nil {
|
||||
info.StreamSerializer = &runtime.StreamSerializerInfo{
|
||||
Serializer: d.StreamSerializer,
|
||||
@ -148,6 +172,12 @@ func newCodecFactory(scheme *runtime.Scheme, serializers []serializerType) Codec
|
||||
}
|
||||
}
|
||||
|
||||
// WithoutConversion returns a NegotiatedSerializer that performs no conversion, even if the
|
||||
// caller requests it.
|
||||
func (f CodecFactory) WithoutConversion() runtime.NegotiatedSerializer {
|
||||
return WithoutConversionCodecFactory{f}
|
||||
}
|
||||
|
||||
// SupportedMediaTypes returns the RFC2046 media types that this factory has serializers for.
|
||||
func (f CodecFactory) SupportedMediaTypes() []runtime.SerializerInfo {
|
||||
return f.accepts
|
||||
@ -215,23 +245,30 @@ func (f CodecFactory) EncoderForVersion(encoder runtime.Encoder, gv runtime.Grou
|
||||
return f.CodecForVersions(encoder, nil, gv, nil)
|
||||
}
|
||||
|
||||
// DirectCodecFactory provides methods for retrieving "DirectCodec"s, which do not do conversion.
|
||||
type DirectCodecFactory struct {
|
||||
// WithoutConversionCodecFactory is a CodecFactory that will explicitly ignore requests to perform conversion.
|
||||
// This wrapper is used while code migrates away from using conversion (such as external clients) and in the future
|
||||
// will be unnecessary when we change the signature of NegotiatedSerializer.
|
||||
type WithoutConversionCodecFactory struct {
|
||||
CodecFactory
|
||||
}
|
||||
|
||||
// EncoderForVersion returns an encoder that does not do conversion.
|
||||
func (f DirectCodecFactory) EncoderForVersion(serializer runtime.Encoder, version runtime.GroupVersioner) runtime.Encoder {
|
||||
return versioning.DirectEncoder{
|
||||
// EncoderForVersion returns an encoder that does not do conversion, but does set the group version kind of the object
|
||||
// when serialized.
|
||||
func (f WithoutConversionCodecFactory) EncoderForVersion(serializer runtime.Encoder, version runtime.GroupVersioner) runtime.Encoder {
|
||||
return runtime.WithVersionEncoder{
|
||||
Version: version,
|
||||
Encoder: serializer,
|
||||
ObjectTyper: f.CodecFactory.scheme,
|
||||
}
|
||||
}
|
||||
|
||||
// DecoderToVersion returns an decoder that does not do conversion. gv is ignored.
|
||||
func (f DirectCodecFactory) DecoderToVersion(serializer runtime.Decoder, _ runtime.GroupVersioner) runtime.Decoder {
|
||||
return versioning.DirectDecoder{
|
||||
// DecoderToVersion returns an decoder that does not do conversion.
|
||||
func (f WithoutConversionCodecFactory) DecoderToVersion(serializer runtime.Decoder, _ runtime.GroupVersioner) runtime.Decoder {
|
||||
return runtime.WithoutVersionDecoder{
|
||||
Decoder: serializer,
|
||||
}
|
||||
}
|
||||
|
||||
// DirectCodecFactory was renamed to WithoutConversionCodecFactory in 1.15.
|
||||
// TODO: remove in 1.16.
|
||||
type DirectCodecFactory = WithoutConversionCodecFactory
|
||||
|
95
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
generated
vendored
95
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
generated
vendored
@ -35,34 +35,56 @@ import (
|
||||
|
||||
// NewSerializer creates a JSON serializer that handles encoding versioned objects into the proper JSON form. If typer
|
||||
// is not nil, the object has the group, version, and kind fields set.
|
||||
// Deprecated: use NewSerializerWithOptions instead.
|
||||
func NewSerializer(meta MetaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper, pretty bool) *Serializer {
|
||||
return &Serializer{
|
||||
meta: meta,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
yaml: false,
|
||||
pretty: pretty,
|
||||
}
|
||||
return NewSerializerWithOptions(meta, creater, typer, SerializerOptions{false, pretty, false})
|
||||
}
|
||||
|
||||
// NewYAMLSerializer creates a YAML serializer that handles encoding versioned objects into the proper YAML form. If typer
|
||||
// is not nil, the object has the group, version, and kind fields set. This serializer supports only the subset of YAML that
|
||||
// matches JSON, and will error if constructs are used that do not serialize to JSON.
|
||||
// Deprecated: use NewSerializerWithOptions instead.
|
||||
func NewYAMLSerializer(meta MetaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper) *Serializer {
|
||||
return NewSerializerWithOptions(meta, creater, typer, SerializerOptions{true, false, false})
|
||||
}
|
||||
|
||||
// NewSerializerWithOptions creates a JSON/YAML serializer that handles encoding versioned objects into the proper JSON/YAML
|
||||
// form. If typer is not nil, the object has the group, version, and kind fields set. Options are copied into the Serializer
|
||||
// and are immutable.
|
||||
func NewSerializerWithOptions(meta MetaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper, options SerializerOptions) *Serializer {
|
||||
return &Serializer{
|
||||
meta: meta,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
yaml: true,
|
||||
options: options,
|
||||
}
|
||||
}
|
||||
|
||||
// SerializerOptions holds the options which are used to configure a JSON/YAML serializer.
|
||||
// example:
|
||||
// (1) To configure a JSON serializer, set `Yaml` to `false`.
|
||||
// (2) To configure a YAML serializer, set `Yaml` to `true`.
|
||||
// (3) To configure a strict serializer that can return strictDecodingError, set `Strict` to `true`.
|
||||
type SerializerOptions struct {
|
||||
// Yaml: configures the Serializer to work with JSON(false) or YAML(true).
|
||||
// When `Yaml` is enabled, this serializer only supports the subset of YAML that
|
||||
// matches JSON, and will error if constructs are used that do not serialize to JSON.
|
||||
Yaml bool
|
||||
|
||||
// Pretty: configures a JSON enabled Serializer(`Yaml: false`) to produce human-readable output.
|
||||
// This option is silently ignored when `Yaml` is `true`.
|
||||
Pretty bool
|
||||
|
||||
// Strict: configures the Serializer to return strictDecodingError's when duplicate fields are present decoding JSON or YAML.
|
||||
// Note that enabling this option is not as performant as the non-strict variant, and should not be used in fast paths.
|
||||
Strict bool
|
||||
}
|
||||
|
||||
type Serializer struct {
|
||||
meta MetaFactory
|
||||
options SerializerOptions
|
||||
creater runtime.ObjectCreater
|
||||
typer runtime.ObjectTyper
|
||||
yaml bool
|
||||
pretty bool
|
||||
}
|
||||
|
||||
// Serializer implements Serializer
|
||||
@ -119,11 +141,28 @@ func CaseSensitiveJsonIterator() jsoniter.API {
|
||||
return config
|
||||
}
|
||||
|
||||
// Private copy of jsoniter to try to shield against possible mutations
|
||||
// StrictCaseSensitiveJsonIterator returns a jsoniterator API that's configured to be
|
||||
// case-sensitive, but also disallows unknown fields when unmarshalling. It is compatible with
|
||||
// the encoding/json standard library.
|
||||
func StrictCaseSensitiveJsonIterator() jsoniter.API {
|
||||
config := jsoniter.Config{
|
||||
EscapeHTML: true,
|
||||
SortMapKeys: true,
|
||||
ValidateJsonRawMessage: true,
|
||||
CaseSensitive: true,
|
||||
DisallowUnknownFields: true,
|
||||
}.Froze()
|
||||
// Force jsoniter to decode number to interface{} via int64/float64, if possible.
|
||||
config.RegisterExtension(&customNumberExtension{})
|
||||
return config
|
||||
}
|
||||
|
||||
// Private copies of jsoniter to try to shield against possible mutations
|
||||
// from outside. Still does not protect from package level jsoniter.Register*() functions - someone calling them
|
||||
// in some other library will mess with every usage of the jsoniter library in the whole program.
|
||||
// See https://github.com/json-iterator/go/issues/265
|
||||
var caseSensitiveJsonIterator = CaseSensitiveJsonIterator()
|
||||
var strictCaseSensitiveJsonIterator = StrictCaseSensitiveJsonIterator()
|
||||
|
||||
// gvkWithDefaults returns group kind and version defaulting from provided default
|
||||
func gvkWithDefaults(actual, defaultGVK schema.GroupVersionKind) schema.GroupVersionKind {
|
||||
@ -160,7 +199,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
||||
}
|
||||
|
||||
data := originalData
|
||||
if s.yaml {
|
||||
if s.options.Yaml {
|
||||
altered, err := yaml.YAMLToJSON(data)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@ -216,12 +255,38 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
||||
if err := caseSensitiveJsonIterator.Unmarshal(data, obj); err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
|
||||
// If the deserializer is non-strict, return successfully here.
|
||||
if !s.options.Strict {
|
||||
return obj, actual, nil
|
||||
}
|
||||
|
||||
// In strict mode pass the data trough the YAMLToJSONStrict converter.
|
||||
// This is done to catch duplicate fields regardless of encoding (JSON or YAML). For JSON data,
|
||||
// the output would equal the input, unless there is a parsing error such as duplicate fields.
|
||||
// As we know this was successful in the non-strict case, the only error that may be returned here
|
||||
// is because of the newly-added strictness. hence we know we can return the typed strictDecoderError
|
||||
// the actual error is that the object contains duplicate fields.
|
||||
altered, err := yaml.YAMLToJSONStrict(originalData)
|
||||
if err != nil {
|
||||
return nil, actual, runtime.NewStrictDecodingError(err.Error(), string(originalData))
|
||||
}
|
||||
// As performance is not an issue for now for the strict deserializer (one has regardless to do
|
||||
// the unmarshal twice), we take the sanitized, altered data that is guaranteed to have no duplicated
|
||||
// fields, and unmarshal this into a copy of the already-populated obj. Any error that occurs here is
|
||||
// due to that a matching field doesn't exist in the object. hence we can return a typed strictDecoderError,
|
||||
// the actual error is that the object contains unknown field.
|
||||
strictObj := obj.DeepCopyObject()
|
||||
if err := strictCaseSensitiveJsonIterator.Unmarshal(altered, strictObj); err != nil {
|
||||
return nil, actual, runtime.NewStrictDecodingError(err.Error(), string(originalData))
|
||||
}
|
||||
// Always return the same object as the non-strict serializer to avoid any deviations.
|
||||
return obj, actual, nil
|
||||
}
|
||||
|
||||
// Encode serializes the provided object to the given writer.
|
||||
func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if s.yaml {
|
||||
if s.options.Yaml {
|
||||
json, err := caseSensitiveJsonIterator.Marshal(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -234,7 +299,7 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if s.pretty {
|
||||
if s.options.Pretty {
|
||||
data, err := caseSensitiveJsonIterator.MarshalIndent(obj, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
@ -248,7 +313,7 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
|
||||
// RecognizesData implements the RecognizingDecoder interface.
|
||||
func (s *Serializer) RecognizesData(peek io.Reader) (ok, unknown bool, err error) {
|
||||
if s.yaml {
|
||||
if s.options.Yaml {
|
||||
// we could potentially look for '---'
|
||||
return false, true, nil
|
||||
}
|
||||
|
37
vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go
generated
vendored
37
vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go
generated
vendored
@ -69,22 +69,18 @@ func IsNotMarshalable(err error) bool {
|
||||
// NewSerializer creates a Protobuf serializer that handles encoding versioned objects into the proper wire form. If a typer
|
||||
// is passed, the encoded object will have group, version, and kind fields set. If typer is nil, the objects will be written
|
||||
// as-is (any type info passed with the object will be used).
|
||||
//
|
||||
// This encoding scheme is experimental, and is subject to change at any time.
|
||||
func NewSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper, defaultContentType string) *Serializer {
|
||||
func NewSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper) *Serializer {
|
||||
return &Serializer{
|
||||
prefix: protoEncodingPrefix,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
contentType: defaultContentType,
|
||||
prefix: protoEncodingPrefix,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
}
|
||||
}
|
||||
|
||||
type Serializer struct {
|
||||
prefix []byte
|
||||
creater runtime.ObjectCreater
|
||||
typer runtime.ObjectTyper
|
||||
contentType string
|
||||
prefix []byte
|
||||
creater runtime.ObjectCreater
|
||||
typer runtime.ObjectTyper
|
||||
}
|
||||
|
||||
var _ runtime.Serializer = &Serializer{}
|
||||
@ -138,7 +134,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
||||
if intoUnknown, ok := into.(*runtime.Unknown); ok && intoUnknown != nil {
|
||||
*intoUnknown = unk
|
||||
if ok, _, _ := s.RecognizesData(bytes.NewBuffer(unk.Raw)); ok {
|
||||
intoUnknown.ContentType = s.contentType
|
||||
intoUnknown.ContentType = runtime.ContentTypeProtobuf
|
||||
}
|
||||
return intoUnknown, &actual, nil
|
||||
}
|
||||
@ -303,20 +299,18 @@ func estimateUnknownSize(unk *runtime.Unknown, byteSize uint64) uint64 {
|
||||
// encoded object, and thus is not self describing (callers must know what type is being described in order to decode).
|
||||
//
|
||||
// This encoding scheme is experimental, and is subject to change at any time.
|
||||
func NewRawSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper, defaultContentType string) *RawSerializer {
|
||||
func NewRawSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper) *RawSerializer {
|
||||
return &RawSerializer{
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
contentType: defaultContentType,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
}
|
||||
}
|
||||
|
||||
// RawSerializer encodes and decodes objects without adding a runtime.Unknown wrapper (objects are encoded without identifying
|
||||
// type).
|
||||
type RawSerializer struct {
|
||||
creater runtime.ObjectCreater
|
||||
typer runtime.ObjectTyper
|
||||
contentType string
|
||||
creater runtime.ObjectCreater
|
||||
typer runtime.ObjectTyper
|
||||
}
|
||||
|
||||
var _ runtime.Serializer = &RawSerializer{}
|
||||
@ -358,7 +352,7 @@ func (s *RawSerializer) Decode(originalData []byte, gvk *schema.GroupVersionKind
|
||||
if intoUnknown, ok := into.(*runtime.Unknown); ok && intoUnknown != nil {
|
||||
intoUnknown.Raw = data
|
||||
intoUnknown.ContentEncoding = ""
|
||||
intoUnknown.ContentType = s.contentType
|
||||
intoUnknown.ContentType = runtime.ContentTypeProtobuf
|
||||
intoUnknown.SetGroupVersionKind(*actual)
|
||||
return intoUnknown, actual, nil
|
||||
}
|
||||
@ -411,6 +405,9 @@ func unmarshalToObject(typer runtime.ObjectTyper, creater runtime.ObjectCreater,
|
||||
if err := proto.Unmarshal(data, pb); err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
if actual != nil {
|
||||
obj.GetObjectKind().SetGroupVersionKind(*actual)
|
||||
}
|
||||
return obj, actual, nil
|
||||
}
|
||||
|
||||
|
48
vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf_extension.go
generated
vendored
48
vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf_extension.go
generated
vendored
@ -1,48 +0,0 @@
|
||||
/*
|
||||
Copyright 2014 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 serializer
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/protobuf"
|
||||
)
|
||||
|
||||
const (
|
||||
// contentTypeProtobuf is the protobuf type exposed for Kubernetes. It is private to prevent others from
|
||||
// depending on it unintentionally.
|
||||
// TODO: potentially move to pkg/api (since it's part of the Kube public API) and pass it in to the
|
||||
// CodecFactory on initialization.
|
||||
contentTypeProtobuf = "application/vnd.kubernetes.protobuf"
|
||||
)
|
||||
|
||||
func protobufSerializer(scheme *runtime.Scheme) (serializerType, bool) {
|
||||
serializer := protobuf.NewSerializer(scheme, scheme, contentTypeProtobuf)
|
||||
raw := protobuf.NewRawSerializer(scheme, scheme, contentTypeProtobuf)
|
||||
return serializerType{
|
||||
AcceptContentTypes: []string{contentTypeProtobuf},
|
||||
ContentType: contentTypeProtobuf,
|
||||
FileExtensions: []string{"pb"},
|
||||
Serializer: serializer,
|
||||
|
||||
Framer: protobuf.LengthDelimitedFramer,
|
||||
StreamSerializer: raw,
|
||||
}, true
|
||||
}
|
||||
|
||||
func init() {
|
||||
serializerExtensions = append(serializerExtensions, protobufSerializer)
|
||||
}
|
90
vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
generated
vendored
90
vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
generated
vendored
@ -106,20 +106,13 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
|
||||
}
|
||||
|
||||
if d, ok := obj.(runtime.NestedObjectDecoder); ok {
|
||||
if err := d.DecodeNestedObjects(DirectDecoder{c.decoder}); err != nil {
|
||||
if err := d.DecodeNestedObjects(runtime.WithoutVersionDecoder{c.decoder}); err != nil {
|
||||
return nil, gvk, err
|
||||
}
|
||||
}
|
||||
|
||||
// if we specify a target, use generic conversion.
|
||||
if into != nil {
|
||||
if into == obj {
|
||||
if isVersioned {
|
||||
return versioned, gvk, nil
|
||||
}
|
||||
return into, gvk, nil
|
||||
}
|
||||
|
||||
// perform defaulting if requested
|
||||
if c.defaulter != nil {
|
||||
// create a copy to ensure defaulting is not applied to the original versioned objects
|
||||
@ -133,6 +126,14 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
|
||||
}
|
||||
}
|
||||
|
||||
// Short-circuit conversion if the into object is same object
|
||||
if into == obj {
|
||||
if isVersioned {
|
||||
return versioned, gvk, nil
|
||||
}
|
||||
return into, gvk, nil
|
||||
}
|
||||
|
||||
if err := c.convertor.Convert(obj, into, c.decodeVersion); err != nil {
|
||||
return nil, gvk, err
|
||||
}
|
||||
@ -199,84 +200,41 @@ func (c *codec) Encode(obj runtime.Object, w io.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
objectKind := obj.GetObjectKind()
|
||||
old := objectKind.GroupVersionKind()
|
||||
// restore the old GVK after encoding
|
||||
defer objectKind.SetGroupVersionKind(old)
|
||||
|
||||
if c.encodeVersion == nil || isUnversioned {
|
||||
if e, ok := obj.(runtime.NestedObjectEncoder); ok {
|
||||
if err := e.EncodeNestedObjects(DirectEncoder{Encoder: c.encoder, ObjectTyper: c.typer}); err != nil {
|
||||
if err := e.EncodeNestedObjects(runtime.WithVersionEncoder{Encoder: c.encoder, ObjectTyper: c.typer}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
objectKind := obj.GetObjectKind()
|
||||
old := objectKind.GroupVersionKind()
|
||||
objectKind.SetGroupVersionKind(gvks[0])
|
||||
err = c.encoder.Encode(obj, w)
|
||||
objectKind.SetGroupVersionKind(old)
|
||||
return err
|
||||
return c.encoder.Encode(obj, w)
|
||||
}
|
||||
|
||||
// Perform a conversion if necessary
|
||||
objectKind := obj.GetObjectKind()
|
||||
old := objectKind.GroupVersionKind()
|
||||
out, err := c.convertor.ConvertToVersion(obj, c.encodeVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if e, ok := out.(runtime.NestedObjectEncoder); ok {
|
||||
if err := e.EncodeNestedObjects(DirectEncoder{Version: c.encodeVersion, Encoder: c.encoder, ObjectTyper: c.typer}); err != nil {
|
||||
if err := e.EncodeNestedObjects(runtime.WithVersionEncoder{Version: c.encodeVersion, Encoder: c.encoder, ObjectTyper: c.typer}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Conversion is responsible for setting the proper group, version, and kind onto the outgoing object
|
||||
err = c.encoder.Encode(out, w)
|
||||
// restore the old GVK, in case conversion returned the same object
|
||||
objectKind.SetGroupVersionKind(old)
|
||||
return err
|
||||
return c.encoder.Encode(out, w)
|
||||
}
|
||||
|
||||
// DirectEncoder serializes an object and ensures the GVK is set.
|
||||
type DirectEncoder struct {
|
||||
Version runtime.GroupVersioner
|
||||
runtime.Encoder
|
||||
runtime.ObjectTyper
|
||||
}
|
||||
// DirectEncoder was moved and renamed to runtime.WithVersionEncoder in 1.15.
|
||||
// TODO: remove in 1.16.
|
||||
type DirectEncoder = runtime.WithVersionEncoder
|
||||
|
||||
// Encode does not do conversion. It sets the gvk during serialization.
|
||||
func (e DirectEncoder) Encode(obj runtime.Object, stream io.Writer) error {
|
||||
gvks, _, err := e.ObjectTyper.ObjectKinds(obj)
|
||||
if err != nil {
|
||||
if runtime.IsNotRegisteredError(err) {
|
||||
return e.Encoder.Encode(obj, stream)
|
||||
}
|
||||
return err
|
||||
}
|
||||
kind := obj.GetObjectKind()
|
||||
oldGVK := kind.GroupVersionKind()
|
||||
gvk := gvks[0]
|
||||
if e.Version != nil {
|
||||
preferredGVK, ok := e.Version.KindForGroupVersionKinds(gvks)
|
||||
if ok {
|
||||
gvk = preferredGVK
|
||||
}
|
||||
}
|
||||
kind.SetGroupVersionKind(gvk)
|
||||
err = e.Encoder.Encode(obj, stream)
|
||||
kind.SetGroupVersionKind(oldGVK)
|
||||
return err
|
||||
}
|
||||
|
||||
// DirectDecoder clears the group version kind of a deserialized object.
|
||||
type DirectDecoder struct {
|
||||
runtime.Decoder
|
||||
}
|
||||
|
||||
// Decode does not do conversion. It removes the gvk during deserialization.
|
||||
func (d DirectDecoder) Decode(data []byte, defaults *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
|
||||
obj, gvk, err := d.Decoder.Decode(data, defaults, into)
|
||||
if obj != nil {
|
||||
kind := obj.GetObjectKind()
|
||||
// clearing the gvk is just a convention of a codec
|
||||
kind.SetGroupVersionKind(schema.GroupVersionKind{})
|
||||
}
|
||||
return obj, gvk, err
|
||||
}
|
||||
// DirectDecoder was moved and renamed to runtime.WithoutVersionDecoder in 1.15.
|
||||
// TODO: remove in 1.16.
|
||||
type DirectDecoder = runtime.WithoutVersionDecoder
|
||||
|
5
vendor/k8s.io/apimachinery/pkg/runtime/types.go
generated
vendored
5
vendor/k8s.io/apimachinery/pkg/runtime/types.go
generated
vendored
@ -41,8 +41,9 @@ type TypeMeta struct {
|
||||
}
|
||||
|
||||
const (
|
||||
ContentTypeJSON string = "application/json"
|
||||
ContentTypeYAML string = "application/yaml"
|
||||
ContentTypeJSON string = "application/json"
|
||||
ContentTypeYAML string = "application/yaml"
|
||||
ContentTypeProtobuf string = "application/vnd.kubernetes.protobuf"
|
||||
)
|
||||
|
||||
// RawExtension is used to hold extensions in external versions.
|
||||
|
229
vendor/k8s.io/apimachinery/pkg/util/diff/diff.go
generated
vendored
229
vendor/k8s.io/apimachinery/pkg/util/diff/diff.go
generated
vendored
@ -18,16 +18,12 @@ package diff
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
)
|
||||
|
||||
// StringDiff diffs a and b and returns a human readable diff.
|
||||
@ -50,220 +46,29 @@ func StringDiff(a, b string) string {
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// ObjectDiff writes the two objects out as JSON and prints out the identical part of
|
||||
// the objects followed by the remaining part of 'a' and finally the remaining part of 'b'.
|
||||
// For debugging tests.
|
||||
func legacyDiff(a, b interface{}) string {
|
||||
return cmp.Diff(a, b)
|
||||
}
|
||||
|
||||
// ObjectDiff prints the diff of two go objects and fails if the objects
|
||||
// contain unhandled unexported fields.
|
||||
// DEPRECATED: use github.com/google/go-cmp/cmp.Diff
|
||||
func ObjectDiff(a, b interface{}) string {
|
||||
ab, err := json.Marshal(a)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("a: %v", err))
|
||||
}
|
||||
bb, err := json.Marshal(b)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("b: %v", err))
|
||||
}
|
||||
return StringDiff(string(ab), string(bb))
|
||||
return legacyDiff(a, b)
|
||||
}
|
||||
|
||||
// ObjectGoPrintDiff is like ObjectDiff, but uses go-spew to print the objects,
|
||||
// which shows absolutely everything by recursing into every single pointer
|
||||
// (go's %#v formatters OTOH stop at a certain point). This is needed when you
|
||||
// can't figure out why reflect.DeepEqual is returning false and nothing is
|
||||
// showing you differences. This will.
|
||||
// ObjectGoPrintDiff prints the diff of two go objects and fails if the objects
|
||||
// contain unhandled unexported fields.
|
||||
// DEPRECATED: use github.com/google/go-cmp/cmp.Diff
|
||||
func ObjectGoPrintDiff(a, b interface{}) string {
|
||||
s := spew.ConfigState{DisableMethods: true}
|
||||
return StringDiff(
|
||||
s.Sprintf("%#v", a),
|
||||
s.Sprintf("%#v", b),
|
||||
)
|
||||
return legacyDiff(a, b)
|
||||
}
|
||||
|
||||
// ObjectReflectDiff prints the diff of two go objects and fails if the objects
|
||||
// contain unhandled unexported fields.
|
||||
// DEPRECATED: use github.com/google/go-cmp/cmp.Diff
|
||||
func ObjectReflectDiff(a, b interface{}) string {
|
||||
vA, vB := reflect.ValueOf(a), reflect.ValueOf(b)
|
||||
if vA.Type() != vB.Type() {
|
||||
return fmt.Sprintf("type A %T and type B %T do not match", a, b)
|
||||
}
|
||||
diffs := objectReflectDiff(field.NewPath("object"), vA, vB)
|
||||
if len(diffs) == 0 {
|
||||
return "<no diffs>"
|
||||
}
|
||||
out := []string{""}
|
||||
for _, d := range diffs {
|
||||
elidedA, elidedB := limit(d.a, d.b, 80)
|
||||
out = append(out,
|
||||
fmt.Sprintf("%s:", d.path),
|
||||
fmt.Sprintf(" a: %s", elidedA),
|
||||
fmt.Sprintf(" b: %s", elidedB),
|
||||
)
|
||||
}
|
||||
return strings.Join(out, "\n")
|
||||
}
|
||||
|
||||
// limit:
|
||||
// 1. stringifies aObj and bObj
|
||||
// 2. elides identical prefixes if either is too long
|
||||
// 3. elides remaining content from the end if either is too long
|
||||
func limit(aObj, bObj interface{}, max int) (string, string) {
|
||||
elidedPrefix := ""
|
||||
elidedASuffix := ""
|
||||
elidedBSuffix := ""
|
||||
a, b := fmt.Sprintf("%#v", aObj), fmt.Sprintf("%#v", bObj)
|
||||
|
||||
if aObj != nil && bObj != nil {
|
||||
if aType, bType := fmt.Sprintf("%T", aObj), fmt.Sprintf("%T", bObj); aType != bType {
|
||||
a = fmt.Sprintf("%s (%s)", a, aType)
|
||||
b = fmt.Sprintf("%s (%s)", b, bType)
|
||||
}
|
||||
}
|
||||
|
||||
for {
|
||||
switch {
|
||||
case len(a) > max && len(a) > 4 && len(b) > 4 && a[:4] == b[:4]:
|
||||
// a is too long, b has data, and the first several characters are the same
|
||||
elidedPrefix = "..."
|
||||
a = a[2:]
|
||||
b = b[2:]
|
||||
|
||||
case len(b) > max && len(b) > 4 && len(a) > 4 && a[:4] == b[:4]:
|
||||
// b is too long, a has data, and the first several characters are the same
|
||||
elidedPrefix = "..."
|
||||
a = a[2:]
|
||||
b = b[2:]
|
||||
|
||||
case len(a) > max:
|
||||
a = a[:max]
|
||||
elidedASuffix = "..."
|
||||
|
||||
case len(b) > max:
|
||||
b = b[:max]
|
||||
elidedBSuffix = "..."
|
||||
|
||||
default:
|
||||
// both are short enough
|
||||
return elidedPrefix + a + elidedASuffix, elidedPrefix + b + elidedBSuffix
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func public(s string) bool {
|
||||
if len(s) == 0 {
|
||||
return false
|
||||
}
|
||||
return s[:1] == strings.ToUpper(s[:1])
|
||||
}
|
||||
|
||||
type diff struct {
|
||||
path *field.Path
|
||||
a, b interface{}
|
||||
}
|
||||
|
||||
type orderedDiffs []diff
|
||||
|
||||
func (d orderedDiffs) Len() int { return len(d) }
|
||||
func (d orderedDiffs) Swap(i, j int) { d[i], d[j] = d[j], d[i] }
|
||||
func (d orderedDiffs) Less(i, j int) bool {
|
||||
a, b := d[i].path.String(), d[j].path.String()
|
||||
if a < b {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func objectReflectDiff(path *field.Path, a, b reflect.Value) []diff {
|
||||
switch a.Type().Kind() {
|
||||
case reflect.Struct:
|
||||
var changes []diff
|
||||
for i := 0; i < a.Type().NumField(); i++ {
|
||||
if !public(a.Type().Field(i).Name) {
|
||||
if reflect.DeepEqual(a.Interface(), b.Interface()) {
|
||||
continue
|
||||
}
|
||||
return []diff{{path: path, a: fmt.Sprintf("%#v", a), b: fmt.Sprintf("%#v", b)}}
|
||||
}
|
||||
if sub := objectReflectDiff(path.Child(a.Type().Field(i).Name), a.Field(i), b.Field(i)); len(sub) > 0 {
|
||||
changes = append(changes, sub...)
|
||||
}
|
||||
}
|
||||
return changes
|
||||
case reflect.Ptr, reflect.Interface:
|
||||
if a.IsNil() || b.IsNil() {
|
||||
switch {
|
||||
case a.IsNil() && b.IsNil():
|
||||
return nil
|
||||
case a.IsNil():
|
||||
return []diff{{path: path, a: nil, b: b.Interface()}}
|
||||
default:
|
||||
return []diff{{path: path, a: a.Interface(), b: nil}}
|
||||
}
|
||||
}
|
||||
return objectReflectDiff(path, a.Elem(), b.Elem())
|
||||
case reflect.Chan:
|
||||
if !reflect.DeepEqual(a.Interface(), b.Interface()) {
|
||||
return []diff{{path: path, a: a.Interface(), b: b.Interface()}}
|
||||
}
|
||||
return nil
|
||||
case reflect.Slice:
|
||||
lA, lB := a.Len(), b.Len()
|
||||
l := lA
|
||||
if lB < lA {
|
||||
l = lB
|
||||
}
|
||||
if lA == lB && lA == 0 {
|
||||
if a.IsNil() != b.IsNil() {
|
||||
return []diff{{path: path, a: a.Interface(), b: b.Interface()}}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
var diffs []diff
|
||||
for i := 0; i < l; i++ {
|
||||
if !reflect.DeepEqual(a.Index(i), b.Index(i)) {
|
||||
diffs = append(diffs, objectReflectDiff(path.Index(i), a.Index(i), b.Index(i))...)
|
||||
}
|
||||
}
|
||||
for i := l; i < lA; i++ {
|
||||
diffs = append(diffs, diff{path: path.Index(i), a: a.Index(i), b: nil})
|
||||
}
|
||||
for i := l; i < lB; i++ {
|
||||
diffs = append(diffs, diff{path: path.Index(i), a: nil, b: b.Index(i)})
|
||||
}
|
||||
return diffs
|
||||
case reflect.Map:
|
||||
if reflect.DeepEqual(a.Interface(), b.Interface()) {
|
||||
return nil
|
||||
}
|
||||
aKeys := make(map[interface{}]interface{})
|
||||
for _, key := range a.MapKeys() {
|
||||
aKeys[key.Interface()] = a.MapIndex(key).Interface()
|
||||
}
|
||||
var missing []diff
|
||||
for _, key := range b.MapKeys() {
|
||||
if _, ok := aKeys[key.Interface()]; ok {
|
||||
delete(aKeys, key.Interface())
|
||||
if reflect.DeepEqual(a.MapIndex(key).Interface(), b.MapIndex(key).Interface()) {
|
||||
continue
|
||||
}
|
||||
missing = append(missing, objectReflectDiff(path.Key(fmt.Sprintf("%s", key.Interface())), a.MapIndex(key), b.MapIndex(key))...)
|
||||
continue
|
||||
}
|
||||
missing = append(missing, diff{path: path.Key(fmt.Sprintf("%s", key.Interface())), a: nil, b: b.MapIndex(key).Interface()})
|
||||
}
|
||||
for key, value := range aKeys {
|
||||
missing = append(missing, diff{path: path.Key(fmt.Sprintf("%s", key)), a: value, b: nil})
|
||||
}
|
||||
if len(missing) == 0 {
|
||||
missing = append(missing, diff{path: path, a: a.Interface(), b: b.Interface()})
|
||||
}
|
||||
sort.Sort(orderedDiffs(missing))
|
||||
return missing
|
||||
default:
|
||||
if reflect.DeepEqual(a.Interface(), b.Interface()) {
|
||||
return nil
|
||||
}
|
||||
if !a.CanInterface() {
|
||||
return []diff{{path: path, a: fmt.Sprintf("%#v", a), b: fmt.Sprintf("%#v", b)}}
|
||||
}
|
||||
return []diff{{path: path, a: a.Interface(), b: b.Interface()}}
|
||||
}
|
||||
return legacyDiff(a, b)
|
||||
}
|
||||
|
||||
// ObjectGoPrintSideBySide prints a and b as textual dumps side by side,
|
||||
|
33
vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
generated
vendored
33
vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
generated
vendored
@ -62,27 +62,18 @@ func HandleCrash(additionalHandlers ...func(interface{})) {
|
||||
|
||||
// logPanic logs the caller tree when a panic occurs.
|
||||
func logPanic(r interface{}) {
|
||||
callers := getCallers(r)
|
||||
// Same as stdlib http server code. Manually allocate stack trace buffer size
|
||||
// to prevent excessively large logs
|
||||
const size = 64 << 10
|
||||
stacktrace := make([]byte, size)
|
||||
stacktrace = stacktrace[:runtime.Stack(stacktrace, false)]
|
||||
if _, ok := r.(string); ok {
|
||||
klog.Errorf("Observed a panic: %s\n%v", r, callers)
|
||||
klog.Errorf("Observed a panic: %s\n%s", r, stacktrace)
|
||||
} else {
|
||||
klog.Errorf("Observed a panic: %#v (%v)\n%v", r, r, callers)
|
||||
klog.Errorf("Observed a panic: %#v (%v)\n%s", r, r, stacktrace)
|
||||
}
|
||||
}
|
||||
|
||||
func getCallers(r interface{}) string {
|
||||
callers := ""
|
||||
for i := 0; true; i++ {
|
||||
_, file, line, ok := runtime.Caller(i)
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
callers = callers + fmt.Sprintf("%v:%v\n", file, line)
|
||||
}
|
||||
|
||||
return callers
|
||||
}
|
||||
|
||||
// ErrorHandlers is a list of functions which will be invoked when an unreturnable
|
||||
// error occurs.
|
||||
// TODO(lavalamp): for testability, this and the below HandleError function
|
||||
@ -155,13 +146,17 @@ func GetCaller() string {
|
||||
// handlers to handle errors and panics the same way.
|
||||
func RecoverFromPanic(err *error) {
|
||||
if r := recover(); r != nil {
|
||||
callers := getCallers(r)
|
||||
// Same as stdlib http server code. Manually allocate stack trace buffer size
|
||||
// to prevent excessively large logs
|
||||
const size = 64 << 10
|
||||
stacktrace := make([]byte, size)
|
||||
stacktrace = stacktrace[:runtime.Stack(stacktrace, false)]
|
||||
|
||||
*err = fmt.Errorf(
|
||||
"recovered from panic %q. (err=%v) Call stack:\n%v",
|
||||
"recovered from panic %q. (err=%v) Call stack:\n%s",
|
||||
r,
|
||||
*err,
|
||||
callers)
|
||||
stacktrace)
|
||||
}
|
||||
}
|
||||
|
||||
|
203
vendor/k8s.io/apimachinery/pkg/util/sets/int32.go
generated
vendored
Normal file
203
vendor/k8s.io/apimachinery/pkg/util/sets/int32.go
generated
vendored
Normal file
@ -0,0 +1,203 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by set-gen. DO NOT EDIT.
|
||||
|
||||
package sets
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"sort"
|
||||
)
|
||||
|
||||
// sets.Int32 is a set of int32s, implemented via map[int32]struct{} for minimal memory consumption.
|
||||
type Int32 map[int32]Empty
|
||||
|
||||
// NewInt32 creates a Int32 from a list of values.
|
||||
func NewInt32(items ...int32) Int32 {
|
||||
ss := Int32{}
|
||||
ss.Insert(items...)
|
||||
return ss
|
||||
}
|
||||
|
||||
// Int32KeySet creates a Int32 from a keys of a map[int32](? extends interface{}).
|
||||
// If the value passed in is not actually a map, this will panic.
|
||||
func Int32KeySet(theMap interface{}) Int32 {
|
||||
v := reflect.ValueOf(theMap)
|
||||
ret := Int32{}
|
||||
|
||||
for _, keyValue := range v.MapKeys() {
|
||||
ret.Insert(keyValue.Interface().(int32))
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// Insert adds items to the set.
|
||||
func (s Int32) Insert(items ...int32) {
|
||||
for _, item := range items {
|
||||
s[item] = Empty{}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete removes all items from the set.
|
||||
func (s Int32) Delete(items ...int32) {
|
||||
for _, item := range items {
|
||||
delete(s, item)
|
||||
}
|
||||
}
|
||||
|
||||
// Has returns true if and only if item is contained in the set.
|
||||
func (s Int32) Has(item int32) bool {
|
||||
_, contained := s[item]
|
||||
return contained
|
||||
}
|
||||
|
||||
// HasAll returns true if and only if all items are contained in the set.
|
||||
func (s Int32) HasAll(items ...int32) bool {
|
||||
for _, item := range items {
|
||||
if !s.Has(item) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// HasAny returns true if any items are contained in the set.
|
||||
func (s Int32) HasAny(items ...int32) bool {
|
||||
for _, item := range items {
|
||||
if s.Has(item) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Difference returns a set of objects that are not in s2
|
||||
// For example:
|
||||
// s1 = {a1, a2, a3}
|
||||
// s2 = {a1, a2, a4, a5}
|
||||
// s1.Difference(s2) = {a3}
|
||||
// s2.Difference(s1) = {a4, a5}
|
||||
func (s Int32) Difference(s2 Int32) Int32 {
|
||||
result := NewInt32()
|
||||
for key := range s {
|
||||
if !s2.Has(key) {
|
||||
result.Insert(key)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Union returns a new set which includes items in either s1 or s2.
|
||||
// For example:
|
||||
// s1 = {a1, a2}
|
||||
// s2 = {a3, a4}
|
||||
// s1.Union(s2) = {a1, a2, a3, a4}
|
||||
// s2.Union(s1) = {a1, a2, a3, a4}
|
||||
func (s1 Int32) Union(s2 Int32) Int32 {
|
||||
result := NewInt32()
|
||||
for key := range s1 {
|
||||
result.Insert(key)
|
||||
}
|
||||
for key := range s2 {
|
||||
result.Insert(key)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Intersection returns a new set which includes the item in BOTH s1 and s2
|
||||
// For example:
|
||||
// s1 = {a1, a2}
|
||||
// s2 = {a2, a3}
|
||||
// s1.Intersection(s2) = {a2}
|
||||
func (s1 Int32) Intersection(s2 Int32) Int32 {
|
||||
var walk, other Int32
|
||||
result := NewInt32()
|
||||
if s1.Len() < s2.Len() {
|
||||
walk = s1
|
||||
other = s2
|
||||
} else {
|
||||
walk = s2
|
||||
other = s1
|
||||
}
|
||||
for key := range walk {
|
||||
if other.Has(key) {
|
||||
result.Insert(key)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// IsSuperset returns true if and only if s1 is a superset of s2.
|
||||
func (s1 Int32) IsSuperset(s2 Int32) bool {
|
||||
for item := range s2 {
|
||||
if !s1.Has(item) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Equal returns true if and only if s1 is equal (as a set) to s2.
|
||||
// Two sets are equal if their membership is identical.
|
||||
// (In practice, this means same elements, order doesn't matter)
|
||||
func (s1 Int32) Equal(s2 Int32) bool {
|
||||
return len(s1) == len(s2) && s1.IsSuperset(s2)
|
||||
}
|
||||
|
||||
type sortableSliceOfInt32 []int32
|
||||
|
||||
func (s sortableSliceOfInt32) Len() int { return len(s) }
|
||||
func (s sortableSliceOfInt32) Less(i, j int) bool { return lessInt32(s[i], s[j]) }
|
||||
func (s sortableSliceOfInt32) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
|
||||
// List returns the contents as a sorted int32 slice.
|
||||
func (s Int32) List() []int32 {
|
||||
res := make(sortableSliceOfInt32, 0, len(s))
|
||||
for key := range s {
|
||||
res = append(res, key)
|
||||
}
|
||||
sort.Sort(res)
|
||||
return []int32(res)
|
||||
}
|
||||
|
||||
// UnsortedList returns the slice with contents in random order.
|
||||
func (s Int32) UnsortedList() []int32 {
|
||||
res := make([]int32, 0, len(s))
|
||||
for key := range s {
|
||||
res = append(res, key)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// Returns a single element from the set.
|
||||
func (s Int32) PopAny() (int32, bool) {
|
||||
for key := range s {
|
||||
s.Delete(key)
|
||||
return key, true
|
||||
}
|
||||
var zeroValue int32
|
||||
return zeroValue, false
|
||||
}
|
||||
|
||||
// Len returns the size of the set.
|
||||
func (s Int32) Len() int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
func lessInt32(lhs, rhs int32) bool {
|
||||
return lhs < rhs
|
||||
}
|
20
vendor/k8s.io/apimachinery/pkg/util/uuid/uuid.go
generated
vendored
20
vendor/k8s.io/apimachinery/pkg/util/uuid/uuid.go
generated
vendored
@ -17,27 +17,11 @@ limitations under the License.
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/pborman/uuid"
|
||||
"github.com/google/uuid"
|
||||
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
var uuidLock sync.Mutex
|
||||
var lastUUID uuid.UUID
|
||||
|
||||
func NewUUID() types.UID {
|
||||
uuidLock.Lock()
|
||||
defer uuidLock.Unlock()
|
||||
result := uuid.NewUUID()
|
||||
// The UUID package is naive and can generate identical UUIDs if the
|
||||
// time interval is quick enough.
|
||||
// The UUID uses 100 ns increments so it's short enough to actively
|
||||
// wait for a new value.
|
||||
for uuid.Equal(lastUUID, result) == true {
|
||||
result = uuid.NewUUID()
|
||||
}
|
||||
lastUUID = result
|
||||
return types.UID(result.String())
|
||||
return types.UID(uuid.New().String())
|
||||
}
|
||||
|
27
vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
generated
vendored
27
vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
generated
vendored
@ -250,6 +250,25 @@ func (b *Backoff) Step() time.Duration {
|
||||
return duration
|
||||
}
|
||||
|
||||
// contextForChannel derives a child context from a parent channel.
|
||||
//
|
||||
// The derived context's Done channel is closed when the returned cancel function
|
||||
// is called or when the parent channel is closed, whichever happens first.
|
||||
//
|
||||
// Note the caller must *always* call the CancelFunc, otherwise resources may be leaked.
|
||||
func contextForChannel(parentCh <-chan struct{}) (context.Context, context.CancelFunc) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
go func() {
|
||||
select {
|
||||
case <-parentCh:
|
||||
cancel()
|
||||
case <-ctx.Done():
|
||||
}
|
||||
}()
|
||||
return ctx, cancel
|
||||
}
|
||||
|
||||
// ExponentialBackoff repeats a condition check with exponential backoff.
|
||||
//
|
||||
// It checks the condition up to Steps times, increasing the wait by multiplying
|
||||
@ -353,7 +372,9 @@ func PollImmediateInfinite(interval time.Duration, condition ConditionFunc) erro
|
||||
// PollUntil always waits interval before the first run of 'condition'.
|
||||
// 'condition' will always be invoked at least once.
|
||||
func PollUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
|
||||
return WaitFor(poller(interval, 0), condition, stopCh)
|
||||
ctx, cancel := contextForChannel(stopCh)
|
||||
defer cancel()
|
||||
return WaitFor(poller(interval, 0), condition, ctx.Done())
|
||||
}
|
||||
|
||||
// PollImmediateUntil tries a condition func until it returns true, an error or stopCh is closed.
|
||||
@ -422,7 +443,9 @@ func WaitFor(wait WaitFunc, fn ConditionFunc, done <-chan struct{}) error {
|
||||
// timeout has elapsed and then closes the channel.
|
||||
//
|
||||
// Over very short intervals you may receive no ticks before the channel is
|
||||
// closed. A timeout of 0 is interpreted as an infinity.
|
||||
// closed. A timeout of 0 is interpreted as an infinity, and in such a case
|
||||
// it would be the caller's responsibility to close the done channel.
|
||||
// Failure to do so would result in a leaked goroutine.
|
||||
//
|
||||
// Output ticks are not buffered. If the channel is not ready to receive an
|
||||
// item, the tick is skipped.
|
||||
|
31
vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go
generated
vendored
31
vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go
generated
vendored
@ -17,13 +17,15 @@ limitations under the License.
|
||||
package watch
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"k8s.io/klog"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/net"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// Decoder allows StreamWatcher to watch any stream for which a Decoder can be written.
|
||||
@ -39,19 +41,28 @@ type Decoder interface {
|
||||
Close()
|
||||
}
|
||||
|
||||
// Reporter hides the details of how an error is turned into a runtime.Object for
|
||||
// reporting on a watch stream since this package may not import a higher level report.
|
||||
type Reporter interface {
|
||||
// AsObject must convert err into a valid runtime.Object for the watch stream.
|
||||
AsObject(err error) runtime.Object
|
||||
}
|
||||
|
||||
// StreamWatcher turns any stream for which you can write a Decoder interface
|
||||
// into a watch.Interface.
|
||||
type StreamWatcher struct {
|
||||
sync.Mutex
|
||||
source Decoder
|
||||
result chan Event
|
||||
stopped bool
|
||||
source Decoder
|
||||
reporter Reporter
|
||||
result chan Event
|
||||
stopped bool
|
||||
}
|
||||
|
||||
// NewStreamWatcher creates a StreamWatcher from the given decoder.
|
||||
func NewStreamWatcher(d Decoder) *StreamWatcher {
|
||||
func NewStreamWatcher(d Decoder, r Reporter) *StreamWatcher {
|
||||
sw := &StreamWatcher{
|
||||
source: d,
|
||||
source: d,
|
||||
reporter: r,
|
||||
// It's easy for a consumer to add buffering via an extra
|
||||
// goroutine/channel, but impossible for them to remove it,
|
||||
// so nonbuffered is better.
|
||||
@ -102,11 +113,13 @@ func (sw *StreamWatcher) receive() {
|
||||
case io.ErrUnexpectedEOF:
|
||||
klog.V(1).Infof("Unexpected EOF during watch stream event decoding: %v", err)
|
||||
default:
|
||||
msg := "Unable to decode an event from the watch stream: %v"
|
||||
if net.IsProbableEOF(err) {
|
||||
klog.V(5).Infof(msg, err)
|
||||
klog.V(5).Infof("Unable to decode an event from the watch stream: %v", err)
|
||||
} else {
|
||||
klog.Errorf(msg, err)
|
||||
sw.result <- Event{
|
||||
Type: Error,
|
||||
Object: sw.reporter.AsObject(fmt.Errorf("unable to decode an event from the watch stream: %v", err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
|
5
vendor/k8s.io/apimachinery/pkg/watch/watch.go
generated
vendored
5
vendor/k8s.io/apimachinery/pkg/watch/watch.go
generated
vendored
@ -44,6 +44,7 @@ const (
|
||||
Added EventType = "ADDED"
|
||||
Modified EventType = "MODIFIED"
|
||||
Deleted EventType = "DELETED"
|
||||
Bookmark EventType = "BOOKMARK"
|
||||
Error EventType = "ERROR"
|
||||
|
||||
DefaultChanSize int32 = 100
|
||||
@ -57,6 +58,10 @@ type Event struct {
|
||||
// Object is:
|
||||
// * If Type is Added or Modified: the new state of the object.
|
||||
// * If Type is Deleted: the state of the object immediately before deletion.
|
||||
// * If Type is Bookmark: the object (instance of a type being watched) where
|
||||
// only ResourceVersion field is set. On successful restart of watch from a
|
||||
// bookmark resourceVersion, client is guaranteed to not get repeat event
|
||||
// nor miss any events.
|
||||
// * If Type is Error: *api.Status is recommended; other types may make sense
|
||||
// depending on context.
|
||||
Object runtime.Object
|
||||
|
Reference in New Issue
Block a user