rebase: update kubernetes to v1.23.0

updating go dependency to latest kubernetes
released version i.e v1.23.0

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2021-12-08 19:20:47 +05:30
committed by mergify[bot]
parent 42403e2ba7
commit 5762da3e91
789 changed files with 49781 additions and 11501 deletions

View File

@ -44,6 +44,28 @@ type APIStatus interface {
var _ error = &StatusError{}
var knownReasons = map[metav1.StatusReason]struct{}{
// metav1.StatusReasonUnknown : {}
metav1.StatusReasonUnauthorized: {},
metav1.StatusReasonForbidden: {},
metav1.StatusReasonNotFound: {},
metav1.StatusReasonAlreadyExists: {},
metav1.StatusReasonConflict: {},
metav1.StatusReasonGone: {},
metav1.StatusReasonInvalid: {},
metav1.StatusReasonServerTimeout: {},
metav1.StatusReasonTimeout: {},
metav1.StatusReasonTooManyRequests: {},
metav1.StatusReasonBadRequest: {},
metav1.StatusReasonMethodNotAllowed: {},
metav1.StatusReasonNotAcceptable: {},
metav1.StatusReasonRequestEntityTooLarge: {},
metav1.StatusReasonUnsupportedMediaType: {},
metav1.StatusReasonInternalError: {},
metav1.StatusReasonExpired: {},
metav1.StatusReasonServiceUnavailable: {},
}
// Error implements the Error interface.
func (e *StatusError) Error() string {
return e.ErrStatus.Message
@ -148,6 +170,25 @@ func NewAlreadyExists(qualifiedResource schema.GroupResource, name string) *Stat
}}
}
// NewGenerateNameConflict returns an error indicating the server
// was not able to generate a valid name for a resource.
func NewGenerateNameConflict(qualifiedResource schema.GroupResource, name string, retryAfterSeconds int) *StatusError {
return &StatusError{metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusConflict,
Reason: metav1.StatusReasonAlreadyExists,
Details: &metav1.StatusDetails{
Group: qualifiedResource.Group,
Kind: qualifiedResource.Resource,
Name: name,
RetryAfterSeconds: int32(retryAfterSeconds),
},
Message: fmt.Sprintf(
"%s %q already exists, the server was not able to generate a unique name for the object",
qualifiedResource.String(), name),
}}
}
// NewUnauthorized returns an error indicating the client is not authorized to perform the requested
// action.
func NewUnauthorized(reason string) *StatusError {
@ -248,7 +289,7 @@ func NewInvalid(qualifiedKind schema.GroupKind, name string, errs field.ErrorLis
Field: err.Field,
})
}
return &StatusError{metav1.Status{
err := &StatusError{metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusUnprocessableEntity,
Reason: metav1.StatusReasonInvalid,
@ -258,8 +299,14 @@ func NewInvalid(qualifiedKind schema.GroupKind, name string, errs field.ErrorLis
Name: name,
Causes: causes,
},
Message: fmt.Sprintf("%s %q is invalid: %v", qualifiedKind.String(), name, errs.ToAggregate()),
}}
aggregatedErrs := errs.ToAggregate()
if aggregatedErrs == nil {
err.ErrStatus.Message = fmt.Sprintf("%s %q is invalid", qualifiedKind.String(), name)
} else {
err.ErrStatus.Message = fmt.Sprintf("%s %q is invalid: %v", qualifiedKind.String(), name, aggregatedErrs)
}
return err
}
// NewBadRequest creates an error that indicates that the request is invalid and can not be processed.
@ -478,7 +525,14 @@ func NewGenericServerResponse(code int, verb string, qualifiedResource schema.Gr
// IsNotFound returns true if the specified error was created by NewNotFound.
// It supports wrapped errors.
func IsNotFound(err error) bool {
return ReasonForError(err) == metav1.StatusReasonNotFound
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonNotFound {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusNotFound {
return true
}
return false
}
// IsAlreadyExists determines if the err is an error which indicates that a specified resource already exists.
@ -490,19 +544,40 @@ func IsAlreadyExists(err error) bool {
// IsConflict determines if the err is an error which indicates the provided update conflicts.
// It supports wrapped errors.
func IsConflict(err error) bool {
return ReasonForError(err) == metav1.StatusReasonConflict
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonConflict {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusConflict {
return true
}
return false
}
// IsInvalid determines if the err is an error which indicates the provided resource is not valid.
// It supports wrapped errors.
func IsInvalid(err error) bool {
return ReasonForError(err) == metav1.StatusReasonInvalid
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonInvalid {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusUnprocessableEntity {
return true
}
return false
}
// IsGone is true if the error indicates the requested resource is no longer available.
// It supports wrapped errors.
func IsGone(err error) bool {
return ReasonForError(err) == metav1.StatusReasonGone
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonGone {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusGone {
return true
}
return false
}
// IsResourceExpired is true if the error indicates the resource has expired and the current action is
@ -515,77 +590,147 @@ func IsResourceExpired(err error) bool {
// IsNotAcceptable determines if err is an error which indicates that the request failed due to an invalid Accept header
// It supports wrapped errors.
func IsNotAcceptable(err error) bool {
return ReasonForError(err) == metav1.StatusReasonNotAcceptable
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonNotAcceptable {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusNotAcceptable {
return true
}
return false
}
// IsUnsupportedMediaType determines if err is an error which indicates that the request failed due to an invalid Content-Type header
// It supports wrapped errors.
func IsUnsupportedMediaType(err error) bool {
return ReasonForError(err) == metav1.StatusReasonUnsupportedMediaType
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonUnsupportedMediaType {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusUnsupportedMediaType {
return true
}
return false
}
// 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.
// It supports wrapped errors.
func IsMethodNotSupported(err error) bool {
return ReasonForError(err) == metav1.StatusReasonMethodNotAllowed
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonMethodNotAllowed {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusMethodNotAllowed {
return true
}
return false
}
// IsServiceUnavailable is true if the error indicates the underlying service is no longer available.
// It supports wrapped errors.
func IsServiceUnavailable(err error) bool {
return ReasonForError(err) == metav1.StatusReasonServiceUnavailable
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonServiceUnavailable {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusServiceUnavailable {
return true
}
return false
}
// IsBadRequest determines if err is an error which indicates that the request is invalid.
// It supports wrapped errors.
func IsBadRequest(err error) bool {
return ReasonForError(err) == metav1.StatusReasonBadRequest
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonBadRequest {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusBadRequest {
return true
}
return false
}
// IsUnauthorized determines if err is an error which indicates that the request is unauthorized and
// requires authentication by the user.
// It supports wrapped errors.
func IsUnauthorized(err error) bool {
return ReasonForError(err) == metav1.StatusReasonUnauthorized
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonUnauthorized {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusUnauthorized {
return true
}
return false
}
// IsForbidden determines if err is an error which indicates that the request is forbidden and cannot
// be completed as requested.
// It supports wrapped errors.
func IsForbidden(err error) bool {
return ReasonForError(err) == metav1.StatusReasonForbidden
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonForbidden {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusForbidden {
return true
}
return false
}
// IsTimeout determines if err is an error which indicates that request times out due to long
// processing.
// It supports wrapped errors.
func IsTimeout(err error) bool {
return ReasonForError(err) == metav1.StatusReasonTimeout
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonTimeout {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusGatewayTimeout {
return true
}
return false
}
// IsServerTimeout determines if err is an error which indicates that the request needs to be retried
// by the client.
// It supports wrapped errors.
func IsServerTimeout(err error) bool {
// do not check the status code, because no https status code exists that can
// be scoped to retryable timeouts.
return ReasonForError(err) == metav1.StatusReasonServerTimeout
}
// IsInternalError determines if err is an error which indicates an internal server error.
// It supports wrapped errors.
func IsInternalError(err error) bool {
return ReasonForError(err) == metav1.StatusReasonInternalError
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonInternalError {
return true
}
if _, ok := knownReasons[reason]; !ok && code == http.StatusInternalServerError {
return true
}
return false
}
// IsTooManyRequests determines if err is an error which indicates that there are too many requests
// that the server cannot handle.
// It supports wrapped errors.
func IsTooManyRequests(err error) bool {
if ReasonForError(err) == metav1.StatusReasonTooManyRequests {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonTooManyRequests {
return true
}
if status := APIStatus(nil); errors.As(err, &status) {
return status.Status().Code == http.StatusTooManyRequests
// IsTooManyRequests' checking of code predates the checking of the code in
// the other Is* functions. In order to maintain backward compatibility, this
// does not check that the reason is unknown.
if code == http.StatusTooManyRequests {
return true
}
return false
}
@ -594,11 +739,16 @@ func IsTooManyRequests(err error) bool {
// the request entity is too large.
// It supports wrapped errors.
func IsRequestEntityTooLargeError(err error) bool {
if ReasonForError(err) == metav1.StatusReasonRequestEntityTooLarge {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonRequestEntityTooLarge {
return true
}
if status := APIStatus(nil); errors.As(err, &status) {
return status.Status().Code == http.StatusRequestEntityTooLarge
// IsRequestEntityTooLargeError's checking of code predates the checking of
// the code in the other Is* functions. In order to maintain backward
// compatibility, this does not check that the reason is unknown.
if code == http.StatusRequestEntityTooLarge {
return true
}
return false
}
@ -653,6 +803,13 @@ func ReasonForError(err error) metav1.StatusReason {
return metav1.StatusReasonUnknown
}
func reasonAndCodeForError(err error) (metav1.StatusReason, int32) {
if status := APIStatus(nil); errors.As(err, &status) {
return status.Status().Reason, status.Status().Code
}
return metav1.StatusReasonUnknown, 0
}
// 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.

View File

@ -23,6 +23,10 @@ import (
utilerrors "k8s.io/apimachinery/pkg/util/errors"
)
var (
_ ResettableRESTMapper = &FirstHitRESTMapper{}
)
// FirstHitRESTMapper is a wrapper for multiple RESTMappers which returns the
// first successful result for the singular requests
type FirstHitRESTMapper struct {
@ -75,6 +79,10 @@ func (m FirstHitRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string)
return nil, collapseAggregateErrors(errors)
}
func (m FirstHitRESTMapper) Reset() {
m.MultiRESTMapper.Reset()
}
// collapseAggregateErrors returns the minimal errors. it handles empty as nil, handles one item in a list
// by returning the item, and collapses all NoMatchErrors to a single one (since they should all be the same)
func collapseAggregateErrors(errors []error) error {

View File

@ -132,3 +132,12 @@ type RESTMapper interface {
ResourceSingularizer(resource string) (singular string, err error)
}
// ResettableRESTMapper is a RESTMapper which is capable of resetting itself
// from discovery.
// All rest mappers that delegate to other rest mappers must implement this interface and dynamically
// check if the delegate mapper supports the Reset() operation.
type ResettableRESTMapper interface {
RESTMapper
Reset()
}

View File

@ -32,7 +32,7 @@ type lazyObject struct {
mapper RESTMapper
}
// NewLazyObjectLoader handles unrecoverable errors when creating a RESTMapper / ObjectTyper by
// NewLazyRESTMapperLoader handles unrecoverable errors when creating a RESTMapper / ObjectTyper by
// returning those initialization errors when the interface methods are invoked. This defers the
// initialization and any server calls until a client actually needs to perform the action.
func NewLazyRESTMapperLoader(fn func() (RESTMapper, error)) RESTMapper {
@ -52,7 +52,7 @@ func (o *lazyObject) init() error {
return o.err
}
var _ RESTMapper = &lazyObject{}
var _ ResettableRESTMapper = &lazyObject{}
func (o *lazyObject) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) {
if err := o.init(); err != nil {
@ -102,3 +102,11 @@ func (o *lazyObject) ResourceSingularizer(resource string) (singular string, err
}
return o.mapper.ResourceSingularizer(resource)
}
func (o *lazyObject) Reset() {
o.lock.Lock()
defer o.lock.Unlock()
if o.loaded && o.err == nil {
MaybeResetRESTMapper(o.mapper)
}
}

View File

@ -24,11 +24,15 @@ import (
utilerrors "k8s.io/apimachinery/pkg/util/errors"
)
var (
_ ResettableRESTMapper = MultiRESTMapper{}
)
// MultiRESTMapper is a wrapper for multiple RESTMappers.
type MultiRESTMapper []RESTMapper
func (m MultiRESTMapper) String() string {
nested := []string{}
nested := make([]string, 0, len(m))
for _, t := range m {
currString := fmt.Sprintf("%v", t)
splitStrings := strings.Split(currString, "\n")
@ -208,3 +212,9 @@ func (m MultiRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) (
}
return allMappings, nil
}
func (m MultiRESTMapper) Reset() {
for _, t := range m {
MaybeResetRESTMapper(t)
}
}

View File

@ -29,6 +29,10 @@ const (
AnyKind = "*"
)
var (
_ ResettableRESTMapper = PriorityRESTMapper{}
)
// PriorityRESTMapper is a wrapper for automatically choosing a particular Resource or Kind
// when multiple matches are possible
type PriorityRESTMapper struct {
@ -220,3 +224,7 @@ func (m PriorityRESTMapper) ResourcesFor(partiallySpecifiedResource schema.Group
func (m PriorityRESTMapper) KindsFor(partiallySpecifiedResource schema.GroupVersionResource) (gvk []schema.GroupVersionKind, err error) {
return m.Delegate.KindsFor(partiallySpecifiedResource)
}
func (m PriorityRESTMapper) Reset() {
MaybeResetRESTMapper(m.Delegate)
}

View File

@ -519,3 +519,12 @@ func (m *DefaultRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string
}
return mappings, nil
}
// MaybeResetRESTMapper calls Reset() on the mapper if it is a ResettableRESTMapper.
func MaybeResetRESTMapper(mapper RESTMapper) bool {
m, ok := mapper.(ResettableRESTMapper)
if ok {
m.Reset()
}
return ok
}

View File

@ -61,8 +61,32 @@ func (m *Quantity) XXX_DiscardUnknown() {
var xxx_messageInfo_Quantity proto.InternalMessageInfo
func (m *QuantityValue) Reset() { *m = QuantityValue{} }
func (*QuantityValue) ProtoMessage() {}
func (*QuantityValue) Descriptor() ([]byte, []int) {
return fileDescriptor_612bba87bd70906c, []int{1}
}
func (m *QuantityValue) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QuantityValue.Unmarshal(m, b)
}
func (m *QuantityValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QuantityValue.Marshal(b, m, deterministic)
}
func (m *QuantityValue) XXX_Merge(src proto.Message) {
xxx_messageInfo_QuantityValue.Merge(m, src)
}
func (m *QuantityValue) XXX_Size() int {
return xxx_messageInfo_QuantityValue.Size(m)
}
func (m *QuantityValue) XXX_DiscardUnknown() {
xxx_messageInfo_QuantityValue.DiscardUnknown(m)
}
var xxx_messageInfo_QuantityValue proto.InternalMessageInfo
func init() {
proto.RegisterType((*Quantity)(nil), "k8s.io.apimachinery.pkg.api.resource.Quantity")
proto.RegisterType((*QuantityValue)(nil), "k8s.io.apimachinery.pkg.api.resource.QuantityValue")
}
func init() {
@ -70,20 +94,21 @@ func init() {
}
var fileDescriptor_612bba87bd70906c = []byte{
// 237 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x8e, 0xb1, 0x4e, 0xc3, 0x30,
0x10, 0x40, 0xcf, 0x0b, 0x2a, 0x19, 0x2b, 0x84, 0x10, 0xc3, 0xa5, 0x42, 0x0c, 0x2c, 0xd8, 0x6b,
0xc5, 0xc8, 0xce, 0x00, 0x23, 0x5b, 0x92, 0x1e, 0xae, 0x15, 0xd5, 0x8e, 0x2e, 0x36, 0x52, 0xb7,
0x8e, 0x8c, 0x1d, 0x19, 0x9b, 0xbf, 0xe9, 0xd8, 0xb1, 0x03, 0x03, 0x31, 0x3f, 0x82, 0xea, 0x36,
0x52, 0xb7, 0x7b, 0xef, 0xf4, 0x4e, 0x97, 0xbd, 0xd4, 0xd3, 0x56, 0x1a, 0xa7, 0xea, 0x50, 0x12,
0x5b, 0xf2, 0xd4, 0xaa, 0x4f, 0xb2, 0x33, 0xc7, 0xea, 0xb4, 0x28, 0x1a, 0xb3, 0x28, 0xaa, 0xb9,
0xb1, 0xc4, 0x4b, 0xd5, 0xd4, 0xfa, 0x20, 0x14, 0x53, 0xeb, 0x02, 0x57, 0xa4, 0x34, 0x59, 0xe2,
0xc2, 0xd3, 0x4c, 0x36, 0xec, 0xbc, 0x1b, 0xdf, 0x1f, 0x2b, 0x79, 0x5e, 0xc9, 0x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x53, 0xf3, 0x52, 0x8b, 0x12, 0x4b, 0x52, 0x53, 0xf4, 0x0a, 0x8a, 0xf2,
0x4b, 0xf2, 0x85, 0x54, 0x20, 0xba, 0xf4, 0x90, 0x75, 0xe9, 0x15, 0x64, 0xa7, 0x83, 0x04, 0xf4,
0x60, 0xba, 0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3,
0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0x9a, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x18,
0xaa, 0x64, 0xc1, 0xc5, 0x11, 0x58, 0x9a, 0x98, 0x57, 0x92, 0x59, 0x52, 0x29, 0x24, 0xc6, 0xc5,
0x56, 0x5c, 0x52, 0x94, 0x99, 0x97, 0x2e, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe5, 0x59,
0x89, 0xcc, 0x58, 0x20, 0xcf, 0xd0, 0xb1, 0x50, 0x9e, 0x61, 0xc2, 0x42, 0x79, 0x86, 0x05, 0x0b,
0xe5, 0x19, 0x1a, 0xee, 0x28, 0x30, 0x28, 0xd9, 0x72, 0xf1, 0xc2, 0x74, 0x86, 0x25, 0xe6, 0x94,
0xa6, 0x92, 0xa6, 0xdd, 0x49, 0xef, 0xc4, 0x43, 0x39, 0x86, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c,
0x94, 0x63, 0x68, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x37,
0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0x43, 0x14, 0x07, 0xcc, 0x5f,
0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x21, 0x76, 0x9f, 0x66, 0x4d, 0x01, 0x00, 0x00,
}

View File

@ -86,3 +86,15 @@ message Quantity {
optional string string = 1;
}
// QuantityValue makes it possible to use a Quantity as value for a command
// line parameter.
//
// +protobuf=true
// +protobuf.embed=string
// +protobuf.options.marshal=false
// +protobuf.options.(gogoproto.goproto_stringer)=false
// +k8s:deepcopy-gen=true
message QuantityValue {
optional string string = 1;
}

View File

@ -460,17 +460,7 @@ func (q *Quantity) AsApproximateFloat64() float64 {
return base
}
// multiply by the appropriate exponential scale
switch q.Format {
case DecimalExponent, DecimalSI:
return base * math.Pow10(exponent)
default:
// fast path for exponents that can fit in 64 bits
if exponent > 0 && exponent < 7 {
return base * float64(int64(1)<<(exponent*10))
}
return base * math.Pow(2, float64(exponent*10))
}
return base * math.Pow10(exponent)
}
// AsInt64 returns a representation of the current value as an int64 if a fast conversion
@ -774,3 +764,30 @@ func (q *Quantity) SetScaled(value int64, scale Scale) {
q.d.Dec = nil
q.i = int64Amount{value: value, scale: scale}
}
// QuantityValue makes it possible to use a Quantity as value for a command
// line parameter.
//
// +protobuf=true
// +protobuf.embed=string
// +protobuf.options.marshal=false
// +protobuf.options.(gogoproto.goproto_stringer)=false
// +k8s:deepcopy-gen=true
type QuantityValue struct {
Quantity
}
// Set implements pflag.Value.Set and Go flag.Value.Set.
func (q *QuantityValue) Set(s string) error {
quantity, err := ParseQuantity(s)
if err != nil {
return err
}
q.Quantity = quantity
return nil
}
// Type implements pflag.Value.Type.
func (q QuantityValue) Type() string {
return "quantity"
}

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
@ -25,3 +26,20 @@ func (in *Quantity) DeepCopyInto(out *Quantity) {
*out = in.DeepCopy()
return
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *QuantityValue) DeepCopyInto(out *QuantityValue) {
*out = *in
out.Quantity = in.Quantity.DeepCopy()
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QuantityValue.
func (in *QuantityValue) DeepCopy() *QuantityValue {
if in == nil {
return nil
}
out := new(QuantityValue)
in.DeepCopyInto(out)
return out
}

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*

View File

@ -1326,184 +1326,186 @@ func init() {
}
var fileDescriptor_cf52fa777ced5367 = []byte{
// 2829 bytes of a gzipped FileDescriptorProto
// 2859 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x3a, 0xcb, 0x6f, 0x24, 0x47,
0xf9, 0xee, 0x19, 0x8f, 0x3d, 0xf3, 0x8d, 0xc7, 0x8f, 0x5a, 0xef, 0xef, 0x37, 0x6b, 0x84, 0xc7,
0xe9, 0xa0, 0x68, 0x03, 0xc9, 0x38, 0x5e, 0x42, 0xb4, 0xd9, 0x90, 0x80, 0xc7, 0xb3, 0xde, 0x98,
0xac, 0x63, 0xab, 0xbc, 0xbb, 0x40, 0x88, 0x50, 0xda, 0xdd, 0xe5, 0x71, 0xe3, 0x9e, 0xee, 0x49,
0x55, 0x8f, 0x37, 0x03, 0x07, 0x72, 0x00, 0x01, 0x12, 0x44, 0xe1, 0xc6, 0x09, 0x25, 0x82, 0xbf,
0x80, 0x0b, 0xfc, 0x01, 0x48, 0xe4, 0x18, 0xc4, 0x25, 0x12, 0x68, 0x94, 0x98, 0x03, 0x47, 0xc4,
0xd5, 0x17, 0x50, 0x3d, 0xba, 0xbb, 0x7a, 0x1e, 0xeb, 0x9e, 0xec, 0x12, 0x71, 0x9b, 0xfe, 0xde,
0x55, 0xf5, 0xd5, 0xf7, 0xaa, 0x81, 0xdd, 0x93, 0xeb, 0xac, 0xee, 0x06, 0xeb, 0x27, 0xdd, 0x43,
0x42, 0x7d, 0x12, 0x12, 0xb6, 0x7e, 0x4a, 0x7c, 0x27, 0xa0, 0xeb, 0x0a, 0x61, 0x75, 0xdc, 0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 0x6d, 0x2f, 0xa8, 0x92, 0xd2, 0xb5, 0x57, 0x2e, 0x4b, 0xed,
0x25, 0x9e, 0x55, 0xef, 0x76, 0x9c, 0x87, 0x7c, 0x56, 0xcd, 0x3d, 0x4c, 0xe6, 0xcb, 0x4f, 0x98,
0xf9, 0xae, 0x81, 0xfc, 0xeb, 0x09, 0x4f, 0x32, 0xb2, 0x80, 0xd0, 0x92, 0x8c, 0x9e, 0xff, 0xb5,
0x37, 0x85, 0x1f, 0x1b, 0x00, 0x62, 0x78, 0x77, 0xf3, 0x94, 0xf8, 0x61, 0x86, 0x07, 0xfc, 0xbb,
0x30, 0x13, 0x48, 0x8f, 0x94, 0x4f, 0xab, 0x13, 0x4e, 0x88, 0xe3, 0x8b, 0x24, 0x7d, 0x12, 0x2b,
0x61, 0x8d, 0xab, 0x1f, 0x7c, 0xb2, 0x3a, 0xf5, 0xe1, 0x27, 0xab, 0x53, 0x1f, 0x7d, 0xb2, 0x3a,
0xf5, 0xf6, 0xd9, 0xaa, 0xf1, 0xc1, 0xd9, 0xaa, 0xf1, 0xe1, 0xd9, 0xaa, 0xf1, 0xd1, 0xd9, 0xaa,
0xf1, 0xf1, 0xd9, 0xaa, 0xf1, 0xee, 0xdf, 0x57, 0xa7, 0x5e, 0xcb, 0x9d, 0x6e, 0xfc, 0x27, 0x00,
0x00, 0xff, 0xff, 0x7e, 0xef, 0x1e, 0xdd, 0xf0, 0x27, 0x00, 0x00,
}
func (m *APIGroup) Marshal() (dAtA []byte, err error) {
@ -1909,6 +1911,11 @@ func (m *CreateOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
i -= len(m.FieldValidation)
copy(dAtA[i:], m.FieldValidation)
i = encodeVarintGenerated(dAtA, i, uint64(len(m.FieldValidation)))
i--
dAtA[i] = 0x22
i -= len(m.FieldManager)
copy(dAtA[i:], m.FieldManager)
i = encodeVarintGenerated(dAtA, i, uint64(len(m.FieldManager)))
@ -2982,6 +2989,11 @@ func (m *PatchOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
i -= len(m.FieldValidation)
copy(dAtA[i:], m.FieldValidation)
i = encodeVarintGenerated(dAtA, i, uint64(len(m.FieldValidation)))
i--
dAtA[i] = 0x22
i -= len(m.FieldManager)
copy(dAtA[i:], m.FieldManager)
i = encodeVarintGenerated(dAtA, i, uint64(len(m.FieldManager)))
@ -3382,6 +3394,11 @@ func (m *UpdateOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
i -= len(m.FieldValidation)
copy(dAtA[i:], m.FieldValidation)
i = encodeVarintGenerated(dAtA, i, uint64(len(m.FieldValidation)))
i--
dAtA[i] = 0x1a
i -= len(m.FieldManager)
copy(dAtA[i:], m.FieldManager)
i = encodeVarintGenerated(dAtA, i, uint64(len(m.FieldManager)))
@ -3648,6 +3665,8 @@ func (m *CreateOptions) Size() (n int) {
}
l = len(m.FieldManager)
n += 1 + l + sovGenerated(uint64(l))
l = len(m.FieldValidation)
n += 1 + l + sovGenerated(uint64(l))
return n
}
@ -4069,6 +4088,8 @@ func (m *PatchOptions) Size() (n int) {
}
l = len(m.FieldManager)
n += 1 + l + sovGenerated(uint64(l))
l = len(m.FieldValidation)
n += 1 + l + sovGenerated(uint64(l))
return n
}
@ -4227,6 +4248,8 @@ func (m *UpdateOptions) Size() (n int) {
}
l = len(m.FieldManager)
n += 1 + l + sovGenerated(uint64(l))
l = len(m.FieldValidation)
n += 1 + l + sovGenerated(uint64(l))
return n
}
@ -4371,6 +4394,7 @@ func (this *CreateOptions) String() string {
s := strings.Join([]string{`&CreateOptions{`,
`DryRun:` + fmt.Sprintf("%v", this.DryRun) + `,`,
`FieldManager:` + fmt.Sprintf("%v", this.FieldManager) + `,`,
`FieldValidation:` + fmt.Sprintf("%v", this.FieldValidation) + `,`,
`}`,
}, "")
return s
@ -4634,6 +4658,7 @@ func (this *PatchOptions) String() string {
`DryRun:` + fmt.Sprintf("%v", this.DryRun) + `,`,
`Force:` + valueToStringGenerated(this.Force) + `,`,
`FieldManager:` + fmt.Sprintf("%v", this.FieldManager) + `,`,
`FieldValidation:` + fmt.Sprintf("%v", this.FieldValidation) + `,`,
`}`,
}, "")
return s
@ -4756,6 +4781,7 @@ func (this *UpdateOptions) String() string {
s := strings.Join([]string{`&UpdateOptions{`,
`DryRun:` + fmt.Sprintf("%v", this.DryRun) + `,`,
`FieldManager:` + fmt.Sprintf("%v", this.FieldManager) + `,`,
`FieldValidation:` + fmt.Sprintf("%v", this.FieldValidation) + `,`,
`}`,
}, "")
return s
@ -6097,6 +6123,38 @@ func (m *CreateOptions) Unmarshal(dAtA []byte) error {
}
m.FieldManager = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field FieldValidation", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthGenerated
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.FieldValidation = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
@ -9824,6 +9882,38 @@ func (m *PatchOptions) Unmarshal(dAtA []byte) error {
}
m.FieldManager = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field FieldValidation", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthGenerated
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.FieldValidation = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
@ -11145,6 +11235,38 @@ func (m *UpdateOptions) Unmarshal(dAtA []byte) error {
}
m.FieldManager = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field FieldValidation", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthGenerated
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.FieldValidation = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])

View File

@ -242,6 +242,19 @@ message CreateOptions {
// as defined by https://golang.org/pkg/unicode/#IsPrint.
// +optional
optional string fieldManager = 3;
// fieldValidation determines how the server should respond to
// unknown/duplicate fields in the object in the request.
// Introduced as alpha in 1.23, older servers or servers with the
// `ServerSideFieldValidation` feature disabled will discard valid values
// specified in this param and not perform any server side field validation.
// Valid values are:
// - Ignore: ignores unknown/duplicate fields.
// - Warn: responds with a warning for each
// unknown/duplicate field, but successfully serves the request.
// - Strict: fails the request on unknown/duplicate fields.
// +optional
optional string fieldValidation = 4;
}
// DeleteOptions may be provided when deleting an API object.
@ -362,7 +375,7 @@ message GroupVersionForDiscovery {
}
// GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion
// to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling
// to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling
//
// +protobuf.options.(gogoproto.goproto_stringer)=false
message GroupVersionKind {
@ -374,7 +387,7 @@ message GroupVersionKind {
}
// GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion
// to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling
// to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling
//
// +protobuf.options.(gogoproto.goproto_stringer)=false
message GroupVersionResource {
@ -878,6 +891,19 @@ message PatchOptions {
// types (JsonPatch, MergePatch, StrategicMergePatch).
// +optional
optional string fieldManager = 3;
// fieldValidation determines how the server should respond to
// unknown/duplicate fields in the object in the request.
// Introduced as alpha in 1.23, older servers or servers with the
// `ServerSideFieldValidation` feature disabled will discard valid values
// specified in this param and not perform any server side field validation.
// Valid values are:
// - Ignore: ignores unknown/duplicate fields.
// - Warn: responds with a warning for each
// unknown/duplicate field, but successfully serves the request.
// - Strict: fails the request on unknown/duplicate fields.
// +optional
optional string fieldValidation = 4;
}
// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.
@ -1095,6 +1121,19 @@ message UpdateOptions {
// as defined by https://golang.org/pkg/unicode/#IsPrint.
// +optional
optional string fieldManager = 2;
// fieldValidation determines how the server should respond to
// unknown/duplicate fields in the object in the request.
// Introduced as alpha in 1.23, older servers or servers with the
// `ServerSideFieldValidation` feature disabled will discard valid values
// specified in this param and not perform any server side field validation.
// Valid values are:
// - Ignore: ignores unknown/duplicate fields.
// - Warn: responds with a warning for each
// unknown/duplicate field, but successfully serves the request.
// - Strict: fails the request on unknown/duplicate fields.
// +optional
optional string fieldValidation = 3;
}
// Verbs masks the value so protobuf can generate

View File

@ -44,7 +44,7 @@ func (gr *GroupResource) String() string {
}
// GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion
// to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling
// to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling
//
// +protobuf.options.(gogoproto.goproto_stringer)=false
type GroupVersionResource struct {
@ -80,7 +80,7 @@ func (gk *GroupKind) String() string {
}
// GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion
// to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling
// to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling
//
// +protobuf.options.(gogoproto.goproto_stringer)=false
type GroupVersionKind struct {

View File

@ -1,3 +1,4 @@
//go:build !notest
// +build !notest
/*

View File

@ -1,3 +1,4 @@
//go:build !notest
// +build !notest
/*

View File

@ -522,6 +522,15 @@ type DeleteOptions struct {
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,5,rep,name=dryRun"`
}
const (
// FieldValidationIgnore ignores unknown/duplicate fields
FieldValidationIgnore = "Ignore"
// FieldValidationWarn responds with a warning, but successfully serve the request
FieldValidationWarn = "Warn"
// FieldValidationStrict fails the request on unknown/duplicate fields
FieldValidationStrict = "Strict"
)
// +k8s:conversion-gen:explicit-from=net/url.Values
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@ -544,6 +553,19 @@ type CreateOptions struct {
// as defined by https://golang.org/pkg/unicode/#IsPrint.
// +optional
FieldManager string `json:"fieldManager,omitempty" protobuf:"bytes,3,name=fieldManager"`
// fieldValidation determines how the server should respond to
// unknown/duplicate fields in the object in the request.
// Introduced as alpha in 1.23, older servers or servers with the
// `ServerSideFieldValidation` feature disabled will discard valid values
// specified in this param and not perform any server side field validation.
// Valid values are:
// - Ignore: ignores unknown/duplicate fields.
// - Warn: responds with a warning for each
// unknown/duplicate field, but successfully serves the request.
// - Strict: fails the request on unknown/duplicate fields.
// +optional
FieldValidation string `json:"fieldValidation,omitempty" protobuf:"bytes,4,name=fieldValidation"`
}
// +k8s:conversion-gen:explicit-from=net/url.Values
@ -577,6 +599,19 @@ type PatchOptions struct {
// types (JsonPatch, MergePatch, StrategicMergePatch).
// +optional
FieldManager string `json:"fieldManager,omitempty" protobuf:"bytes,3,name=fieldManager"`
// fieldValidation determines how the server should respond to
// unknown/duplicate fields in the object in the request.
// Introduced as alpha in 1.23, older servers or servers with the
// `ServerSideFieldValidation` feature disabled will discard valid values
// specified in this param and not perform any server side field validation.
// Valid values are:
// - Ignore: ignores unknown/duplicate fields.
// - Warn: responds with a warning for each
// unknown/duplicate field, but successfully serves the request.
// - Strict: fails the request on unknown/duplicate fields.
// +optional
FieldValidation string `json:"fieldValidation,omitempty" protobuf:"bytes,4,name=fieldValidation"`
}
// ApplyOptions may be provided when applying an API object.
@ -632,6 +667,19 @@ type UpdateOptions struct {
// as defined by https://golang.org/pkg/unicode/#IsPrint.
// +optional
FieldManager string `json:"fieldManager,omitempty" protobuf:"bytes,2,name=fieldManager"`
// fieldValidation determines how the server should respond to
// unknown/duplicate fields in the object in the request.
// Introduced as alpha in 1.23, older servers or servers with the
// `ServerSideFieldValidation` feature disabled will discard valid values
// specified in this param and not perform any server side field validation.
// Valid values are:
// - Ignore: ignores unknown/duplicate fields.
// - Warn: responds with a warning for each
// unknown/duplicate field, but successfully serves the request.
// - Strict: fails the request on unknown/duplicate fields.
// +optional
FieldValidation string `json:"fieldValidation,omitempty" protobuf:"bytes,3,name=fieldValidation"`
}
// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.

View File

@ -112,9 +112,10 @@ func (Condition) SwaggerDoc() map[string]string {
}
var map_CreateOptions = map[string]string{
"": "CreateOptions may be provided when creating an API object.",
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.",
"": "CreateOptions may be provided when creating an API object.",
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.",
"fieldValidation": "fieldValidation determines how the server should respond to unknown/duplicate fields in the object in the request. Introduced as alpha in 1.23, older servers or servers with the `ServerSideFieldValidation` feature disabled will discard valid values specified in this param and not perform any server side field validation. Valid values are: - Ignore: ignores unknown/duplicate fields. - Warn: responds with a warning for each unknown/duplicate field, but successfully serves the request. - Strict: fails the request on unknown/duplicate fields.",
}
func (CreateOptions) SwaggerDoc() map[string]string {
@ -302,10 +303,11 @@ func (Patch) SwaggerDoc() map[string]string {
}
var map_PatchOptions = map[string]string{
"": "PatchOptions may be provided when patching an API object. PatchOptions is meant to be a superset of UpdateOptions.",
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"force": "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).",
"": "PatchOptions may be provided when patching an API object. PatchOptions is meant to be a superset of UpdateOptions.",
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"force": "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).",
"fieldValidation": "fieldValidation determines how the server should respond to unknown/duplicate fields in the object in the request. Introduced as alpha in 1.23, older servers or servers with the `ServerSideFieldValidation` feature disabled will discard valid values specified in this param and not perform any server side field validation. Valid values are: - Ignore: ignores unknown/duplicate fields. - Warn: responds with a warning for each unknown/duplicate field, but successfully serves the request. - Strict: fails the request on unknown/duplicate fields.",
}
func (PatchOptions) SwaggerDoc() map[string]string {
@ -447,9 +449,10 @@ func (TypeMeta) SwaggerDoc() map[string]string {
}
var map_UpdateOptions = map[string]string{
"": "UpdateOptions may be provided when updating an API object. All fields in UpdateOptions should also be present in PatchOptions.",
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.",
"": "UpdateOptions may be provided when updating an API object. All fields in UpdateOptions should also be present in PatchOptions.",
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.",
"fieldValidation": "fieldValidation determines how the server should respond to unknown/duplicate fields in the object in the request. Introduced as alpha in 1.23, older servers or servers with the `ServerSideFieldValidation` feature disabled will discard valid values specified in this param and not perform any server side field validation. Valid values are: - Ignore: ignores unknown/duplicate fields. - Warn: responds with a warning for each unknown/duplicate field, but successfully serves the request. - Strict: fails the request on unknown/duplicate fields.",
}
func (UpdateOptions) SwaggerDoc() map[string]string {

View File

@ -382,7 +382,7 @@ func (unstructuredJSONScheme) Identifier() runtime.Identifier {
func (s unstructuredJSONScheme) decode(data []byte) (runtime.Object, error) {
type detector struct {
Items gojson.RawMessage
Items gojson.RawMessage `json:"items"`
}
var det detector
if err := json.Unmarshal(data, &det); err != nil {
@ -425,7 +425,7 @@ func (unstructuredJSONScheme) decodeToUnstructured(data []byte, unstruct *Unstru
func (s unstructuredJSONScheme) decodeToList(data []byte, list *UnstructuredList) error {
type decodeList struct {
Items []gojson.RawMessage
Items []gojson.RawMessage `json:"items"`
}
var dList decodeList

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*

View File

@ -96,17 +96,19 @@ func ValidateDeleteOptions(options *metav1.DeleteOptions) field.ErrorList {
}
func ValidateCreateOptions(options *metav1.CreateOptions) field.ErrorList {
return append(
ValidateFieldManager(options.FieldManager, field.NewPath("fieldManager")),
ValidateDryRun(field.NewPath("dryRun"), options.DryRun)...,
)
allErrs := field.ErrorList{}
allErrs = append(allErrs, ValidateFieldManager(options.FieldManager, field.NewPath("fieldManager"))...)
allErrs = append(allErrs, ValidateDryRun(field.NewPath("dryRun"), options.DryRun)...)
allErrs = append(allErrs, ValidateFieldValidation(field.NewPath("fieldValidation"), options.FieldValidation)...)
return allErrs
}
func ValidateUpdateOptions(options *metav1.UpdateOptions) field.ErrorList {
return append(
ValidateFieldManager(options.FieldManager, field.NewPath("fieldManager")),
ValidateDryRun(field.NewPath("dryRun"), options.DryRun)...,
)
allErrs := field.ErrorList{}
allErrs = append(allErrs, ValidateFieldManager(options.FieldManager, field.NewPath("fieldManager"))...)
allErrs = append(allErrs, ValidateDryRun(field.NewPath("dryRun"), options.DryRun)...)
allErrs = append(allErrs, ValidateFieldValidation(field.NewPath("fieldValidation"), options.FieldValidation)...)
return allErrs
}
func ValidatePatchOptions(options *metav1.PatchOptions, patchType types.PatchType) field.ErrorList {
@ -123,6 +125,7 @@ func ValidatePatchOptions(options *metav1.PatchOptions, patchType types.PatchTyp
}
allErrs = append(allErrs, ValidateFieldManager(options.FieldManager, field.NewPath("fieldManager"))...)
allErrs = append(allErrs, ValidateDryRun(field.NewPath("dryRun"), options.DryRun)...)
allErrs = append(allErrs, ValidateFieldValidation(field.NewPath("fieldValidation"), options.FieldValidation)...)
return allErrs
}
@ -159,6 +162,18 @@ func ValidateDryRun(fldPath *field.Path, dryRun []string) field.ErrorList {
return allErrs
}
var allowedFieldValidationValues = sets.NewString("", metav1.FieldValidationIgnore, metav1.FieldValidationWarn, metav1.FieldValidationStrict)
// ValidateFieldValidation validates that a fieldValidation query param only contains allowed values.
func ValidateFieldValidation(fldPath *field.Path, fieldValidation string) field.ErrorList {
allErrs := field.ErrorList{}
if !allowedFieldValidationValues.Has(fieldValidation) {
allErrs = append(allErrs, field.NotSupported(fldPath, fieldValidation, allowedFieldValidationValues.List()))
}
return allErrs
}
const UninitializedStatusUpdateErrorMsg string = `must not update status when the object is uninitialized`
// ValidateTableOptions returns any invalid flags on TableOptions.

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
@ -293,6 +294,13 @@ func autoConvert_url_Values_To_v1_CreateOptions(in *url.Values, out *CreateOptio
} else {
out.FieldManager = ""
}
if values, ok := map[string][]string(*in)["fieldValidation"]; ok && len(values) > 0 {
if err := runtime.Convert_Slice_string_To_string(&values, &out.FieldValidation, s); err != nil {
return err
}
} else {
out.FieldValidation = ""
}
return nil
}
@ -448,6 +456,13 @@ func autoConvert_url_Values_To_v1_PatchOptions(in *url.Values, out *PatchOptions
} else {
out.FieldManager = ""
}
if values, ok := map[string][]string(*in)["fieldValidation"]; ok && len(values) > 0 {
if err := runtime.Convert_Slice_string_To_string(&values, &out.FieldValidation, s); err != nil {
return err
}
} else {
out.FieldValidation = ""
}
return nil
}
@ -496,6 +511,13 @@ func autoConvert_url_Values_To_v1_UpdateOptions(in *url.Values, out *UpdateOptio
} else {
out.FieldManager = ""
}
if values, ok := map[string][]string(*in)["fieldValidation"]; ok && len(values) > 0 {
if err := runtime.Convert_Slice_string_To_string(&values, &out.FieldValidation, s); err != nil {
return err
}
} else {
out.FieldValidation = ""
}
return nil
}

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*

View File

@ -44,23 +44,16 @@ type Converter struct {
generatedConversionFuncs ConversionFuncs
// Set of conversions that should be treated as a no-op
ignoredConversions map[typePair]struct{}
ignoredUntypedConversions map[typePair]struct{}
// nameFunc is called to retrieve the name of a type; this name is used for the
// purpose of deciding whether two types match or not (i.e., will we attempt to
// do a conversion). The default returns the go type name.
nameFunc func(t reflect.Type) string
}
// NewConverter creates a new Converter object.
func NewConverter(nameFn NameFunc) *Converter {
// Arg NameFunc is just for backward compatibility.
func NewConverter(NameFunc) *Converter {
c := &Converter{
conversionFuncs: NewConversionFuncs(),
generatedConversionFuncs: NewConversionFuncs(),
ignoredConversions: make(map[typePair]struct{}),
ignoredUntypedConversions: make(map[typePair]struct{}),
nameFunc: nameFn,
}
c.RegisterUntypedConversionFunc(
(*[]byte)(nil), (*[]byte)(nil),
@ -192,7 +185,6 @@ func (c *Converter) RegisterIgnoredConversion(from, to interface{}) error {
if typeTo.Kind() != reflect.Ptr {
return fmt.Errorf("expected pointer arg for 'to' param 1, got: %v", typeTo)
}
c.ignoredConversions[typePair{typeFrom.Elem(), typeTo.Elem()}] = struct{}{}
c.ignoredUntypedConversions[typePair{typeFrom, typeTo}] = struct{}{}
return nil
}

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*

View File

@ -22,6 +22,7 @@ import (
"math"
"os"
"reflect"
"sort"
"strconv"
"strings"
"sync"
@ -109,21 +110,141 @@ type unstructuredConverter struct {
// to Go types via reflection. It performs mismatch detection automatically and is intended for use by external
// test tools. Use DefaultUnstructuredConverter if you do not explicitly need mismatch detection.
func NewTestUnstructuredConverter(comparison conversion.Equalities) UnstructuredConverter {
return NewTestUnstructuredConverterWithValidation(comparison)
}
// NewTestUnstrucutredConverterWithValidation allows for access to
// FromUnstructuredWithValidation from within tests.
func NewTestUnstructuredConverterWithValidation(comparison conversion.Equalities) *unstructuredConverter {
return &unstructuredConverter{
mismatchDetection: true,
comparison: comparison,
}
}
// FromUnstructured converts an object from map[string]interface{} representation into a concrete type.
// fromUnstructuredContext provides options for informing the converter
// the state of its recursive walk through the conversion process.
type fromUnstructuredContext struct {
// isInlined indicates whether the converter is currently in
// an inlined field or not to determine whether it should
// validate the matchedKeys yet or only collect them.
// This should only be set from `structFromUnstructured`
isInlined bool
// matchedKeys is a stack of the set of all fields that exist in the
// concrete go type of the object being converted into.
// This should only be manipulated via `pushMatchedKeyTracker`,
// `recordMatchedKey`, or `popAndVerifyMatchedKeys`
matchedKeys []map[string]struct{}
// parentPath collects the path that the conversion
// takes as it traverses the unstructured json map.
// It is used to report the full path to any unknown
// fields that the converter encounters.
parentPath []string
// returnUnknownFields indicates whether or not
// unknown field errors should be collected and
// returned to the caller
returnUnknownFields bool
// unknownFieldErrors are the collection of
// the full path to each unknown field in the
// object.
unknownFieldErrors []error
}
// pushMatchedKeyTracker adds a placeholder set for tracking
// matched keys for the given level. This should only be
// called from `structFromUnstructured`.
func (c *fromUnstructuredContext) pushMatchedKeyTracker() {
if !c.returnUnknownFields {
return
}
c.matchedKeys = append(c.matchedKeys, nil)
}
// recordMatchedKey initializes the last element of matchedKeys
// (if needed) and sets 'key'. This should only be called from
// `structFromUnstructured`.
func (c *fromUnstructuredContext) recordMatchedKey(key string) {
if !c.returnUnknownFields {
return
}
last := len(c.matchedKeys) - 1
if c.matchedKeys[last] == nil {
c.matchedKeys[last] = map[string]struct{}{}
}
c.matchedKeys[last][key] = struct{}{}
}
// popAndVerifyMatchedKeys pops the last element of matchedKeys,
// checks the matched keys against the data, and adds unknown
// field errors for any matched keys.
// `mapValue` is the value of sv containing all of the keys that exist at this level
// (ie. sv.MapKeys) in the source data.
// `matchedKeys` are all the keys found for that level in the destination object.
// This should only be called from `structFromUnstructured`.
func (c *fromUnstructuredContext) popAndVerifyMatchedKeys(mapValue reflect.Value) {
if !c.returnUnknownFields {
return
}
last := len(c.matchedKeys) - 1
curMatchedKeys := c.matchedKeys[last]
c.matchedKeys[last] = nil
c.matchedKeys = c.matchedKeys[:last]
for _, key := range mapValue.MapKeys() {
if _, ok := curMatchedKeys[key.String()]; !ok {
c.recordUnknownField(key.String())
}
}
}
func (c *fromUnstructuredContext) recordUnknownField(field string) {
if !c.returnUnknownFields {
return
}
pathLen := len(c.parentPath)
c.pushKey(field)
errPath := strings.Join(c.parentPath, "")
c.parentPath = c.parentPath[:pathLen]
c.unknownFieldErrors = append(c.unknownFieldErrors, fmt.Errorf(`unknown field "%s"`, errPath))
}
func (c *fromUnstructuredContext) pushIndex(index int) {
if !c.returnUnknownFields {
return
}
c.parentPath = append(c.parentPath, "[", strconv.Itoa(index), "]")
}
func (c *fromUnstructuredContext) pushKey(key string) {
if !c.returnUnknownFields {
return
}
if len(c.parentPath) > 0 {
c.parentPath = append(c.parentPath, ".")
}
c.parentPath = append(c.parentPath, key)
}
// FromUnstructuredWIthValidation converts an object from map[string]interface{} representation into a concrete type.
// It uses encoding/json/Unmarshaler if object implements it or reflection if not.
func (c *unstructuredConverter) FromUnstructured(u map[string]interface{}, obj interface{}) error {
// It takes a validationDirective that indicates how to behave when it encounters unknown fields.
func (c *unstructuredConverter) FromUnstructuredWithValidation(u map[string]interface{}, obj interface{}, returnUnknownFields bool) error {
t := reflect.TypeOf(obj)
value := reflect.ValueOf(obj)
if t.Kind() != reflect.Ptr || value.IsNil() {
return fmt.Errorf("FromUnstructured requires a non-nil pointer to an object, got %v", t)
}
err := fromUnstructured(reflect.ValueOf(u), value.Elem())
fromUnstructuredContext := &fromUnstructuredContext{
returnUnknownFields: returnUnknownFields,
}
err := fromUnstructured(reflect.ValueOf(u), value.Elem(), fromUnstructuredContext)
if c.mismatchDetection {
newObj := reflect.New(t.Elem()).Interface()
newErr := fromUnstructuredViaJSON(u, newObj)
@ -134,7 +255,23 @@ func (c *unstructuredConverter) FromUnstructured(u map[string]interface{}, obj i
klog.Fatalf("FromUnstructured mismatch\nobj1: %#v\nobj2: %#v", obj, newObj)
}
}
return err
if err != nil {
return err
}
if returnUnknownFields && len(fromUnstructuredContext.unknownFieldErrors) > 0 {
sort.Slice(fromUnstructuredContext.unknownFieldErrors, func(i, j int) bool {
return fromUnstructuredContext.unknownFieldErrors[i].Error() <
fromUnstructuredContext.unknownFieldErrors[j].Error()
})
return NewStrictDecodingError(fromUnstructuredContext.unknownFieldErrors)
}
return nil
}
// FromUnstructured converts an object from map[string]interface{} representation into a concrete type.
// It uses encoding/json/Unmarshaler if object implements it or reflection if not.
func (c *unstructuredConverter) FromUnstructured(u map[string]interface{}, obj interface{}) error {
return c.FromUnstructuredWithValidation(u, obj, false)
}
func fromUnstructuredViaJSON(u map[string]interface{}, obj interface{}) error {
@ -145,7 +282,7 @@ func fromUnstructuredViaJSON(u map[string]interface{}, obj interface{}) error {
return json.Unmarshal(data, obj)
}
func fromUnstructured(sv, dv reflect.Value) error {
func fromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) error {
sv = unwrapInterface(sv)
if !sv.IsValid() {
dv.Set(reflect.Zero(dv.Type()))
@ -213,18 +350,19 @@ func fromUnstructured(sv, dv reflect.Value) error {
switch dt.Kind() {
case reflect.Map:
return mapFromUnstructured(sv, dv)
return mapFromUnstructured(sv, dv, ctx)
case reflect.Slice:
return sliceFromUnstructured(sv, dv)
return sliceFromUnstructured(sv, dv, ctx)
case reflect.Ptr:
return pointerFromUnstructured(sv, dv)
return pointerFromUnstructured(sv, dv, ctx)
case reflect.Struct:
return structFromUnstructured(sv, dv)
return structFromUnstructured(sv, dv, ctx)
case reflect.Interface:
return interfaceFromUnstructured(sv, dv)
default:
return fmt.Errorf("unrecognized type: %v", dt.Kind())
}
}
func fieldInfoFromField(structType reflect.Type, field int) *fieldInfo {
@ -275,7 +413,7 @@ func unwrapInterface(v reflect.Value) reflect.Value {
return v
}
func mapFromUnstructured(sv, dv reflect.Value) error {
func mapFromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) error {
st, dt := sv.Type(), dv.Type()
if st.Kind() != reflect.Map {
return fmt.Errorf("cannot restore map from %v", st.Kind())
@ -293,7 +431,7 @@ func mapFromUnstructured(sv, dv reflect.Value) error {
for _, key := range sv.MapKeys() {
value := reflect.New(dt.Elem()).Elem()
if val := unwrapInterface(sv.MapIndex(key)); val.IsValid() {
if err := fromUnstructured(val, value); err != nil {
if err := fromUnstructured(val, value, ctx); err != nil {
return err
}
} else {
@ -308,7 +446,7 @@ func mapFromUnstructured(sv, dv reflect.Value) error {
return nil
}
func sliceFromUnstructured(sv, dv reflect.Value) error {
func sliceFromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) error {
st, dt := sv.Type(), dv.Type()
if st.Kind() == reflect.String && dt.Elem().Kind() == reflect.Uint8 {
// We store original []byte representation as string.
@ -340,15 +478,22 @@ func sliceFromUnstructured(sv, dv reflect.Value) error {
return nil
}
dv.Set(reflect.MakeSlice(dt, sv.Len(), sv.Cap()))
pathLen := len(ctx.parentPath)
defer func() {
ctx.parentPath = ctx.parentPath[:pathLen]
}()
for i := 0; i < sv.Len(); i++ {
if err := fromUnstructured(sv.Index(i), dv.Index(i)); err != nil {
ctx.pushIndex(i)
if err := fromUnstructured(sv.Index(i), dv.Index(i), ctx); err != nil {
return err
}
ctx.parentPath = ctx.parentPath[:pathLen]
}
return nil
}
func pointerFromUnstructured(sv, dv reflect.Value) error {
func pointerFromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) error {
st, dt := sv.Type(), dv.Type()
if st.Kind() == reflect.Ptr && sv.IsNil() {
@ -358,38 +503,63 @@ func pointerFromUnstructured(sv, dv reflect.Value) error {
dv.Set(reflect.New(dt.Elem()))
switch st.Kind() {
case reflect.Ptr, reflect.Interface:
return fromUnstructured(sv.Elem(), dv.Elem())
return fromUnstructured(sv.Elem(), dv.Elem(), ctx)
default:
return fromUnstructured(sv, dv.Elem())
return fromUnstructured(sv, dv.Elem(), ctx)
}
}
func structFromUnstructured(sv, dv reflect.Value) error {
func structFromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) error {
st, dt := sv.Type(), dv.Type()
if st.Kind() != reflect.Map {
return fmt.Errorf("cannot restore struct from: %v", st.Kind())
}
pathLen := len(ctx.parentPath)
svInlined := ctx.isInlined
defer func() {
ctx.parentPath = ctx.parentPath[:pathLen]
ctx.isInlined = svInlined
}()
if !svInlined {
ctx.pushMatchedKeyTracker()
}
for i := 0; i < dt.NumField(); i++ {
fieldInfo := fieldInfoFromField(dt, i)
fv := dv.Field(i)
if len(fieldInfo.name) == 0 {
// This field is inlined.
if err := fromUnstructured(sv, fv); err != nil {
// This field is inlined, recurse into fromUnstructured again
// with the same set of matched keys.
ctx.isInlined = true
if err := fromUnstructured(sv, fv, ctx); err != nil {
return err
}
ctx.isInlined = svInlined
} else {
// This field is not inlined so we recurse into
// child field of sv corresponding to field i of
// dv, with a new set of matchedKeys and updating
// the parentPath to indicate that we are one level
// deeper.
ctx.recordMatchedKey(fieldInfo.name)
value := unwrapInterface(sv.MapIndex(fieldInfo.nameValue))
if value.IsValid() {
if err := fromUnstructured(value, fv); err != nil {
ctx.isInlined = false
ctx.pushKey(fieldInfo.name)
if err := fromUnstructured(value, fv, ctx); err != nil {
return err
}
ctx.parentPath = ctx.parentPath[:pathLen]
ctx.isInlined = svInlined
} else {
fv.Set(reflect.Zero(fv.Type()))
}
}
}
if !svInlined {
ctx.popAndVerifyMatchedKeys(sv)
}
return nil
}

View File

@ -19,6 +19,7 @@ package runtime
import (
"fmt"
"reflect"
"strings"
"k8s.io/apimachinery/pkg/runtime/schema"
)
@ -124,20 +125,30 @@ func IsMissingVersion(err error) bool {
// strictDecodingError is a base error type that is returned by a strict Decoder such
// as UniversalStrictDecoder.
type strictDecodingError struct {
message string
data string
errors []error
}
// NewStrictDecodingError creates a new strictDecodingError object.
func NewStrictDecodingError(message string, data string) error {
func NewStrictDecodingError(errors []error) error {
return &strictDecodingError{
message: message,
data: data,
errors: errors,
}
}
func (e *strictDecodingError) Error() string {
return fmt.Sprintf("strict decoder error for %s: %s", e.data, e.message)
var s strings.Builder
s.WriteString("strict decoding error: ")
for i, err := range e.errors {
if i != 0 {
s.WriteString(", ")
}
s.WriteString(err.Error())
}
return s.String()
}
func (e *strictDecodingError) Errors() []error {
return e.errors
}
// IsStrictDecodingError returns true if the error indicates that the provided object
@ -149,3 +160,13 @@ func IsStrictDecodingError(err error) bool {
_, ok := err.(*strictDecodingError)
return ok
}
// AsStrictDecodingError returns a strict decoding error
// containing all the strictness violations.
func AsStrictDecodingError(err error) (*strictDecodingError, bool) {
if err == nil {
return nil, false
}
strictErr, ok := err.(*strictDecodingError)
return strictErr, ok
}

View File

@ -125,6 +125,9 @@ type SerializerInfo struct {
// PrettySerializer, if set, can serialize this object in a form biased towards
// readability.
PrettySerializer Serializer
// StrictSerializer, if set, deserializes this object strictly,
// erring on unknown fields.
StrictSerializer Serializer
// StreamSerializer, if set, describes the streaming serialization format
// for this media type.
StreamSerializer *StreamSerializerInfo

View File

@ -99,7 +99,7 @@ func NewScheme() *Scheme {
versionPriority: map[string][]string{},
schemeName: naming.GetNameFromCallsite(internalPackages...),
}
s.converter = conversion.NewConverter(s.nameFunc)
s.converter = conversion.NewConverter(nil)
// Enable couple default conversions by default.
utilruntime.Must(RegisterEmbeddedConversions(s))
@ -107,28 +107,6 @@ func NewScheme() *Scheme {
return s
}
// nameFunc returns the name of the type that we wish to use to determine when two types attempt
// a conversion. Defaults to the go name of the type if the type is not registered.
func (s *Scheme) nameFunc(t reflect.Type) string {
// find the preferred names for this type
gvks, ok := s.typeToGVK[t]
if !ok {
return t.Name()
}
for _, gvk := range gvks {
internalGV := gvk.GroupVersion()
internalGV.Version = APIVersionInternal // this is hacky and maybe should be passed in
internalGVK := internalGV.WithKind(gvk.Kind)
if internalType, exists := s.gvkToType[internalGVK]; exists {
return s.typeToGVK[internalType][0].Kind
}
}
return gvks[0].Kind
}
// Converter allows access to the converter for the scheme
func (s *Scheme) Converter() *conversion.Converter {
return s.converter

View File

@ -40,6 +40,7 @@ type serializerType struct {
Serializer runtime.Serializer
PrettySerializer runtime.Serializer
StrictSerializer runtime.Serializer
AcceptStreamContentTypes []string
StreamContentType string
@ -70,10 +71,20 @@ func newSerializersForScheme(scheme *runtime.Scheme, mf json.MetaFactory, option
)
}
strictJSONSerializer := json.NewSerializerWithOptions(
mf, scheme, scheme,
json.SerializerOptions{Yaml: false, Pretty: false, Strict: true},
)
jsonSerializerType.StrictSerializer = strictJSONSerializer
yamlSerializer := json.NewSerializerWithOptions(
mf, scheme, scheme,
json.SerializerOptions{Yaml: true, Pretty: false, Strict: options.Strict},
)
strictYAMLSerializer := json.NewSerializerWithOptions(
mf, scheme, scheme,
json.SerializerOptions{Yaml: true, Pretty: false, Strict: true},
)
protoSerializer := protobuf.NewSerializer(scheme, scheme)
protoRawSerializer := protobuf.NewRawSerializer(scheme, scheme)
@ -85,12 +96,16 @@ func newSerializersForScheme(scheme *runtime.Scheme, mf json.MetaFactory, option
FileExtensions: []string{"yaml"},
EncodesAsText: true,
Serializer: yamlSerializer,
StrictSerializer: strictYAMLSerializer,
},
{
AcceptContentTypes: []string{runtime.ContentTypeProtobuf},
ContentType: runtime.ContentTypeProtobuf,
FileExtensions: []string{"pb"},
Serializer: protoSerializer,
// note, strict decoding is unsupported for protobuf,
// fall back to regular serializing
StrictSerializer: protoSerializer,
Framer: protobuf.LengthDelimitedFramer,
StreamSerializer: protoRawSerializer,
@ -187,6 +202,7 @@ func newCodecFactory(scheme *runtime.Scheme, serializers []serializerType) Codec
EncodesAsText: d.EncodesAsText,
Serializer: d.Serializer,
PrettySerializer: d.PrettySerializer,
StrictSerializer: d.StrictSerializer,
}
mediaType, _, err := mime.ParseMediaType(info.MediaType)

View File

@ -20,10 +20,8 @@ import (
"encoding/json"
"io"
"strconv"
"unsafe"
jsoniter "github.com/json-iterator/go"
"github.com/modern-go/reflect2"
kjson "sigs.k8s.io/json"
"sigs.k8s.io/yaml"
"k8s.io/apimachinery/pkg/runtime"
@ -68,6 +66,7 @@ func identifier(options SerializerOptions) runtime.Identifier {
"name": "json",
"yaml": strconv.FormatBool(options.Yaml),
"pretty": strconv.FormatBool(options.Pretty),
"strict": strconv.FormatBool(options.Strict),
}
identifier, err := json.Marshal(result)
if err != nil {
@ -110,79 +109,6 @@ type Serializer struct {
var _ runtime.Serializer = &Serializer{}
var _ recognizer.RecognizingDecoder = &Serializer{}
type customNumberExtension struct {
jsoniter.DummyExtension
}
func (cne *customNumberExtension) CreateDecoder(typ reflect2.Type) jsoniter.ValDecoder {
if typ.String() == "interface {}" {
return customNumberDecoder{}
}
return nil
}
type customNumberDecoder struct {
}
func (customNumberDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator) {
switch iter.WhatIsNext() {
case jsoniter.NumberValue:
var number jsoniter.Number
iter.ReadVal(&number)
i64, err := strconv.ParseInt(string(number), 10, 64)
if err == nil {
*(*interface{})(ptr) = i64
return
}
f64, err := strconv.ParseFloat(string(number), 64)
if err == nil {
*(*interface{})(ptr) = f64
return
}
iter.ReportError("DecodeNumber", err.Error())
default:
*(*interface{})(ptr) = iter.Read()
}
}
// CaseSensitiveJSONIterator returns a jsoniterator API that's configured to be
// case-sensitive when unmarshalling, and otherwise compatible with
// the encoding/json standard library.
func CaseSensitiveJSONIterator() jsoniter.API {
config := jsoniter.Config{
EscapeHTML: true,
SortMapKeys: true,
ValidateJsonRawMessage: true,
CaseSensitive: true,
}.Froze()
// Force jsoniter to decode number to interface{} via int64/float64, if possible.
config.RegisterExtension(&customNumberExtension{})
return config
}
// 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 {
if len(actual.Kind) == 0 {
@ -237,8 +163,11 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
types, _, err := s.typer.ObjectKinds(into)
switch {
case runtime.IsNotRegisteredError(err), isUnstructured:
if err := caseSensitiveJSONIterator.Unmarshal(data, into); err != nil {
strictErrs, err := s.unmarshal(into, data, originalData)
if err != nil {
return nil, actual, err
} else if len(strictErrs) > 0 {
return into, actual, runtime.NewStrictDecodingError(strictErrs)
}
return into, actual, nil
case err != nil:
@ -261,35 +190,12 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
return nil, actual, err
}
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)
strictErrs, err := s.unmarshal(obj, data, originalData)
if err != nil {
return nil, actual, runtime.NewStrictDecodingError(err.Error(), string(originalData))
return nil, actual, err
} else if len(strictErrs) > 0 {
return obj, actual, runtime.NewStrictDecodingError(strictErrs)
}
// 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
}
@ -303,7 +209,7 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
if s.options.Yaml {
json, err := caseSensitiveJSONIterator.Marshal(obj)
json, err := json.Marshal(obj)
if err != nil {
return err
}
@ -316,7 +222,7 @@ func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
}
if s.options.Pretty {
data, err := caseSensitiveJSONIterator.MarshalIndent(obj, "", " ")
data, err := json.MarshalIndent(obj, "", " ")
if err != nil {
return err
}
@ -327,6 +233,50 @@ func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
return encoder.Encode(obj)
}
// IsStrict indicates whether the serializer
// uses strict decoding or not
func (s *Serializer) IsStrict() bool {
return s.options.Strict
}
func (s *Serializer) unmarshal(into runtime.Object, data, originalData []byte) (strictErrs []error, err error) {
// If the deserializer is non-strict, return here.
if !s.options.Strict {
if err := kjson.UnmarshalCaseSensitivePreserveInts(data, into); err != nil {
return nil, err
}
return nil, nil
}
if s.options.Yaml {
// In strict mode pass the original data through the YAMLToJSONStrict converter.
// This is done to catch duplicate fields in YAML that would have been dropped in the original YAMLToJSON conversion.
// TODO: rework YAMLToJSONStrict to return warnings about duplicate fields without terminating so we don't have to do this twice.
_, err := yaml.YAMLToJSONStrict(originalData)
if err != nil {
strictErrs = append(strictErrs, err)
}
}
var strictJSONErrs []error
if u, isUnstructured := into.(runtime.Unstructured); isUnstructured {
// Unstructured is a custom unmarshaler that gets delegated
// to, so inorder to detect strict JSON errors we need
// to unmarshal directly into the object.
m := u.UnstructuredContent()
strictJSONErrs, err = kjson.UnmarshalStrict(data, &m)
u.SetUnstructuredContent(m)
} else {
strictJSONErrs, err = kjson.UnmarshalStrict(data, into)
}
if err != nil {
// fatal decoding error, not due to strictness
return nil, err
}
strictErrs = append(strictErrs, strictJSONErrs...)
return strictErrs, nil
}
// Identifier implements runtime.Encoder interface.
func (s *Serializer) Identifier() runtime.Identifier {
return s.identifier

View File

@ -109,10 +109,16 @@ func (d *decoder) Decode(data []byte, gvk *schema.GroupVersionKind, into runtime
for _, r := range skipped {
out, actual, err := r.Decode(data, gvk, into)
if err != nil {
lastErr = err
continue
// if we got an object back from the decoder, and the
// error was a strict decoding error (e.g. unknown or
// duplicate fields), we still consider the recognizer
// to have understood the object
if out == nil || !runtime.IsStrictDecodingError(err) {
lastErr = err
continue
}
}
return out, actual, nil
return out, actual, err
}
if lastErr == nil {

View File

@ -90,7 +90,6 @@ func (d *decoder) Decode(defaults *schema.GroupVersionKind, into runtime.Object)
}
// must read the rest of the frame (until we stop getting ErrShortBuffer)
d.resetRead = true
base = 0
return nil, nil, ErrObjectTooLarge
}
if err != nil {

View File

@ -133,11 +133,18 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
}
}
var strictDecodingErr error
obj, gvk, err := c.decoder.Decode(data, defaultGVK, decodeInto)
if err != nil {
return nil, gvk, err
if obj != nil && runtime.IsStrictDecodingError(err) {
// save the strictDecodingError and the caller decide what to do with it
strictDecodingErr = err
} else {
return nil, gvk, err
}
}
// TODO: look into strict handling of nested object decoding
if d, ok := obj.(runtime.NestedObjectDecoder); ok {
if err := d.DecodeNestedObjects(runtime.WithoutVersionDecoder{c.decoder}); err != nil {
return nil, gvk, err
@ -153,14 +160,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 {
return into, gvk, nil
return into, gvk, strictDecodingErr
}
if err := c.convertor.Convert(obj, into, c.decodeVersion); err != nil {
return nil, gvk, err
}
return into, gvk, nil
return into, gvk, strictDecodingErr
}
// perform defaulting if requested
@ -172,7 +179,7 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
if err != nil {
return nil, gvk, err
}
return out, gvk, nil
return out, gvk, strictDecodingErr
}
// Encode ensures the provided object is output in the appropriate group and version, invoking

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*

View File

@ -21,17 +21,17 @@ import (
"sync"
"time"
utilclock "k8s.io/apimachinery/pkg/util/clock"
"k8s.io/utils/clock"
)
// NewExpiring returns an initialized expiring cache.
func NewExpiring() *Expiring {
return NewExpiringWithClock(utilclock.RealClock{})
return NewExpiringWithClock(clock.RealClock{})
}
// NewExpiringWithClock is like NewExpiring but allows passing in a custom
// clock for testing.
func NewExpiringWithClock(clock utilclock.Clock) *Expiring {
func NewExpiringWithClock(clock clock.Clock) *Expiring {
return &Expiring{
clock: clock,
cache: make(map[interface{}]entry),
@ -40,7 +40,7 @@ func NewExpiringWithClock(clock utilclock.Clock) *Expiring {
// Expiring is a map whose entries expire after a per-entry timeout.
type Expiring struct {
clock utilclock.Clock
clock clock.Clock
// mu protects the below fields
mu sync.RWMutex

View File

@ -1,445 +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 clock
import (
"sync"
"time"
)
// PassiveClock allows for injecting fake or real clocks into code
// that needs to read the current time but does not support scheduling
// activity in the future.
type PassiveClock interface {
Now() time.Time
Since(time.Time) time.Duration
}
// Clock allows for injecting fake or real clocks into code that
// needs to do arbitrary things based on time.
type Clock interface {
PassiveClock
After(time.Duration) <-chan time.Time
AfterFunc(time.Duration, func()) Timer
NewTimer(time.Duration) Timer
Sleep(time.Duration)
NewTicker(time.Duration) Ticker
}
// RealClock really calls time.Now()
type RealClock struct{}
// Now returns the current time.
func (RealClock) Now() time.Time {
return time.Now()
}
// Since returns time since the specified timestamp.
func (RealClock) Since(ts time.Time) time.Duration {
return time.Since(ts)
}
// After is the same as time.After(d).
func (RealClock) After(d time.Duration) <-chan time.Time {
return time.After(d)
}
// AfterFunc is the same as time.AfterFunc(d, f).
func (RealClock) AfterFunc(d time.Duration, f func()) Timer {
return &realTimer{
timer: time.AfterFunc(d, f),
}
}
// NewTimer returns a new Timer.
func (RealClock) NewTimer(d time.Duration) Timer {
return &realTimer{
timer: time.NewTimer(d),
}
}
// NewTicker returns a new Ticker.
func (RealClock) NewTicker(d time.Duration) Ticker {
return &realTicker{
ticker: time.NewTicker(d),
}
}
// Sleep pauses the RealClock for duration d.
func (RealClock) Sleep(d time.Duration) {
time.Sleep(d)
}
// FakePassiveClock implements PassiveClock, but returns an arbitrary time.
type FakePassiveClock struct {
lock sync.RWMutex
time time.Time
}
// FakeClock implements Clock, but returns an arbitrary time.
type FakeClock struct {
FakePassiveClock
// waiters are waiting for the fake time to pass their specified time
waiters []fakeClockWaiter
}
type fakeClockWaiter struct {
targetTime time.Time
stepInterval time.Duration
skipIfBlocked bool
destChan chan time.Time
afterFunc func()
}
// NewFakePassiveClock returns a new FakePassiveClock.
func NewFakePassiveClock(t time.Time) *FakePassiveClock {
return &FakePassiveClock{
time: t,
}
}
// NewFakeClock returns a new FakeClock
func NewFakeClock(t time.Time) *FakeClock {
return &FakeClock{
FakePassiveClock: *NewFakePassiveClock(t),
}
}
// Now returns f's time.
func (f *FakePassiveClock) Now() time.Time {
f.lock.RLock()
defer f.lock.RUnlock()
return f.time
}
// Since returns time since the time in f.
func (f *FakePassiveClock) Since(ts time.Time) time.Duration {
f.lock.RLock()
defer f.lock.RUnlock()
return f.time.Sub(ts)
}
// SetTime sets the time on the FakePassiveClock.
func (f *FakePassiveClock) SetTime(t time.Time) {
f.lock.Lock()
defer f.lock.Unlock()
f.time = t
}
// After is the Fake version of time.After(d).
func (f *FakeClock) After(d time.Duration) <-chan time.Time {
f.lock.Lock()
defer f.lock.Unlock()
stopTime := f.time.Add(d)
ch := make(chan time.Time, 1) // Don't block!
f.waiters = append(f.waiters, fakeClockWaiter{
targetTime: stopTime,
destChan: ch,
})
return ch
}
// AfterFunc is the Fake version of time.AfterFunc(d, callback).
func (f *FakeClock) AfterFunc(d time.Duration, cb func()) Timer {
f.lock.Lock()
defer f.lock.Unlock()
stopTime := f.time.Add(d)
ch := make(chan time.Time, 1) // Don't block!
timer := &fakeTimer{
fakeClock: f,
waiter: fakeClockWaiter{
targetTime: stopTime,
destChan: ch,
afterFunc: cb,
},
}
f.waiters = append(f.waiters, timer.waiter)
return timer
}
// NewTimer is the Fake version of time.NewTimer(d).
func (f *FakeClock) NewTimer(d time.Duration) Timer {
f.lock.Lock()
defer f.lock.Unlock()
stopTime := f.time.Add(d)
ch := make(chan time.Time, 1) // Don't block!
timer := &fakeTimer{
fakeClock: f,
waiter: fakeClockWaiter{
targetTime: stopTime,
destChan: ch,
},
}
f.waiters = append(f.waiters, timer.waiter)
return timer
}
// NewTicker returns a new Ticker.
func (f *FakeClock) NewTicker(d time.Duration) Ticker {
f.lock.Lock()
defer f.lock.Unlock()
tickTime := f.time.Add(d)
ch := make(chan time.Time, 1) // hold one tick
f.waiters = append(f.waiters, fakeClockWaiter{
targetTime: tickTime,
stepInterval: d,
skipIfBlocked: true,
destChan: ch,
})
return &fakeTicker{
c: ch,
}
}
// Step moves clock by Duration, notifies anyone that's called After, Tick, or NewTimer
func (f *FakeClock) Step(d time.Duration) {
f.lock.Lock()
defer f.lock.Unlock()
f.setTimeLocked(f.time.Add(d))
}
// SetTime sets the time on a FakeClock.
func (f *FakeClock) SetTime(t time.Time) {
f.lock.Lock()
defer f.lock.Unlock()
f.setTimeLocked(t)
}
// Actually changes the time and checks any waiters. f must be write-locked.
func (f *FakeClock) setTimeLocked(t time.Time) {
f.time = t
newWaiters := make([]fakeClockWaiter, 0, len(f.waiters))
for i := range f.waiters {
w := &f.waiters[i]
if !w.targetTime.After(t) {
if w.skipIfBlocked {
select {
case w.destChan <- t:
default:
}
} else {
w.destChan <- t
}
if w.afterFunc != nil {
w.afterFunc()
}
if w.stepInterval > 0 {
for !w.targetTime.After(t) {
w.targetTime = w.targetTime.Add(w.stepInterval)
}
newWaiters = append(newWaiters, *w)
}
} else {
newWaiters = append(newWaiters, f.waiters[i])
}
}
f.waiters = newWaiters
}
// HasWaiters returns true if After or AfterFunc has been called on f but not yet satisfied
// (so you can write race-free tests).
func (f *FakeClock) HasWaiters() bool {
f.lock.RLock()
defer f.lock.RUnlock()
return len(f.waiters) > 0
}
// Sleep pauses the FakeClock for duration d.
func (f *FakeClock) Sleep(d time.Duration) {
f.Step(d)
}
// IntervalClock implements Clock, but each invocation of Now steps the clock forward the specified duration
type IntervalClock struct {
Time time.Time
Duration time.Duration
}
// Now returns i's time.
func (i *IntervalClock) Now() time.Time {
i.Time = i.Time.Add(i.Duration)
return i.Time
}
// Since returns time since the time in i.
func (i *IntervalClock) Since(ts time.Time) time.Duration {
return i.Time.Sub(ts)
}
// After is currently unimplemented, will panic.
// TODO: make interval clock use FakeClock so this can be implemented.
func (*IntervalClock) After(d time.Duration) <-chan time.Time {
panic("IntervalClock doesn't implement After")
}
// AfterFunc is currently unimplemented, will panic.
// TODO: make interval clock use FakeClock so this can be implemented.
func (*IntervalClock) AfterFunc(d time.Duration, cb func()) Timer {
panic("IntervalClock doesn't implement AfterFunc")
}
// NewTimer is currently unimplemented, will panic.
// TODO: make interval clock use FakeClock so this can be implemented.
func (*IntervalClock) NewTimer(d time.Duration) Timer {
panic("IntervalClock doesn't implement NewTimer")
}
// NewTicker is currently unimplemented, will panic.
// TODO: make interval clock use FakeClock so this can be implemented.
func (*IntervalClock) NewTicker(d time.Duration) Ticker {
panic("IntervalClock doesn't implement NewTicker")
}
// Sleep is currently unimplemented; will panic.
func (*IntervalClock) Sleep(d time.Duration) {
panic("IntervalClock doesn't implement Sleep")
}
// Timer allows for injecting fake or real timers into code that
// needs to do arbitrary things based on time.
type Timer interface {
C() <-chan time.Time
Stop() bool
Reset(d time.Duration) bool
}
// realTimer is backed by an actual time.Timer.
type realTimer struct {
timer *time.Timer
}
// C returns the underlying timer's channel.
func (r *realTimer) C() <-chan time.Time {
return r.timer.C
}
// Stop calls Stop() on the underlying timer.
func (r *realTimer) Stop() bool {
return r.timer.Stop()
}
// Reset calls Reset() on the underlying timer.
func (r *realTimer) Reset(d time.Duration) bool {
return r.timer.Reset(d)
}
// fakeTimer implements Timer based on a FakeClock.
type fakeTimer struct {
fakeClock *FakeClock
waiter fakeClockWaiter
}
// C returns the channel that notifies when this timer has fired.
func (f *fakeTimer) C() <-chan time.Time {
return f.waiter.destChan
}
// Stop conditionally stops the timer. If the timer has neither fired
// nor been stopped then this call stops the timer and returns true,
// otherwise this call returns false. This is like time.Timer::Stop.
func (f *fakeTimer) Stop() bool {
f.fakeClock.lock.Lock()
defer f.fakeClock.lock.Unlock()
// The timer has already fired or been stopped, unless it is found
// among the clock's waiters.
stopped := false
oldWaiters := f.fakeClock.waiters
newWaiters := make([]fakeClockWaiter, 0, len(oldWaiters))
seekChan := f.waiter.destChan
for i := range oldWaiters {
// Identify the timer's fakeClockWaiter by the identity of the
// destination channel, nothing else is necessarily unique and
// constant since the timer's creation.
if oldWaiters[i].destChan == seekChan {
stopped = true
} else {
newWaiters = append(newWaiters, oldWaiters[i])
}
}
f.fakeClock.waiters = newWaiters
return stopped
}
// Reset conditionally updates the firing time of the timer. If the
// timer has neither fired nor been stopped then this call resets the
// timer to the fake clock's "now" + d and returns true, otherwise
// it creates a new waiter, adds it to the clock, and returns true.
//
// It is not possible to return false, because a fake timer can be reset
// from any state (waiting to fire, already fired, and stopped).
//
// See the GoDoc for time.Timer::Reset for more context on why
// the return value of Reset() is not useful.
func (f *fakeTimer) Reset(d time.Duration) bool {
f.fakeClock.lock.Lock()
defer f.fakeClock.lock.Unlock()
waiters := f.fakeClock.waiters
seekChan := f.waiter.destChan
for i := range waiters {
if waiters[i].destChan == seekChan {
waiters[i].targetTime = f.fakeClock.time.Add(d)
return true
}
}
// No existing waiter, timer has already fired or been reset.
// We should still enable Reset() to succeed by creating a
// new waiter and adding it to the clock's waiters.
newWaiter := fakeClockWaiter{
targetTime: f.fakeClock.time.Add(d),
destChan: seekChan,
}
f.fakeClock.waiters = append(f.fakeClock.waiters, newWaiter)
return true
}
// Ticker defines the Ticker interface
type Ticker interface {
C() <-chan time.Time
Stop()
}
type realTicker struct {
ticker *time.Ticker
}
func (t *realTicker) C() <-chan time.Time {
return t.ticker.C
}
func (t *realTicker) Stop() {
t.ticker.Stop()
}
type fakeTicker struct {
c <-chan time.Time
}
func (t *fakeTicker) C() <-chan time.Time {
return t.c
}
func (t *fakeTicker) Stop() {
}

View File

@ -132,14 +132,14 @@ func (r *jsonFrameReader) Read(data []byte) (int, error) {
// Return whatever remaining data exists from an in progress frame
if n := len(r.remaining); n > 0 {
if n <= len(data) {
//lint:ignore SA4006,SA4010 underlying array of data is modified here.
//nolint:staticcheck // SA4006,SA4010 underlying array of data is modified here.
data = append(data[0:0], r.remaining...)
r.remaining = nil
return n, nil
}
n = len(data)
//lint:ignore SA4006,SA4010 underlying array of data is modified here.
//nolint:staticcheck // SA4006,SA4010 underlying array of data is modified here.
data = append(data[0:0], r.remaining[:n]...)
r.remaining = r.remaining[n:]
return n, io.ErrShortBuffer
@ -157,7 +157,7 @@ func (r *jsonFrameReader) Read(data []byte) (int, error) {
// and set m to it, which means we need to copy the partial result back into data and preserve
// the remaining result for subsequent reads.
if len(m) > n {
//lint:ignore SA4006,SA4010 underlying array of data is modified here.
//nolint:staticcheck // SA4006,SA4010 underlying array of data is modified here.
data = append(data[0:0], m[:n]...)
r.remaining = m[n:]
return n, io.ErrShortBuffer

View File

@ -183,10 +183,10 @@ func (s *SpdyRoundTripper) dial(req *http.Request) (net.Conn, error) {
return nil, err
}
//lint:ignore SA1019 ignore deprecated httputil.NewProxyClientConn
//nolint:staticcheck // SA1019 ignore deprecated httputil.NewProxyClientConn
proxyClientConn := httputil.NewProxyClientConn(proxyDialConn, nil)
_, err = proxyClientConn.Do(&proxyReq)
//lint:ignore SA1019 ignore deprecated httputil.ErrPersistEOF: it might be
//nolint:staticcheck // SA1019 ignore deprecated httputil.ErrPersistEOF: it might be
// returned from the invocation of proxyClientConn.Do
if err != nil && err != httputil.ErrPersistEOF {
return nil, err

View File

@ -1,3 +1,4 @@
//go:build !notest
// +build !notest
/*

View File

@ -17,10 +17,11 @@ limitations under the License.
package json
import (
"bytes"
"encoding/json"
"fmt"
"io"
kjson "sigs.k8s.io/json"
)
// NewEncoder delegates to json.NewEncoder
@ -38,50 +39,11 @@ func Marshal(v interface{}) ([]byte, error) {
// limit recursive depth to prevent stack overflow errors
const maxDepth = 10000
// Unmarshal unmarshals the given data
// If v is a *map[string]interface{}, *[]interface{}, or *interface{} numbers
// are converted to int64 or float64
// Unmarshal unmarshals the given data.
// Object keys are case-sensitive.
// Numbers decoded into interface{} fields are converted to int64 or float64.
func Unmarshal(data []byte, v interface{}) error {
switch v := v.(type) {
case *map[string]interface{}:
// Build a decoder from the given data
decoder := json.NewDecoder(bytes.NewBuffer(data))
// Preserve numbers, rather than casting to float64 automatically
decoder.UseNumber()
// Run the decode
if err := decoder.Decode(v); err != nil {
return err
}
// If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64
return ConvertMapNumbers(*v, 0)
case *[]interface{}:
// Build a decoder from the given data
decoder := json.NewDecoder(bytes.NewBuffer(data))
// Preserve numbers, rather than casting to float64 automatically
decoder.UseNumber()
// Run the decode
if err := decoder.Decode(v); err != nil {
return err
}
// If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64
return ConvertSliceNumbers(*v, 0)
case *interface{}:
// Build a decoder from the given data
decoder := json.NewDecoder(bytes.NewBuffer(data))
// Preserve numbers, rather than casting to float64 automatically
decoder.UseNumber()
// Run the decode
if err := decoder.Decode(v); err != nil {
return err
}
// If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64
return ConvertInterfaceNumbers(v, 0)
default:
return json.Unmarshal(data, v)
}
return kjson.UnmarshalCaseSensitivePreserveInts(data, v)
}
// ConvertInterfaceNumbers converts any json.Number values to int64 or float64.

View File

@ -75,6 +75,13 @@ func ExtractInto(object runtime.Object, objectType typed.ParseableType, fieldMan
if !ok {
return fmt.Errorf("unable to convert managed fields for %s to unstructured, expected map, got %T", fieldManager, u)
}
// set the type meta manually if it doesn't exist to avoid missing kind errors
// when decoding from unstructured JSON
if _, ok := m["kind"]; !ok && object.GetObjectKind().GroupVersionKind().Kind != "" {
m["kind"] = object.GetObjectKind().GroupVersionKind().Kind
m["apiVersion"] = object.GetObjectKind().GroupVersionKind().GroupVersion().String()
}
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(m, applyConfiguration); err != nil {
return fmt.Errorf("error extracting into obj from unstructured: %w", err)
}

View File

@ -0,0 +1,127 @@
/*
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.
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 managedfields
import (
"fmt"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/kube-openapi/pkg/schemaconv"
"k8s.io/kube-openapi/pkg/util/proto"
"sigs.k8s.io/structured-merge-diff/v4/typed"
)
// groupVersionKindExtensionKey is the key used to lookup the
// GroupVersionKind value for an object definition from the
// definition's "extensions" map.
const groupVersionKindExtensionKey = "x-kubernetes-group-version-kind"
// GvkParser contains a Parser that allows introspecting the schema.
type GvkParser struct {
gvks map[schema.GroupVersionKind]string
parser typed.Parser
}
// Type returns a helper which can produce objects of the given type. Any
// errors are deferred until a further function is called.
func (p *GvkParser) Type(gvk schema.GroupVersionKind) *typed.ParseableType {
typeName, ok := p.gvks[gvk]
if !ok {
return nil
}
t := p.parser.Type(typeName)
return &t
}
// NewGVKParser builds a GVKParser from a proto.Models. This
// will automatically find the proper version of the object, and the
// corresponding schema information.
func NewGVKParser(models proto.Models, preserveUnknownFields bool) (*GvkParser, error) {
typeSchema, err := schemaconv.ToSchemaWithPreserveUnknownFields(models, preserveUnknownFields)
if err != nil {
return nil, fmt.Errorf("failed to convert models to schema: %v", err)
}
parser := GvkParser{
gvks: map[schema.GroupVersionKind]string{},
}
parser.parser = typed.Parser{Schema: *typeSchema}
for _, modelName := range models.ListModels() {
model := models.LookupModel(modelName)
if model == nil {
panic(fmt.Sprintf("ListModels returns a model that can't be looked-up for: %v", modelName))
}
gvkList := parseGroupVersionKind(model)
for _, gvk := range gvkList {
if len(gvk.Kind) > 0 {
_, ok := parser.gvks[gvk]
if ok {
return nil, fmt.Errorf("duplicate entry for %v", gvk)
}
parser.gvks[gvk] = modelName
}
}
}
return &parser, nil
}
// Get and parse GroupVersionKind from the extension. Returns empty if it doesn't have one.
func parseGroupVersionKind(s proto.Schema) []schema.GroupVersionKind {
extensions := s.GetExtensions()
gvkListResult := []schema.GroupVersionKind{}
// Get the extensions
gvkExtension, ok := extensions[groupVersionKindExtensionKey]
if !ok {
return []schema.GroupVersionKind{}
}
// gvk extension must be a list of at least 1 element.
gvkList, ok := gvkExtension.([]interface{})
if !ok {
return []schema.GroupVersionKind{}
}
for _, gvk := range gvkList {
// gvk extension list must be a map with group, version, and
// kind fields
gvkMap, ok := gvk.(map[interface{}]interface{})
if !ok {
continue
}
group, ok := gvkMap["group"].(string)
if !ok {
continue
}
version, ok := gvkMap["version"].(string)
if !ok {
continue
}
kind, ok := gvkMap["kind"].(string)
if !ok {
continue
}
gvkListResult = append(gvkListResult, schema.GroupVersionKind{
Group: group,
Version: version,
Kind: kind,
})
}
return gvkListResult
}

View File

@ -39,6 +39,7 @@ import (
"golang.org/x/net/http2"
"k8s.io/klog/v2"
netutils "k8s.io/utils/net"
)
// JoinPreservingTrailingSlash does a path.Join of the specified elements,
@ -237,6 +238,29 @@ func DialerFor(transport http.RoundTripper) (DialFunc, error) {
}
}
// CloseIdleConnectionsFor close idles connections for the Transport.
// If the Transport is wrapped it iterates over the wrapped round trippers
// until it finds one that implements the CloseIdleConnections method.
// If the Transport does not have a CloseIdleConnections method
// then this function does nothing.
func CloseIdleConnectionsFor(transport http.RoundTripper) {
if transport == nil {
return
}
type closeIdler interface {
CloseIdleConnections()
}
switch transport := transport.(type) {
case closeIdler:
transport.CloseIdleConnections()
case RoundTripperWrapper:
CloseIdleConnectionsFor(transport.WrappedRoundTripper())
default:
klog.Warningf("unknown transport type: %T", transport)
}
}
type TLSClientConfigHolder interface {
TLSClientConfig() *tls.Config
}
@ -289,7 +313,7 @@ func SourceIPs(req *http.Request) []net.IP {
// Use the first valid one.
parts := strings.Split(hdrForwardedFor, ",")
for _, part := range parts {
ip := net.ParseIP(strings.TrimSpace(part))
ip := netutils.ParseIPSloppy(strings.TrimSpace(part))
if ip != nil {
srcIPs = append(srcIPs, ip)
}
@ -299,7 +323,7 @@ func SourceIPs(req *http.Request) []net.IP {
// Try the X-Real-Ip header.
hdrRealIp := hdr.Get("X-Real-Ip")
if hdrRealIp != "" {
ip := net.ParseIP(hdrRealIp)
ip := netutils.ParseIPSloppy(hdrRealIp)
// Only append the X-Real-Ip if it's not already contained in the X-Forwarded-For chain.
if ip != nil && !containsIP(srcIPs, ip) {
srcIPs = append(srcIPs, ip)
@ -311,11 +335,11 @@ func SourceIPs(req *http.Request) []net.IP {
// Remote Address in Go's HTTP server is in the form host:port so we need to split that first.
host, _, err := net.SplitHostPort(req.RemoteAddr)
if err == nil {
remoteIP = net.ParseIP(host)
remoteIP = netutils.ParseIPSloppy(host)
}
// Fallback if Remote Address was just IP.
if remoteIP == nil {
remoteIP = net.ParseIP(req.RemoteAddr)
remoteIP = netutils.ParseIPSloppy(req.RemoteAddr)
}
// Don't duplicate remote IP if it's already the last address in the chain.
@ -382,7 +406,7 @@ func NewProxierWithNoProxyCIDR(delegate func(req *http.Request) (*url.URL, error
cidrs := []*net.IPNet{}
for _, noProxyRule := range noProxyRules {
_, cidr, _ := net.ParseCIDR(noProxyRule)
_, cidr, _ := netutils.ParseCIDRSloppy(noProxyRule)
if cidr != nil {
cidrs = append(cidrs, cidr)
}
@ -393,7 +417,7 @@ func NewProxierWithNoProxyCIDR(delegate func(req *http.Request) (*url.URL, error
}
return func(req *http.Request) (*url.URL, error) {
ip := net.ParseIP(req.URL.Hostname())
ip := netutils.ParseIPSloppy(req.URL.Hostname())
if ip == nil {
return delegate(req)
}

View File

@ -27,6 +27,7 @@ import (
"strings"
"k8s.io/klog/v2"
netutils "k8s.io/utils/net"
)
type AddressFamily uint
@ -221,7 +222,7 @@ func getMatchingGlobalIP(addrs []net.Addr, family AddressFamily) (net.IP, error)
if len(addrs) > 0 {
for i := range addrs {
klog.V(4).Infof("Checking addr %s.", addrs[i].String())
ip, _, err := net.ParseCIDR(addrs[i].String())
ip, _, err := netutils.ParseCIDRSloppy(addrs[i].String())
if err != nil {
return nil, err
}
@ -336,7 +337,7 @@ func chooseIPFromHostInterfaces(nw networkInterfacer, addressFamilies AddressFam
continue
}
for _, addr := range addrs {
ip, _, err := net.ParseCIDR(addr.String())
ip, _, err := netutils.ParseCIDRSloppy(addr.String())
if err != nil {
return nil, fmt.Errorf("Unable to parse CIDR for interface %q: %s", intf.Name, err)
}

View File

@ -31,22 +31,22 @@ type PatchMeta struct {
patchMergeKey string
}
func (pm PatchMeta) GetPatchStrategies() []string {
func (pm *PatchMeta) GetPatchStrategies() []string {
if pm.patchStrategies == nil {
return []string{}
}
return pm.patchStrategies
}
func (pm PatchMeta) SetPatchStrategies(ps []string) {
func (pm *PatchMeta) SetPatchStrategies(ps []string) {
pm.patchStrategies = ps
}
func (pm PatchMeta) GetPatchMergeKey() string {
func (pm *PatchMeta) GetPatchMergeKey() string {
return pm.patchMergeKey
}
func (pm PatchMeta) SetPatchMergeKey(pmk string) {
func (pm *PatchMeta) SetPatchMergeKey(pmk string) {
pm.patchMergeKey = pmk
}

View File

@ -1328,15 +1328,19 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
_, ok := original[k]
if !ok {
// If it's not in the original document, just take the patch value.
original[k] = patchV
if !isDeleteList {
// If it's not in the original document, just take the patch value.
original[k] = patchV
}
continue
}
originalType := reflect.TypeOf(original[k])
patchType := reflect.TypeOf(patchV)
if originalType != patchType {
original[k] = patchV
if !isDeleteList {
original[k] = patchV
}
continue
}
// If they're both maps or lists, recurse into the value.

View File

@ -239,6 +239,9 @@ func NewErrorTypeMatcher(t ErrorType) utilerrors.Matcher {
// ToAggregate converts the ErrorList into an errors.Aggregate.
func (list ErrorList) ToAggregate() utilerrors.Aggregate {
if len(list) == 0 {
return nil
}
errs := make([]error, 0, len(list))
errorMsgs := sets.NewString()
for _, err := range list {

View File

@ -25,6 +25,7 @@ import (
"strings"
"k8s.io/apimachinery/pkg/util/validation/field"
netutils "k8s.io/utils/net"
)
const qnameCharFmt string = "[A-Za-z0-9]"
@ -346,7 +347,7 @@ func IsValidPortName(port string) []string {
// IsValidIP tests that the argument is a valid IP address.
func IsValidIP(value string) []string {
if net.ParseIP(value) == nil {
if netutils.ParseIPSloppy(value) == nil {
return []string{"must be a valid IP address, (e.g. 10.9.8.7 or 2001:db8::ffff)"}
}
return nil
@ -355,7 +356,7 @@ func IsValidIP(value string) []string {
// IsValidIPv4Address tests that the argument is a valid IPv4 address.
func IsValidIPv4Address(fldPath *field.Path, value string) field.ErrorList {
var allErrors field.ErrorList
ip := net.ParseIP(value)
ip := netutils.ParseIPSloppy(value)
if ip == nil || ip.To4() == nil {
allErrors = append(allErrors, field.Invalid(fldPath, value, "must be a valid IPv4 address"))
}
@ -365,7 +366,7 @@ func IsValidIPv4Address(fldPath *field.Path, value string) field.ErrorList {
// IsValidIPv6Address tests that the argument is a valid IPv6 address.
func IsValidIPv6Address(fldPath *field.Path, value string) field.ErrorList {
var allErrors field.ErrorList
ip := net.ParseIP(value)
ip := netutils.ParseIPSloppy(value)
if ip == nil || ip.To4() != nil {
allErrors = append(allErrors, field.Invalid(fldPath, value, "must be a valid IPv6 address"))
}

View File

@ -24,8 +24,8 @@ import (
"sync"
"time"
"k8s.io/apimachinery/pkg/util/clock"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/utils/clock"
)
// For any test of the style:
@ -166,6 +166,9 @@ func BackoffUntil(f func(), backoff BackoffManager, sliding bool, stopCh <-chan
// of every loop to prevent extra executions of f().
select {
case <-stopCh:
if !t.Stop() {
<-t.C()
}
return
case <-t.C():
}

View File

@ -59,6 +59,34 @@ func Unmarshal(data []byte, v interface{}) error {
}
}
// UnmarshalStrict unmarshals the given data
// strictly (erroring when there are duplicate fields).
func UnmarshalStrict(data []byte, v interface{}) error {
preserveIntFloat := func(d *json.Decoder) *json.Decoder {
d.UseNumber()
return d
}
switch v := v.(type) {
case *map[string]interface{}:
if err := yaml.UnmarshalStrict(data, v, preserveIntFloat); err != nil {
return err
}
return jsonutil.ConvertMapNumbers(*v, 0)
case *[]interface{}:
if err := yaml.UnmarshalStrict(data, v, preserveIntFloat); err != nil {
return err
}
return jsonutil.ConvertSliceNumbers(*v, 0)
case *interface{}:
if err := yaml.UnmarshalStrict(data, v, preserveIntFloat); err != nil {
return err
}
return jsonutil.ConvertInterfaceNumbers(v, 0)
default:
return yaml.UnmarshalStrict(data, v)
}
}
// ToJSON converts a single YAML document into a JSON document
// or returns an error. If the document appears to be JSON the
// YAML decoding path is not used (so that error messages are

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*