Update code for latest k8s
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
8f5e37a83c
commit
5f7ac28059
792 changed files with 25023 additions and 19841 deletions
21
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
21
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
|
@ -352,12 +352,23 @@ func NewGenericServerResponse(code int, verb string, qualifiedResource schema.Gr
|
|||
reason = metav1.StatusReasonForbidden
|
||||
// the server message has details about who is trying to perform what action. Keep its message.
|
||||
message = serverMessage
|
||||
case http.StatusNotAcceptable:
|
||||
reason = metav1.StatusReasonNotAcceptable
|
||||
// the server message has details about what types are acceptable
|
||||
message = serverMessage
|
||||
case http.StatusUnsupportedMediaType:
|
||||
reason = metav1.StatusReasonUnsupportedMediaType
|
||||
// the server message has details about what types are acceptable
|
||||
message = serverMessage
|
||||
case http.StatusMethodNotAllowed:
|
||||
reason = metav1.StatusReasonMethodNotAllowed
|
||||
message = "the server does not allow this method on the requested resource"
|
||||
case http.StatusUnprocessableEntity:
|
||||
reason = metav1.StatusReasonInvalid
|
||||
message = "the server rejected our request due to an error in our request"
|
||||
case http.StatusServiceUnavailable:
|
||||
reason = metav1.StatusReasonServiceUnavailable
|
||||
message = "the server is currently unable to handle the request"
|
||||
case http.StatusGatewayTimeout:
|
||||
reason = metav1.StatusReasonTimeout
|
||||
message = "the server was unable to return a response in the time allotted, but may still be processing the request"
|
||||
|
@ -434,6 +445,16 @@ func IsResourceExpired(err error) bool {
|
|||
return ReasonForError(err) == metav1.StatusReasonExpired
|
||||
}
|
||||
|
||||
// IsNotAcceptable determines if err is an error which indicates that the request failed due to an invalid Accept header
|
||||
func IsNotAcceptable(err error) bool {
|
||||
return ReasonForError(err) == metav1.StatusReasonNotAcceptable
|
||||
}
|
||||
|
||||
// IsUnsupportedMediaType determines if err is an error which indicates that the request failed due to an invalid Content-Type header
|
||||
func IsUnsupportedMediaType(err error) bool {
|
||||
return ReasonForError(err) == metav1.StatusReasonUnsupportedMediaType
|
||||
}
|
||||
|
||||
// IsMethodNotSupported determines if the err is an error which indicates the provided action could not
|
||||
// be performed because it is not supported by the server.
|
||||
func IsMethodNotSupported(err error) bool {
|
||||
|
|
20
vendor/k8s.io/apimachinery/pkg/api/meta/errors.go
generated
vendored
20
vendor/k8s.io/apimachinery/pkg/api/meta/errors.go
generated
vendored
|
@ -20,6 +20,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
)
|
||||
|
||||
// AmbiguousResourceError is returned if the RESTMapper finds multiple matches for a resource
|
||||
|
@ -85,11 +86,26 @@ func (e *NoResourceMatchError) Error() string {
|
|||
|
||||
// NoKindMatchError is returned if the RESTMapper can't find any match for a kind
|
||||
type NoKindMatchError struct {
|
||||
PartialKind schema.GroupVersionKind
|
||||
// GroupKind is the API group and kind that was searched
|
||||
GroupKind schema.GroupKind
|
||||
// SearchedVersions is the optional list of versions the search was restricted to
|
||||
SearchedVersions []string
|
||||
}
|
||||
|
||||
func (e *NoKindMatchError) Error() string {
|
||||
return fmt.Sprintf("no matches for %v", e.PartialKind)
|
||||
searchedVersions := sets.NewString()
|
||||
for _, v := range e.SearchedVersions {
|
||||
searchedVersions.Insert(schema.GroupVersion{Group: e.GroupKind.Group, Version: v}.String())
|
||||
}
|
||||
|
||||
switch len(searchedVersions) {
|
||||
case 0:
|
||||
return fmt.Sprintf("no matches for kind %q in group %q", e.GroupKind.Kind, e.GroupKind.Group)
|
||||
case 1:
|
||||
return fmt.Sprintf("no matches for kind %q in version %q", e.GroupKind.Kind, searchedVersions.List()[0])
|
||||
default:
|
||||
return fmt.Sprintf("no matches for kind %q in versions %q", e.GroupKind.Kind, searchedVersions.List())
|
||||
}
|
||||
}
|
||||
|
||||
func IsNoMatchError(err error) bool {
|
||||
|
|
8
vendor/k8s.io/apimachinery/pkg/api/meta/meta.go
generated
vendored
8
vendor/k8s.io/apimachinery/pkg/api/meta/meta.go
generated
vendored
|
@ -23,7 +23,7 @@ import (
|
|||
"github.com/golang/glog"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1alpha1 "k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
|
||||
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
@ -118,12 +118,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) *metav1alpha1.PartialObjectMetadata {
|
||||
func AsPartialObjectMetadata(m metav1.Object) *metav1beta1.PartialObjectMetadata {
|
||||
switch t := m.(type) {
|
||||
case *metav1.ObjectMeta:
|
||||
return &metav1alpha1.PartialObjectMetadata{ObjectMeta: *t}
|
||||
return &metav1beta1.PartialObjectMetadata{ObjectMeta: *t}
|
||||
default:
|
||||
return &metav1alpha1.PartialObjectMetadata{
|
||||
return &metav1beta1.PartialObjectMetadata{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: m.GetName(),
|
||||
GenerateName: m.GetGenerateName(),
|
||||
|
|
4
vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper.go
generated
vendored
4
vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper.go
generated
vendored
|
@ -179,7 +179,7 @@ func (m MultiRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*
|
|||
if len(errors) > 0 {
|
||||
return nil, utilerrors.NewAggregate(errors)
|
||||
}
|
||||
return nil, &NoKindMatchError{PartialKind: gk.WithVersion("")}
|
||||
return nil, &NoKindMatchError{GroupKind: gk, SearchedVersions: versions}
|
||||
}
|
||||
|
||||
// RESTMappings returns all possible RESTMappings for the provided group kind, or an error
|
||||
|
@ -204,7 +204,7 @@ func (m MultiRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) (
|
|||
return nil, utilerrors.NewAggregate(errors)
|
||||
}
|
||||
if len(allMappings) == 0 {
|
||||
return nil, &NoKindMatchError{PartialKind: gk.WithVersion("")}
|
||||
return nil, &NoKindMatchError{GroupKind: gk, SearchedVersions: versions}
|
||||
}
|
||||
return allMappings, nil
|
||||
}
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/api/meta/priority.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/api/meta/priority.go
generated
vendored
|
@ -153,7 +153,7 @@ func kindMatches(pattern schema.GroupVersionKind, kind schema.GroupVersionKind)
|
|||
}
|
||||
|
||||
func (m PriorityRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (mapping *RESTMapping, err error) {
|
||||
mappings, err := m.Delegate.RESTMappings(gk)
|
||||
mappings, err := m.Delegate.RESTMappings(gk, versions...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
4
vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go
generated
vendored
4
vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go
generated
vendored
|
@ -472,7 +472,7 @@ func (m *DefaultRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string)
|
|||
return nil, err
|
||||
}
|
||||
if len(mappings) == 0 {
|
||||
return nil, &NoKindMatchError{PartialKind: gk.WithVersion("")}
|
||||
return nil, &NoKindMatchError{GroupKind: gk, SearchedVersions: versions}
|
||||
}
|
||||
// since we rely on RESTMappings method
|
||||
// take the first match and return to the caller
|
||||
|
@ -510,7 +510,7 @@ func (m *DefaultRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string
|
|||
}
|
||||
|
||||
if len(potentialGVK) == 0 {
|
||||
return nil, &NoKindMatchError{PartialKind: gk.WithVersion("")}
|
||||
return nil, &NoKindMatchError{GroupKind: gk, SearchedVersions: versions}
|
||||
}
|
||||
|
||||
for _, gvk := range potentialGVK {
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
22
vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
generated
vendored
22
vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
generated
vendored
|
@ -27,9 +27,7 @@ import (
|
|||
|
||||
flag "github.com/spf13/pflag"
|
||||
|
||||
"github.com/go-openapi/spec"
|
||||
inf "gopkg.in/inf.v0"
|
||||
openapi "k8s.io/kube-openapi/pkg/common"
|
||||
)
|
||||
|
||||
// Quantity is a fixed-point representation of a number.
|
||||
|
@ -399,17 +397,15 @@ func (q Quantity) DeepCopy() Quantity {
|
|||
return q
|
||||
}
|
||||
|
||||
// OpenAPIDefinition returns openAPI definition for this type.
|
||||
func (_ Quantity) OpenAPIDefinition() openapi.OpenAPIDefinition {
|
||||
return openapi.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
// OpenAPISchemaType is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
//
|
||||
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
|
||||
func (_ Quantity) OpenAPISchemaType() []string { return []string{"string"} }
|
||||
|
||||
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
func (_ Quantity) OpenAPISchemaFormat() string { return "" }
|
||||
|
||||
// CanonicalizeBytes returns the canonical form of q and its suffix (see comment on Quantity).
|
||||
//
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/apimachinery/announced/announced.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/apimachinery/announced/announced.go
generated
vendored
|
@ -35,7 +35,7 @@ import (
|
|||
//
|
||||
// (Right now APIRegistrationManager has separate 'registration' and 'enabled'
|
||||
// concepts-- APIGroupFactory is going to take over the former function;
|
||||
// they will overlap untill the refactoring is finished.)
|
||||
// they will overlap until the refactoring is finished.)
|
||||
//
|
||||
// The key is the group name. After initialization, this should be treated as
|
||||
// read-only. It is implemented as a map from group name to group factory, and
|
||||
|
|
1
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/doc.go
generated
vendored
1
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/doc.go
generated
vendored
|
@ -15,5 +15,6 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:conversion-gen=k8s.io/apimachinery/pkg/apis/meta/v1
|
||||
|
||||
package internalversion
|
||||
|
|
20
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go
generated
vendored
20
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go
generated
vendored
|
@ -18,7 +18,7 @@ package internalversion
|
|||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1alpha1 "k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
|
||||
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
|
@ -79,16 +79,16 @@ func addToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion)
|
|||
&metav1.DeleteOptions{},
|
||||
)
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&metav1alpha1.Table{},
|
||||
&metav1alpha1.TableOptions{},
|
||||
&metav1alpha1.PartialObjectMetadata{},
|
||||
&metav1alpha1.PartialObjectMetadataList{},
|
||||
&metav1beta1.Table{},
|
||||
&metav1beta1.TableOptions{},
|
||||
&metav1beta1.PartialObjectMetadata{},
|
||||
&metav1beta1.PartialObjectMetadataList{},
|
||||
)
|
||||
scheme.AddKnownTypes(metav1alpha1.SchemeGroupVersion,
|
||||
&metav1alpha1.Table{},
|
||||
&metav1alpha1.TableOptions{},
|
||||
&metav1alpha1.PartialObjectMetadata{},
|
||||
&metav1alpha1.PartialObjectMetadataList{},
|
||||
scheme.AddKnownTypes(metav1beta1.SchemeGroupVersion,
|
||||
&metav1beta1.Table{},
|
||||
&metav1beta1.TableOptions{},
|
||||
&metav1beta1.PartialObjectMetadata{},
|
||||
&metav1beta1.PartialObjectMetadataList{},
|
||||
)
|
||||
// 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{})
|
||||
|
|
11
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go
generated
vendored
11
vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
@ -21,10 +21,11 @@ limitations under the License.
|
|||
package internalversion
|
||||
|
||||
import (
|
||||
unsafe "unsafe"
|
||||
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -53,7 +54,7 @@ func autoConvert_internalversion_List_To_v1_List(in *List, out *v1.List, s conve
|
|||
}
|
||||
}
|
||||
} else {
|
||||
out.Items = make([]runtime.RawExtension, 0)
|
||||
out.Items = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -95,6 +96,8 @@ func autoConvert_internalversion_ListOptions_To_v1_ListOptions(in *ListOptions,
|
|||
out.Watch = in.Watch
|
||||
out.ResourceVersion = in.ResourceVersion
|
||||
out.TimeoutSeconds = (*int64)(unsafe.Pointer(in.TimeoutSeconds))
|
||||
out.Limit = in.Limit
|
||||
out.Continue = in.Continue
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -109,5 +112,7 @@ func autoConvert_v1_ListOptions_To_internalversion_ListOptions(in *v1.ListOption
|
|||
out.Watch = in.Watch
|
||||
out.ResourceVersion = in.ResourceVersion
|
||||
out.TimeoutSeconds = (*int64)(unsafe.Pointer(in.TimeoutSeconds))
|
||||
out.Limit = in.Limit
|
||||
out.Continue = in.Continue
|
||||
return nil
|
||||
}
|
||||
|
|
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
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
18
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion.go
generated
vendored
18
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion.go
generated
vendored
|
@ -65,6 +65,9 @@ func AddConversionFuncs(scheme *runtime.Scheme) error {
|
|||
Convert_Pointer_int32_To_int32,
|
||||
Convert_int32_To_Pointer_int32,
|
||||
|
||||
Convert_Pointer_int64_To_int64,
|
||||
Convert_int64_To_Pointer_int64,
|
||||
|
||||
Convert_Pointer_float64_To_float64,
|
||||
Convert_float64_To_Pointer_float64,
|
||||
|
||||
|
@ -105,6 +108,21 @@ func Convert_int32_To_Pointer_int32(in *int32, out **int32, s conversion.Scope)
|
|||
return nil
|
||||
}
|
||||
|
||||
func Convert_Pointer_int64_To_int64(in **int64, out *int64, s conversion.Scope) error {
|
||||
if *in == nil {
|
||||
*out = 0
|
||||
return nil
|
||||
}
|
||||
*out = int64(**in)
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_int64_To_Pointer_int64(in *int64, out **int64, s conversion.Scope) error {
|
||||
temp := int64(*in)
|
||||
*out = &temp
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_Pointer_int64_To_int(in **int64, out *int, s conversion.Scope) error {
|
||||
if *in == nil {
|
||||
*out = 0
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
3
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
generated
vendored
3
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
@ -375,6 +375,7 @@ message ListOptions {
|
|||
optional string resourceVersion = 4;
|
||||
|
||||
// Timeout for the list/watch call.
|
||||
// This limits the duration of the call, regardless of any activity or inactivity.
|
||||
// +optional
|
||||
optional int64 timeoutSeconds = 5;
|
||||
|
||||
|
|
28
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/labels.go
generated
vendored
28
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/labels.go
generated
vendored
|
@ -25,34 +25,14 @@ func CloneSelectorAndAddLabel(selector *LabelSelector, labelKey, labelValue stri
|
|||
}
|
||||
|
||||
// Clone.
|
||||
newSelector := new(LabelSelector)
|
||||
newSelector := selector.DeepCopy()
|
||||
|
||||
// TODO(madhusudancs): Check if you can use deepCopy_extensions_LabelSelector here.
|
||||
newSelector.MatchLabels = make(map[string]string)
|
||||
if selector.MatchLabels != nil {
|
||||
for key, val := range selector.MatchLabels {
|
||||
newSelector.MatchLabels[key] = val
|
||||
}
|
||||
if newSelector.MatchLabels == nil {
|
||||
newSelector.MatchLabels = make(map[string]string)
|
||||
}
|
||||
|
||||
newSelector.MatchLabels[labelKey] = labelValue
|
||||
|
||||
if selector.MatchExpressions != nil {
|
||||
newMExps := make([]LabelSelectorRequirement, len(selector.MatchExpressions))
|
||||
for i, me := range selector.MatchExpressions {
|
||||
newMExps[i].Key = me.Key
|
||||
newMExps[i].Operator = me.Operator
|
||||
if me.Values != nil {
|
||||
newMExps[i].Values = make([]string, len(me.Values))
|
||||
copy(newMExps[i].Values, me.Values)
|
||||
} else {
|
||||
newMExps[i].Values = nil
|
||||
}
|
||||
}
|
||||
newSelector.MatchExpressions = newMExps
|
||||
} else {
|
||||
newSelector.MatchExpressions = nil
|
||||
}
|
||||
|
||||
return newSelector
|
||||
}
|
||||
|
||||
|
|
22
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
generated
vendored
22
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
generated
vendored
|
@ -20,9 +20,6 @@ import (
|
|||
"encoding/json"
|
||||
"time"
|
||||
|
||||
openapi "k8s.io/kube-openapi/pkg/common"
|
||||
|
||||
"github.com/go-openapi/spec"
|
||||
"github.com/google/gofuzz"
|
||||
)
|
||||
|
||||
|
@ -149,16 +146,15 @@ func (t MicroTime) MarshalJSON() ([]byte, error) {
|
|||
return json.Marshal(t.UTC().Format(RFC3339Micro))
|
||||
}
|
||||
|
||||
func (_ MicroTime) OpenAPIDefinition() openapi.OpenAPIDefinition {
|
||||
return openapi.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"string"},
|
||||
Format: "date-time",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
// OpenAPISchemaType is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
//
|
||||
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
|
||||
func (_ MicroTime) OpenAPISchemaType() []string { return []string{"string"} }
|
||||
|
||||
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
func (_ MicroTime) OpenAPISchemaFormat() string { return "date-time" }
|
||||
|
||||
// MarshalQueryParameter converts to a URL query parameter value
|
||||
func (t MicroTime) MarshalQueryParameter() (string, error) {
|
||||
|
|
22
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
generated
vendored
22
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
generated
vendored
|
@ -20,9 +20,6 @@ import (
|
|||
"encoding/json"
|
||||
"time"
|
||||
|
||||
openapi "k8s.io/kube-openapi/pkg/common"
|
||||
|
||||
"github.com/go-openapi/spec"
|
||||
"github.com/google/gofuzz"
|
||||
)
|
||||
|
||||
|
@ -151,16 +148,15 @@ func (t Time) MarshalJSON() ([]byte, error) {
|
|||
return json.Marshal(t.UTC().Format(time.RFC3339))
|
||||
}
|
||||
|
||||
func (_ Time) OpenAPIDefinition() openapi.OpenAPIDefinition {
|
||||
return openapi.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"string"},
|
||||
Format: "date-time",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
// OpenAPISchemaType is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
//
|
||||
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
|
||||
func (_ Time) OpenAPISchemaType() []string { return []string{"string"} }
|
||||
|
||||
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
func (_ Time) OpenAPISchemaFormat() string { return "date-time" }
|
||||
|
||||
// MarshalQueryParameter converts to a URL query parameter value
|
||||
func (t Time) MarshalQueryParameter() (string, error) {
|
||||
|
|
13
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
generated
vendored
13
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
generated
vendored
|
@ -342,6 +342,7 @@ type ListOptions struct {
|
|||
// +optional
|
||||
ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,4,opt,name=resourceVersion"`
|
||||
// Timeout for the list/watch call.
|
||||
// This limits the duration of the call, regardless of any activity or inactivity.
|
||||
// +optional
|
||||
TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty" protobuf:"varint,5,opt,name=timeoutSeconds"`
|
||||
|
||||
|
@ -651,6 +652,18 @@ const (
|
|||
// can only be created. API calls that return MethodNotAllowed can never succeed.
|
||||
StatusReasonMethodNotAllowed StatusReason = "MethodNotAllowed"
|
||||
|
||||
// StatusReasonNotAcceptable means that the accept types indicated by the client were not acceptable
|
||||
// to the server - for instance, attempting to receive protobuf for a resource that supports only json and yaml.
|
||||
// API calls that return NotAcceptable can never succeed.
|
||||
// Status code 406
|
||||
StatusReasonNotAcceptable StatusReason = "NotAcceptable"
|
||||
|
||||
// StatusReasonUnsupportedMediaType means that the content type sent by the client is not acceptable
|
||||
// to the server - for instance, attempting to send protobuf for a resource that supports only json and yaml.
|
||||
// API calls that return UnsupportedMediaType can never succeed.
|
||||
// Status code 415
|
||||
StatusReasonUnsupportedMediaType StatusReason = "UnsupportedMediaType"
|
||||
|
||||
// StatusReasonInternalError indicates that an internal error occurred, it is unexpected
|
||||
// and the outcome of the call is unknown.
|
||||
// Details (optional):
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
generated
vendored
|
@ -195,7 +195,7 @@ var map_ListOptions = map[string]string{
|
|||
"includeUninitialized": "If true, partially initialized resources are included in the response.",
|
||||
"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.",
|
||||
"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 indicating the client must restart their list without the continue field. This 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.",
|
||||
}
|
||||
|
|
216
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
generated
vendored
216
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
generated
vendored
|
@ -31,163 +31,181 @@ import (
|
|||
)
|
||||
|
||||
// NestedFieldCopy returns a deep copy of the value of a nested field.
|
||||
// false is returned if the value is missing.
|
||||
// nil, true is returned for a nil field.
|
||||
func NestedFieldCopy(obj map[string]interface{}, fields ...string) (interface{}, bool) {
|
||||
val, ok := nestedFieldNoCopy(obj, fields...)
|
||||
if !ok {
|
||||
return nil, false
|
||||
// Returns false if the value is missing.
|
||||
// No error is returned for a nil field.
|
||||
func NestedFieldCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error) {
|
||||
val, found, err := nestedFieldNoCopy(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return nil, found, err
|
||||
}
|
||||
return runtime.DeepCopyJSONValue(val), true
|
||||
return runtime.DeepCopyJSONValue(val), true, nil
|
||||
}
|
||||
|
||||
func nestedFieldNoCopy(obj map[string]interface{}, fields ...string) (interface{}, bool) {
|
||||
func nestedFieldNoCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error) {
|
||||
var val interface{} = obj
|
||||
for _, field := range fields {
|
||||
|
||||
for i, field := range fields {
|
||||
if m, ok := val.(map[string]interface{}); ok {
|
||||
val, ok = m[field]
|
||||
if !ok {
|
||||
return nil, false
|
||||
return nil, false, nil
|
||||
}
|
||||
} else {
|
||||
// Expected map[string]interface{}, got something else
|
||||
return nil, false
|
||||
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected map[string]interface{}", jsonPath(fields[:i+1]), val, val)
|
||||
}
|
||||
}
|
||||
return val, true
|
||||
return val, true, nil
|
||||
}
|
||||
|
||||
// NestedString returns the string value of a nested field.
|
||||
// Returns false if value is not found or is not a string.
|
||||
func NestedString(obj map[string]interface{}, fields ...string) (string, bool) {
|
||||
val, ok := nestedFieldNoCopy(obj, fields...)
|
||||
if !ok {
|
||||
return "", false
|
||||
// Returns false if value is not found and an error if not a string.
|
||||
func NestedString(obj map[string]interface{}, fields ...string) (string, bool, error) {
|
||||
val, found, err := nestedFieldNoCopy(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return "", found, err
|
||||
}
|
||||
s, ok := val.(string)
|
||||
return s, ok
|
||||
if !ok {
|
||||
return "", false, fmt.Errorf("%v accessor error: %v is of the type %T, expected string", jsonPath(fields), val, val)
|
||||
}
|
||||
return s, true, nil
|
||||
}
|
||||
|
||||
// NestedBool returns the bool value of a nested field.
|
||||
// Returns false if value is not found or is not a bool.
|
||||
func NestedBool(obj map[string]interface{}, fields ...string) (bool, bool) {
|
||||
val, ok := nestedFieldNoCopy(obj, fields...)
|
||||
if !ok {
|
||||
return false, false
|
||||
// Returns false if value is not found and an error if not a bool.
|
||||
func NestedBool(obj map[string]interface{}, fields ...string) (bool, bool, error) {
|
||||
val, found, err := nestedFieldNoCopy(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return false, found, err
|
||||
}
|
||||
b, ok := val.(bool)
|
||||
return b, ok
|
||||
if !ok {
|
||||
return false, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected bool", jsonPath(fields), val, val)
|
||||
}
|
||||
return b, true, nil
|
||||
}
|
||||
|
||||
// NestedFloat64 returns the bool value of a nested field.
|
||||
// Returns false if value is not found or is not a float64.
|
||||
func NestedFloat64(obj map[string]interface{}, fields ...string) (float64, bool) {
|
||||
val, ok := nestedFieldNoCopy(obj, fields...)
|
||||
if !ok {
|
||||
return 0, false
|
||||
// NestedFloat64 returns the float64 value of a nested field.
|
||||
// Returns false if value is not found and an error if not a float64.
|
||||
func NestedFloat64(obj map[string]interface{}, fields ...string) (float64, bool, error) {
|
||||
val, found, err := nestedFieldNoCopy(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return 0, found, err
|
||||
}
|
||||
f, ok := val.(float64)
|
||||
return f, ok
|
||||
if !ok {
|
||||
return 0, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected float64", jsonPath(fields), val, val)
|
||||
}
|
||||
return f, true, nil
|
||||
}
|
||||
|
||||
// NestedInt64 returns the int64 value of a nested field.
|
||||
// Returns false if value is not found or is not an int64.
|
||||
func NestedInt64(obj map[string]interface{}, fields ...string) (int64, bool) {
|
||||
val, ok := nestedFieldNoCopy(obj, fields...)
|
||||
if !ok {
|
||||
return 0, false
|
||||
// Returns false if value is not found and an error if not an int64.
|
||||
func NestedInt64(obj map[string]interface{}, fields ...string) (int64, bool, error) {
|
||||
val, found, err := nestedFieldNoCopy(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return 0, found, err
|
||||
}
|
||||
i, ok := val.(int64)
|
||||
return i, ok
|
||||
if !ok {
|
||||
return 0, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected int64", jsonPath(fields), val, val)
|
||||
}
|
||||
return i, true, nil
|
||||
}
|
||||
|
||||
// NestedStringSlice returns a copy of []string value of a nested field.
|
||||
// Returns false if value is not found, is not a []interface{} or contains non-string items in the slice.
|
||||
func NestedStringSlice(obj map[string]interface{}, fields ...string) ([]string, bool) {
|
||||
val, ok := nestedFieldNoCopy(obj, fields...)
|
||||
// Returns false if value is not found and an error if not a []interface{} or contains non-string items in the slice.
|
||||
func NestedStringSlice(obj map[string]interface{}, fields ...string) ([]string, bool, error) {
|
||||
val, found, err := nestedFieldNoCopy(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return nil, found, err
|
||||
}
|
||||
m, ok := val.([]interface{})
|
||||
if !ok {
|
||||
return nil, false
|
||||
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected []interface{}", jsonPath(fields), val, val)
|
||||
}
|
||||
if m, ok := val.([]interface{}); ok {
|
||||
strSlice := make([]string, 0, len(m))
|
||||
for _, v := range m {
|
||||
if str, ok := v.(string); ok {
|
||||
strSlice = append(strSlice, str)
|
||||
} else {
|
||||
return nil, false
|
||||
}
|
||||
strSlice := make([]string, 0, len(m))
|
||||
for _, v := range m {
|
||||
if str, ok := v.(string); ok {
|
||||
strSlice = append(strSlice, str)
|
||||
} else {
|
||||
return nil, false, fmt.Errorf("%v accessor error: contains non-string key in the slice: %v is of the type %T, expected string", jsonPath(fields), v, v)
|
||||
}
|
||||
return strSlice, true
|
||||
}
|
||||
return nil, false
|
||||
return strSlice, true, nil
|
||||
}
|
||||
|
||||
// NestedSlice returns a deep copy of []interface{} value of a nested field.
|
||||
// Returns false if value is not found or is not a []interface{}.
|
||||
func NestedSlice(obj map[string]interface{}, fields ...string) ([]interface{}, bool) {
|
||||
val, ok := nestedFieldNoCopy(obj, fields...)
|
||||
// Returns false if value is not found and an error if not a []interface{}.
|
||||
func NestedSlice(obj map[string]interface{}, fields ...string) ([]interface{}, bool, error) {
|
||||
val, found, err := nestedFieldNoCopy(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return nil, found, err
|
||||
}
|
||||
_, ok := val.([]interface{})
|
||||
if !ok {
|
||||
return nil, false
|
||||
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected []interface{}", jsonPath(fields), val, val)
|
||||
}
|
||||
if _, ok := val.([]interface{}); ok {
|
||||
return runtime.DeepCopyJSONValue(val).([]interface{}), true
|
||||
}
|
||||
return nil, false
|
||||
return runtime.DeepCopyJSONValue(val).([]interface{}), true, nil
|
||||
}
|
||||
|
||||
// NestedStringMap returns a copy of map[string]string value of a nested field.
|
||||
// Returns false if value is not found, is not a map[string]interface{} or contains non-string values in the map.
|
||||
func NestedStringMap(obj map[string]interface{}, fields ...string) (map[string]string, bool) {
|
||||
m, ok := nestedMapNoCopy(obj, fields...)
|
||||
if !ok {
|
||||
return nil, false
|
||||
// Returns false if value is not found and an error if not a map[string]interface{} or contains non-string values in the map.
|
||||
func NestedStringMap(obj map[string]interface{}, fields ...string) (map[string]string, bool, error) {
|
||||
m, found, err := nestedMapNoCopy(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return nil, found, err
|
||||
}
|
||||
strMap := make(map[string]string, len(m))
|
||||
for k, v := range m {
|
||||
if str, ok := v.(string); ok {
|
||||
strMap[k] = str
|
||||
} else {
|
||||
return nil, false
|
||||
return nil, false, fmt.Errorf("%v accessor error: contains non-string key in the map: %v is of the type %T, expected string", jsonPath(fields), v, v)
|
||||
}
|
||||
}
|
||||
return strMap, true
|
||||
return strMap, true, nil
|
||||
}
|
||||
|
||||
// NestedMap returns a deep copy of map[string]interface{} value of a nested field.
|
||||
// Returns false if value is not found or is not a map[string]interface{}.
|
||||
func NestedMap(obj map[string]interface{}, fields ...string) (map[string]interface{}, bool) {
|
||||
m, ok := nestedMapNoCopy(obj, fields...)
|
||||
if !ok {
|
||||
return nil, false
|
||||
// Returns false if value is not found and an error if not a map[string]interface{}.
|
||||
func NestedMap(obj map[string]interface{}, fields ...string) (map[string]interface{}, bool, error) {
|
||||
m, found, err := nestedMapNoCopy(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return nil, found, err
|
||||
}
|
||||
return runtime.DeepCopyJSON(m), true
|
||||
return runtime.DeepCopyJSON(m), true, nil
|
||||
}
|
||||
|
||||
// nestedMapNoCopy returns a map[string]interface{} value of a nested field.
|
||||
// Returns false if value is not found or is not a map[string]interface{}.
|
||||
func nestedMapNoCopy(obj map[string]interface{}, fields ...string) (map[string]interface{}, bool) {
|
||||
val, ok := nestedFieldNoCopy(obj, fields...)
|
||||
if !ok {
|
||||
return nil, false
|
||||
// Returns false if value is not found and an error if not a map[string]interface{}.
|
||||
func nestedMapNoCopy(obj map[string]interface{}, fields ...string) (map[string]interface{}, bool, error) {
|
||||
val, found, err := nestedFieldNoCopy(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return nil, found, err
|
||||
}
|
||||
m, ok := val.(map[string]interface{})
|
||||
return m, ok
|
||||
if !ok {
|
||||
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected map[string]interface{}", jsonPath(fields), val, val)
|
||||
}
|
||||
return m, true, nil
|
||||
}
|
||||
|
||||
// SetNestedField sets the value of a nested field to a deep copy of the value provided.
|
||||
// Returns false if value cannot be set because one of the nesting levels is not a map[string]interface{}.
|
||||
func SetNestedField(obj map[string]interface{}, value interface{}, fields ...string) bool {
|
||||
// Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.
|
||||
func SetNestedField(obj map[string]interface{}, value interface{}, fields ...string) error {
|
||||
return setNestedFieldNoCopy(obj, runtime.DeepCopyJSONValue(value), fields...)
|
||||
}
|
||||
|
||||
func setNestedFieldNoCopy(obj map[string]interface{}, value interface{}, fields ...string) bool {
|
||||
func setNestedFieldNoCopy(obj map[string]interface{}, value interface{}, fields ...string) error {
|
||||
m := obj
|
||||
for _, field := range fields[:len(fields)-1] {
|
||||
|
||||
for i, field := range fields[:len(fields)-1] {
|
||||
if val, ok := m[field]; ok {
|
||||
if valMap, ok := val.(map[string]interface{}); ok {
|
||||
m = valMap
|
||||
} else {
|
||||
return false
|
||||
return fmt.Errorf("value cannot be set because %v is not a map[string]interface{}", jsonPath(fields[:i+1]))
|
||||
}
|
||||
} else {
|
||||
newVal := make(map[string]interface{})
|
||||
|
@ -196,12 +214,12 @@ func setNestedFieldNoCopy(obj map[string]interface{}, value interface{}, fields
|
|||
}
|
||||
}
|
||||
m[fields[len(fields)-1]] = value
|
||||
return true
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetNestedStringSlice sets the string slice value of a nested field.
|
||||
// Returns false if value cannot be set because one of the nesting levels is not a map[string]interface{}.
|
||||
func SetNestedStringSlice(obj map[string]interface{}, value []string, fields ...string) bool {
|
||||
// Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.
|
||||
func SetNestedStringSlice(obj map[string]interface{}, value []string, fields ...string) error {
|
||||
m := make([]interface{}, 0, len(value)) // convert []string into []interface{}
|
||||
for _, v := range value {
|
||||
m = append(m, v)
|
||||
|
@ -210,14 +228,14 @@ func SetNestedStringSlice(obj map[string]interface{}, value []string, fields ...
|
|||
}
|
||||
|
||||
// SetNestedSlice sets the slice value of a nested field.
|
||||
// Returns false if value cannot be set because one of the nesting levels is not a map[string]interface{}.
|
||||
func SetNestedSlice(obj map[string]interface{}, value []interface{}, fields ...string) bool {
|
||||
// Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.
|
||||
func SetNestedSlice(obj map[string]interface{}, value []interface{}, fields ...string) error {
|
||||
return SetNestedField(obj, value, fields...)
|
||||
}
|
||||
|
||||
// SetNestedStringMap sets the map[string]string value of a nested field.
|
||||
// Returns false if value cannot be set because one of the nesting levels is not a map[string]interface{}.
|
||||
func SetNestedStringMap(obj map[string]interface{}, value map[string]string, fields ...string) bool {
|
||||
// Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.
|
||||
func SetNestedStringMap(obj map[string]interface{}, value map[string]string, fields ...string) error {
|
||||
m := make(map[string]interface{}, len(value)) // convert map[string]string into map[string]interface{}
|
||||
for k, v := range value {
|
||||
m[k] = v
|
||||
|
@ -226,8 +244,8 @@ func SetNestedStringMap(obj map[string]interface{}, value map[string]string, fie
|
|||
}
|
||||
|
||||
// SetNestedMap sets the map[string]interface{} value of a nested field.
|
||||
// Returns false if value cannot be set because one of the nesting levels is not a map[string]interface{}.
|
||||
func SetNestedMap(obj map[string]interface{}, value map[string]interface{}, fields ...string) bool {
|
||||
// Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.
|
||||
func SetNestedMap(obj map[string]interface{}, value map[string]interface{}, fields ...string) error {
|
||||
return SetNestedField(obj, value, fields...)
|
||||
}
|
||||
|
||||
|
@ -245,22 +263,26 @@ func RemoveNestedField(obj map[string]interface{}, fields ...string) {
|
|||
}
|
||||
|
||||
func getNestedString(obj map[string]interface{}, fields ...string) string {
|
||||
val, ok := NestedString(obj, fields...)
|
||||
if !ok {
|
||||
val, found, err := NestedString(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return ""
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
func jsonPath(fields []string) string {
|
||||
return "." + strings.Join(fields, ".")
|
||||
}
|
||||
|
||||
func extractOwnerReference(v map[string]interface{}) metav1.OwnerReference {
|
||||
// though this field is a *bool, but when decoded from JSON, it's
|
||||
// unmarshalled as bool.
|
||||
var controllerPtr *bool
|
||||
if controller, ok := NestedBool(v, "controller"); ok {
|
||||
if controller, found, err := NestedBool(v, "controller"); err == nil && found {
|
||||
controllerPtr = &controller
|
||||
}
|
||||
var blockOwnerDeletionPtr *bool
|
||||
if blockOwnerDeletion, ok := NestedBool(v, "blockOwnerDeletion"); ok {
|
||||
if blockOwnerDeletion, found, err := NestedBool(v, "blockOwnerDeletion"); err == nil && found {
|
||||
blockOwnerDeletionPtr = &blockOwnerDeletion
|
||||
}
|
||||
return metav1.OwnerReference{
|
||||
|
|
22
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
generated
vendored
22
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
generated
vendored
|
@ -138,8 +138,8 @@ func (u *Unstructured) setNestedMap(value map[string]string, fields ...string) {
|
|||
}
|
||||
|
||||
func (u *Unstructured) GetOwnerReferences() []metav1.OwnerReference {
|
||||
field, ok := nestedFieldNoCopy(u.Object, "metadata", "ownerReferences")
|
||||
if !ok {
|
||||
field, found, err := nestedFieldNoCopy(u.Object, "metadata", "ownerReferences")
|
||||
if !found || err != nil {
|
||||
return nil
|
||||
}
|
||||
original, ok := field.([]interface{})
|
||||
|
@ -228,8 +228,8 @@ func (u *Unstructured) SetResourceVersion(version string) {
|
|||
}
|
||||
|
||||
func (u *Unstructured) GetGeneration() int64 {
|
||||
val, ok := NestedInt64(u.Object, "metadata", "generation")
|
||||
if !ok {
|
||||
val, found, err := NestedInt64(u.Object, "metadata", "generation")
|
||||
if !found || err != nil {
|
||||
return 0
|
||||
}
|
||||
return val
|
||||
|
@ -289,8 +289,8 @@ func (u *Unstructured) SetDeletionTimestamp(timestamp *metav1.Time) {
|
|||
}
|
||||
|
||||
func (u *Unstructured) GetDeletionGracePeriodSeconds() *int64 {
|
||||
val, ok := NestedInt64(u.Object, "metadata", "deletionGracePeriodSeconds")
|
||||
if !ok {
|
||||
val, found, err := NestedInt64(u.Object, "metadata", "deletionGracePeriodSeconds")
|
||||
if !found || err != nil {
|
||||
return nil
|
||||
}
|
||||
return &val
|
||||
|
@ -305,7 +305,7 @@ func (u *Unstructured) SetDeletionGracePeriodSeconds(deletionGracePeriodSeconds
|
|||
}
|
||||
|
||||
func (u *Unstructured) GetLabels() map[string]string {
|
||||
m, _ := NestedStringMap(u.Object, "metadata", "labels")
|
||||
m, _, _ := NestedStringMap(u.Object, "metadata", "labels")
|
||||
return m
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@ func (u *Unstructured) SetLabels(labels map[string]string) {
|
|||
}
|
||||
|
||||
func (u *Unstructured) GetAnnotations() map[string]string {
|
||||
m, _ := NestedStringMap(u.Object, "metadata", "annotations")
|
||||
m, _, _ := NestedStringMap(u.Object, "metadata", "annotations")
|
||||
return m
|
||||
}
|
||||
|
||||
|
@ -337,8 +337,8 @@ func (u *Unstructured) GroupVersionKind() schema.GroupVersionKind {
|
|||
}
|
||||
|
||||
func (u *Unstructured) GetInitializers() *metav1.Initializers {
|
||||
m, ok := nestedMapNoCopy(u.Object, "metadata", "initializers")
|
||||
if !ok {
|
||||
m, found, err := nestedMapNoCopy(u.Object, "metadata", "initializers")
|
||||
if !found || err != nil {
|
||||
return nil
|
||||
}
|
||||
out := &metav1.Initializers{}
|
||||
|
@ -362,7 +362,7 @@ func (u *Unstructured) SetInitializers(initializers *metav1.Initializers) {
|
|||
}
|
||||
|
||||
func (u *Unstructured) GetFinalizers() []string {
|
||||
val, _ := NestedStringSlice(u.Object, "metadata", "finalizers")
|
||||
val, _, _ := NestedStringSlice(u.Object, "metadata", "finalizers")
|
||||
return val
|
||||
}
|
||||
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
|
@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import "k8s.io/apimachinery/pkg/conversion"
|
||||
|
||||
// Convert_Slice_string_To_v1alpha1_IncludeObjectPolicy allows converting a URL query parameter value
|
||||
func Convert_Slice_string_To_v1alpha1_IncludeObjectPolicy(input *[]string, out *IncludeObjectPolicy, s conversion.Scope) error {
|
||||
// Convert_Slice_string_To_v1beta1_IncludeObjectPolicy allows converting a URL query parameter value
|
||||
func Convert_Slice_string_To_v1beta1_IncludeObjectPolicy(input *[]string, out *IncludeObjectPolicy, s conversion.Scope) error {
|
||||
if len(*input) > 0 {
|
||||
*out = IncludeObjectPolicy((*input)[0])
|
||||
}
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
func (in *TableRow) DeepCopy() *TableRow {
|
||||
if in == nil {
|
|
@ -19,4 +19,4 @@ limitations under the License.
|
|||
// +k8s:defaulter-gen=TypeMeta
|
||||
|
||||
// +groupName=meta.k8s.io
|
||||
package v1alpha1
|
||||
package v1beta1
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
@ -15,21 +15,21 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
// Code generated by protoc-gen-gogo.
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1/generated.proto
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package v1alpha1 is a generated protocol buffer package.
|
||||
Package v1beta1 is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1/generated.proto
|
||||
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
PartialObjectMetadata
|
||||
PartialObjectMetadataList
|
||||
TableOptions
|
||||
*/
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
|
@ -66,9 +66,9 @@ func (*TableOptions) ProtoMessage() {}
|
|||
func (*TableOptions) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*PartialObjectMetadata)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1alpha1.PartialObjectMetadata")
|
||||
proto.RegisterType((*PartialObjectMetadataList)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1alpha1.PartialObjectMetadataList")
|
||||
proto.RegisterType((*TableOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1alpha1.TableOptions")
|
||||
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()
|
||||
|
@ -600,34 +600,34 @@ var (
|
|||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1/generated.proto", fileDescriptorGenerated)
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 392 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xbf, 0x6e, 0xd4, 0x40,
|
||||
0x10, 0x87, 0xbd, 0x42, 0x91, 0x92, 0x0d, 0x69, 0x8c, 0x90, 0xc2, 0x15, 0xeb, 0xe8, 0xaa, 0x08,
|
||||
0xc1, 0x2e, 0x09, 0x08, 0xd1, 0xe2, 0x2e, 0x12, 0x28, 0x91, 0xa1, 0xa2, 0x62, 0x6d, 0x0f, 0xf6,
|
||||
0x62, 0x7b, 0xd7, 0xda, 0x1d, 0x47, 0xba, 0x0a, 0x1e, 0x81, 0xc7, 0xba, 0x32, 0x65, 0x2a, 0x8b,
|
||||
0x33, 0x6f, 0x41, 0x85, 0x6c, 0x5f, 0xc8, 0xbf, 0x3b, 0xe5, 0xba, 0x99, 0xdf, 0xe8, 0xfb, 0x3c,
|
||||
0xe3, 0xa5, 0x9f, 0x8a, 0x77, 0x8e, 0x2b, 0x23, 0x8a, 0x26, 0x06, 0xab, 0x01, 0xc1, 0x89, 0x73,
|
||||
0xd0, 0xa9, 0xb1, 0x62, 0x39, 0x90, 0xb5, 0xaa, 0x64, 0x92, 0x2b, 0x0d, 0x76, 0x26, 0xea, 0x22,
|
||||
0xeb, 0x03, 0x27, 0x2a, 0x40, 0x29, 0xce, 0x8f, 0x64, 0x59, 0xe7, 0xf2, 0x48, 0x64, 0xa0, 0xc1,
|
||||
0x4a, 0x84, 0x94, 0xd7, 0xd6, 0xa0, 0xf1, 0x9f, 0x8f, 0x2c, 0xbf, 0xc9, 0xf2, 0xba, 0xc8, 0xfa,
|
||||
0xc0, 0xf1, 0x9e, 0xe5, 0x57, 0xec, 0xe4, 0x65, 0xa6, 0x30, 0x6f, 0x62, 0x9e, 0x98, 0x4a, 0x64,
|
||||
0x26, 0x33, 0x62, 0x50, 0xc4, 0xcd, 0xb7, 0xa1, 0x1b, 0x9a, 0xa1, 0x1a, 0xd5, 0x93, 0x37, 0x9b,
|
||||
0xac, 0x75, 0x77, 0xa1, 0xc9, 0xda, 0x63, 0x6c, 0xa3, 0x51, 0x55, 0x70, 0x0f, 0x78, 0xfb, 0x10,
|
||||
0xe0, 0x92, 0x1c, 0x2a, 0x79, 0x8f, 0x7b, 0xbd, 0x8e, 0x6b, 0x50, 0x95, 0x42, 0x69, 0x74, 0x68,
|
||||
0xef, 0x42, 0xd3, 0x19, 0x7d, 0x7a, 0x26, 0x2d, 0x2a, 0x59, 0x9e, 0xc6, 0xdf, 0x21, 0xc1, 0x8f,
|
||||
0x80, 0x32, 0x95, 0x28, 0xfd, 0xaf, 0x74, 0xbb, 0x5a, 0xd6, 0xfb, 0xe4, 0x80, 0x1c, 0xee, 0x1e,
|
||||
0xbf, 0xe2, 0x9b, 0xfc, 0x5a, 0x7e, 0xed, 0x09, 0xfd, 0x79, 0x1b, 0x78, 0x5d, 0x1b, 0xd0, 0xeb,
|
||||
0x2c, 0xfa, 0x6f, 0x9d, 0xfe, 0xa0, 0xcf, 0x56, 0x7e, 0xfa, 0x83, 0x72, 0xe8, 0xc7, 0x74, 0x4b,
|
||||
0x21, 0x54, 0x6e, 0x9f, 0x1c, 0x3c, 0x3a, 0xdc, 0x3d, 0x7e, 0xcf, 0x37, 0x7f, 0x56, 0xbe, 0xd2,
|
||||
0x1a, 0xee, 0x74, 0x6d, 0xb0, 0x75, 0xd2, 0x3b, 0xa3, 0x51, 0x3d, 0x8d, 0xe9, 0xe3, 0xcf, 0x32,
|
||||
0x2e, 0xe1, 0xb4, 0x46, 0x65, 0xb4, 0xf3, 0x23, 0xba, 0xa7, 0x74, 0x52, 0x36, 0x29, 0x8c, 0xe8,
|
||||
0x70, 0xf7, 0x4e, 0xf8, 0x62, 0x79, 0xc5, 0xde, 0xc9, 0xcd, 0xe1, 0xdf, 0x36, 0x78, 0x72, 0x2b,
|
||||
0x38, 0x33, 0xa5, 0x4a, 0x66, 0xd1, 0x6d, 0x45, 0xc8, 0xe7, 0x0b, 0xe6, 0x5d, 0x2c, 0x98, 0x77,
|
||||
0xb9, 0x60, 0xde, 0xcf, 0x8e, 0x91, 0x79, 0xc7, 0xc8, 0x45, 0xc7, 0xc8, 0x65, 0xc7, 0xc8, 0xef,
|
||||
0x8e, 0x91, 0x5f, 0x7f, 0x98, 0xf7, 0x65, 0xfb, 0x6a, 0xf7, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff,
|
||||
0x97, 0x95, 0xbb, 0xf9, 0x14, 0x03, 0x00, 0x00,
|
||||
// 391 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xbd, 0x6e, 0xd4, 0x40,
|
||||
0x10, 0xc7, 0xbd, 0x42, 0x11, 0x64, 0x43, 0x1a, 0x23, 0xa4, 0x70, 0xc5, 0x3a, 0xba, 0x2a, 0x48,
|
||||
0x64, 0x97, 0x04, 0x84, 0x28, 0x91, 0xbb, 0x48, 0xa0, 0x44, 0x16, 0x15, 0x15, 0x6b, 0x7b, 0xf0,
|
||||
0x2d, 0xb6, 0x77, 0xad, 0xdd, 0x71, 0xa4, 0x6b, 0x10, 0x8f, 0xc0, 0x63, 0x5d, 0x99, 0x32, 0x95,
|
||||
0xc5, 0x99, 0xb7, 0xa0, 0x42, 0xfe, 0x10, 0xf9, 0xb8, 0x3b, 0xe5, 0xba, 0x99, 0xff, 0xe8, 0xf7,
|
||||
0xf3, 0x8c, 0x97, 0x46, 0xf9, 0x7b, 0xc7, 0x95, 0x11, 0x79, 0x1d, 0x83, 0xd5, 0x80, 0xe0, 0xc4,
|
||||
0x25, 0xe8, 0xd4, 0x58, 0x31, 0x0e, 0x64, 0xa5, 0x4a, 0x99, 0xcc, 0x94, 0x06, 0x3b, 0x17, 0x55,
|
||||
0x9e, 0x75, 0x81, 0x13, 0x25, 0xa0, 0x14, 0x97, 0x27, 0x31, 0xa0, 0x3c, 0x11, 0x19, 0x68, 0xb0,
|
||||
0x12, 0x21, 0xe5, 0x95, 0x35, 0x68, 0xfc, 0x97, 0x03, 0xca, 0x6f, 0xa3, 0xbc, 0xca, 0xb3, 0x2e,
|
||||
0x70, 0xbc, 0x43, 0xf9, 0x88, 0x4e, 0x8e, 0x33, 0x85, 0xb3, 0x3a, 0xe6, 0x89, 0x29, 0x45, 0x66,
|
||||
0x32, 0x23, 0x7a, 0x43, 0x5c, 0x7f, 0xeb, 0xbb, 0xbe, 0xe9, 0xab, 0xc1, 0x3c, 0x79, 0xbb, 0xcd,
|
||||
0x52, 0xf7, 0xf7, 0x99, 0x6c, 0x3c, 0xc5, 0xd6, 0x1a, 0x55, 0x09, 0x2b, 0xc0, 0xbb, 0x87, 0x00,
|
||||
0x97, 0xcc, 0xa0, 0x94, 0x2b, 0xdc, 0x9b, 0x4d, 0x5c, 0x8d, 0xaa, 0x10, 0x4a, 0xa3, 0x43, 0x7b,
|
||||
0x1f, 0x9a, 0xce, 0xe9, 0xf3, 0x0b, 0x69, 0x51, 0xc9, 0xe2, 0x3c, 0xfe, 0x0e, 0x09, 0x7e, 0x02,
|
||||
0x94, 0xa9, 0x44, 0xe9, 0x7f, 0xa5, 0x4f, 0xca, 0xb1, 0x3e, 0x20, 0x87, 0xe4, 0x68, 0xef, 0xf4,
|
||||
0x35, 0xdf, 0xe6, 0xcf, 0xf2, 0x1b, 0x4f, 0xe8, 0x2f, 0x9a, 0xc0, 0x6b, 0x9b, 0x80, 0xde, 0x64,
|
||||
0xd1, 0x7f, 0xeb, 0xf4, 0x07, 0x7d, 0xb1, 0xf6, 0xd3, 0x1f, 0x95, 0x43, 0x5f, 0xd2, 0x1d, 0x85,
|
||||
0x50, 0xba, 0x03, 0x72, 0xf8, 0xe8, 0x68, 0xef, 0xf4, 0x03, 0xdf, 0xfa, 0x55, 0xf9, 0x5a, 0x69,
|
||||
0xb8, 0xdb, 0x36, 0xc1, 0xce, 0x59, 0xa7, 0x8c, 0x06, 0xf3, 0x34, 0xa6, 0x4f, 0x3f, 0xcb, 0xb8,
|
||||
0x80, 0xf3, 0x0a, 0x95, 0xd1, 0xce, 0x8f, 0xe8, 0xbe, 0xd2, 0x49, 0x51, 0xa7, 0x30, 0xa0, 0xfd,
|
||||
0xd9, 0xbb, 0xe1, 0xab, 0xf1, 0x88, 0xfd, 0xb3, 0xdb, 0xc3, 0xbf, 0x4d, 0xf0, 0xec, 0x4e, 0x70,
|
||||
0x61, 0x0a, 0x95, 0xcc, 0xa3, 0xbb, 0x8a, 0xf0, 0x78, 0xb1, 0x64, 0xde, 0xd5, 0x92, 0x79, 0xd7,
|
||||
0x4b, 0xe6, 0xfd, 0x6c, 0x19, 0x59, 0xb4, 0x8c, 0x5c, 0xb5, 0x8c, 0x5c, 0xb7, 0x8c, 0xfc, 0x6e,
|
||||
0x19, 0xf9, 0xf5, 0x87, 0x79, 0x5f, 0x1e, 0x8f, 0xab, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x73,
|
||||
0xdf, 0x3a, 0x0c, 0x10, 0x03, 0x00, 0x00,
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
@ -19,7 +19,7 @@ limitations under the License.
|
|||
|
||||
syntax = 'proto2';
|
||||
|
||||
package k8s.io.apimachinery.pkg.apis.meta.v1alpha1;
|
||||
package k8s.io.apimachinery.pkg.apis.meta.v1beta1;
|
||||
|
||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||
|
@ -27,7 +27,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
|||
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
|
||||
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1alpha1";
|
||||
option go_package = "v1beta1";
|
||||
|
||||
// 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.
|
||||
|
@ -52,7 +52,7 @@ message TableOptions {
|
|||
// 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 v1alpha1 of the meta.k8s.io API group.
|
||||
// in version v1beta1 of the meta.k8s.io API group.
|
||||
optional string includeObject = 1;
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
@ -25,17 +25,17 @@ import (
|
|||
const GroupName = "meta.k8s.io"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
|
||||
|
||||
// Kind takes an unqualified kind and returns a Group qualified GroupKind
|
||||
func Kind(kind string) schema.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// scheme is the registry for the common types that adhere to the meta v1alpha1 API spec.
|
||||
// scheme is the registry for the common types that adhere to the meta v1beta1 API spec.
|
||||
var scheme = runtime.NewScheme()
|
||||
|
||||
// ParameterCodec knows about query parameters used with the meta v1alpha1 API spec.
|
||||
// ParameterCodec knows about query parameters used with the meta v1beta1 API spec.
|
||||
var ParameterCodec = runtime.NewParameterCodec(scheme)
|
||||
|
||||
func init() {
|
||||
|
@ -47,7 +47,7 @@ func init() {
|
|||
)
|
||||
|
||||
if err := scheme.AddConversionFuncs(
|
||||
Convert_Slice_string_To_v1alpha1_IncludeObjectPolicy,
|
||||
Convert_Slice_string_To_v1beta1_IncludeObjectPolicy,
|
||||
); err != nil {
|
||||
panic(err)
|
||||
}
|
|
@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// package v1alpha1 is alpha objects from meta that will be introduced.
|
||||
package v1alpha1
|
||||
// package v1beta1 is alpha objects from meta that will be introduced.
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -136,7 +136,7 @@ type TableOptions struct {
|
|||
// 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 v1alpha1 of the meta.k8s.io API group.
|
||||
// in version v1beta1 of the meta.k8s.io API group.
|
||||
IncludeObject IncludeObjectPolicy `json:"includeObject,omitempty" protobuf:"bytes,1,opt,name=includeObject,casttype=IncludeObjectPolicy"`
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
// This file contains a collection of methods that can be used from go-restful to
|
||||
// generate Swagger API documentation for its models. Please read this PR for more
|
||||
|
@ -71,7 +71,7 @@ func (TableColumnDefinition) SwaggerDoc() map[string]string {
|
|||
|
||||
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 v1alpha1 of the meta.k8s.io API group.",
|
||||
"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 {
|
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||
|
||||
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||
|
||||
// This file was autogenerated by defaulter-gen. Do not edit it manually!
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
2
vendor/k8s.io/apimachinery/pkg/fields/selector.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/fields/selector.go
generated
vendored
|
@ -396,7 +396,7 @@ const (
|
|||
var termOperators = []string{notEqualOperator, doubleEqualOperator, equalOperator}
|
||||
|
||||
// splitTerm returns the lhs, operator, and rhs parsed from the given term, along with an indicator of whether the parse was successful.
|
||||
// no escaping of special characters is supported in the lhs value, so the first occurance of a recognized operator is used as the split point.
|
||||
// no escaping of special characters is supported in the lhs value, so the first occurrence of a recognized operator is used as the split point.
|
||||
// the literal rhs is returned, and the caller is responsible for applying any desired unescaping.
|
||||
func splitTerm(term string) (lhs, op, rhs string, ok bool) {
|
||||
for i := range term {
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/runtime/codec.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/codec.go
generated
vendored
|
@ -281,7 +281,7 @@ func (disabledGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersi
|
|||
// GroupVersioners implements GroupVersioner and resolves to the first exact match for any kind.
|
||||
type GroupVersioners []GroupVersioner
|
||||
|
||||
// KindForGroupVersionKinds returns the first match of any of the group versioners, or false if no match occured.
|
||||
// KindForGroupVersionKinds returns the first match of any of the group versioners, or false if no match occurred.
|
||||
func (gvs GroupVersioners) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) {
|
||||
for _, gv := range gvs {
|
||||
target, ok := gv.KindForGroupVersionKinds(kinds)
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
58
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
generated
vendored
58
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
generated
vendored
|
@ -98,11 +98,29 @@ func init() {
|
|||
jsoniter.RegisterTypeDecoderFunc("interface {}", decodeNumberAsInt64IfPossible)
|
||||
}
|
||||
|
||||
// gvkWithDefaults returns group kind and version defaulting from provided default
|
||||
func gvkWithDefaults(actual, defaultGVK schema.GroupVersionKind) schema.GroupVersionKind {
|
||||
if len(actual.Kind) == 0 {
|
||||
actual.Kind = defaultGVK.Kind
|
||||
}
|
||||
if len(actual.Version) == 0 && len(actual.Group) == 0 {
|
||||
actual.Group = defaultGVK.Group
|
||||
actual.Version = defaultGVK.Version
|
||||
}
|
||||
if len(actual.Version) == 0 && actual.Group == defaultGVK.Group {
|
||||
actual.Version = defaultGVK.Version
|
||||
}
|
||||
return actual
|
||||
}
|
||||
|
||||
// Decode attempts to convert the provided data into YAML or JSON, extract the stored schema kind, apply the provided default gvk, and then
|
||||
// load that data into an object matching the desired schema kind or the provided into. If into is *runtime.Unknown, the raw data will be
|
||||
// extracted and no decoding will be performed. If into is not registered with the typer, then the object will be straight decoded using
|
||||
// normal JSON/YAML unmarshalling. If into is provided and the original data is not fully qualified with kind/version/group, the type of
|
||||
// the into will be used to alter the returned gvk. On success or most errors, the method will return the calculated schema kind.
|
||||
// load that data into an object matching the desired schema kind or the provided into.
|
||||
// If into is *runtime.Unknown, the raw data will be extracted and no decoding will be performed.
|
||||
// If into is not registered with the typer, then the object will be straight decoded using normal JSON/YAML unmarshalling.
|
||||
// If into is provided and the original data is not fully qualified with kind/version/group, the type of the into will be used to alter the returned gvk.
|
||||
// If into is nil or data's gvk different from into's gvk, it will generate a new Object with ObjectCreater.New(gvk)
|
||||
// On success or most errors, the method will return the calculated schema kind.
|
||||
// The gvk calculate priority will be originalData > default gvk > into
|
||||
func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
|
||||
if versioned, ok := into.(*runtime.VersionedObjects); ok {
|
||||
into = versioned.Last()
|
||||
|
@ -129,17 +147,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
|||
}
|
||||
|
||||
if gvk != nil {
|
||||
// apply kind and version defaulting from provided default
|
||||
if len(actual.Kind) == 0 {
|
||||
actual.Kind = gvk.Kind
|
||||
}
|
||||
if len(actual.Version) == 0 && len(actual.Group) == 0 {
|
||||
actual.Group = gvk.Group
|
||||
actual.Version = gvk.Version
|
||||
}
|
||||
if len(actual.Version) == 0 && actual.Group == gvk.Group {
|
||||
actual.Version = gvk.Version
|
||||
}
|
||||
*actual = gvkWithDefaults(*actual, *gvk)
|
||||
}
|
||||
|
||||
if unk, ok := into.(*runtime.Unknown); ok && unk != nil {
|
||||
|
@ -154,24 +162,14 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
|||
types, _, err := s.typer.ObjectKinds(into)
|
||||
switch {
|
||||
case runtime.IsNotRegisteredError(err), isUnstructured:
|
||||
if err := jsoniter.ConfigFastest.Unmarshal(data, into); err != nil {
|
||||
if err := jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(data, into); err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
return into, actual, nil
|
||||
case err != nil:
|
||||
return nil, actual, err
|
||||
default:
|
||||
typed := types[0]
|
||||
if len(actual.Kind) == 0 {
|
||||
actual.Kind = typed.Kind
|
||||
}
|
||||
if len(actual.Version) == 0 && len(actual.Group) == 0 {
|
||||
actual.Group = typed.Group
|
||||
actual.Version = typed.Version
|
||||
}
|
||||
if len(actual.Version) == 0 && actual.Group == typed.Group {
|
||||
actual.Version = typed.Version
|
||||
}
|
||||
*actual = gvkWithDefaults(*actual, types[0])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +186,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
|||
return nil, actual, err
|
||||
}
|
||||
|
||||
if err := jsoniter.ConfigFastest.Unmarshal(data, obj); err != nil {
|
||||
if err := jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(data, obj); err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
return obj, actual, nil
|
||||
|
@ -197,7 +195,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
|||
// Encode serializes the provided object to the given writer.
|
||||
func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if s.yaml {
|
||||
json, err := jsoniter.ConfigFastest.Marshal(obj)
|
||||
json, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -210,7 +208,7 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
|||
}
|
||||
|
||||
if s.pretty {
|
||||
data, err := jsoniter.ConfigFastest.MarshalIndent(obj, "", " ")
|
||||
data, err := jsoniter.ConfigCompatibleWithStandardLibrary.MarshalIndent(obj, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/util/errors/errors.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/util/errors/errors.go
generated
vendored
|
@ -21,7 +21,7 @@ import (
|
|||
"fmt"
|
||||
)
|
||||
|
||||
// MessageCountMap contains occurance for each error message.
|
||||
// MessageCountMap contains occurrence for each error message.
|
||||
type MessageCountMap map[string]int
|
||||
|
||||
// Aggregate represents an object that contains multiple errors, but does not
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
22
vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
generated
vendored
22
vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
generated
vendored
|
@ -24,9 +24,6 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
openapi "k8s.io/kube-openapi/pkg/common"
|
||||
|
||||
"github.com/go-openapi/spec"
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/gofuzz"
|
||||
)
|
||||
|
@ -120,16 +117,15 @@ func (intstr IntOrString) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
}
|
||||
|
||||
func (_ IntOrString) OpenAPIDefinition() openapi.OpenAPIDefinition {
|
||||
return openapi.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"string"},
|
||||
Format: "int-or-string",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
// OpenAPISchemaType is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
//
|
||||
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
|
||||
func (_ IntOrString) OpenAPISchemaType() []string { return []string{"string"} }
|
||||
|
||||
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
func (_ IntOrString) OpenAPISchemaFormat() string { return "int-or-string" }
|
||||
|
||||
func (intstr *IntOrString) Fuzz(c fuzz.Continue) {
|
||||
if intstr == nil {
|
||||
|
|
14
vendor/k8s.io/apimachinery/pkg/util/net/util.go
generated
vendored
14
vendor/k8s.io/apimachinery/pkg/util/net/util.go
generated
vendored
|
@ -18,6 +18,8 @@ package net
|
|||
|
||||
import (
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"reflect"
|
||||
"syscall"
|
||||
)
|
||||
|
@ -38,8 +40,16 @@ func IPNetEqual(ipnet1, ipnet2 *net.IPNet) bool {
|
|||
|
||||
// Returns if the given err is "connection reset by peer" error.
|
||||
func IsConnectionReset(err error) bool {
|
||||
opErr, ok := err.(*net.OpError)
|
||||
if ok && opErr.Err.Error() == syscall.ECONNRESET.Error() {
|
||||
if urlErr, ok := err.(*url.Error); ok {
|
||||
err = urlErr.Err
|
||||
}
|
||||
if opErr, ok := err.(*net.OpError); ok {
|
||||
err = opErr.Err
|
||||
}
|
||||
if osErr, ok := err.(*os.SyscallError); ok {
|
||||
err = osErr.Err
|
||||
}
|
||||
if errno, ok := err.(syscall.Errno); ok && errno == syscall.ECONNRESET {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
generated
vendored
|
@ -43,7 +43,7 @@ var PanicHandlers = []func(interface{}){logPanic}
|
|||
// TODO: remove this function. We are switching to a world where it's safe for
|
||||
// apiserver to panic, since it will be restarted by kubelet. At the beginning
|
||||
// of the Kubernetes project, nothing was going to restart apiserver and so
|
||||
// catching panics was important. But it's actually much simpler for montoring
|
||||
// catching panics was important. But it's actually much simpler for monitoring
|
||||
// software if we just exit when an unexpected panic happens.
|
||||
func HandleCrash(additionalHandlers ...func(interface{})) {
|
||||
if r := recover(); r != nil {
|
||||
|
|
28
vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go
generated
vendored
28
vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go
generated
vendored
|
@ -423,7 +423,7 @@ func normalizeElementOrder(patch, serverOnly, patchOrder, serverOrder []interfac
|
|||
// scan from the place of last insertion in `right` to the end of `right`,
|
||||
// the place is before the first item that is greater than the item we want to insert.
|
||||
// example usage: using server-only items as left and patch items as right. We insert server-only items
|
||||
// to patch list. We use the order of live object as record for comparision.
|
||||
// to patch list. We use the order of live object as record for comparison.
|
||||
func mergeSortedSlice(left, right, serverOrder []interface{}, mergeKey string, kind reflect.Kind) []interface{} {
|
||||
// Returns if l is less than r, and if both have been found.
|
||||
// If l and r both present and l is in front of r, l is less than r.
|
||||
|
@ -1322,23 +1322,23 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
|
|||
// If they're both maps or lists, recurse into the value.
|
||||
switch originalType.Kind() {
|
||||
case reflect.Map:
|
||||
subschema, patchMeta, err := schema.LookupPatchMetadataForStruct(k)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
subschema, patchMeta, err2 := schema.LookupPatchMetadataForStruct(k)
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
_, patchStrategy, err := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
_, patchStrategy, err2 := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
original[k], err = mergeMapHandler(original[k], patchV, subschema, patchStrategy, mergeOptions)
|
||||
case reflect.Slice:
|
||||
subschema, patchMeta, err := schema.LookupPatchMetadataForSlice(k)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
subschema, patchMeta, err2 := schema.LookupPatchMetadataForSlice(k)
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
_, patchStrategy, err := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
_, patchStrategy, err2 := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
original[k], err = mergeSliceHandler(original[k], patchV, subschema, patchStrategy, patchMeta.GetPatchMergeKey(), isDeleteList, mergeOptions)
|
||||
default:
|
||||
|
@ -2109,7 +2109,7 @@ func sliceTypeAssertion(original, patch interface{}) ([]interface{}, []interface
|
|||
}
|
||||
|
||||
// extractRetainKeysPatchStrategy process patch strategy, which is a string may contains multiple
|
||||
// patch strategies seperated by ",". It returns a boolean var indicating if it has
|
||||
// patch strategies separated by ",". It returns a boolean var indicating if it has
|
||||
// retainKeys strategies and a string for the other strategy.
|
||||
func extractRetainKeysPatchStrategy(strategies []string) (bool, string, error) {
|
||||
switch len(strategies) {
|
||||
|
|
6
vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go
generated
vendored
6
vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go
generated
vendored
|
@ -122,12 +122,12 @@ func (d *YAMLDecoder) Read(data []byte) (n int, err error) {
|
|||
if left <= len(data) {
|
||||
copy(data, d.remaining)
|
||||
d.remaining = nil
|
||||
return len(d.remaining), nil
|
||||
return left, nil
|
||||
}
|
||||
|
||||
// caller will need to reread
|
||||
copy(data, d.remaining[:left])
|
||||
d.remaining = d.remaining[left:]
|
||||
copy(data, d.remaining[:len(data)])
|
||||
d.remaining = d.remaining[len(data):]
|
||||
return len(data), io.ErrShortBuffer
|
||||
}
|
||||
|
||||
|
|
2
vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2018 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue