mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
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:
committed by
mergify[bot]
parent
42403e2ba7
commit
5762da3e91
199
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
199
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
@ -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.
|
||||
|
8
vendor/k8s.io/apimachinery/pkg/api/meta/firsthit_restmapper.go
generated
vendored
8
vendor/k8s.io/apimachinery/pkg/api/meta/firsthit_restmapper.go
generated
vendored
@ -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 {
|
||||
|
9
vendor/k8s.io/apimachinery/pkg/api/meta/interfaces.go
generated
vendored
9
vendor/k8s.io/apimachinery/pkg/api/meta/interfaces.go
generated
vendored
@ -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()
|
||||
}
|
||||
|
12
vendor/k8s.io/apimachinery/pkg/api/meta/lazy.go
generated
vendored
12
vendor/k8s.io/apimachinery/pkg/api/meta/lazy.go
generated
vendored
@ -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)
|
||||
}
|
||||
}
|
||||
|
12
vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper.go
generated
vendored
12
vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper.go
generated
vendored
@ -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)
|
||||
}
|
||||
}
|
||||
|
8
vendor/k8s.io/apimachinery/pkg/api/meta/priority.go
generated
vendored
8
vendor/k8s.io/apimachinery/pkg/api/meta/priority.go
generated
vendored
@ -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)
|
||||
}
|
||||
|
9
vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go
generated
vendored
9
vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go
generated
vendored
@ -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
|
||||
}
|
||||
|
57
vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
generated
vendored
57
vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
generated
vendored
@ -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, 0xa6, 0xd6, 0x07,
|
||||
0x21, 0x87, 0xea, 0xf6, 0x51, 0x1b, 0x3f, 0x0f, 0xa5, 0xac, 0xdc, 0x42, 0x69, 0xa7, 0x9d, 0x4a,
|
||||
0x71, 0x19, 0x3e, 0x12, 0x25, 0x48, 0xd3, 0xf1, 0xe8, 0xdd, 0x34, 0x1b, 0xbd, 0x86, 0xc2, 0x7a,
|
||||
0xe3, 0x97, 0xe3, 0xeb, 0xec, 0xa2, 0xf5, 0x6c, 0xac, 0xbe, 0x11, 0x13, 0xf1, 0x70, 0xf9, 0x76,
|
||||
0xa2, 0xa7, 0xab, 0xef, 0x4d, 0x0e, 0x5f, 0x5d, 0x0e, 0xeb, 0x2e, 0x87, 0x4d, 0x97, 0xc3, 0xea,
|
||||
0x67, 0x02, 0xcf, 0x72, 0xdb, 0x23, 0xec, 0x7a, 0x84, 0x7d, 0x8f, 0xb0, 0x8a, 0x28, 0xb6, 0x11,
|
||||
0xc5, 0x2e, 0xa2, 0xd8, 0x47, 0x14, 0xbf, 0x11, 0xc5, 0xfa, 0x0f, 0xe1, 0x7d, 0x34, 0x3c, 0xf6,
|
||||
0x1f, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x08, 0x88, 0x49, 0x0e, 0x01, 0x00, 0x00,
|
||||
// 254 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xf2, 0xcd, 0xb6, 0x28, 0xd6,
|
||||
0xcb, 0xcc, 0xd7, 0xcf, 0x2e, 0x4d, 0x4a, 0x2d, 0xca, 0x4b, 0x2d, 0x49, 0x2d, 0xd6, 0x2f, 0x4b,
|
||||
0xcd, 0x4b, 0xc9, 0x2f, 0xd2, 0x87, 0x4a, 0x24, 0x16, 0x64, 0xe6, 0x26, 0x26, 0x67, 0x64, 0xe6,
|
||||
0xa5, 0x16, 0x55, 0xea, 0x17, 0x64, 0xa7, 0x83, 0x04, 0xf4, 0x8b, 0x52, 0x8b, 0xf3, 0x4b, 0x8b,
|
||||
0x92, 0x53, 0xf5, 0xd3, 0x53, 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,
|
||||
}
|
||||
|
12
vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
generated
vendored
12
vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
generated
vendored
@ -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;
|
||||
}
|
||||
|
||||
|
39
vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
generated
vendored
39
vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
generated
vendored
@ -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"
|
||||
}
|
||||
|
18
vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go
generated
vendored
18
vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go
generated
vendored
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user