3
vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
generated
vendored
3
vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
generated
vendored
@ -17,10 +17,7 @@ reviewers:
|
||||
- saad-ali
|
||||
- janetkuo
|
||||
- tallclair
|
||||
- eparis
|
||||
- dims
|
||||
- hongchaodeng
|
||||
- krousey
|
||||
- cjcullen
|
||||
- david-mcmahon
|
||||
- goltermann
|
||||
|
154
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
154
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
@ -18,6 +18,7 @@ package errors
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"reflect"
|
||||
@ -29,12 +30,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
)
|
||||
|
||||
const (
|
||||
// StatusTooManyRequests means the server experienced too many requests within a
|
||||
// given window and that the client must wait to perform the action again.
|
||||
StatusTooManyRequests = 429
|
||||
)
|
||||
|
||||
// StatusError is an error intended for consumption by a REST API server; it can also be
|
||||
// reconstructed by clients from a REST response. Public to allow easy type switches.
|
||||
type StatusError struct {
|
||||
@ -68,6 +63,28 @@ func (e *StatusError) DebugError() (string, []interface{}) {
|
||||
return "server response object: %#v", []interface{}{e.ErrStatus}
|
||||
}
|
||||
|
||||
// HasStatusCause returns true if the provided error has a details cause
|
||||
// with the provided type name.
|
||||
func HasStatusCause(err error, name metav1.CauseType) bool {
|
||||
_, ok := StatusCause(err, name)
|
||||
return ok
|
||||
}
|
||||
|
||||
// StatusCause returns the named cause from the provided error if it exists and
|
||||
// the error is of the type APIStatus. Otherwise it returns false.
|
||||
func StatusCause(err error, name metav1.CauseType) (metav1.StatusCause, bool) {
|
||||
apierr, ok := err.(APIStatus)
|
||||
if !ok || apierr == nil || apierr.Status().Details == nil {
|
||||
return metav1.StatusCause{}, false
|
||||
}
|
||||
for _, cause := range apierr.Status().Details.Causes {
|
||||
if cause.Type == name {
|
||||
return cause, true
|
||||
}
|
||||
}
|
||||
return metav1.StatusCause{}, false
|
||||
}
|
||||
|
||||
// UnexpectedObjectError can be returned by FromObject if it's passed a non-status object.
|
||||
type UnexpectedObjectError struct {
|
||||
Object runtime.Object
|
||||
@ -199,6 +216,7 @@ func NewApplyConflict(causes []metav1.StatusCause, message string) *StatusError
|
||||
}
|
||||
|
||||
// NewGone returns an error indicating the item no longer available at the server and no forwarding address is known.
|
||||
// DEPRECATED: Please use NewResourceExpired instead.
|
||||
func NewGone(message string) *StatusError {
|
||||
return &StatusError{metav1.Status{
|
||||
Status: metav1.StatusFailure,
|
||||
@ -349,7 +367,7 @@ func NewTimeoutError(message string, retryAfterSeconds int) *StatusError {
|
||||
func NewTooManyRequestsError(message string) *StatusError {
|
||||
return &StatusError{metav1.Status{
|
||||
Status: metav1.StatusFailure,
|
||||
Code: StatusTooManyRequests,
|
||||
Code: http.StatusTooManyRequests,
|
||||
Reason: metav1.StatusReasonTooManyRequests,
|
||||
Message: fmt.Sprintf("Too many requests: %s", message),
|
||||
}}
|
||||
@ -394,7 +412,11 @@ func NewGenericServerResponse(code int, verb string, qualifiedResource schema.Gr
|
||||
case http.StatusNotAcceptable:
|
||||
reason = metav1.StatusReasonNotAcceptable
|
||||
// the server message has details about what types are acceptable
|
||||
message = serverMessage
|
||||
if len(serverMessage) == 0 || serverMessage == "unknown" {
|
||||
message = "the server was unable to respond with a content type that the client supports"
|
||||
} else {
|
||||
message = serverMessage
|
||||
}
|
||||
case http.StatusUnsupportedMediaType:
|
||||
reason = metav1.StatusReasonUnsupportedMediaType
|
||||
// the server message has details about what types are acceptable
|
||||
@ -454,127 +476,141 @@ 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
|
||||
}
|
||||
|
||||
// IsAlreadyExists determines if the err is an error which indicates that a specified resource already exists.
|
||||
// It supports wrapped errors.
|
||||
func IsAlreadyExists(err error) bool {
|
||||
return ReasonForError(err) == metav1.StatusReasonAlreadyExists
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// IsResourceExpired is true if the error indicates the resource has expired and the current action is
|
||||
// no longer possible.
|
||||
// It supports wrapped errors.
|
||||
func IsResourceExpired(err error) bool {
|
||||
return ReasonForError(err) == metav1.StatusReasonExpired
|
||||
}
|
||||
|
||||
// IsNotAcceptable determines if err is an error which indicates that the request failed due to an invalid Accept header
|
||||
// It supports wrapped errors.
|
||||
func IsNotAcceptable(err error) bool {
|
||||
return ReasonForError(err) == metav1.StatusReasonNotAcceptable
|
||||
}
|
||||
|
||||
// IsUnsupportedMediaType determines if err is an error which indicates that the request failed due to an invalid Content-Type header
|
||||
// It supports wrapped errors.
|
||||
func IsUnsupportedMediaType(err error) bool {
|
||||
return ReasonForError(err) == metav1.StatusReasonUnsupportedMediaType
|
||||
}
|
||||
|
||||
// IsMethodNotSupported determines if the err is an error which indicates the provided action could not
|
||||
// be performed because it is not supported by the server.
|
||||
// It supports wrapped errors.
|
||||
func IsMethodNotSupported(err error) bool {
|
||||
return ReasonForError(err) == metav1.StatusReasonMethodNotAllowed
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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 {
|
||||
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
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return true
|
||||
}
|
||||
switch t := err.(type) {
|
||||
case APIStatus:
|
||||
return t.Status().Code == http.StatusTooManyRequests
|
||||
if status := APIStatus(nil); errors.As(err, &status) {
|
||||
return status.Status().Code == http.StatusTooManyRequests
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRequestEntityTooLargeError determines if err is an error which indicates
|
||||
// the request entity is too large.
|
||||
// It supports wrapped errors.
|
||||
func IsRequestEntityTooLargeError(err error) bool {
|
||||
if ReasonForError(err) == metav1.StatusReasonRequestEntityTooLarge {
|
||||
return true
|
||||
}
|
||||
switch t := err.(type) {
|
||||
case APIStatus:
|
||||
return t.Status().Code == http.StatusRequestEntityTooLarge
|
||||
if status := APIStatus(nil); errors.As(err, &status) {
|
||||
return status.Status().Code == http.StatusRequestEntityTooLarge
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsUnexpectedServerError returns true if the server response was not in the expected API format,
|
||||
// and may be the result of another HTTP actor.
|
||||
// It supports wrapped errors.
|
||||
func IsUnexpectedServerError(err error) bool {
|
||||
switch t := err.(type) {
|
||||
case APIStatus:
|
||||
if d := t.Status().Details; d != nil {
|
||||
for _, cause := range d.Causes {
|
||||
if cause.Type == metav1.CauseTypeUnexpectedServerResponse {
|
||||
return true
|
||||
}
|
||||
if status := APIStatus(nil); errors.As(err, &status) && status.Status().Details != nil {
|
||||
for _, cause := range status.Status().Details.Causes {
|
||||
if cause.Type == metav1.CauseTypeUnexpectedServerResponse {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -582,38 +618,80 @@ func IsUnexpectedServerError(err error) bool {
|
||||
}
|
||||
|
||||
// IsUnexpectedObjectError determines if err is due to an unexpected object from the master.
|
||||
// It supports wrapped errors.
|
||||
func IsUnexpectedObjectError(err error) bool {
|
||||
_, ok := err.(*UnexpectedObjectError)
|
||||
return err != nil && ok
|
||||
uoe := &UnexpectedObjectError{}
|
||||
return err != nil && errors.As(err, &uoe)
|
||||
}
|
||||
|
||||
// SuggestsClientDelay returns true if this error suggests a client delay as well as the
|
||||
// suggested seconds to wait, or false if the error does not imply a wait. It does not
|
||||
// address whether the error *should* be retried, since some errors (like a 3xx) may
|
||||
// request delay without retry.
|
||||
// It supports wrapped errors.
|
||||
func SuggestsClientDelay(err error) (int, bool) {
|
||||
switch t := err.(type) {
|
||||
case APIStatus:
|
||||
if t.Status().Details != nil {
|
||||
switch t.Status().Reason {
|
||||
// this StatusReason explicitly requests the caller to delay the action
|
||||
case metav1.StatusReasonServerTimeout:
|
||||
return int(t.Status().Details.RetryAfterSeconds), true
|
||||
}
|
||||
// If the client requests that we retry after a certain number of seconds
|
||||
if t.Status().Details.RetryAfterSeconds > 0 {
|
||||
return int(t.Status().Details.RetryAfterSeconds), true
|
||||
}
|
||||
if t := APIStatus(nil); errors.As(err, &t) && t.Status().Details != nil {
|
||||
switch t.Status().Reason {
|
||||
// this StatusReason explicitly requests the caller to delay the action
|
||||
case metav1.StatusReasonServerTimeout:
|
||||
return int(t.Status().Details.RetryAfterSeconds), true
|
||||
}
|
||||
// If the client requests that we retry after a certain number of seconds
|
||||
if t.Status().Details.RetryAfterSeconds > 0 {
|
||||
return int(t.Status().Details.RetryAfterSeconds), true
|
||||
}
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
// ReasonForError returns the HTTP status for a particular error.
|
||||
// It supports wrapped errors.
|
||||
func ReasonForError(err error) metav1.StatusReason {
|
||||
switch t := err.(type) {
|
||||
case APIStatus:
|
||||
return t.Status().Reason
|
||||
if status := APIStatus(nil); errors.As(err, &status) {
|
||||
return status.Status().Reason
|
||||
}
|
||||
return metav1.StatusReasonUnknown
|
||||
}
|
||||
|
||||
// ErrorReporter converts generic errors into runtime.Object errors without
|
||||
// requiring the caller to take a dependency on meta/v1 (where Status lives).
|
||||
// This prevents circular dependencies in core watch code.
|
||||
type ErrorReporter struct {
|
||||
code int
|
||||
verb string
|
||||
reason string
|
||||
}
|
||||
|
||||
// NewClientErrorReporter will respond with valid v1.Status objects that report
|
||||
// unexpected server responses. Primarily used by watch to report errors when
|
||||
// we attempt to decode a response from the server and it is not in the form
|
||||
// we expect. Because watch is a dependency of the core api, we can't return
|
||||
// meta/v1.Status in that package and so much inject this interface to convert a
|
||||
// generic error as appropriate. The reason is passed as a unique status cause
|
||||
// on the returned status, otherwise the generic "ClientError" is returned.
|
||||
func NewClientErrorReporter(code int, verb string, reason string) *ErrorReporter {
|
||||
return &ErrorReporter{
|
||||
code: code,
|
||||
verb: verb,
|
||||
reason: reason,
|
||||
}
|
||||
}
|
||||
|
||||
// AsObject returns a valid error runtime.Object (a v1.Status) for the given
|
||||
// error, using the code and verb of the reporter type. The error is set to
|
||||
// indicate that this was an unexpected server response.
|
||||
func (r *ErrorReporter) AsObject(err error) runtime.Object {
|
||||
status := NewGenericServerResponse(r.code, r.verb, schema.GroupResource{}, "", err.Error(), 0, true)
|
||||
if status.ErrStatus.Details == nil {
|
||||
status.ErrStatus.Details = &metav1.StatusDetails{}
|
||||
}
|
||||
reason := r.reason
|
||||
if len(reason) == 0 {
|
||||
reason = "ClientError"
|
||||
}
|
||||
status.ErrStatus.Details.Causes = append(status.ErrStatus.Details.Causes, metav1.StatusCause{
|
||||
Type: metav1.CauseType(reason),
|
||||
Message: err.Error(),
|
||||
})
|
||||
return &status.ErrStatus
|
||||
}
|
||||
|
6
vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS
generated
vendored
6
vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS
generated
vendored
@ -14,14 +14,8 @@ reviewers:
|
||||
- gmarek
|
||||
- janetkuo
|
||||
- ncdc
|
||||
- eparis
|
||||
- dims
|
||||
- krousey
|
||||
- markturansky
|
||||
- fabioy
|
||||
- resouer
|
||||
- david-mcmahon
|
||||
- mfojtik
|
||||
- jianhuiz
|
||||
- feihujiang
|
||||
- ghodss
|
||||
|
101
vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go
generated
vendored
Normal file
101
vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
Copyright 2020 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 meta
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// SetStatusCondition sets the corresponding condition in conditions to newCondition.
|
||||
// conditions must be non-nil.
|
||||
// 1. if the condition of the specified type already exists (all fields of the existing condition are updated to
|
||||
// newCondition, LastTransitionTime is set to now if the new status differs from the old status)
|
||||
// 2. if a condition of the specified type does not exist (LastTransitionTime is set to now() if unset, and newCondition is appended)
|
||||
func SetStatusCondition(conditions *[]metav1.Condition, newCondition metav1.Condition) {
|
||||
if conditions == nil {
|
||||
return
|
||||
}
|
||||
existingCondition := FindStatusCondition(*conditions, newCondition.Type)
|
||||
if existingCondition == nil {
|
||||
if newCondition.LastTransitionTime.IsZero() {
|
||||
newCondition.LastTransitionTime = metav1.NewTime(time.Now())
|
||||
}
|
||||
*conditions = append(*conditions, newCondition)
|
||||
return
|
||||
}
|
||||
|
||||
if existingCondition.Status != newCondition.Status {
|
||||
existingCondition.Status = newCondition.Status
|
||||
if !newCondition.LastTransitionTime.IsZero() {
|
||||
existingCondition.LastTransitionTime = newCondition.LastTransitionTime
|
||||
} else {
|
||||
existingCondition.LastTransitionTime = metav1.NewTime(time.Now())
|
||||
}
|
||||
}
|
||||
|
||||
existingCondition.Reason = newCondition.Reason
|
||||
existingCondition.Message = newCondition.Message
|
||||
}
|
||||
|
||||
// RemoveStatusCondition removes the corresponding conditionType from conditions.
|
||||
// conditions must be non-nil.
|
||||
func RemoveStatusCondition(conditions *[]metav1.Condition, conditionType string) {
|
||||
if conditions == nil {
|
||||
return
|
||||
}
|
||||
newConditions := make([]metav1.Condition, 0, len(*conditions)-1)
|
||||
for _, condition := range *conditions {
|
||||
if condition.Type != conditionType {
|
||||
newConditions = append(newConditions, condition)
|
||||
}
|
||||
}
|
||||
|
||||
*conditions = newConditions
|
||||
}
|
||||
|
||||
// FindStatusCondition finds the conditionType in conditions.
|
||||
func FindStatusCondition(conditions []metav1.Condition, conditionType string) *metav1.Condition {
|
||||
for i := range conditions {
|
||||
if conditions[i].Type == conditionType {
|
||||
return &conditions[i]
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsStatusConditionTrue returns true when the conditionType is present and set to `metav1.ConditionTrue`
|
||||
func IsStatusConditionTrue(conditions []metav1.Condition, conditionType string) bool {
|
||||
return IsStatusConditionPresentAndEqual(conditions, conditionType, metav1.ConditionTrue)
|
||||
}
|
||||
|
||||
// IsStatusConditionFalse returns true when the conditionType is present and set to `metav1.ConditionFalse`
|
||||
func IsStatusConditionFalse(conditions []metav1.Condition, conditionType string) bool {
|
||||
return IsStatusConditionPresentAndEqual(conditions, conditionType, metav1.ConditionFalse)
|
||||
}
|
||||
|
||||
// IsStatusConditionPresentAndEqual returns true when conditionType is present and equal to status.
|
||||
func IsStatusConditionPresentAndEqual(conditions []metav1.Condition, conditionType string, status metav1.ConditionStatus) bool {
|
||||
for _, condition := range conditions {
|
||||
if condition.Type == conditionType {
|
||||
return condition.Status == status
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
66
vendor/k8s.io/apimachinery/pkg/api/meta/help.go
generated
vendored
66
vendor/k8s.io/apimachinery/pkg/api/meta/help.go
generated
vendored
@ -17,30 +17,76 @@ limitations under the License.
|
||||
package meta
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// IsListType returns true if the provided Object has a slice called Items
|
||||
var (
|
||||
// isListCache maintains a cache of types that are checked for lists
|
||||
// which is used by IsListType.
|
||||
// TODO: remove and replace with an interface check
|
||||
isListCache = struct {
|
||||
lock sync.RWMutex
|
||||
byType map[reflect.Type]bool
|
||||
}{
|
||||
byType: make(map[reflect.Type]bool, 1024),
|
||||
}
|
||||
)
|
||||
|
||||
// IsListType returns true if the provided Object has a slice called Items.
|
||||
// TODO: Replace the code in this check with an interface comparison by
|
||||
// creating and enforcing that lists implement a list accessor.
|
||||
func IsListType(obj runtime.Object) bool {
|
||||
// if we're a runtime.Unstructured, check whether this is a list.
|
||||
// TODO: refactor GetItemsPtr to use an interface that returns []runtime.Object
|
||||
if unstructured, ok := obj.(runtime.Unstructured); ok {
|
||||
return unstructured.IsList()
|
||||
switch t := obj.(type) {
|
||||
case runtime.Unstructured:
|
||||
return t.IsList()
|
||||
}
|
||||
t := reflect.TypeOf(obj)
|
||||
|
||||
isListCache.lock.RLock()
|
||||
ok, exists := isListCache.byType[t]
|
||||
isListCache.lock.RUnlock()
|
||||
|
||||
if !exists {
|
||||
_, err := getItemsPtr(obj)
|
||||
ok = err == nil
|
||||
|
||||
// cache only the first 1024 types
|
||||
isListCache.lock.Lock()
|
||||
if len(isListCache.byType) < 1024 {
|
||||
isListCache.byType[t] = ok
|
||||
}
|
||||
isListCache.lock.Unlock()
|
||||
}
|
||||
|
||||
_, err := GetItemsPtr(obj)
|
||||
return err == nil
|
||||
return ok
|
||||
}
|
||||
|
||||
var (
|
||||
errExpectFieldItems = errors.New("no Items field in this object")
|
||||
errExpectSliceItems = errors.New("Items field must be a slice of objects")
|
||||
)
|
||||
|
||||
// GetItemsPtr returns a pointer to the list object's Items member.
|
||||
// If 'list' doesn't have an Items member, it's not really a list type
|
||||
// and an error will be returned.
|
||||
// This function will either return a pointer to a slice, or an error, but not both.
|
||||
// TODO: this will be replaced with an interface in the future
|
||||
func GetItemsPtr(list runtime.Object) (interface{}, error) {
|
||||
obj, err := getItemsPtr(list)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%T is not a list: %v", list, err)
|
||||
}
|
||||
return obj, nil
|
||||
}
|
||||
|
||||
// getItemsPtr returns a pointer to the list object's Items member or an error.
|
||||
func getItemsPtr(list runtime.Object) (interface{}, error) {
|
||||
v, err := conversion.EnforcePtr(list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -48,19 +94,19 @@ func GetItemsPtr(list runtime.Object) (interface{}, error) {
|
||||
|
||||
items := v.FieldByName("Items")
|
||||
if !items.IsValid() {
|
||||
return nil, fmt.Errorf("no Items field in %#v", list)
|
||||
return nil, errExpectFieldItems
|
||||
}
|
||||
switch items.Kind() {
|
||||
case reflect.Interface, reflect.Ptr:
|
||||
target := reflect.TypeOf(items.Interface()).Elem()
|
||||
if target.Kind() != reflect.Slice {
|
||||
return nil, fmt.Errorf("items: Expected slice, got %s", target.Kind())
|
||||
return nil, errExpectSliceItems
|
||||
}
|
||||
return items.Interface(), nil
|
||||
case reflect.Slice:
|
||||
return items.Addr().Interface(), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("items: Expected slice, got %s", items.Kind())
|
||||
return nil, errExpectSliceItems
|
||||
}
|
||||
}
|
||||
|
||||
|
10
vendor/k8s.io/apimachinery/pkg/api/meta/meta.go
generated
vendored
10
vendor/k8s.io/apimachinery/pkg/api/meta/meta.go
generated
vendored
@ -21,12 +21,11 @@ import (
|
||||
"reflect"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// errNotList is returned when an object implements the Object style interfaces but not the List style
|
||||
@ -114,12 +113,12 @@ func Accessor(obj interface{}) (metav1.Object, error) {
|
||||
|
||||
// AsPartialObjectMetadata takes the metav1 interface and returns a partial object.
|
||||
// TODO: consider making this solely a conversion action.
|
||||
func AsPartialObjectMetadata(m metav1.Object) *metav1beta1.PartialObjectMetadata {
|
||||
func AsPartialObjectMetadata(m metav1.Object) *metav1.PartialObjectMetadata {
|
||||
switch t := m.(type) {
|
||||
case *metav1.ObjectMeta:
|
||||
return &metav1beta1.PartialObjectMetadata{ObjectMeta: *t}
|
||||
return &metav1.PartialObjectMetadata{ObjectMeta: *t}
|
||||
default:
|
||||
return &metav1beta1.PartialObjectMetadata{
|
||||
return &metav1.PartialObjectMetadata{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: m.GetName(),
|
||||
GenerateName: m.GetGenerateName(),
|
||||
@ -136,7 +135,6 @@ func AsPartialObjectMetadata(m metav1.Object) *metav1beta1.PartialObjectMetadata
|
||||
OwnerReferences: m.GetOwnerReferences(),
|
||||
Finalizers: m.GetFinalizers(),
|
||||
ClusterName: m.GetClusterName(),
|
||||
Initializers: m.GetInitializers(),
|
||||
ManagedFields: m.GetManagedFields(),
|
||||
},
|
||||
}
|
||||
|
5
vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS
generated
vendored
5
vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS
generated
vendored
@ -9,10 +9,5 @@ reviewers:
|
||||
- mikedanese
|
||||
- saad-ali
|
||||
- janetkuo
|
||||
- tallclair
|
||||
- eparis
|
||||
- jbeda
|
||||
- xiang90
|
||||
- mbohlool
|
||||
- david-mcmahon
|
||||
- goltermann
|
||||
|
44
vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
generated
vendored
44
vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
generated
vendored
@ -17,23 +17,14 @@ limitations under the License.
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
|
||||
|
||||
/*
|
||||
Package resource is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Quantity
|
||||
*/
|
||||
package resource
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
|
||||
math "math"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -45,21 +36,40 @@ var _ = math.Inf
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
func (m *Quantity) Reset() { *m = Quantity{} }
|
||||
func (*Quantity) ProtoMessage() {}
|
||||
func (*Quantity) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
func (m *Quantity) Reset() { *m = Quantity{} }
|
||||
func (*Quantity) ProtoMessage() {}
|
||||
func (*Quantity) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_612bba87bd70906c, []int{0}
|
||||
}
|
||||
func (m *Quantity) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Quantity.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Quantity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Quantity.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Quantity) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Quantity.Merge(m, src)
|
||||
}
|
||||
func (m *Quantity) XXX_Size() int {
|
||||
return xxx_messageInfo_Quantity.Size(m)
|
||||
}
|
||||
func (m *Quantity) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Quantity.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Quantity proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Quantity)(nil), "k8s.io.apimachinery.pkg.api.resource.Quantity")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto", fileDescriptorGenerated)
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto", fileDescriptor_612bba87bd70906c)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
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,
|
||||
|
2
vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
generated
vendored
@ -26,7 +26,7 @@ option go_package = "resource";
|
||||
|
||||
// Quantity is a fixed-point representation of a number.
|
||||
// It provides convenient marshaling/unmarshaling in JSON and YAML,
|
||||
// in addition to String() and Int64() accessors.
|
||||
// in addition to String() and AsInt64() accessors.
|
||||
//
|
||||
// The serialization format is:
|
||||
//
|
||||
|
12
vendor/k8s.io/apimachinery/pkg/api/resource/math.go
generated
vendored
12
vendor/k8s.io/apimachinery/pkg/api/resource/math.go
generated
vendored
@ -37,12 +37,8 @@ var (
|
||||
big1024 = big.NewInt(1024)
|
||||
|
||||
// Commonly needed inf.Dec values-- treat as read only!
|
||||
decZero = inf.NewDec(0, 0)
|
||||
decOne = inf.NewDec(1, 0)
|
||||
decMinusOne = inf.NewDec(-1, 0)
|
||||
decThousand = inf.NewDec(1000, 0)
|
||||
dec1024 = inf.NewDec(1024, 0)
|
||||
decMinus1024 = inf.NewDec(-1024, 0)
|
||||
decZero = inf.NewDec(0, 0)
|
||||
decOne = inf.NewDec(1, 0)
|
||||
|
||||
// Largest (in magnitude) number allowed.
|
||||
maxAllowed = infDecAmount{inf.NewDec((1<<63)-1, 0)} // == max int64
|
||||
@ -194,9 +190,9 @@ func negativeScaleInt64(base int64, scale Scale) (result int64, exact bool) {
|
||||
}
|
||||
if fraction {
|
||||
if base > 0 {
|
||||
value += 1
|
||||
value++
|
||||
} else {
|
||||
value += -1
|
||||
value--
|
||||
}
|
||||
}
|
||||
return value, !fraction
|
||||
|
35
vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
generated
vendored
35
vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
generated
vendored
@ -29,7 +29,7 @@ import (
|
||||
|
||||
// Quantity is a fixed-point representation of a number.
|
||||
// It provides convenient marshaling/unmarshaling in JSON and YAML,
|
||||
// in addition to String() and Int64() accessors.
|
||||
// in addition to String() and AsInt64() accessors.
|
||||
//
|
||||
// The serialization format is:
|
||||
//
|
||||
@ -584,6 +584,12 @@ func (q *Quantity) Neg() {
|
||||
q.d.Dec.Neg(q.d.Dec)
|
||||
}
|
||||
|
||||
// Equal checks equality of two Quantities. This is useful for testing with
|
||||
// cmp.Equal.
|
||||
func (q Quantity) Equal(v Quantity) bool {
|
||||
return q.Cmp(v) == 0
|
||||
}
|
||||
|
||||
// int64QuantityExpectedBytes is the expected width in bytes of the canonical string representation
|
||||
// of most Quantity values.
|
||||
const int64QuantityExpectedBytes = 18
|
||||
@ -628,6 +634,11 @@ func (q Quantity) MarshalJSON() ([]byte, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ToUnstructured implements the value.UnstructuredConverter interface.
|
||||
func (q Quantity) ToUnstructured() interface{} {
|
||||
return q.String()
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaller interface.
|
||||
// TODO: Remove support for leading/trailing whitespace
|
||||
func (q *Quantity) UnmarshalJSON(value []byte) error {
|
||||
@ -691,7 +702,9 @@ func (q *Quantity) MilliValue() int64 {
|
||||
return q.ScaledValue(Milli)
|
||||
}
|
||||
|
||||
// ScaledValue returns the value of ceil(q * 10^scale); this could overflow an int64.
|
||||
// ScaledValue returns the value of ceil(q / 10^scale).
|
||||
// For example, NewQuantity(1, DecimalSI).ScaledValue(Milli) returns 1000.
|
||||
// This could overflow an int64.
|
||||
// To detect overflow, call Value() first and verify the expected magnitude.
|
||||
func (q *Quantity) ScaledValue(scale Scale) int64 {
|
||||
if q.d.Dec == nil {
|
||||
@ -718,21 +731,3 @@ func (q *Quantity) SetScaled(value int64, scale Scale) {
|
||||
q.d.Dec = nil
|
||||
q.i = int64Amount{value: value, scale: scale}
|
||||
}
|
||||
|
||||
// Copy is a convenience function that makes a deep copy for you. Non-deep
|
||||
// copies of quantities share pointers and you will regret that.
|
||||
func (q *Quantity) Copy() *Quantity {
|
||||
if q.d.Dec == nil {
|
||||
return &Quantity{
|
||||
s: q.s,
|
||||
i: q.i,
|
||||
Format: q.Format,
|
||||
}
|
||||
}
|
||||
tmp := &inf.Dec{}
|
||||
return &Quantity{
|
||||
s: q.s,
|
||||
d: infDecAmount{tmp.Set(q.d.Dec)},
|
||||
Format: q.Format,
|
||||
}
|
||||
}
|
||||
|
34
vendor/k8s.io/apimachinery/pkg/api/resource/quantity_proto.go
generated
vendored
34
vendor/k8s.io/apimachinery/pkg/api/resource/quantity_proto.go
generated
vendored
@ -19,6 +19,7 @@ package resource
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"math/bits"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
@ -28,7 +29,7 @@ var _ proto.Sizer = &Quantity{}
|
||||
func (m *Quantity) Marshal() (data []byte, err error) {
|
||||
size := m.Size()
|
||||
data = make([]byte, size)
|
||||
n, err := m.MarshalTo(data)
|
||||
n, err := m.MarshalToSizedBuffer(data[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -38,30 +39,40 @@ func (m *Quantity) Marshal() (data []byte, err error) {
|
||||
// MarshalTo is a customized version of the generated Protobuf unmarshaler for a struct
|
||||
// with a single string field.
|
||||
func (m *Quantity) MarshalTo(data []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(data[:size])
|
||||
}
|
||||
|
||||
// MarshalToSizedBuffer is a customized version of the generated
|
||||
// Protobuf unmarshaler for a struct with a single string field.
|
||||
func (m *Quantity) MarshalToSizedBuffer(data []byte) (int, error) {
|
||||
i := len(data)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
|
||||
data[i] = 0xa
|
||||
i++
|
||||
// BEGIN CUSTOM MARSHAL
|
||||
out := m.String()
|
||||
i -= len(out)
|
||||
copy(data[i:], out)
|
||||
i = encodeVarintGenerated(data, i, uint64(len(out)))
|
||||
i += copy(data[i:], out)
|
||||
// END CUSTOM MARSHAL
|
||||
i--
|
||||
data[i] = 0xa
|
||||
|
||||
return i, nil
|
||||
return len(data) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintGenerated(data []byte, offset int, v uint64) int {
|
||||
offset -= sovGenerated(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
data[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
data[offset] = uint8(v)
|
||||
return offset + 1
|
||||
return base
|
||||
}
|
||||
|
||||
func (m *Quantity) Size() (n int) {
|
||||
@ -77,14 +88,7 @@ func (m *Quantity) Size() (n int) {
|
||||
}
|
||||
|
||||
func sovGenerated(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
return (bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
|
||||
// Unmarshal is a customized version of the generated Protobuf unmarshaler for a struct
|
||||
|
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS
generated
vendored
@ -25,9 +25,7 @@ reviewers:
|
||||
- krousey
|
||||
- mml
|
||||
- mbohlool
|
||||
- david-mcmahon
|
||||
- therc
|
||||
- mqliang
|
||||
- kevin-wangzefeng
|
||||
- jianhuiz
|
||||
- feihujiang
|
||||
|
19
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go
generated
vendored
19
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go
generated
vendored
@ -22,7 +22,7 @@ import (
|
||||
|
||||
// IsControlledBy checks if the object has a controllerRef set to the given owner
|
||||
func IsControlledBy(obj Object, owner Object) bool {
|
||||
ref := GetControllerOf(obj)
|
||||
ref := GetControllerOfNoCopy(obj)
|
||||
if ref == nil {
|
||||
return false
|
||||
}
|
||||
@ -31,9 +31,20 @@ func IsControlledBy(obj Object, owner Object) bool {
|
||||
|
||||
// GetControllerOf returns a pointer to a copy of the controllerRef if controllee has a controller
|
||||
func GetControllerOf(controllee Object) *OwnerReference {
|
||||
for _, ref := range controllee.GetOwnerReferences() {
|
||||
if ref.Controller != nil && *ref.Controller {
|
||||
return &ref
|
||||
ref := GetControllerOfNoCopy(controllee)
|
||||
if ref == nil {
|
||||
return nil
|
||||
}
|
||||
cp := *ref
|
||||
return &cp
|
||||
}
|
||||
|
||||
// GetControllerOf returns a pointer to the controllerRef if controllee has a controller
|
||||
func GetControllerOfNoCopy(controllee Object) *OwnerReference {
|
||||
refs := controllee.GetOwnerReferences()
|
||||
for i := range refs {
|
||||
if refs[i].Controller != nil && *refs[i].Controller {
|
||||
return &refs[i]
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
156
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion.go
generated
vendored
156
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion.go
generated
vendored
@ -18,6 +18,7 @@ package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@ -25,61 +26,10 @@ import (
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
)
|
||||
|
||||
func AddConversionFuncs(scheme *runtime.Scheme) error {
|
||||
return scheme.AddConversionFuncs(
|
||||
Convert_v1_TypeMeta_To_v1_TypeMeta,
|
||||
|
||||
Convert_v1_ListMeta_To_v1_ListMeta,
|
||||
|
||||
Convert_intstr_IntOrString_To_intstr_IntOrString,
|
||||
|
||||
Convert_Pointer_v1_Duration_To_v1_Duration,
|
||||
Convert_v1_Duration_To_Pointer_v1_Duration,
|
||||
|
||||
Convert_Slice_string_To_v1_Time,
|
||||
|
||||
Convert_v1_Time_To_v1_Time,
|
||||
Convert_v1_MicroTime_To_v1_MicroTime,
|
||||
|
||||
Convert_resource_Quantity_To_resource_Quantity,
|
||||
|
||||
Convert_string_To_labels_Selector,
|
||||
Convert_labels_Selector_To_string,
|
||||
|
||||
Convert_string_To_fields_Selector,
|
||||
Convert_fields_Selector_To_string,
|
||||
|
||||
Convert_Pointer_bool_To_bool,
|
||||
Convert_bool_To_Pointer_bool,
|
||||
|
||||
Convert_Pointer_string_To_string,
|
||||
Convert_string_To_Pointer_string,
|
||||
|
||||
Convert_Pointer_int64_To_int,
|
||||
Convert_int_To_Pointer_int64,
|
||||
|
||||
Convert_Pointer_int32_To_int32,
|
||||
Convert_int32_To_Pointer_int32,
|
||||
|
||||
Convert_Pointer_int64_To_int64,
|
||||
Convert_int64_To_Pointer_int64,
|
||||
|
||||
Convert_Pointer_float64_To_float64,
|
||||
Convert_float64_To_Pointer_float64,
|
||||
|
||||
Convert_Map_string_To_string_To_v1_LabelSelector,
|
||||
Convert_v1_LabelSelector_To_Map_string_To_string,
|
||||
|
||||
Convert_Slice_string_To_Slice_int32,
|
||||
|
||||
Convert_Slice_string_To_v1_DeletionPropagation,
|
||||
)
|
||||
}
|
||||
|
||||
func Convert_Pointer_float64_To_float64(in **float64, out *float64, s conversion.Scope) error {
|
||||
if *in == nil {
|
||||
*out = 0
|
||||
@ -192,12 +142,33 @@ func Convert_v1_ListMeta_To_v1_ListMeta(in, out *ListMeta, s conversion.Scope) e
|
||||
return nil
|
||||
}
|
||||
|
||||
// +k8s:conversion-fn=copy-only
|
||||
func Convert_v1_DeleteOptions_To_v1_DeleteOptions(in, out *DeleteOptions, s conversion.Scope) error {
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
|
||||
// +k8s:conversion-fn=copy-only
|
||||
func Convert_intstr_IntOrString_To_intstr_IntOrString(in, out *intstr.IntOrString, s conversion.Scope) error {
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_Pointer_intstr_IntOrString_To_intstr_IntOrString(in **intstr.IntOrString, out *intstr.IntOrString, s conversion.Scope) error {
|
||||
if *in == nil {
|
||||
*out = intstr.IntOrString{} // zero value
|
||||
return nil
|
||||
}
|
||||
*out = **in // copy
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_intstr_IntOrString_To_Pointer_intstr_IntOrString(in *intstr.IntOrString, out **intstr.IntOrString, s conversion.Scope) error {
|
||||
temp := *in // copy
|
||||
*out = &temp
|
||||
return nil
|
||||
}
|
||||
|
||||
// +k8s:conversion-fn=copy-only
|
||||
func Convert_v1_Time_To_v1_Time(in *Time, out *Time, s conversion.Scope) error {
|
||||
// Cannot deep copy these, because time.Time has unexported fields.
|
||||
@ -228,14 +199,30 @@ func Convert_v1_Duration_To_Pointer_v1_Duration(in *Duration, out **Duration, s
|
||||
}
|
||||
|
||||
// Convert_Slice_string_To_v1_Time allows converting a URL query parameter value
|
||||
func Convert_Slice_string_To_v1_Time(input *[]string, out *Time, s conversion.Scope) error {
|
||||
func Convert_Slice_string_To_v1_Time(in *[]string, out *Time, s conversion.Scope) error {
|
||||
str := ""
|
||||
if len(*input) > 0 {
|
||||
str = (*input)[0]
|
||||
if len(*in) > 0 {
|
||||
str = (*in)[0]
|
||||
}
|
||||
return out.UnmarshalQueryParameter(str)
|
||||
}
|
||||
|
||||
func Convert_Slice_string_To_Pointer_v1_Time(in *[]string, out **Time, s conversion.Scope) error {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
str := ""
|
||||
if len(*in) > 0 {
|
||||
str = (*in)[0]
|
||||
}
|
||||
temp := Time{}
|
||||
if err := temp.UnmarshalQueryParameter(str); err != nil {
|
||||
return err
|
||||
}
|
||||
*out = &temp
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_string_To_labels_Selector(in *string, out *labels.Selector, s conversion.Scope) error {
|
||||
selector, err := labels.Parse(*in)
|
||||
if err != nil {
|
||||
@ -308,12 +295,61 @@ func Convert_Slice_string_To_Slice_int32(in *[]string, out *[]int32, s conversio
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_Slice_string_To_v1_DeletionPropagation allows converting a URL query parameter propagationPolicy
|
||||
func Convert_Slice_string_To_v1_DeletionPropagation(input *[]string, out *DeletionPropagation, s conversion.Scope) error {
|
||||
if len(*input) > 0 {
|
||||
*out = DeletionPropagation((*input)[0])
|
||||
// Convert_Slice_string_To_Pointer_v1_DeletionPropagation allows converting a URL query parameter propagationPolicy
|
||||
func Convert_Slice_string_To_Pointer_v1_DeletionPropagation(in *[]string, out **DeletionPropagation, s conversion.Scope) error {
|
||||
var str string
|
||||
if len(*in) > 0 {
|
||||
str = (*in)[0]
|
||||
} else {
|
||||
*out = ""
|
||||
str = ""
|
||||
}
|
||||
temp := DeletionPropagation(str)
|
||||
*out = &temp
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_Slice_string_To_v1_IncludeObjectPolicy allows converting a URL query parameter value
|
||||
func Convert_Slice_string_To_v1_IncludeObjectPolicy(in *[]string, out *IncludeObjectPolicy, s conversion.Scope) error {
|
||||
if len(*in) > 0 {
|
||||
*out = IncludeObjectPolicy((*in)[0])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_url_Values_To_v1_DeleteOptions allows converting a URL to DeleteOptions.
|
||||
func Convert_url_Values_To_v1_DeleteOptions(in *url.Values, out *DeleteOptions, s conversion.Scope) error {
|
||||
if err := autoConvert_url_Values_To_v1_DeleteOptions(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
uid := types.UID("")
|
||||
if values, ok := (*in)["uid"]; ok && len(values) > 0 {
|
||||
uid = types.UID(values[0])
|
||||
}
|
||||
|
||||
resourceVersion := ""
|
||||
if values, ok := (*in)["resourceVersion"]; ok && len(values) > 0 {
|
||||
resourceVersion = values[0]
|
||||
}
|
||||
|
||||
if len(uid) > 0 || len(resourceVersion) > 0 {
|
||||
if out.Preconditions == nil {
|
||||
out.Preconditions = &Preconditions{}
|
||||
}
|
||||
if len(uid) > 0 {
|
||||
out.Preconditions.UID = &uid
|
||||
}
|
||||
if len(resourceVersion) > 0 {
|
||||
out.Preconditions.ResourceVersion = &resourceVersion
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_Slice_string_To_v1_ResourceVersionMatch allows converting a URL query parameter to ResourceVersionMatch
|
||||
func Convert_Slice_string_To_v1_ResourceVersionMatch(in *[]string, out *ResourceVersionMatch, s conversion.Scope) error {
|
||||
if len(*in) > 0 {
|
||||
*out = ResourceVersionMatch((*in)[0])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -14,9 +14,11 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
package v1
|
||||
|
||||
import "k8s.io/apimachinery/pkg/runtime"
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
func (in *TableRow) DeepCopy() *TableRow {
|
||||
if in == nil {
|
1
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/doc.go
generated
vendored
1
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/doc.go
generated
vendored
@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// +k8s:conversion-gen=false
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
|
5
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go
generated
vendored
5
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go
generated
vendored
@ -49,6 +49,11 @@ func (d Duration) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(d.Duration.String())
|
||||
}
|
||||
|
||||
// ToUnstructured implements the value.UnstructuredConverter interface.
|
||||
func (d Duration) ToUnstructured() interface{} {
|
||||
return d.Duration.String()
|
||||
}
|
||||
|
||||
// OpenAPISchemaType is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
//
|
||||
|
6093
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
generated
vendored
6093
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
271
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
generated
vendored
271
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
generated
vendored
@ -134,6 +134,73 @@ message APIVersions {
|
||||
repeated ServerAddressByClientCIDR serverAddressByClientCIDRs = 2;
|
||||
}
|
||||
|
||||
// Condition contains details for one aspect of the current state of this API Resource.
|
||||
// ---
|
||||
// This struct is intended for direct use as an array at the field path .status.conditions. For example,
|
||||
// type FooStatus struct{
|
||||
// // Represents the observations of a foo's current state.
|
||||
// // Known .status.conditions.type are: "Available", "Progressing", and "Degraded"
|
||||
// // +patchMergeKey=type
|
||||
// // +patchStrategy=merge
|
||||
// // +listType=map
|
||||
// // +listMapKey=type
|
||||
// Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
|
||||
//
|
||||
// // other fields
|
||||
// }
|
||||
message Condition {
|
||||
// type of condition in CamelCase or in foo.example.com/CamelCase.
|
||||
// ---
|
||||
// Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
|
||||
// useful (see .node.status.conditions), the ability to deconflict is important.
|
||||
// The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
|
||||
// +required
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$`
|
||||
// +kubebuilder:validation:MaxLength=316
|
||||
optional string type = 1;
|
||||
|
||||
// status of the condition, one of True, False, Unknown.
|
||||
// +required
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:Enum=True;False;Unknown
|
||||
optional string status = 2;
|
||||
|
||||
// observedGeneration represents the .metadata.generation that the condition was set based upon.
|
||||
// For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
|
||||
// with respect to the current state of the instance.
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
optional int64 observedGeneration = 3;
|
||||
|
||||
// lastTransitionTime is the last time the condition transitioned from one status to another.
|
||||
// This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
|
||||
// +required
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:Type=string
|
||||
// +kubebuilder:validation:Format=date-time
|
||||
optional Time lastTransitionTime = 4;
|
||||
|
||||
// reason contains a programmatic identifier indicating the reason for the condition's last transition.
|
||||
// Producers of specific condition types may define expected values and meanings for this field,
|
||||
// and whether the values are considered a guaranteed API.
|
||||
// The value should be a CamelCase string.
|
||||
// This field may not be empty.
|
||||
// +required
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:MaxLength=1024
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
// +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$`
|
||||
optional string reason = 5;
|
||||
|
||||
// message is a human readable message indicating details about the transition.
|
||||
// This may be an empty string.
|
||||
// +required
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:MaxLength=32768
|
||||
optional string message = 6;
|
||||
}
|
||||
|
||||
// CreateOptions may be provided when creating an API object.
|
||||
message CreateOptions {
|
||||
// When present, indicates that modifications should not be
|
||||
@ -163,6 +230,7 @@ message DeleteOptions {
|
||||
|
||||
// Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be
|
||||
// returned.
|
||||
// +k8s:conversion-gen=false
|
||||
// +optional
|
||||
optional Preconditions preconditions = 2;
|
||||
|
||||
@ -212,29 +280,31 @@ message ExportOptions {
|
||||
optional bool exact = 2;
|
||||
}
|
||||
|
||||
// Fields stores a set of fields in a data structure like a Trie.
|
||||
// To understand how this is used, see: https://github.com/kubernetes-sigs/structured-merge-diff
|
||||
message Fields {
|
||||
// Map stores a set of fields in a data structure like a Trie.
|
||||
//
|
||||
// Each key is either a '.' representing the field itself, and will always map to an empty set,
|
||||
// or a string representing a sub-field or item. The string will follow one of these four formats:
|
||||
// 'f:<name>', where <name> is the name of a field in a struct, or key in a map
|
||||
// 'v:<value>', where <value> is the exact json formatted value of a list item
|
||||
// 'i:<index>', where <index> is position of a item in a list
|
||||
// 'k:<keys>', where <keys> is a map of a list item's key fields to their unique values
|
||||
// If a key maps to an empty Fields value, the field that key represents is part of the set.
|
||||
//
|
||||
// The exact format is defined in k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/internal
|
||||
map<string, Fields> map = 1;
|
||||
// FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.
|
||||
//
|
||||
// Each key is either a '.' representing the field itself, and will always map to an empty set,
|
||||
// or a string representing a sub-field or item. The string will follow one of these four formats:
|
||||
// 'f:<name>', where <name> is the name of a field in a struct, or key in a map
|
||||
// 'v:<value>', where <value> is the exact json formatted value of a list item
|
||||
// 'i:<index>', where <index> is position of a item in a list
|
||||
// 'k:<keys>', where <keys> is a map of a list item's key fields to their unique values
|
||||
// If a key maps to an empty Fields value, the field that key represents is part of the set.
|
||||
//
|
||||
// The exact format is defined in sigs.k8s.io/structured-merge-diff
|
||||
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
||||
message FieldsV1 {
|
||||
// Raw is the underlying serialization of this object.
|
||||
optional bytes Raw = 1;
|
||||
}
|
||||
|
||||
// GetOptions is the standard query options to the standard REST get call.
|
||||
message GetOptions {
|
||||
// When specified:
|
||||
// - if unset, then the result is returned from remote storage based on quorum-read flag;
|
||||
// - if it's 0, then we simply return what we currently have in cache, no guarantee;
|
||||
// - if set to non zero, then the result is at least as fresh as given rv.
|
||||
// resourceVersion sets a constraint on what resource versions a request may be served from.
|
||||
// See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for
|
||||
// details.
|
||||
//
|
||||
// Defaults to unset
|
||||
// +optional
|
||||
optional string resourceVersion = 1;
|
||||
}
|
||||
|
||||
@ -302,27 +372,6 @@ message GroupVersionResource {
|
||||
optional string resource = 3;
|
||||
}
|
||||
|
||||
// Initializer is information about an initializer that has not yet completed.
|
||||
message Initializer {
|
||||
// name of the process that is responsible for initializing this object.
|
||||
optional string name = 1;
|
||||
}
|
||||
|
||||
// Initializers tracks the progress of initialization.
|
||||
message Initializers {
|
||||
// Pending is a list of initializers that must execute in order before this object is visible.
|
||||
// When the last pending initializer is removed, and no failing result is set, the initializers
|
||||
// struct will be set to nil and the object is considered as initialized and visible to all
|
||||
// clients.
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
repeated Initializer pending = 1;
|
||||
|
||||
// If result is set with the Failure field, the object will be persisted to storage and then deleted,
|
||||
// ensuring that other clients can observe the deletion.
|
||||
optional Status result = 2;
|
||||
}
|
||||
|
||||
// A label selector is a label query over a set of resources. The result of matchLabels and
|
||||
// matchExpressions are ANDed. An empty label selector matches all objects. A null
|
||||
// label selector matches no objects.
|
||||
@ -361,7 +410,7 @@ message LabelSelectorRequirement {
|
||||
// List holds a list of objects, which may not be known by the server.
|
||||
message List {
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
optional ListMeta metadata = 1;
|
||||
|
||||
@ -375,6 +424,10 @@ message ListMeta {
|
||||
// selfLink is a URL representing this object.
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
//
|
||||
// DEPRECATED
|
||||
// Kubernetes will stop propagating this field in 1.20 release and the field is planned
|
||||
// to be removed in 1.21 release.
|
||||
// +optional
|
||||
optional string selfLink = 1;
|
||||
|
||||
@ -383,7 +436,7 @@ message ListMeta {
|
||||
// Value must be treated as opaque by clients and passed unmodified back to the server.
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
|
||||
// +optional
|
||||
optional string resourceVersion = 2;
|
||||
|
||||
@ -395,6 +448,18 @@ message ListMeta {
|
||||
// identical to the value in the first response, unless you have received this token from an error
|
||||
// message.
|
||||
optional string continue = 3;
|
||||
|
||||
// remainingItemCount is the number of subsequent items in the list which are not included in this
|
||||
// list response. If the list request contained label or field selectors, then the number of
|
||||
// remaining items is unknown and the field will be left unset and omitted during serialization.
|
||||
// If the list is complete (either because it is not chunking or because this is the last chunk),
|
||||
// then there are no more remaining items and this field will be left unset and omitted during
|
||||
// serialization.
|
||||
// Servers older than v1.15 do not set this field.
|
||||
// The intended use of the remainingItemCount is *estimating* the size of a collection. Clients
|
||||
// should not rely on the remainingItemCount to be set or to be exact.
|
||||
// +optional
|
||||
optional int64 remainingItemCount = 4;
|
||||
}
|
||||
|
||||
// ListOptions is the query options to a standard REST list call.
|
||||
@ -414,15 +479,35 @@ message ListOptions {
|
||||
// +optional
|
||||
optional bool watch = 3;
|
||||
|
||||
// When specified with a watch call, shows changes that occur after that particular version of a resource.
|
||||
// Defaults to changes from the beginning of history.
|
||||
// When specified for list:
|
||||
// - if unset, then the result is returned from remote storage based on quorum-read flag;
|
||||
// - if it's 0, then we simply return what we currently have in cache, no guarantee;
|
||||
// - if set to non zero, then the result is at least as fresh as given rv.
|
||||
// allowWatchBookmarks requests watch events with type "BOOKMARK".
|
||||
// Servers that do not implement bookmarks may ignore this flag and
|
||||
// bookmarks are sent at the server's discretion. Clients should not
|
||||
// assume bookmarks are returned at any specific interval, nor may they
|
||||
// assume the server will send any BOOKMARK event during a session.
|
||||
// If this is not a watch, this field is ignored.
|
||||
// If the feature gate WatchBookmarks is not enabled in apiserver,
|
||||
// this field is ignored.
|
||||
// +optional
|
||||
optional bool allowWatchBookmarks = 9;
|
||||
|
||||
// resourceVersion sets a constraint on what resource versions a request may be served from.
|
||||
// See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for
|
||||
// details.
|
||||
//
|
||||
// Defaults to unset
|
||||
// +optional
|
||||
optional string resourceVersion = 4;
|
||||
|
||||
// resourceVersionMatch determines how resourceVersion is applied to list calls.
|
||||
// It is highly recommended that resourceVersionMatch be set for list calls where
|
||||
// resourceVersion is set
|
||||
// See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for
|
||||
// details.
|
||||
//
|
||||
// Defaults to unset
|
||||
// +optional
|
||||
optional string resourceVersionMatch = 10;
|
||||
|
||||
// Timeout for the list/watch call.
|
||||
// This limits the duration of the call, regardless of any activity or inactivity.
|
||||
// +optional
|
||||
@ -483,9 +568,13 @@ message ManagedFieldsEntry {
|
||||
// +optional
|
||||
optional Time time = 4;
|
||||
|
||||
// Fields identifies a set of fields.
|
||||
// FieldsType is the discriminator for the different fields format and version.
|
||||
// There is currently only one possible value: "FieldsV1"
|
||||
optional string fieldsType = 6;
|
||||
|
||||
// FieldsV1 holds the first JSON version format as described in the "FieldsV1" type.
|
||||
// +optional
|
||||
optional Fields fields = 5;
|
||||
optional FieldsV1 fieldsV1 = 7;
|
||||
}
|
||||
|
||||
// MicroTime is version of Time with microsecond level precision.
|
||||
@ -532,11 +621,11 @@ message ObjectMeta {
|
||||
// should retry (optionally after the time indicated in the Retry-After header).
|
||||
//
|
||||
// Applied only if Name is not specified.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency
|
||||
// +optional
|
||||
optional string generateName = 2;
|
||||
|
||||
// Namespace defines the space within each name must be unique. An empty namespace is
|
||||
// Namespace defines the space within which each name must be unique. An empty namespace is
|
||||
// equivalent to the "default" namespace, but "default" is the canonical representation.
|
||||
// Not all objects are required to be scoped to a namespace - the value of this field for
|
||||
// those objects will be empty.
|
||||
@ -550,6 +639,10 @@ message ObjectMeta {
|
||||
// SelfLink is a URL representing this object.
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
//
|
||||
// DEPRECATED
|
||||
// Kubernetes will stop propagating this field in 1.20 release and the field is planned
|
||||
// to be removed in 1.21 release.
|
||||
// +optional
|
||||
optional string selfLink = 4;
|
||||
|
||||
@ -572,7 +665,7 @@ message ObjectMeta {
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
// Value must be treated as opaque by clients and .
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
|
||||
// +optional
|
||||
optional string resourceVersion = 6;
|
||||
|
||||
@ -588,7 +681,7 @@ message ObjectMeta {
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
// Null for lists.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional Time creationTimestamp = 8;
|
||||
|
||||
@ -609,7 +702,7 @@ message ObjectMeta {
|
||||
//
|
||||
// Populated by the system when a graceful deletion is requested.
|
||||
// Read-only.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional Time deletionTimestamp = 9;
|
||||
|
||||
@ -643,23 +736,19 @@ message ObjectMeta {
|
||||
// +patchStrategy=merge
|
||||
repeated OwnerReference ownerReferences = 13;
|
||||
|
||||
// An initializer is a controller which enforces some system invariant at object creation time.
|
||||
// This field is a list of initializers that have not yet acted on this object. If nil or empty,
|
||||
// this object has been completely initialized. Otherwise, the object is considered uninitialized
|
||||
// and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to
|
||||
// observe uninitialized objects.
|
||||
//
|
||||
// When an object is created, the system will populate this list with the current set of initializers.
|
||||
// Only privileged users may set or modify this list. Once it is empty, it may not be modified further
|
||||
// by any user.
|
||||
//
|
||||
// DEPRECATED - initializers are an alpha field and will be removed in v1.15.
|
||||
optional Initializers initializers = 16;
|
||||
|
||||
// Must be empty before the object is deleted from the registry. Each entry
|
||||
// is an identifier for the responsible component that will remove the entry
|
||||
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
||||
// in this list can only be removed.
|
||||
// Finalizers may be processed and removed in any order. Order is NOT enforced
|
||||
// because it introduces significant risk of stuck finalizers.
|
||||
// finalizers is a shared field, any actor with permission can reorder it.
|
||||
// If the finalizer list is processed in order, then this can lead to a situation
|
||||
// in which the component responsible for the first finalizer in the list is
|
||||
// waiting for a signal (field value, external system, or other) produced by a
|
||||
// component responsible for a finalizer later in the list, resulting in a deadlock.
|
||||
// Without enforced ordering finalizers are free to order amongst themselves and
|
||||
// are not vulnerable to ordering changes in the list.
|
||||
// +optional
|
||||
// +patchStrategy=merge
|
||||
repeated string finalizers = 14;
|
||||
@ -678,8 +767,6 @@ message ObjectMeta {
|
||||
// "ci-cd". The set of fields is always in the version that the
|
||||
// workflow used when modifying the object.
|
||||
//
|
||||
// This field is alpha and can be changed or removed without notice.
|
||||
//
|
||||
// +optional
|
||||
repeated ManagedFieldsEntry managedFields = 17;
|
||||
}
|
||||
@ -692,7 +779,7 @@ message OwnerReference {
|
||||
optional string apiVersion = 5;
|
||||
|
||||
// Kind of the referent.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
optional string kind = 1;
|
||||
|
||||
// Name of the referent.
|
||||
@ -717,6 +804,28 @@ message OwnerReference {
|
||||
optional bool blockOwnerDeletion = 7;
|
||||
}
|
||||
|
||||
// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients
|
||||
// to get access to a particular ObjectMeta schema without knowing the details of the version.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
message PartialObjectMetadata {
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional ObjectMeta metadata = 1;
|
||||
}
|
||||
|
||||
// PartialObjectMetadataList contains a list of objects containing only their metadata
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
message PartialObjectMetadataList {
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
optional ListMeta metadata = 1;
|
||||
|
||||
// items contains each of the included items.
|
||||
repeated PartialObjectMetadata items = 2;
|
||||
}
|
||||
|
||||
// Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.
|
||||
message Patch {
|
||||
}
|
||||
@ -780,13 +889,13 @@ message ServerAddressByClientCIDR {
|
||||
// Status is a return value for calls that don't return other objects.
|
||||
message Status {
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
optional ListMeta metadata = 1;
|
||||
|
||||
// Status of the operation.
|
||||
// One of: "Success" or "Failure".
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
optional string status = 2;
|
||||
|
||||
@ -857,7 +966,7 @@ message StatusDetails {
|
||||
|
||||
// The kind attribute of the resource associated with the status StatusReason.
|
||||
// On some operations may differ from the requested resource Kind.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
optional string kind = 3;
|
||||
|
||||
@ -879,6 +988,16 @@ message StatusDetails {
|
||||
optional int32 retryAfterSeconds = 5;
|
||||
}
|
||||
|
||||
// TableOptions are used when a Table is requested by the caller.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
message TableOptions {
|
||||
// includeObject decides whether to include each object along with its columnar information.
|
||||
// Specifying "None" will return no object, specifying "Object" will return the full object contents, and
|
||||
// specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind
|
||||
// in version v1beta1 of the meta.k8s.io API group.
|
||||
optional string includeObject = 1;
|
||||
}
|
||||
|
||||
// Time is a wrapper around time.Time which supports correct
|
||||
// marshaling to YAML and JSON. Wrappers are provided for many
|
||||
// of the factory methods that the time package offers.
|
||||
@ -925,14 +1044,14 @@ message TypeMeta {
|
||||
// Servers may infer this from the endpoint the client submits requests to.
|
||||
// Cannot be updated.
|
||||
// In CamelCase.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
optional string kind = 1;
|
||||
|
||||
// APIVersion defines the versioned schema of this representation of an object.
|
||||
// Servers should convert recognized schemas to the latest internal value, and
|
||||
// may reject unrecognized values.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
|
||||
// +optional
|
||||
optional string apiVersion = 2;
|
||||
}
|
||||
|
29
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go
generated
vendored
29
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go
generated
vendored
@ -17,7 +17,9 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
@ -250,18 +252,31 @@ func ResetObjectMetaForStatus(meta, existingMeta Object) {
|
||||
meta.SetAnnotations(existingMeta.GetAnnotations())
|
||||
meta.SetFinalizers(existingMeta.GetFinalizers())
|
||||
meta.SetOwnerReferences(existingMeta.GetOwnerReferences())
|
||||
meta.SetManagedFields(existingMeta.GetManagedFields())
|
||||
// managedFields must be preserved since it's been modified to
|
||||
// track changed fields in the status update.
|
||||
//meta.SetManagedFields(existingMeta.GetManagedFields())
|
||||
}
|
||||
|
||||
// MarshalJSON implements json.Marshaler
|
||||
func (f Fields) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(&f.Map)
|
||||
// MarshalJSON may get called on pointers or values, so implement MarshalJSON on value.
|
||||
// http://stackoverflow.com/questions/21390979/custom-marshaljson-never-gets-called-in-go
|
||||
func (f FieldsV1) MarshalJSON() ([]byte, error) {
|
||||
if f.Raw == nil {
|
||||
return []byte("null"), nil
|
||||
}
|
||||
return f.Raw, nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements json.Unmarshaler
|
||||
func (f *Fields) UnmarshalJSON(b []byte) error {
|
||||
return json.Unmarshal(b, &f.Map)
|
||||
func (f *FieldsV1) UnmarshalJSON(b []byte) error {
|
||||
if f == nil {
|
||||
return errors.New("metav1.Fields: UnmarshalJSON on nil pointer")
|
||||
}
|
||||
if !bytes.Equal(b, []byte("null")) {
|
||||
f.Raw = append(f.Raw[0:0], b...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ json.Marshaler = Fields{}
|
||||
var _ json.Unmarshaler = &Fields{}
|
||||
var _ json.Marshaler = FieldsV1{}
|
||||
var _ json.Unmarshaler = &FieldsV1{}
|
||||
|
14
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go
generated
vendored
14
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go
generated
vendored
@ -55,8 +55,6 @@ type Object interface {
|
||||
SetLabels(labels map[string]string)
|
||||
GetAnnotations() map[string]string
|
||||
SetAnnotations(annotations map[string]string)
|
||||
GetInitializers() *Initializers
|
||||
SetInitializers(initializers *Initializers)
|
||||
GetFinalizers() []string
|
||||
SetFinalizers(finalizers []string)
|
||||
GetOwnerReferences() []OwnerReference
|
||||
@ -94,6 +92,8 @@ type ListInterface interface {
|
||||
SetSelfLink(selfLink string)
|
||||
GetContinue() string
|
||||
SetContinue(c string)
|
||||
GetRemainingItemCount() *int64
|
||||
SetRemainingItemCount(c *int64)
|
||||
}
|
||||
|
||||
// Type exposes the type and APIVersion of versioned or internal API objects.
|
||||
@ -105,12 +105,16 @@ type Type interface {
|
||||
SetKind(kind string)
|
||||
}
|
||||
|
||||
var _ ListInterface = &ListMeta{}
|
||||
|
||||
func (meta *ListMeta) GetResourceVersion() string { return meta.ResourceVersion }
|
||||
func (meta *ListMeta) SetResourceVersion(version string) { meta.ResourceVersion = version }
|
||||
func (meta *ListMeta) GetSelfLink() string { return meta.SelfLink }
|
||||
func (meta *ListMeta) SetSelfLink(selfLink string) { meta.SelfLink = selfLink }
|
||||
func (meta *ListMeta) GetContinue() string { return meta.Continue }
|
||||
func (meta *ListMeta) SetContinue(c string) { meta.Continue = c }
|
||||
func (meta *ListMeta) GetRemainingItemCount() *int64 { return meta.RemainingItemCount }
|
||||
func (meta *ListMeta) SetRemainingItemCount(c *int64) { meta.RemainingItemCount = c }
|
||||
|
||||
func (obj *TypeMeta) GetObjectKind() schema.ObjectKind { return obj }
|
||||
|
||||
@ -152,7 +156,9 @@ func (meta *ObjectMeta) GetDeletionTimestamp() *Time { return meta.DeletionTimes
|
||||
func (meta *ObjectMeta) SetDeletionTimestamp(deletionTimestamp *Time) {
|
||||
meta.DeletionTimestamp = deletionTimestamp
|
||||
}
|
||||
func (meta *ObjectMeta) GetDeletionGracePeriodSeconds() *int64 { return meta.DeletionGracePeriodSeconds }
|
||||
func (meta *ObjectMeta) GetDeletionGracePeriodSeconds() *int64 {
|
||||
return meta.DeletionGracePeriodSeconds
|
||||
}
|
||||
func (meta *ObjectMeta) SetDeletionGracePeriodSeconds(deletionGracePeriodSeconds *int64) {
|
||||
meta.DeletionGracePeriodSeconds = deletionGracePeriodSeconds
|
||||
}
|
||||
@ -160,8 +166,6 @@ func (meta *ObjectMeta) GetLabels() map[string]string { return m
|
||||
func (meta *ObjectMeta) SetLabels(labels map[string]string) { meta.Labels = labels }
|
||||
func (meta *ObjectMeta) GetAnnotations() map[string]string { return meta.Annotations }
|
||||
func (meta *ObjectMeta) SetAnnotations(annotations map[string]string) { meta.Annotations = annotations }
|
||||
func (meta *ObjectMeta) GetInitializers() *Initializers { return meta.Initializers }
|
||||
func (meta *ObjectMeta) SetInitializers(initializers *Initializers) { meta.Initializers = initializers }
|
||||
func (meta *ObjectMeta) GetFinalizers() []string { return meta.Finalizers }
|
||||
func (meta *ObjectMeta) SetFinalizers(finalizers []string) { meta.Finalizers = finalizers }
|
||||
func (meta *ObjectMeta) GetOwnerReferences() []OwnerReference { return meta.OwnerReferences }
|
||||
|
31
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
generated
vendored
31
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
generated
vendored
@ -41,11 +41,6 @@ func (t *MicroTime) DeepCopyInto(out *MicroTime) {
|
||||
*out = *t
|
||||
}
|
||||
|
||||
// String returns the representation of the time.
|
||||
func (t MicroTime) String() string {
|
||||
return t.Time.String()
|
||||
}
|
||||
|
||||
// NewMicroTime returns a wrapped instance of the provided time
|
||||
func NewMicroTime(time time.Time) MicroTime {
|
||||
return MicroTime{time}
|
||||
@ -72,22 +67,40 @@ func (t *MicroTime) IsZero() bool {
|
||||
|
||||
// Before reports whether the time instant t is before u.
|
||||
func (t *MicroTime) Before(u *MicroTime) bool {
|
||||
return t.Time.Before(u.Time)
|
||||
if t != nil && u != nil {
|
||||
return t.Time.Before(u.Time)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Equal reports whether the time instant t is equal to u.
|
||||
func (t *MicroTime) Equal(u *MicroTime) bool {
|
||||
return t.Time.Equal(u.Time)
|
||||
if t == nil && u == nil {
|
||||
return true
|
||||
}
|
||||
if t != nil && u != nil {
|
||||
return t.Time.Equal(u.Time)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// BeforeTime reports whether the time instant t is before second-lever precision u.
|
||||
func (t *MicroTime) BeforeTime(u *Time) bool {
|
||||
return t.Time.Before(u.Time)
|
||||
if t != nil && u != nil {
|
||||
return t.Time.Before(u.Time)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// EqualTime reports whether the time instant t is equal to second-lever precision u.
|
||||
func (t *MicroTime) EqualTime(u *Time) bool {
|
||||
return t.Time.Equal(u.Time)
|
||||
if t == nil && u == nil {
|
||||
return true
|
||||
}
|
||||
if t != nil && u != nil {
|
||||
return t.Time.Equal(u.Time)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// UnixMicro returns the local time corresponding to the given Unix time
|
||||
|
8
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go
generated
vendored
8
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go
generated
vendored
@ -70,3 +70,11 @@ func (m *MicroTime) MarshalTo(data []byte) (int, error) {
|
||||
}
|
||||
return m.ProtoMicroTime().MarshalTo(data)
|
||||
}
|
||||
|
||||
// MarshalToSizedBuffer implements the protobuf marshalling interface.
|
||||
func (m *MicroTime) MarshalToSizedBuffer(data []byte) (int, error) {
|
||||
if m == nil || m.Time.IsZero() {
|
||||
return 0, nil
|
||||
}
|
||||
return m.ProtoMicroTime().MarshalToSizedBuffer(data)
|
||||
}
|
||||
|
67
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/register.go
generated
vendored
67
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/register.go
generated
vendored
@ -25,6 +25,13 @@ import (
|
||||
// GroupName is the group name for this API.
|
||||
const GroupName = "meta.k8s.io"
|
||||
|
||||
var (
|
||||
// localSchemeBuilder is used to make compiler happy for autogenerated
|
||||
// conversions. However, it's not used.
|
||||
schemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &schemeBuilder
|
||||
)
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
|
||||
|
||||
@ -40,6 +47,22 @@ func Kind(kind string) schema.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// scheme is the registry for the common types that adhere to the meta v1 API spec.
|
||||
var scheme = runtime.NewScheme()
|
||||
|
||||
// ParameterCodec knows about query parameters used with the meta v1 API spec.
|
||||
var ParameterCodec = runtime.NewParameterCodec(scheme)
|
||||
|
||||
var optionsTypes = []runtime.Object{
|
||||
&ListOptions{},
|
||||
&ExportOptions{},
|
||||
&GetOptions{},
|
||||
&DeleteOptions{},
|
||||
&CreateOptions{},
|
||||
&UpdateOptions{},
|
||||
&PatchOptions{},
|
||||
}
|
||||
|
||||
// AddToGroupVersion registers common meta types into schemas.
|
||||
func AddToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion) {
|
||||
scheme.AddKnownTypeWithName(groupVersion.WithKind(WatchEventKind), &WatchEvent{})
|
||||
@ -48,21 +71,7 @@ func AddToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion)
|
||||
&InternalEvent{},
|
||||
)
|
||||
// Supports legacy code paths, most callers should use metav1.ParameterCodec for now
|
||||
scheme.AddKnownTypes(groupVersion,
|
||||
&ListOptions{},
|
||||
&ExportOptions{},
|
||||
&GetOptions{},
|
||||
&DeleteOptions{},
|
||||
&CreateOptions{},
|
||||
&UpdateOptions{},
|
||||
&PatchOptions{},
|
||||
)
|
||||
utilruntime.Must(scheme.AddConversionFuncs(
|
||||
Convert_v1_WatchEvent_To_watch_Event,
|
||||
Convert_v1_InternalEvent_To_v1_WatchEvent,
|
||||
Convert_watch_Event_To_v1_WatchEvent,
|
||||
Convert_v1_WatchEvent_To_v1_InternalEvent,
|
||||
))
|
||||
scheme.AddKnownTypes(groupVersion, optionsTypes...)
|
||||
// Register Unversioned types under their own special group
|
||||
scheme.AddUnversionedTypes(Unversioned,
|
||||
&Status{},
|
||||
@ -73,26 +82,26 @@ func AddToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion)
|
||||
)
|
||||
|
||||
// register manually. This usually goes through the SchemeBuilder, which we cannot use here.
|
||||
utilruntime.Must(AddConversionFuncs(scheme))
|
||||
utilruntime.Must(RegisterConversions(scheme))
|
||||
utilruntime.Must(RegisterDefaults(scheme))
|
||||
}
|
||||
|
||||
// scheme is the registry for the common types that adhere to the meta v1 API spec.
|
||||
var scheme = runtime.NewScheme()
|
||||
// AddMetaToScheme registers base meta types into schemas.
|
||||
func AddMetaToScheme(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&Table{},
|
||||
&TableOptions{},
|
||||
&PartialObjectMetadata{},
|
||||
&PartialObjectMetadataList{},
|
||||
)
|
||||
|
||||
// ParameterCodec knows about query parameters used with the meta v1 API spec.
|
||||
var ParameterCodec = runtime.NewParameterCodec(scheme)
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
scheme.AddUnversionedTypes(SchemeGroupVersion,
|
||||
&ListOptions{},
|
||||
&ExportOptions{},
|
||||
&GetOptions{},
|
||||
&DeleteOptions{},
|
||||
&CreateOptions{},
|
||||
&UpdateOptions{},
|
||||
&PatchOptions{},
|
||||
)
|
||||
scheme.AddUnversionedTypes(SchemeGroupVersion, optionsTypes...)
|
||||
|
||||
utilruntime.Must(AddMetaToScheme(scheme))
|
||||
|
||||
// register manually. This usually goes through the SchemeBuilder, which we cannot use here.
|
||||
utilruntime.Must(RegisterDefaults(scheme))
|
||||
|
28
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
generated
vendored
28
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
generated
vendored
@ -20,7 +20,7 @@ import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/google/gofuzz"
|
||||
fuzz "github.com/google/gofuzz"
|
||||
)
|
||||
|
||||
// Time is a wrapper around time.Time which supports correct
|
||||
@ -41,11 +41,6 @@ func (t *Time) DeepCopyInto(out *Time) {
|
||||
*out = *t
|
||||
}
|
||||
|
||||
// String returns the representation of the time.
|
||||
func (t Time) String() string {
|
||||
return t.Time.String()
|
||||
}
|
||||
|
||||
// NewTime returns a wrapped instance of the provided time
|
||||
func NewTime(time time.Time) Time {
|
||||
return Time{time}
|
||||
@ -72,7 +67,10 @@ func (t *Time) IsZero() bool {
|
||||
|
||||
// Before reports whether the time instant t is before u.
|
||||
func (t *Time) Before(u *Time) bool {
|
||||
return t.Time.Before(u.Time)
|
||||
if t != nil && u != nil {
|
||||
return t.Time.Before(u.Time)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Equal reports whether the time instant t is equal to u.
|
||||
@ -147,8 +145,22 @@ func (t Time) MarshalJSON() ([]byte, error) {
|
||||
// Encode unset/nil objects as JSON's "null".
|
||||
return []byte("null"), nil
|
||||
}
|
||||
buf := make([]byte, 0, len(time.RFC3339)+2)
|
||||
buf = append(buf, '"')
|
||||
// time cannot contain non escapable JSON characters
|
||||
buf = t.UTC().AppendFormat(buf, time.RFC3339)
|
||||
buf = append(buf, '"')
|
||||
return buf, nil
|
||||
}
|
||||
|
||||
return json.Marshal(t.UTC().Format(time.RFC3339))
|
||||
// ToUnstructured implements the value.UnstructuredConverter interface.
|
||||
func (t Time) ToUnstructured() interface{} {
|
||||
if t.IsZero() {
|
||||
return nil
|
||||
}
|
||||
buf := make([]byte, 0, len(time.RFC3339))
|
||||
buf = t.UTC().AppendFormat(buf, time.RFC3339)
|
||||
return string(buf)
|
||||
}
|
||||
|
||||
// OpenAPISchemaType is used by the kube-openapi generator when constructing
|
||||
|
12
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_proto.go
generated
vendored
12
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_proto.go
generated
vendored
@ -75,7 +75,7 @@ func (m *Time) Unmarshal(data []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Marshal implements the protobuf marshalling interface.
|
||||
// Marshal implements the protobuf marshaling interface.
|
||||
func (m *Time) Marshal() (data []byte, err error) {
|
||||
if m == nil || m.Time.IsZero() {
|
||||
return nil, nil
|
||||
@ -83,10 +83,18 @@ func (m *Time) Marshal() (data []byte, err error) {
|
||||
return m.ProtoTime().Marshal()
|
||||
}
|
||||
|
||||
// MarshalTo implements the protobuf marshalling interface.
|
||||
// MarshalTo implements the protobuf marshaling interface.
|
||||
func (m *Time) MarshalTo(data []byte) (int, error) {
|
||||
if m == nil || m.Time.IsZero() {
|
||||
return 0, nil
|
||||
}
|
||||
return m.ProtoTime().MarshalTo(data)
|
||||
}
|
||||
|
||||
// MarshalToSizedBuffer implements the protobuf reverse marshaling interface.
|
||||
func (m *Time) MarshalToSizedBuffer(data []byte) (int, error) {
|
||||
if m == nil || m.Time.IsZero() {
|
||||
return 0, nil
|
||||
}
|
||||
return m.ProtoTime().MarshalToSizedBuffer(data)
|
||||
}
|
||||
|
433
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
generated
vendored
433
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
generated
vendored
@ -43,14 +43,14 @@ type TypeMeta struct {
|
||||
// Servers may infer this from the endpoint the client submits requests to.
|
||||
// Cannot be updated.
|
||||
// In CamelCase.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
Kind string `json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"`
|
||||
|
||||
// APIVersion defines the versioned schema of this representation of an object.
|
||||
// Servers should convert recognized schemas to the latest internal value, and
|
||||
// may reject unrecognized values.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
|
||||
// +optional
|
||||
APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,2,opt,name=apiVersion"`
|
||||
}
|
||||
@ -61,6 +61,10 @@ type ListMeta struct {
|
||||
// selfLink is a URL representing this object.
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
//
|
||||
// DEPRECATED
|
||||
// Kubernetes will stop propagating this field in 1.20 release and the field is planned
|
||||
// to be removed in 1.21 release.
|
||||
// +optional
|
||||
SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,1,opt,name=selfLink"`
|
||||
|
||||
@ -69,7 +73,7 @@ type ListMeta struct {
|
||||
// Value must be treated as opaque by clients and passed unmodified back to the server.
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
|
||||
// +optional
|
||||
ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,2,opt,name=resourceVersion"`
|
||||
|
||||
@ -81,6 +85,18 @@ type ListMeta struct {
|
||||
// identical to the value in the first response, unless you have received this token from an error
|
||||
// message.
|
||||
Continue string `json:"continue,omitempty" protobuf:"bytes,3,opt,name=continue"`
|
||||
|
||||
// remainingItemCount is the number of subsequent items in the list which are not included in this
|
||||
// list response. If the list request contained label or field selectors, then the number of
|
||||
// remaining items is unknown and the field will be left unset and omitted during serialization.
|
||||
// If the list is complete (either because it is not chunking or because this is the last chunk),
|
||||
// then there are no more remaining items and this field will be left unset and omitted during
|
||||
// serialization.
|
||||
// Servers older than v1.15 do not set this field.
|
||||
// The intended use of the remainingItemCount is *estimating* the size of a collection. Clients
|
||||
// should not rely on the remainingItemCount to be set or to be exact.
|
||||
// +optional
|
||||
RemainingItemCount *int64 `json:"remainingItemCount,omitempty" protobuf:"bytes,4,opt,name=remainingItemCount"`
|
||||
}
|
||||
|
||||
// These are internal finalizer values for Kubernetes-like APIs, must be qualified name unless defined here
|
||||
@ -115,11 +131,11 @@ type ObjectMeta struct {
|
||||
// should retry (optionally after the time indicated in the Retry-After header).
|
||||
//
|
||||
// Applied only if Name is not specified.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency
|
||||
// +optional
|
||||
GenerateName string `json:"generateName,omitempty" protobuf:"bytes,2,opt,name=generateName"`
|
||||
|
||||
// Namespace defines the space within each name must be unique. An empty namespace is
|
||||
// Namespace defines the space within which each name must be unique. An empty namespace is
|
||||
// equivalent to the "default" namespace, but "default" is the canonical representation.
|
||||
// Not all objects are required to be scoped to a namespace - the value of this field for
|
||||
// those objects will be empty.
|
||||
@ -133,6 +149,10 @@ type ObjectMeta struct {
|
||||
// SelfLink is a URL representing this object.
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
//
|
||||
// DEPRECATED
|
||||
// Kubernetes will stop propagating this field in 1.20 release and the field is planned
|
||||
// to be removed in 1.21 release.
|
||||
// +optional
|
||||
SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,4,opt,name=selfLink"`
|
||||
|
||||
@ -155,7 +175,7 @@ type ObjectMeta struct {
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
// Value must be treated as opaque by clients and .
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
|
||||
// +optional
|
||||
ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,6,opt,name=resourceVersion"`
|
||||
|
||||
@ -171,7 +191,7 @@ type ObjectMeta struct {
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
// Null for lists.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
CreationTimestamp Time `json:"creationTimestamp,omitempty" protobuf:"bytes,8,opt,name=creationTimestamp"`
|
||||
|
||||
@ -192,7 +212,7 @@ type ObjectMeta struct {
|
||||
//
|
||||
// Populated by the system when a graceful deletion is requested.
|
||||
// Read-only.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
DeletionTimestamp *Time `json:"deletionTimestamp,omitempty" protobuf:"bytes,9,opt,name=deletionTimestamp"`
|
||||
|
||||
@ -226,23 +246,19 @@ type ObjectMeta struct {
|
||||
// +patchStrategy=merge
|
||||
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"`
|
||||
|
||||
// An initializer is a controller which enforces some system invariant at object creation time.
|
||||
// This field is a list of initializers that have not yet acted on this object. If nil or empty,
|
||||
// this object has been completely initialized. Otherwise, the object is considered uninitialized
|
||||
// and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to
|
||||
// observe uninitialized objects.
|
||||
//
|
||||
// When an object is created, the system will populate this list with the current set of initializers.
|
||||
// Only privileged users may set or modify this list. Once it is empty, it may not be modified further
|
||||
// by any user.
|
||||
//
|
||||
// DEPRECATED - initializers are an alpha field and will be removed in v1.15.
|
||||
Initializers *Initializers `json:"initializers,omitempty" protobuf:"bytes,16,opt,name=initializers"`
|
||||
|
||||
// Must be empty before the object is deleted from the registry. Each entry
|
||||
// is an identifier for the responsible component that will remove the entry
|
||||
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
||||
// in this list can only be removed.
|
||||
// Finalizers may be processed and removed in any order. Order is NOT enforced
|
||||
// because it introduces significant risk of stuck finalizers.
|
||||
// finalizers is a shared field, any actor with permission can reorder it.
|
||||
// If the finalizer list is processed in order, then this can lead to a situation
|
||||
// in which the component responsible for the first finalizer in the list is
|
||||
// waiting for a signal (field value, external system, or other) produced by a
|
||||
// component responsible for a finalizer later in the list, resulting in a deadlock.
|
||||
// Without enforced ordering finalizers are free to order amongst themselves and
|
||||
// are not vulnerable to ordering changes in the list.
|
||||
// +optional
|
||||
// +patchStrategy=merge
|
||||
Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`
|
||||
@ -261,32 +277,10 @@ type ObjectMeta struct {
|
||||
// "ci-cd". The set of fields is always in the version that the
|
||||
// workflow used when modifying the object.
|
||||
//
|
||||
// This field is alpha and can be changed or removed without notice.
|
||||
//
|
||||
// +optional
|
||||
ManagedFields []ManagedFieldsEntry `json:"managedFields,omitempty" protobuf:"bytes,17,rep,name=managedFields"`
|
||||
}
|
||||
|
||||
// Initializers tracks the progress of initialization.
|
||||
type Initializers struct {
|
||||
// Pending is a list of initializers that must execute in order before this object is visible.
|
||||
// When the last pending initializer is removed, and no failing result is set, the initializers
|
||||
// struct will be set to nil and the object is considered as initialized and visible to all
|
||||
// clients.
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
Pending []Initializer `json:"pending" protobuf:"bytes,1,rep,name=pending" patchStrategy:"merge" patchMergeKey:"name"`
|
||||
// If result is set with the Failure field, the object will be persisted to storage and then deleted,
|
||||
// ensuring that other clients can observe the deletion.
|
||||
Result *Status `json:"result,omitempty" protobuf:"bytes,2,opt,name=result"`
|
||||
}
|
||||
|
||||
// Initializer is information about an initializer that has not yet completed.
|
||||
type Initializer struct {
|
||||
// name of the process that is responsible for initializing this object.
|
||||
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
|
||||
}
|
||||
|
||||
const (
|
||||
// NamespaceDefault means the object is in the default namespace which is applied when not specified by clients
|
||||
NamespaceDefault string = "default"
|
||||
@ -307,7 +301,7 @@ type OwnerReference struct {
|
||||
// API version of the referent.
|
||||
APIVersion string `json:"apiVersion" protobuf:"bytes,5,opt,name=apiVersion"`
|
||||
// Kind of the referent.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"`
|
||||
// Name of the referent.
|
||||
// More info: http://kubernetes.io/docs/user-guide/identifiers#names
|
||||
@ -328,6 +322,7 @@ type OwnerReference struct {
|
||||
BlockOwnerDeletion *bool `json:"blockOwnerDeletion,omitempty" protobuf:"varint,7,opt,name=blockOwnerDeletion"`
|
||||
}
|
||||
|
||||
// +k8s:conversion-gen:explicit-from=net/url.Values
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ListOptions is the query options to a standard REST list call.
|
||||
@ -349,14 +344,34 @@ type ListOptions struct {
|
||||
// add, update, and remove notifications. Specify resourceVersion.
|
||||
// +optional
|
||||
Watch bool `json:"watch,omitempty" protobuf:"varint,3,opt,name=watch"`
|
||||
// When specified with a watch call, shows changes that occur after that particular version of a resource.
|
||||
// Defaults to changes from the beginning of history.
|
||||
// When specified for list:
|
||||
// - if unset, then the result is returned from remote storage based on quorum-read flag;
|
||||
// - if it's 0, then we simply return what we currently have in cache, no guarantee;
|
||||
// - if set to non zero, then the result is at least as fresh as given rv.
|
||||
// allowWatchBookmarks requests watch events with type "BOOKMARK".
|
||||
// Servers that do not implement bookmarks may ignore this flag and
|
||||
// bookmarks are sent at the server's discretion. Clients should not
|
||||
// assume bookmarks are returned at any specific interval, nor may they
|
||||
// assume the server will send any BOOKMARK event during a session.
|
||||
// If this is not a watch, this field is ignored.
|
||||
// If the feature gate WatchBookmarks is not enabled in apiserver,
|
||||
// this field is ignored.
|
||||
// +optional
|
||||
AllowWatchBookmarks bool `json:"allowWatchBookmarks,omitempty" protobuf:"varint,9,opt,name=allowWatchBookmarks"`
|
||||
|
||||
// resourceVersion sets a constraint on what resource versions a request may be served from.
|
||||
// See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for
|
||||
// details.
|
||||
//
|
||||
// Defaults to unset
|
||||
// +optional
|
||||
ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,4,opt,name=resourceVersion"`
|
||||
|
||||
// resourceVersionMatch determines how resourceVersion is applied to list calls.
|
||||
// It is highly recommended that resourceVersionMatch be set for list calls where
|
||||
// resourceVersion is set
|
||||
// See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for
|
||||
// details.
|
||||
//
|
||||
// Defaults to unset
|
||||
// +optional
|
||||
ResourceVersionMatch ResourceVersionMatch `json:"resourceVersionMatch,omitempty" protobuf:"bytes,10,opt,name=resourceVersionMatch,casttype=ResourceVersionMatch"`
|
||||
// Timeout for the list/watch call.
|
||||
// This limits the duration of the call, regardless of any activity or inactivity.
|
||||
// +optional
|
||||
@ -396,6 +411,26 @@ type ListOptions struct {
|
||||
Continue string `json:"continue,omitempty" protobuf:"bytes,8,opt,name=continue"`
|
||||
}
|
||||
|
||||
// resourceVersionMatch specifies how the resourceVersion parameter is applied. resourceVersionMatch
|
||||
// may only be set if resourceVersion is also set.
|
||||
//
|
||||
// "NotOlderThan" matches data at least as new as the provided resourceVersion.
|
||||
// "Exact" matches data at the exact resourceVersion provided.
|
||||
//
|
||||
// See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for
|
||||
// details.
|
||||
type ResourceVersionMatch string
|
||||
|
||||
const (
|
||||
// ResourceVersionMatchNotOlderThan matches data at least as new as the provided
|
||||
// resourceVersion.
|
||||
ResourceVersionMatchNotOlderThan ResourceVersionMatch = "NotOlderThan"
|
||||
// ResourceVersionMatchExact matches data at the exact resourceVersion
|
||||
// provided.
|
||||
ResourceVersionMatchExact ResourceVersionMatch = "Exact"
|
||||
)
|
||||
|
||||
// +k8s:conversion-gen:explicit-from=net/url.Values
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ExportOptions is the query options to the standard REST get call.
|
||||
@ -410,15 +445,18 @@ type ExportOptions struct {
|
||||
Exact bool `json:"exact" protobuf:"varint,2,opt,name=exact"`
|
||||
}
|
||||
|
||||
// +k8s:conversion-gen:explicit-from=net/url.Values
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// GetOptions is the standard query options to the standard REST get call.
|
||||
type GetOptions struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// When specified:
|
||||
// - if unset, then the result is returned from remote storage based on quorum-read flag;
|
||||
// - if it's 0, then we simply return what we currently have in cache, no guarantee;
|
||||
// - if set to non zero, then the result is at least as fresh as given rv.
|
||||
// resourceVersion sets a constraint on what resource versions a request may be served from.
|
||||
// See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for
|
||||
// details.
|
||||
//
|
||||
// Defaults to unset
|
||||
// +optional
|
||||
ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,1,opt,name=resourceVersion"`
|
||||
// +k8s:deprecated=includeUninitialized,protobuf=2
|
||||
}
|
||||
@ -447,6 +485,7 @@ const (
|
||||
DryRunAll = "All"
|
||||
)
|
||||
|
||||
// +k8s:conversion-gen:explicit-from=net/url.Values
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// DeleteOptions may be provided when deleting an API object.
|
||||
@ -462,6 +501,7 @@ type DeleteOptions struct {
|
||||
|
||||
// Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be
|
||||
// returned.
|
||||
// +k8s:conversion-gen=false
|
||||
// +optional
|
||||
Preconditions *Preconditions `json:"preconditions,omitempty" protobuf:"bytes,2,opt,name=preconditions"`
|
||||
|
||||
@ -492,6 +532,7 @@ type DeleteOptions struct {
|
||||
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,5,rep,name=dryRun"`
|
||||
}
|
||||
|
||||
// +k8s:conversion-gen:explicit-from=net/url.Values
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// CreateOptions may be provided when creating an API object.
|
||||
@ -515,6 +556,7 @@ type CreateOptions struct {
|
||||
FieldManager string `json:"fieldManager,omitempty" protobuf:"bytes,3,name=fieldManager"`
|
||||
}
|
||||
|
||||
// +k8s:conversion-gen:explicit-from=net/url.Values
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// PatchOptions may be provided when patching an API object.
|
||||
@ -547,6 +589,7 @@ type PatchOptions struct {
|
||||
FieldManager string `json:"fieldManager,omitempty" protobuf:"bytes,3,name=fieldManager"`
|
||||
}
|
||||
|
||||
// +k8s:conversion-gen:explicit-from=net/url.Values
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// UpdateOptions may be provided when updating an API object.
|
||||
@ -586,13 +629,13 @@ type Preconditions struct {
|
||||
type Status struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Status of the operation.
|
||||
// One of: "Success" or "Failure".
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status string `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
|
||||
// A human-readable description of the status of this operation.
|
||||
@ -631,7 +674,7 @@ type StatusDetails struct {
|
||||
Group string `json:"group,omitempty" protobuf:"bytes,2,opt,name=group"`
|
||||
// The kind attribute of the resource associated with the status StatusReason.
|
||||
// On some operations may differ from the requested resource Kind.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
Kind string `json:"kind,omitempty" protobuf:"bytes,3,opt,name=kind"`
|
||||
// UID of the resource.
|
||||
@ -763,11 +806,13 @@ const (
|
||||
// doesn't make any sense, for example deleting a read-only object. This is different than
|
||||
// StatusReasonInvalid above which indicates that the API call could possibly succeed, but the
|
||||
// data was invalid. API calls that return BadRequest can never succeed.
|
||||
// Status code 400
|
||||
StatusReasonBadRequest StatusReason = "BadRequest"
|
||||
|
||||
// StatusReasonMethodNotAllowed means that the action the client attempted to perform on the
|
||||
// resource was not supported by the code - for instance, attempting to delete a resource that
|
||||
// can only be created. API calls that return MethodNotAllowed can never succeed.
|
||||
// Status code 405
|
||||
StatusReasonMethodNotAllowed StatusReason = "MethodNotAllowed"
|
||||
|
||||
// StatusReasonNotAcceptable means that the accept types indicated by the client were not acceptable
|
||||
@ -858,6 +903,9 @@ const (
|
||||
// FieldManagerConflict is used to report when another client claims to manage this field,
|
||||
// It should only be returned for a request using server-side apply.
|
||||
CauseTypeFieldManagerConflict CauseType = "FieldManagerConflict"
|
||||
// CauseTypeResourceVersionTooLarge is used to report that the requested resource version
|
||||
// is newer than the data observed by the API server, so the request cannot be served.
|
||||
CauseTypeResourceVersionTooLarge CauseType = "ResourceVersionTooLarge"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
@ -866,7 +914,7 @@ const (
|
||||
type List struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
@ -1099,9 +1147,16 @@ type ManagedFieldsEntry struct {
|
||||
// Time is timestamp of when these fields were set. It should always be empty if Operation is 'Apply'
|
||||
// +optional
|
||||
Time *Time `json:"time,omitempty" protobuf:"bytes,4,opt,name=time"`
|
||||
// Fields identifies a set of fields.
|
||||
|
||||
// Fields is tombstoned to show why 5 is a reserved protobuf tag.
|
||||
//Fields *Fields `json:"fields,omitempty" protobuf:"bytes,5,opt,name=fields,casttype=Fields"`
|
||||
|
||||
// FieldsType is the discriminator for the different fields format and version.
|
||||
// There is currently only one possible value: "FieldsV1"
|
||||
FieldsType string `json:"fieldsType,omitempty" protobuf:"bytes,6,opt,name=fieldsType"`
|
||||
// FieldsV1 holds the first JSON version format as described in the "FieldsV1" type.
|
||||
// +optional
|
||||
Fields *Fields `json:"fields,omitempty" protobuf:"bytes,5,opt,name=fields,casttype=Fields"`
|
||||
FieldsV1 *FieldsV1 `json:"fieldsV1,omitempty" protobuf:"bytes,7,opt,name=fieldsV1"`
|
||||
}
|
||||
|
||||
// ManagedFieldsOperationType is the type of operation which lead to a ManagedFieldsEntry being created.
|
||||
@ -1112,19 +1167,247 @@ const (
|
||||
ManagedFieldsOperationUpdate ManagedFieldsOperationType = "Update"
|
||||
)
|
||||
|
||||
// Fields stores a set of fields in a data structure like a Trie.
|
||||
// To understand how this is used, see: https://github.com/kubernetes-sigs/structured-merge-diff
|
||||
type Fields struct {
|
||||
// Map stores a set of fields in a data structure like a Trie.
|
||||
//
|
||||
// Each key is either a '.' representing the field itself, and will always map to an empty set,
|
||||
// or a string representing a sub-field or item. The string will follow one of these four formats:
|
||||
// 'f:<name>', where <name> is the name of a field in a struct, or key in a map
|
||||
// 'v:<value>', where <value> is the exact json formatted value of a list item
|
||||
// 'i:<index>', where <index> is position of a item in a list
|
||||
// 'k:<keys>', where <keys> is a map of a list item's key fields to their unique values
|
||||
// If a key maps to an empty Fields value, the field that key represents is part of the set.
|
||||
//
|
||||
// The exact format is defined in k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/internal
|
||||
Map map[string]Fields `json:",inline" protobuf:"bytes,1,rep,name=map"`
|
||||
// FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.
|
||||
//
|
||||
// Each key is either a '.' representing the field itself, and will always map to an empty set,
|
||||
// or a string representing a sub-field or item. The string will follow one of these four formats:
|
||||
// 'f:<name>', where <name> is the name of a field in a struct, or key in a map
|
||||
// 'v:<value>', where <value> is the exact json formatted value of a list item
|
||||
// 'i:<index>', where <index> is position of a item in a list
|
||||
// 'k:<keys>', where <keys> is a map of a list item's key fields to their unique values
|
||||
// If a key maps to an empty Fields value, the field that key represents is part of the set.
|
||||
//
|
||||
// The exact format is defined in sigs.k8s.io/structured-merge-diff
|
||||
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
||||
type FieldsV1 struct {
|
||||
// Raw is the underlying serialization of this object.
|
||||
Raw []byte `json:"-" protobuf:"bytes,1,opt,name=Raw"`
|
||||
}
|
||||
|
||||
func (f FieldsV1) String() string {
|
||||
return string(f.Raw)
|
||||
}
|
||||
|
||||
// TODO: Table does not generate to protobuf because of the interface{} - fix protobuf
|
||||
// generation to support a meta type that can accept any valid JSON. This can be introduced
|
||||
// in a v1 because clients a) receive an error if they try to access proto today, and b)
|
||||
// once introduced they would be able to gracefully switch over to using it.
|
||||
|
||||
// Table is a tabular representation of a set of API resources. The server transforms the
|
||||
// object into a set of preferred columns for quickly reviewing the objects.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +protobuf=false
|
||||
type Table struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
// columnDefinitions describes each column in the returned items array. The number of cells per row
|
||||
// will always match the number of column definitions.
|
||||
ColumnDefinitions []TableColumnDefinition `json:"columnDefinitions"`
|
||||
// rows is the list of items in the table.
|
||||
Rows []TableRow `json:"rows"`
|
||||
}
|
||||
|
||||
// TableColumnDefinition contains information about a column returned in the Table.
|
||||
// +protobuf=false
|
||||
type TableColumnDefinition struct {
|
||||
// name is a human readable name for the column.
|
||||
Name string `json:"name"`
|
||||
// type is an OpenAPI type definition for this column, such as number, integer, string, or
|
||||
// array.
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
|
||||
Type string `json:"type"`
|
||||
// format is an optional OpenAPI type modifier for this column. A format modifies the type and
|
||||
// imposes additional rules, like date or time formatting for a string. The 'name' format is applied
|
||||
// to the primary identifier column which has type 'string' to assist in clients identifying column
|
||||
// is the resource name.
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
|
||||
Format string `json:"format"`
|
||||
// description is a human readable description of this column.
|
||||
Description string `json:"description"`
|
||||
// priority is an integer defining the relative importance of this column compared to others. Lower
|
||||
// numbers are considered higher priority. Columns that may be omitted in limited space scenarios
|
||||
// should be given a higher priority.
|
||||
Priority int32 `json:"priority"`
|
||||
}
|
||||
|
||||
// TableRow is an individual row in a table.
|
||||
// +protobuf=false
|
||||
type TableRow struct {
|
||||
// cells will be as wide as the column definitions array and may contain strings, numbers (float64 or
|
||||
// int64), booleans, simple maps, lists, or null. See the type field of the column definition for a
|
||||
// more detailed description.
|
||||
Cells []interface{} `json:"cells"`
|
||||
// conditions describe additional status of a row that are relevant for a human user. These conditions
|
||||
// apply to the row, not to the object, and will be specific to table output. The only defined
|
||||
// condition type is 'Completed', for a row that indicates a resource that has run to completion and
|
||||
// can be given less visual priority.
|
||||
// +optional
|
||||
Conditions []TableRowCondition `json:"conditions,omitempty"`
|
||||
// This field contains the requested additional information about each object based on the includeObject
|
||||
// policy when requesting the Table. If "None", this field is empty, if "Object" this will be the
|
||||
// default serialization of the object for the current API version, and if "Metadata" (the default) will
|
||||
// contain the object metadata. Check the returned kind and apiVersion of the object before parsing.
|
||||
// The media type of the object will always match the enclosing list - if this as a JSON table, these
|
||||
// will be JSON encoded objects.
|
||||
// +optional
|
||||
Object runtime.RawExtension `json:"object,omitempty"`
|
||||
}
|
||||
|
||||
// TableRowCondition allows a row to be marked with additional information.
|
||||
// +protobuf=false
|
||||
type TableRowCondition struct {
|
||||
// Type of row condition. The only defined value is 'Completed' indicating that the
|
||||
// object this row represents has reached a completed state and may be given less visual
|
||||
// priority than other rows. Clients are not required to honor any conditions but should
|
||||
// be consistent where possible about handling the conditions.
|
||||
Type RowConditionType `json:"type"`
|
||||
// Status of the condition, one of True, False, Unknown.
|
||||
Status ConditionStatus `json:"status"`
|
||||
// (brief) machine readable reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// Human readable message indicating details about last transition.
|
||||
// +optional
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
type RowConditionType string
|
||||
|
||||
// These are valid conditions of a row. This list is not exhaustive and new conditions may be
|
||||
// included by other resources.
|
||||
const (
|
||||
// RowCompleted means the underlying resource has reached completion and may be given less
|
||||
// visual priority than other resources.
|
||||
RowCompleted RowConditionType = "Completed"
|
||||
)
|
||||
|
||||
type ConditionStatus string
|
||||
|
||||
// These are valid condition statuses. "ConditionTrue" means a resource is in the condition.
|
||||
// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes
|
||||
// can't decide if a resource is in the condition or not. In the future, we could add other
|
||||
// intermediate conditions, e.g. ConditionDegraded.
|
||||
const (
|
||||
ConditionTrue ConditionStatus = "True"
|
||||
ConditionFalse ConditionStatus = "False"
|
||||
ConditionUnknown ConditionStatus = "Unknown"
|
||||
)
|
||||
|
||||
// IncludeObjectPolicy controls which portion of the object is returned with a Table.
|
||||
type IncludeObjectPolicy string
|
||||
|
||||
const (
|
||||
// IncludeNone returns no object.
|
||||
IncludeNone IncludeObjectPolicy = "None"
|
||||
// IncludeMetadata serializes the object containing only its metadata field.
|
||||
IncludeMetadata IncludeObjectPolicy = "Metadata"
|
||||
// IncludeObject contains the full object.
|
||||
IncludeObject IncludeObjectPolicy = "Object"
|
||||
)
|
||||
|
||||
// TableOptions are used when a Table is requested by the caller.
|
||||
// +k8s:conversion-gen:explicit-from=net/url.Values
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type TableOptions struct {
|
||||
TypeMeta `json:",inline"`
|
||||
|
||||
// NoHeaders is only exposed for internal callers. It is not included in our OpenAPI definitions
|
||||
// and may be removed as a field in a future release.
|
||||
NoHeaders bool `json:"-"`
|
||||
|
||||
// includeObject decides whether to include each object along with its columnar information.
|
||||
// Specifying "None" will return no object, specifying "Object" will return the full object contents, and
|
||||
// specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind
|
||||
// in version v1beta1 of the meta.k8s.io API group.
|
||||
IncludeObject IncludeObjectPolicy `json:"includeObject,omitempty" protobuf:"bytes,1,opt,name=includeObject,casttype=IncludeObjectPolicy"`
|
||||
}
|
||||
|
||||
// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients
|
||||
// to get access to a particular ObjectMeta schema without knowing the details of the version.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type PartialObjectMetadata struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
}
|
||||
|
||||
// PartialObjectMetadataList contains a list of objects containing only their metadata
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type PartialObjectMetadataList struct {
|
||||
TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// items contains each of the included items.
|
||||
Items []PartialObjectMetadata `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// Condition contains details for one aspect of the current state of this API Resource.
|
||||
// ---
|
||||
// This struct is intended for direct use as an array at the field path .status.conditions. For example,
|
||||
// type FooStatus struct{
|
||||
// // Represents the observations of a foo's current state.
|
||||
// // Known .status.conditions.type are: "Available", "Progressing", and "Degraded"
|
||||
// // +patchMergeKey=type
|
||||
// // +patchStrategy=merge
|
||||
// // +listType=map
|
||||
// // +listMapKey=type
|
||||
// Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
|
||||
//
|
||||
// // other fields
|
||||
// }
|
||||
type Condition struct {
|
||||
// type of condition in CamelCase or in foo.example.com/CamelCase.
|
||||
// ---
|
||||
// Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
|
||||
// useful (see .node.status.conditions), the ability to deconflict is important.
|
||||
// The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
|
||||
// +required
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$`
|
||||
// +kubebuilder:validation:MaxLength=316
|
||||
Type string `json:"type" protobuf:"bytes,1,opt,name=type"`
|
||||
// status of the condition, one of True, False, Unknown.
|
||||
// +required
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:Enum=True;False;Unknown
|
||||
Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status"`
|
||||
// observedGeneration represents the .metadata.generation that the condition was set based upon.
|
||||
// For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
|
||||
// with respect to the current state of the instance.
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
|
||||
// lastTransitionTime is the last time the condition transitioned from one status to another.
|
||||
// This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
|
||||
// +required
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:Type=string
|
||||
// +kubebuilder:validation:Format=date-time
|
||||
LastTransitionTime Time `json:"lastTransitionTime" protobuf:"bytes,4,opt,name=lastTransitionTime"`
|
||||
// reason contains a programmatic identifier indicating the reason for the condition's last transition.
|
||||
// Producers of specific condition types may define expected values and meanings for this field,
|
||||
// and whether the values are considered a guaranteed API.
|
||||
// The value should be a CamelCase string.
|
||||
// This field may not be empty.
|
||||
// +required
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:MaxLength=1024
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
// +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$`
|
||||
Reason string `json:"reason" protobuf:"bytes,5,opt,name=reason"`
|
||||
// message is a human readable message indicating details about the transition.
|
||||
// This may be an empty string.
|
||||
// +required
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:MaxLength=32768
|
||||
Message string `json:"message" protobuf:"bytes,6,opt,name=message"`
|
||||
}
|
||||
|
179
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
generated
vendored
179
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
generated
vendored
@ -86,6 +86,20 @@ func (APIVersions) SwaggerDoc() map[string]string {
|
||||
return map_APIVersions
|
||||
}
|
||||
|
||||
var map_Condition = map[string]string{
|
||||
"": "Condition contains details for one aspect of the current state of this API Resource.",
|
||||
"type": "type of condition in CamelCase or in foo.example.com/CamelCase.",
|
||||
"status": "status of the condition, one of True, False, Unknown.",
|
||||
"observedGeneration": "observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.",
|
||||
"lastTransitionTime": "lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.",
|
||||
"reason": "reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.",
|
||||
"message": "message is a human readable message indicating details about the transition. This may be an empty string.",
|
||||
}
|
||||
|
||||
func (Condition) SwaggerDoc() map[string]string {
|
||||
return map_Condition
|
||||
}
|
||||
|
||||
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",
|
||||
@ -119,17 +133,17 @@ func (ExportOptions) SwaggerDoc() map[string]string {
|
||||
return map_ExportOptions
|
||||
}
|
||||
|
||||
var map_Fields = map[string]string{
|
||||
"": "Fields stores a set of fields in a data structure like a Trie. To understand how this is used, see: https://github.com/kubernetes-sigs/structured-merge-diff",
|
||||
var map_FieldsV1 = map[string]string{
|
||||
"": "FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.\n\nEach key is either a '.' representing the field itself, and will always map to an empty set, or a string representing a sub-field or item. The string will follow one of these four formats: 'f:<name>', where <name> is the name of a field in a struct, or key in a map 'v:<value>', where <value> is the exact json formatted value of a list item 'i:<index>', where <index> is position of a item in a list 'k:<keys>', where <keys> is a map of a list item's key fields to their unique values If a key maps to an empty Fields value, the field that key represents is part of the set.\n\nThe exact format is defined in sigs.k8s.io/structured-merge-diff",
|
||||
}
|
||||
|
||||
func (Fields) SwaggerDoc() map[string]string {
|
||||
return map_Fields
|
||||
func (FieldsV1) SwaggerDoc() map[string]string {
|
||||
return map_FieldsV1
|
||||
}
|
||||
|
||||
var map_GetOptions = map[string]string{
|
||||
"": "GetOptions is the standard query options to the standard REST get call.",
|
||||
"resourceVersion": "When specified: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
|
||||
"resourceVersion": "resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset",
|
||||
}
|
||||
|
||||
func (GetOptions) SwaggerDoc() map[string]string {
|
||||
@ -146,25 +160,6 @@ func (GroupVersionForDiscovery) SwaggerDoc() map[string]string {
|
||||
return map_GroupVersionForDiscovery
|
||||
}
|
||||
|
||||
var map_Initializer = map[string]string{
|
||||
"": "Initializer is information about an initializer that has not yet completed.",
|
||||
"name": "name of the process that is responsible for initializing this object.",
|
||||
}
|
||||
|
||||
func (Initializer) SwaggerDoc() map[string]string {
|
||||
return map_Initializer
|
||||
}
|
||||
|
||||
var map_Initializers = map[string]string{
|
||||
"": "Initializers tracks the progress of initialization.",
|
||||
"pending": "Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.",
|
||||
"result": "If result is set with the Failure field, the object will be persisted to storage and then deleted, ensuring that other clients can observe the deletion.",
|
||||
}
|
||||
|
||||
func (Initializers) SwaggerDoc() map[string]string {
|
||||
return map_Initializers
|
||||
}
|
||||
|
||||
var map_LabelSelector = map[string]string{
|
||||
"": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.",
|
||||
"matchLabels": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
|
||||
@ -188,7 +183,7 @@ func (LabelSelectorRequirement) SwaggerDoc() map[string]string {
|
||||
|
||||
var map_List = map[string]string{
|
||||
"": "List holds a list of objects, which may not be known by the server.",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
"items": "List of objects",
|
||||
}
|
||||
|
||||
@ -197,10 +192,11 @@ func (List) SwaggerDoc() map[string]string {
|
||||
}
|
||||
|
||||
var map_ListMeta = map[string]string{
|
||||
"": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.",
|
||||
"selfLink": "selfLink is a URL representing this object. Populated by the system. Read-only.",
|
||||
"resourceVersion": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency",
|
||||
"continue": "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.",
|
||||
"": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.",
|
||||
"selfLink": "selfLink is a URL representing this object. Populated by the system. Read-only.\n\nDEPRECATED Kubernetes will stop propagating this field in 1.20 release and the field is planned to be removed in 1.21 release.",
|
||||
"resourceVersion": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
|
||||
"continue": "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.",
|
||||
"remainingItemCount": "remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.",
|
||||
}
|
||||
|
||||
func (ListMeta) SwaggerDoc() map[string]string {
|
||||
@ -208,14 +204,16 @@ func (ListMeta) SwaggerDoc() map[string]string {
|
||||
}
|
||||
|
||||
var map_ListOptions = map[string]string{
|
||||
"": "ListOptions is the query options to a standard REST list call.",
|
||||
"labelSelector": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
|
||||
"fieldSelector": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
|
||||
"watch": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
|
||||
"resourceVersion": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
|
||||
"timeoutSeconds": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.",
|
||||
"limit": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.",
|
||||
"continue": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
|
||||
"": "ListOptions is the query options to a standard REST list call.",
|
||||
"labelSelector": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
|
||||
"fieldSelector": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
|
||||
"watch": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
|
||||
"allowWatchBookmarks": "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.",
|
||||
"resourceVersion": "resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset",
|
||||
"resourceVersionMatch": "resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset",
|
||||
"timeoutSeconds": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.",
|
||||
"limit": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.",
|
||||
"continue": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
|
||||
}
|
||||
|
||||
func (ListOptions) SwaggerDoc() map[string]string {
|
||||
@ -228,7 +226,8 @@ var map_ManagedFieldsEntry = map[string]string{
|
||||
"operation": "Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'.",
|
||||
"apiVersion": "APIVersion defines the version of this resource that this field set applies to. The format is \"group/version\" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted.",
|
||||
"time": "Time is timestamp of when these fields were set. It should always be empty if Operation is 'Apply'",
|
||||
"fields": "Fields identifies a set of fields.",
|
||||
"fieldsType": "FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: \"FieldsV1\"",
|
||||
"fieldsV1": "FieldsV1 holds the first JSON version format as described in the \"FieldsV1\" type.",
|
||||
}
|
||||
|
||||
func (ManagedFieldsEntry) SwaggerDoc() map[string]string {
|
||||
@ -238,22 +237,21 @@ func (ManagedFieldsEntry) SwaggerDoc() map[string]string {
|
||||
var map_ObjectMeta = map[string]string{
|
||||
"": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.",
|
||||
"name": "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
|
||||
"generateName": "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency",
|
||||
"namespace": "Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces",
|
||||
"selfLink": "SelfLink is a URL representing this object. Populated by the system. Read-only.",
|
||||
"generateName": "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency",
|
||||
"namespace": "Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces",
|
||||
"selfLink": "SelfLink is a URL representing this object. Populated by the system. Read-only.\n\nDEPRECATED Kubernetes will stop propagating this field in 1.20 release and the field is planned to be removed in 1.21 release.",
|
||||
"uid": "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids",
|
||||
"resourceVersion": "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency",
|
||||
"resourceVersion": "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
|
||||
"generation": "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.",
|
||||
"creationTimestamp": "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
|
||||
"deletionTimestamp": "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
|
||||
"creationTimestamp": "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
"deletionTimestamp": "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
"deletionGracePeriodSeconds": "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.",
|
||||
"labels": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels",
|
||||
"annotations": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations",
|
||||
"ownerReferences": "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.",
|
||||
"initializers": "An initializer is a controller which enforces some system invariant at object creation time. This field is a list of initializers that have not yet acted on this object. If nil or empty, this object has been completely initialized. Otherwise, the object is considered uninitialized and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to observe uninitialized objects.\n\nWhen an object is created, the system will populate this list with the current set of initializers. Only privileged users may set or modify this list. Once it is empty, it may not be modified further by any user.\n\nDEPRECATED - initializers are an alpha field and will be removed in v1.15.",
|
||||
"finalizers": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.",
|
||||
"finalizers": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list.",
|
||||
"clusterName": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.",
|
||||
"managedFields": "ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object.\n\nThis field is alpha and can be changed or removed without notice.",
|
||||
"managedFields": "ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object.",
|
||||
}
|
||||
|
||||
func (ObjectMeta) SwaggerDoc() map[string]string {
|
||||
@ -263,7 +261,7 @@ func (ObjectMeta) SwaggerDoc() map[string]string {
|
||||
var map_OwnerReference = map[string]string{
|
||||
"": "OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.",
|
||||
"apiVersion": "API version of the referent.",
|
||||
"kind": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"kind": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
"name": "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
|
||||
"uid": "UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids",
|
||||
"controller": "If true, this reference points to the managing controller.",
|
||||
@ -274,6 +272,25 @@ func (OwnerReference) SwaggerDoc() map[string]string {
|
||||
return map_OwnerReference
|
||||
}
|
||||
|
||||
var map_PartialObjectMetadata = map[string]string{
|
||||
"": "PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients to get access to a particular ObjectMeta schema without knowing the details of the version.",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
}
|
||||
|
||||
func (PartialObjectMetadata) SwaggerDoc() map[string]string {
|
||||
return map_PartialObjectMetadata
|
||||
}
|
||||
|
||||
var map_PartialObjectMetadataList = map[string]string{
|
||||
"": "PartialObjectMetadataList contains a list of objects containing only their metadata",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
"items": "items contains each of the included items.",
|
||||
}
|
||||
|
||||
func (PartialObjectMetadataList) SwaggerDoc() map[string]string {
|
||||
return map_PartialObjectMetadataList
|
||||
}
|
||||
|
||||
var map_Patch = map[string]string{
|
||||
"": "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.",
|
||||
}
|
||||
@ -324,8 +341,8 @@ func (ServerAddressByClientCIDR) SwaggerDoc() map[string]string {
|
||||
|
||||
var map_Status = map[string]string{
|
||||
"": "Status is a return value for calls that don't return other objects.",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"status": "Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
"status": "Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
|
||||
"message": "A human-readable description of the status of this operation.",
|
||||
"reason": "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.",
|
||||
"details": "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.",
|
||||
@ -351,7 +368,7 @@ var map_StatusDetails = map[string]string{
|
||||
"": "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.",
|
||||
"name": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).",
|
||||
"group": "The group attribute of the resource associated with the status StatusReason.",
|
||||
"kind": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"kind": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
"uid": "UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids",
|
||||
"causes": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.",
|
||||
"retryAfterSeconds": "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.",
|
||||
@ -361,10 +378,66 @@ func (StatusDetails) SwaggerDoc() map[string]string {
|
||||
return map_StatusDetails
|
||||
}
|
||||
|
||||
var map_Table = map[string]string{
|
||||
"": "Table is a tabular representation of a set of API resources. The server transforms the object into a set of preferred columns for quickly reviewing the objects.",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
"columnDefinitions": "columnDefinitions describes each column in the returned items array. The number of cells per row will always match the number of column definitions.",
|
||||
"rows": "rows is the list of items in the table.",
|
||||
}
|
||||
|
||||
func (Table) SwaggerDoc() map[string]string {
|
||||
return map_Table
|
||||
}
|
||||
|
||||
var map_TableColumnDefinition = map[string]string{
|
||||
"": "TableColumnDefinition contains information about a column returned in the Table.",
|
||||
"name": "name is a human readable name for the column.",
|
||||
"type": "type is an OpenAPI type definition for this column, such as number, integer, string, or array. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.",
|
||||
"format": "format is an optional OpenAPI type modifier for this column. A format modifies the type and imposes additional rules, like date or time formatting for a string. The 'name' format is applied to the primary identifier column which has type 'string' to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.",
|
||||
"description": "description is a human readable description of this column.",
|
||||
"priority": "priority is an integer defining the relative importance of this column compared to others. Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a higher priority.",
|
||||
}
|
||||
|
||||
func (TableColumnDefinition) SwaggerDoc() map[string]string {
|
||||
return map_TableColumnDefinition
|
||||
}
|
||||
|
||||
var map_TableOptions = map[string]string{
|
||||
"": "TableOptions are used when a Table is requested by the caller.",
|
||||
"includeObject": "includeObject decides whether to include each object along with its columnar information. Specifying \"None\" will return no object, specifying \"Object\" will return the full object contents, and specifying \"Metadata\" (the default) will return the object's metadata in the PartialObjectMetadata kind in version v1beta1 of the meta.k8s.io API group.",
|
||||
}
|
||||
|
||||
func (TableOptions) SwaggerDoc() map[string]string {
|
||||
return map_TableOptions
|
||||
}
|
||||
|
||||
var map_TableRow = map[string]string{
|
||||
"": "TableRow is an individual row in a table.",
|
||||
"cells": "cells will be as wide as the column definitions array and may contain strings, numbers (float64 or int64), booleans, simple maps, lists, or null. See the type field of the column definition for a more detailed description.",
|
||||
"conditions": "conditions describe additional status of a row that are relevant for a human user. These conditions apply to the row, not to the object, and will be specific to table output. The only defined condition type is 'Completed', for a row that indicates a resource that has run to completion and can be given less visual priority.",
|
||||
"object": "This field contains the requested additional information about each object based on the includeObject policy when requesting the Table. If \"None\", this field is empty, if \"Object\" this will be the default serialization of the object for the current API version, and if \"Metadata\" (the default) will contain the object metadata. Check the returned kind and apiVersion of the object before parsing. The media type of the object will always match the enclosing list - if this as a JSON table, these will be JSON encoded objects.",
|
||||
}
|
||||
|
||||
func (TableRow) SwaggerDoc() map[string]string {
|
||||
return map_TableRow
|
||||
}
|
||||
|
||||
var map_TableRowCondition = map[string]string{
|
||||
"": "TableRowCondition allows a row to be marked with additional information.",
|
||||
"type": "Type of row condition. The only defined value is 'Completed' indicating that the object this row represents has reached a completed state and may be given less visual priority than other rows. Clients are not required to honor any conditions but should be consistent where possible about handling the conditions.",
|
||||
"status": "Status of the condition, one of True, False, Unknown.",
|
||||
"reason": "(brief) machine readable reason for the condition's last transition.",
|
||||
"message": "Human readable message indicating details about last transition.",
|
||||
}
|
||||
|
||||
func (TableRowCondition) SwaggerDoc() map[string]string {
|
||||
return map_TableRowCondition
|
||||
}
|
||||
|
||||
var map_TypeMeta = map[string]string{
|
||||
"": "TypeMeta describes an individual object in an API response or request with strings representing the type of the object and its API schema version. Structures that are versioned or persisted should inline TypeMeta.",
|
||||
"kind": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"apiVersion": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
|
||||
"kind": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
"apiVersion": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
|
||||
}
|
||||
|
||||
func (TypeMeta) SwaggerDoc() map[string]string {
|
||||
|
76
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
generated
vendored
76
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
generated
vendored
@ -27,11 +27,15 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// NestedFieldCopy returns a deep copy of the value of a nested field.
|
||||
// Returns false if the value is missing.
|
||||
// No error is returned for a nil field.
|
||||
//
|
||||
// Note: fields passed to this function are treated as keys within the passed
|
||||
// object; no array/slice syntax is supported.
|
||||
func NestedFieldCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error) {
|
||||
val, found, err := NestedFieldNoCopy(obj, fields...)
|
||||
if !found || err != nil {
|
||||
@ -43,6 +47,9 @@ func NestedFieldCopy(obj map[string]interface{}, fields ...string) (interface{},
|
||||
// NestedFieldNoCopy returns a reference to a nested field.
|
||||
// Returns false if value is not found and an error if unable
|
||||
// to traverse obj.
|
||||
//
|
||||
// Note: fields passed to this function are treated as keys within the passed
|
||||
// object; no array/slice syntax is supported.
|
||||
func NestedFieldNoCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error) {
|
||||
var val interface{} = obj
|
||||
|
||||
@ -275,6 +282,22 @@ func getNestedString(obj map[string]interface{}, fields ...string) string {
|
||||
return val
|
||||
}
|
||||
|
||||
func getNestedInt64(obj map[string]interface{}, fields ...string) int64 {
|
||||
val, found, err := NestedInt64(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return 0
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
func getNestedInt64Pointer(obj map[string]interface{}, fields ...string) *int64 {
|
||||
val, found, err := NestedInt64(obj, fields...)
|
||||
if !found || err != nil {
|
||||
return nil
|
||||
}
|
||||
return &val
|
||||
}
|
||||
|
||||
func jsonPath(fields []string) string {
|
||||
return "." + strings.Join(fields, ".")
|
||||
}
|
||||
@ -307,6 +330,8 @@ var UnstructuredJSONScheme runtime.Codec = unstructuredJSONScheme{}
|
||||
|
||||
type unstructuredJSONScheme struct{}
|
||||
|
||||
const unstructuredJSONSchemeIdentifier runtime.Identifier = "unstructuredJSON"
|
||||
|
||||
func (s unstructuredJSONScheme) Decode(data []byte, _ *schema.GroupVersionKind, obj runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
|
||||
var err error
|
||||
if obj != nil {
|
||||
@ -327,7 +352,14 @@ func (s unstructuredJSONScheme) Decode(data []byte, _ *schema.GroupVersionKind,
|
||||
return obj, &gvk, nil
|
||||
}
|
||||
|
||||
func (unstructuredJSONScheme) Encode(obj runtime.Object, w io.Writer) error {
|
||||
func (s unstructuredJSONScheme) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if co, ok := obj.(runtime.CacheableObject); ok {
|
||||
return co.CacheEncode(s.Identifier(), s.doEncode, w)
|
||||
}
|
||||
return s.doEncode(obj, w)
|
||||
}
|
||||
|
||||
func (unstructuredJSONScheme) doEncode(obj runtime.Object, w io.Writer) error {
|
||||
switch t := obj.(type) {
|
||||
case *Unstructured:
|
||||
return json.NewEncoder(w).Encode(t.Object)
|
||||
@ -351,6 +383,11 @@ func (unstructuredJSONScheme) Encode(obj runtime.Object, w io.Writer) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (unstructuredJSONScheme) Identifier() runtime.Identifier {
|
||||
return unstructuredJSONSchemeIdentifier
|
||||
}
|
||||
|
||||
func (s unstructuredJSONScheme) decode(data []byte) (runtime.Object, error) {
|
||||
type detector struct {
|
||||
Items gojson.RawMessage
|
||||
@ -378,12 +415,6 @@ func (s unstructuredJSONScheme) decodeInto(data []byte, obj runtime.Object) erro
|
||||
return s.decodeToUnstructured(data, x)
|
||||
case *UnstructuredList:
|
||||
return s.decodeToList(data, x)
|
||||
case *runtime.VersionedObjects:
|
||||
o, err := s.decode(data)
|
||||
if err == nil {
|
||||
x.Objects = []runtime.Object{o}
|
||||
}
|
||||
return err
|
||||
default:
|
||||
return json.Unmarshal(data, x)
|
||||
}
|
||||
@ -438,12 +469,30 @@ func (s unstructuredJSONScheme) decodeToList(data []byte, list *UnstructuredList
|
||||
return nil
|
||||
}
|
||||
|
||||
type JSONFallbackEncoder struct {
|
||||
runtime.Encoder
|
||||
type jsonFallbackEncoder struct {
|
||||
encoder runtime.Encoder
|
||||
identifier runtime.Identifier
|
||||
}
|
||||
|
||||
func (c JSONFallbackEncoder) Encode(obj runtime.Object, w io.Writer) error {
|
||||
err := c.Encoder.Encode(obj, w)
|
||||
func NewJSONFallbackEncoder(encoder runtime.Encoder) runtime.Encoder {
|
||||
result := map[string]string{
|
||||
"name": "fallback",
|
||||
"base": string(encoder.Identifier()),
|
||||
}
|
||||
identifier, err := gojson.Marshal(result)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed marshaling identifier for jsonFallbackEncoder: %v", err)
|
||||
}
|
||||
return &jsonFallbackEncoder{
|
||||
encoder: encoder,
|
||||
identifier: runtime.Identifier(identifier),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *jsonFallbackEncoder) Encode(obj runtime.Object, w io.Writer) error {
|
||||
// There is no need to handle runtime.CacheableObject, as we only
|
||||
// fallback to other encoders here.
|
||||
err := c.encoder.Encode(obj, w)
|
||||
if runtime.IsNotRegisteredError(err) {
|
||||
switch obj.(type) {
|
||||
case *Unstructured, *UnstructuredList:
|
||||
@ -452,3 +501,8 @@ func (c JSONFallbackEncoder) Encode(obj runtime.Object, w io.Writer) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (c *jsonFallbackEncoder) Identifier() runtime.Identifier {
|
||||
return c.identifier
|
||||
}
|
||||
|
48
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
generated
vendored
48
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
generated
vendored
@ -47,6 +47,7 @@ type Unstructured struct {
|
||||
|
||||
var _ metav1.Object = &Unstructured{}
|
||||
var _ runtime.Unstructured = &Unstructured{}
|
||||
var _ metav1.ListInterface = &Unstructured{}
|
||||
|
||||
func (obj *Unstructured) GetObjectKind() schema.ObjectKind { return obj }
|
||||
|
||||
@ -126,6 +127,16 @@ func (u *Unstructured) UnmarshalJSON(b []byte) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// NewEmptyInstance returns a new instance of the concrete type containing only kind/apiVersion and no other data.
|
||||
// This should be called instead of reflect.New() for unstructured types because the go type alone does not preserve kind/apiVersion info.
|
||||
func (in *Unstructured) NewEmptyInstance() runtime.Unstructured {
|
||||
out := new(Unstructured)
|
||||
if in != nil {
|
||||
out.GetObjectKind().SetGroupVersionKind(in.GetObjectKind().GroupVersionKind())
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (in *Unstructured) DeepCopy() *Unstructured {
|
||||
if in == nil {
|
||||
return nil
|
||||
@ -319,6 +330,18 @@ func (u *Unstructured) SetContinue(c string) {
|
||||
u.setNestedField(c, "metadata", "continue")
|
||||
}
|
||||
|
||||
func (u *Unstructured) GetRemainingItemCount() *int64 {
|
||||
return getNestedInt64Pointer(u.Object, "metadata", "remainingItemCount")
|
||||
}
|
||||
|
||||
func (u *Unstructured) SetRemainingItemCount(c *int64) {
|
||||
if c == nil {
|
||||
RemoveNestedField(u.Object, "metadata", "remainingItemCount")
|
||||
} else {
|
||||
u.setNestedField(*c, "metadata", "remainingItemCount")
|
||||
}
|
||||
}
|
||||
|
||||
func (u *Unstructured) GetCreationTimestamp() metav1.Time {
|
||||
var timestamp metav1.Time
|
||||
timestamp.UnmarshalQueryParameter(getNestedString(u.Object, "metadata", "creationTimestamp"))
|
||||
@ -408,31 +431,6 @@ func (u *Unstructured) GroupVersionKind() schema.GroupVersionKind {
|
||||
return gvk
|
||||
}
|
||||
|
||||
func (u *Unstructured) GetInitializers() *metav1.Initializers {
|
||||
m, found, err := nestedMapNoCopy(u.Object, "metadata", "initializers")
|
||||
if !found || err != nil {
|
||||
return nil
|
||||
}
|
||||
out := &metav1.Initializers{}
|
||||
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(m, out); err != nil {
|
||||
utilruntime.HandleError(fmt.Errorf("unable to retrieve initializers for object: %v", err))
|
||||
return nil
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (u *Unstructured) SetInitializers(initializers *metav1.Initializers) {
|
||||
if initializers == nil {
|
||||
RemoveNestedField(u.Object, "metadata", "initializers")
|
||||
return
|
||||
}
|
||||
out, err := runtime.DefaultUnstructuredConverter.ToUnstructured(initializers)
|
||||
if err != nil {
|
||||
utilruntime.HandleError(fmt.Errorf("unable to retrieve initializers for object: %v", err))
|
||||
}
|
||||
u.setNestedField(out, "metadata", "initializers")
|
||||
}
|
||||
|
||||
func (u *Unstructured) GetFinalizers() []string {
|
||||
val, _, _ := NestedStringSlice(u.Object, "metadata", "finalizers")
|
||||
return val
|
||||
|
22
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go
generated
vendored
22
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go
generated
vendored
@ -52,6 +52,16 @@ func (u *UnstructuredList) EachListItem(fn func(runtime.Object) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewEmptyInstance returns a new instance of the concrete type containing only kind/apiVersion and no other data.
|
||||
// This should be called instead of reflect.New() for unstructured types because the go type alone does not preserve kind/apiVersion info.
|
||||
func (u *UnstructuredList) NewEmptyInstance() runtime.Unstructured {
|
||||
out := new(UnstructuredList)
|
||||
if u != nil {
|
||||
out.SetGroupVersionKind(u.GroupVersionKind())
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// UnstructuredContent returns a map contain an overlay of the Items field onto
|
||||
// the Object field. Items always overwrites overlay.
|
||||
func (u *UnstructuredList) UnstructuredContent() map[string]interface{} {
|
||||
@ -166,6 +176,18 @@ func (u *UnstructuredList) SetContinue(c string) {
|
||||
u.setNestedField(c, "metadata", "continue")
|
||||
}
|
||||
|
||||
func (u *UnstructuredList) GetRemainingItemCount() *int64 {
|
||||
return getNestedInt64Pointer(u.Object, "metadata", "remainingItemCount")
|
||||
}
|
||||
|
||||
func (u *UnstructuredList) SetRemainingItemCount(c *int64) {
|
||||
if c == nil {
|
||||
RemoveNestedField(u.Object, "metadata", "remainingItemCount")
|
||||
} else {
|
||||
u.setNestedField(*c, "metadata", "remainingItemCount")
|
||||
}
|
||||
}
|
||||
|
||||
func (u *UnstructuredList) SetGroupVersionKind(gvk schema.GroupVersionKind) {
|
||||
u.SetAPIVersion(gvk.GroupVersion().String())
|
||||
u.SetKind(gvk.Kind)
|
||||
|
535
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go
generated
vendored
Normal file
535
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go
generated
vendored
Normal file
@ -0,0 +1,535 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by conversion-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
url "net/url"
|
||||
unsafe "unsafe"
|
||||
|
||||
resource "k8s.io/apimachinery/pkg/api/resource"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
fields "k8s.io/apimachinery/pkg/fields"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
intstr "k8s.io/apimachinery/pkg/util/intstr"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
)
|
||||
|
||||
func init() {
|
||||
localSchemeBuilder.Register(RegisterConversions)
|
||||
}
|
||||
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(s *runtime.Scheme) error {
|
||||
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*CreateOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_url_Values_To_v1_CreateOptions(a.(*url.Values), b.(*CreateOptions), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*DeleteOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_url_Values_To_v1_DeleteOptions(a.(*url.Values), b.(*DeleteOptions), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*ExportOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_url_Values_To_v1_ExportOptions(a.(*url.Values), b.(*ExportOptions), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*GetOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_url_Values_To_v1_GetOptions(a.(*url.Values), b.(*GetOptions), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*ListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_url_Values_To_v1_ListOptions(a.(*url.Values), b.(*ListOptions), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*PatchOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_url_Values_To_v1_PatchOptions(a.(*url.Values), b.(*PatchOptions), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*TableOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_url_Values_To_v1_TableOptions(a.(*url.Values), b.(*TableOptions), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*UpdateOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_url_Values_To_v1_UpdateOptions(a.(*url.Values), b.(*UpdateOptions), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*map[string]string)(nil), (*LabelSelector)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Map_string_To_string_To_v1_LabelSelector(a.(*map[string]string), b.(*LabelSelector), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((**bool)(nil), (*bool)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Pointer_bool_To_bool(a.(**bool), b.(*bool), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((**float64)(nil), (*float64)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Pointer_float64_To_float64(a.(**float64), b.(*float64), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((**int32)(nil), (*int32)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Pointer_int32_To_int32(a.(**int32), b.(*int32), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((**int64)(nil), (*int)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Pointer_int64_To_int(a.(**int64), b.(*int), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((**int64)(nil), (*int64)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Pointer_int64_To_int64(a.(**int64), b.(*int64), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((**intstr.IntOrString)(nil), (*intstr.IntOrString)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Pointer_intstr_IntOrString_To_intstr_IntOrString(a.(**intstr.IntOrString), b.(*intstr.IntOrString), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((**string)(nil), (*string)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Pointer_string_To_string(a.(**string), b.(*string), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((**Duration)(nil), (*Duration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Pointer_v1_Duration_To_v1_Duration(a.(**Duration), b.(*Duration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*[]string)(nil), (**DeletionPropagation)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Slice_string_To_Pointer_v1_DeletionPropagation(a.(*[]string), b.(**DeletionPropagation), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*[]string)(nil), (**Time)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Slice_string_To_Pointer_v1_Time(a.(*[]string), b.(**Time), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*[]string)(nil), (*[]int32)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Slice_string_To_Slice_int32(a.(*[]string), b.(*[]int32), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*[]string)(nil), (*IncludeObjectPolicy)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Slice_string_To_v1_IncludeObjectPolicy(a.(*[]string), b.(*IncludeObjectPolicy), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*[]string)(nil), (*ResourceVersionMatch)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Slice_string_To_v1_ResourceVersionMatch(a.(*[]string), b.(*ResourceVersionMatch), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*[]string)(nil), (*Time)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Slice_string_To_v1_Time(a.(*[]string), b.(*Time), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*bool)(nil), (**bool)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_bool_To_Pointer_bool(a.(*bool), b.(**bool), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*fields.Selector)(nil), (*string)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_fields_Selector_To_string(a.(*fields.Selector), b.(*string), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*float64)(nil), (**float64)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_float64_To_Pointer_float64(a.(*float64), b.(**float64), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*int32)(nil), (**int32)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_int32_To_Pointer_int32(a.(*int32), b.(**int32), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*int64)(nil), (**int64)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_int64_To_Pointer_int64(a.(*int64), b.(**int64), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*int)(nil), (**int64)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_int_To_Pointer_int64(a.(*int), b.(**int64), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*intstr.IntOrString)(nil), (**intstr.IntOrString)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_intstr_IntOrString_To_Pointer_intstr_IntOrString(a.(*intstr.IntOrString), b.(**intstr.IntOrString), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*intstr.IntOrString)(nil), (*intstr.IntOrString)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_intstr_IntOrString_To_intstr_IntOrString(a.(*intstr.IntOrString), b.(*intstr.IntOrString), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*labels.Selector)(nil), (*string)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_labels_Selector_To_string(a.(*labels.Selector), b.(*string), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*resource.Quantity)(nil), (*resource.Quantity)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_resource_Quantity_To_resource_Quantity(a.(*resource.Quantity), b.(*resource.Quantity), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*string)(nil), (**string)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_string_To_Pointer_string(a.(*string), b.(**string), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*string)(nil), (*fields.Selector)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_string_To_fields_Selector(a.(*string), b.(*fields.Selector), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*string)(nil), (*labels.Selector)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_string_To_labels_Selector(a.(*string), b.(*labels.Selector), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*url.Values)(nil), (*DeleteOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_url_Values_To_v1_DeleteOptions(a.(*url.Values), b.(*DeleteOptions), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*DeleteOptions)(nil), (*DeleteOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_DeleteOptions_To_v1_DeleteOptions(a.(*DeleteOptions), b.(*DeleteOptions), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*Duration)(nil), (**Duration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_Duration_To_Pointer_v1_Duration(a.(*Duration), b.(**Duration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*InternalEvent)(nil), (*WatchEvent)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_InternalEvent_To_v1_WatchEvent(a.(*InternalEvent), b.(*WatchEvent), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*LabelSelector)(nil), (*map[string]string)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_LabelSelector_To_Map_string_To_string(a.(*LabelSelector), b.(*map[string]string), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*ListMeta)(nil), (*ListMeta)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_ListMeta_To_v1_ListMeta(a.(*ListMeta), b.(*ListMeta), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*MicroTime)(nil), (*MicroTime)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_MicroTime_To_v1_MicroTime(a.(*MicroTime), b.(*MicroTime), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*Time)(nil), (*Time)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_Time_To_v1_Time(a.(*Time), b.(*Time), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*TypeMeta)(nil), (*TypeMeta)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_TypeMeta_To_v1_TypeMeta(a.(*TypeMeta), b.(*TypeMeta), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*WatchEvent)(nil), (*InternalEvent)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_WatchEvent_To_v1_InternalEvent(a.(*WatchEvent), b.(*InternalEvent), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*WatchEvent)(nil), (*watch.Event)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_WatchEvent_To_watch_Event(a.(*WatchEvent), b.(*watch.Event), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*watch.Event)(nil), (*WatchEvent)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_watch_Event_To_v1_WatchEvent(a.(*watch.Event), b.(*WatchEvent), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_url_Values_To_v1_CreateOptions(in *url.Values, out *CreateOptions, s conversion.Scope) error {
|
||||
// WARNING: Field TypeMeta does not have json tag, skipping.
|
||||
|
||||
if values, ok := map[string][]string(*in)["dryRun"]; ok && len(values) > 0 {
|
||||
out.DryRun = *(*[]string)(unsafe.Pointer(&values))
|
||||
} else {
|
||||
out.DryRun = nil
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["fieldManager"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_string(&values, &out.FieldManager, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.FieldManager = ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_url_Values_To_v1_CreateOptions is an autogenerated conversion function.
|
||||
func Convert_url_Values_To_v1_CreateOptions(in *url.Values, out *CreateOptions, s conversion.Scope) error {
|
||||
return autoConvert_url_Values_To_v1_CreateOptions(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_url_Values_To_v1_DeleteOptions(in *url.Values, out *DeleteOptions, s conversion.Scope) error {
|
||||
// WARNING: Field TypeMeta does not have json tag, skipping.
|
||||
|
||||
if values, ok := map[string][]string(*in)["gracePeriodSeconds"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_Pointer_int64(&values, &out.GracePeriodSeconds, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.GracePeriodSeconds = nil
|
||||
}
|
||||
// INFO: in.Preconditions opted out of conversion generation
|
||||
if values, ok := map[string][]string(*in)["orphanDependents"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_Pointer_bool(&values, &out.OrphanDependents, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.OrphanDependents = nil
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["propagationPolicy"]; ok && len(values) > 0 {
|
||||
if err := Convert_Slice_string_To_Pointer_v1_DeletionPropagation(&values, &out.PropagationPolicy, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PropagationPolicy = nil
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["dryRun"]; ok && len(values) > 0 {
|
||||
out.DryRun = *(*[]string)(unsafe.Pointer(&values))
|
||||
} else {
|
||||
out.DryRun = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_url_Values_To_v1_ExportOptions(in *url.Values, out *ExportOptions, s conversion.Scope) error {
|
||||
// WARNING: Field TypeMeta does not have json tag, skipping.
|
||||
|
||||
if values, ok := map[string][]string(*in)["export"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_bool(&values, &out.Export, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Export = false
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["exact"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_bool(&values, &out.Exact, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Exact = false
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_url_Values_To_v1_ExportOptions is an autogenerated conversion function.
|
||||
func Convert_url_Values_To_v1_ExportOptions(in *url.Values, out *ExportOptions, s conversion.Scope) error {
|
||||
return autoConvert_url_Values_To_v1_ExportOptions(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_url_Values_To_v1_GetOptions(in *url.Values, out *GetOptions, s conversion.Scope) error {
|
||||
// WARNING: Field TypeMeta does not have json tag, skipping.
|
||||
|
||||
if values, ok := map[string][]string(*in)["resourceVersion"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_string(&values, &out.ResourceVersion, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.ResourceVersion = ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_url_Values_To_v1_GetOptions is an autogenerated conversion function.
|
||||
func Convert_url_Values_To_v1_GetOptions(in *url.Values, out *GetOptions, s conversion.Scope) error {
|
||||
return autoConvert_url_Values_To_v1_GetOptions(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_url_Values_To_v1_ListOptions(in *url.Values, out *ListOptions, s conversion.Scope) error {
|
||||
// WARNING: Field TypeMeta does not have json tag, skipping.
|
||||
|
||||
if values, ok := map[string][]string(*in)["labelSelector"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_string(&values, &out.LabelSelector, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.LabelSelector = ""
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["fieldSelector"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_string(&values, &out.FieldSelector, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.FieldSelector = ""
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["watch"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_bool(&values, &out.Watch, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Watch = false
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["allowWatchBookmarks"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_bool(&values, &out.AllowWatchBookmarks, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.AllowWatchBookmarks = false
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["resourceVersion"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_string(&values, &out.ResourceVersion, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.ResourceVersion = ""
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["resourceVersionMatch"]; ok && len(values) > 0 {
|
||||
if err := Convert_Slice_string_To_v1_ResourceVersionMatch(&values, &out.ResourceVersionMatch, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.ResourceVersionMatch = ""
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["timeoutSeconds"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_Pointer_int64(&values, &out.TimeoutSeconds, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.TimeoutSeconds = nil
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["limit"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_int64(&values, &out.Limit, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Limit = 0
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["continue"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_string(&values, &out.Continue, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Continue = ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_url_Values_To_v1_ListOptions is an autogenerated conversion function.
|
||||
func Convert_url_Values_To_v1_ListOptions(in *url.Values, out *ListOptions, s conversion.Scope) error {
|
||||
return autoConvert_url_Values_To_v1_ListOptions(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_url_Values_To_v1_PatchOptions(in *url.Values, out *PatchOptions, s conversion.Scope) error {
|
||||
// WARNING: Field TypeMeta does not have json tag, skipping.
|
||||
|
||||
if values, ok := map[string][]string(*in)["dryRun"]; ok && len(values) > 0 {
|
||||
out.DryRun = *(*[]string)(unsafe.Pointer(&values))
|
||||
} else {
|
||||
out.DryRun = nil
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["force"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_Pointer_bool(&values, &out.Force, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.Force = nil
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["fieldManager"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_string(&values, &out.FieldManager, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.FieldManager = ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_url_Values_To_v1_PatchOptions is an autogenerated conversion function.
|
||||
func Convert_url_Values_To_v1_PatchOptions(in *url.Values, out *PatchOptions, s conversion.Scope) error {
|
||||
return autoConvert_url_Values_To_v1_PatchOptions(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_url_Values_To_v1_TableOptions(in *url.Values, out *TableOptions, s conversion.Scope) error {
|
||||
// WARNING: Field TypeMeta does not have json tag, skipping.
|
||||
|
||||
if values, ok := map[string][]string(*in)["-"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_bool(&values, &out.NoHeaders, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.NoHeaders = false
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["includeObject"]; ok && len(values) > 0 {
|
||||
if err := Convert_Slice_string_To_v1_IncludeObjectPolicy(&values, &out.IncludeObject, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.IncludeObject = ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_url_Values_To_v1_TableOptions is an autogenerated conversion function.
|
||||
func Convert_url_Values_To_v1_TableOptions(in *url.Values, out *TableOptions, s conversion.Scope) error {
|
||||
return autoConvert_url_Values_To_v1_TableOptions(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_url_Values_To_v1_UpdateOptions(in *url.Values, out *UpdateOptions, s conversion.Scope) error {
|
||||
// WARNING: Field TypeMeta does not have json tag, skipping.
|
||||
|
||||
if values, ok := map[string][]string(*in)["dryRun"]; ok && len(values) > 0 {
|
||||
out.DryRun = *(*[]string)(unsafe.Pointer(&values))
|
||||
} else {
|
||||
out.DryRun = nil
|
||||
}
|
||||
if values, ok := map[string][]string(*in)["fieldManager"]; ok && len(values) > 0 {
|
||||
if err := runtime.Convert_Slice_string_To_string(&values, &out.FieldManager, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.FieldManager = ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_url_Values_To_v1_UpdateOptions is an autogenerated conversion function.
|
||||
func Convert_url_Values_To_v1_UpdateOptions(in *url.Values, out *UpdateOptions, s conversion.Scope) error {
|
||||
return autoConvert_url_Values_To_v1_UpdateOptions(in, out, s)
|
||||
}
|
258
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
generated
vendored
258
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
generated
vendored
@ -191,6 +191,23 @@ func (in *APIVersions) DeepCopyObject() runtime.Object {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Condition) DeepCopyInto(out *Condition) {
|
||||
*out = *in
|
||||
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.
|
||||
func (in *Condition) DeepCopy() *Condition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Condition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CreateOptions) DeepCopyInto(out *CreateOptions) {
|
||||
*out = *in
|
||||
@ -313,24 +330,22 @@ func (in *ExportOptions) DeepCopyObject() runtime.Object {
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Fields) DeepCopyInto(out *Fields) {
|
||||
func (in *FieldsV1) DeepCopyInto(out *FieldsV1) {
|
||||
*out = *in
|
||||
if in.Map != nil {
|
||||
in, out := &in.Map, &out.Map
|
||||
*out = make(map[string]Fields, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = *val.DeepCopy()
|
||||
}
|
||||
if in.Raw != nil {
|
||||
in, out := &in.Raw, &out.Raw
|
||||
*out = make([]byte, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Fields.
|
||||
func (in *Fields) DeepCopy() *Fields {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FieldsV1.
|
||||
func (in *FieldsV1) DeepCopy() *FieldsV1 {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Fields)
|
||||
out := new(FieldsV1)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
@ -456,48 +471,6 @@ func (in *GroupVersionResource) DeepCopy() *GroupVersionResource {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Initializer) DeepCopyInto(out *Initializer) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Initializer.
|
||||
func (in *Initializer) DeepCopy() *Initializer {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Initializer)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Initializers) DeepCopyInto(out *Initializers) {
|
||||
*out = *in
|
||||
if in.Pending != nil {
|
||||
in, out := &in.Pending, &out.Pending
|
||||
*out = make([]Initializer, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Result != nil {
|
||||
in, out := &in.Result, &out.Result
|
||||
*out = new(Status)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Initializers.
|
||||
func (in *Initializers) DeepCopy() *Initializers {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Initializers)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *InternalEvent) DeepCopyInto(out *InternalEvent) {
|
||||
*out = *in
|
||||
@ -572,7 +545,7 @@ func (in *LabelSelectorRequirement) DeepCopy() *LabelSelectorRequirement {
|
||||
func (in *List) DeepCopyInto(out *List) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]runtime.RawExtension, len(*in))
|
||||
@ -604,6 +577,11 @@ func (in *List) DeepCopyObject() runtime.Object {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ListMeta) DeepCopyInto(out *ListMeta) {
|
||||
*out = *in
|
||||
if in.RemainingItemCount != nil {
|
||||
in, out := &in.RemainingItemCount, &out.RemainingItemCount
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -654,9 +632,9 @@ func (in *ManagedFieldsEntry) DeepCopyInto(out *ManagedFieldsEntry) {
|
||||
in, out := &in.Time, &out.Time
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
if in.Fields != nil {
|
||||
in, out := &in.Fields, &out.Fields
|
||||
*out = new(Fields)
|
||||
if in.FieldsV1 != nil {
|
||||
in, out := &in.FieldsV1, &out.FieldsV1
|
||||
*out = new(FieldsV1)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
@ -716,11 +694,6 @@ func (in *ObjectMeta) DeepCopyInto(out *ObjectMeta) {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Initializers != nil {
|
||||
in, out := &in.Initializers, &out.Initializers
|
||||
*out = new(Initializers)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Finalizers != nil {
|
||||
in, out := &in.Finalizers, &out.Finalizers
|
||||
*out = make([]string, len(*in))
|
||||
@ -772,6 +745,65 @@ func (in *OwnerReference) DeepCopy() *OwnerReference {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PartialObjectMetadata) DeepCopyInto(out *PartialObjectMetadata) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartialObjectMetadata.
|
||||
func (in *PartialObjectMetadata) DeepCopy() *PartialObjectMetadata {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PartialObjectMetadata)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PartialObjectMetadata) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]PartialObjectMetadata, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartialObjectMetadataList.
|
||||
func (in *PartialObjectMetadataList) DeepCopy() *PartialObjectMetadataList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PartialObjectMetadataList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PartialObjectMetadataList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Patch) DeepCopyInto(out *Patch) {
|
||||
*out = *in
|
||||
@ -890,7 +922,7 @@ func (in *ServerAddressByClientCIDR) DeepCopy() *ServerAddressByClientCIDR {
|
||||
func (in *Status) DeepCopyInto(out *Status) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Details != nil {
|
||||
in, out := &in.Details, &out.Details
|
||||
*out = new(StatusDetails)
|
||||
@ -954,6 +986,108 @@ func (in *StatusDetails) DeepCopy() *StatusDetails {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Table) DeepCopyInto(out *Table) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.ColumnDefinitions != nil {
|
||||
in, out := &in.ColumnDefinitions, &out.ColumnDefinitions
|
||||
*out = make([]TableColumnDefinition, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Rows != nil {
|
||||
in, out := &in.Rows, &out.Rows
|
||||
*out = make([]TableRow, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Table.
|
||||
func (in *Table) DeepCopy() *Table {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Table)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Table) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableColumnDefinition) DeepCopyInto(out *TableColumnDefinition) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableColumnDefinition.
|
||||
func (in *TableColumnDefinition) DeepCopy() *TableColumnDefinition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableColumnDefinition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableOptions) DeepCopyInto(out *TableOptions) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableOptions.
|
||||
func (in *TableOptions) DeepCopy() *TableOptions {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableOptions)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *TableOptions) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableRow) DeepCopyInto(out *TableRow) {
|
||||
clone := in.DeepCopy()
|
||||
*out = *clone
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableRowCondition) DeepCopyInto(out *TableRowCondition) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableRowCondition.
|
||||
func (in *TableRowCondition) DeepCopy() *TableRowCondition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableRowCondition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Time.
|
||||
func (in *Time) DeepCopy() *Time {
|
||||
if in == nil {
|
||||
|
27
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/conversion.go
generated
vendored
27
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/conversion.go
generated
vendored
@ -1,27 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 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 v1beta1
|
||||
|
||||
import "k8s.io/apimachinery/pkg/conversion"
|
||||
|
||||
// Convert_Slice_string_To_v1beta1_IncludeObjectPolicy allows converting a URL query parameter value
|
||||
func Convert_Slice_string_To_v1beta1_IncludeObjectPolicy(input *[]string, out *IncludeObjectPolicy, s conversion.Scope) error {
|
||||
if len(*input) > 0 {
|
||||
*out = IncludeObjectPolicy((*input)[0])
|
||||
}
|
||||
return nil
|
||||
}
|
618
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go
generated
vendored
618
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go
generated
vendored
@ -1,618 +0,0 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
|
||||
|
||||
/*
|
||||
Package v1beta1 is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
PartialObjectMetadata
|
||||
PartialObjectMetadataList
|
||||
TableOptions
|
||||
*/
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
|
||||
math "math"
|
||||
|
||||
strings "strings"
|
||||
|
||||
reflect "reflect"
|
||||
|
||||
io "io"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
func (m *PartialObjectMetadata) Reset() { *m = PartialObjectMetadata{} }
|
||||
func (*PartialObjectMetadata) ProtoMessage() {}
|
||||
func (*PartialObjectMetadata) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
|
||||
func (m *PartialObjectMetadataList) Reset() { *m = PartialObjectMetadataList{} }
|
||||
func (*PartialObjectMetadataList) ProtoMessage() {}
|
||||
func (*PartialObjectMetadataList) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptorGenerated, []int{1}
|
||||
}
|
||||
|
||||
func (m *TableOptions) Reset() { *m = TableOptions{} }
|
||||
func (*TableOptions) ProtoMessage() {}
|
||||
func (*TableOptions) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*PartialObjectMetadata)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1beta1.PartialObjectMetadata")
|
||||
proto.RegisterType((*PartialObjectMetadataList)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1beta1.PartialObjectMetadataList")
|
||||
proto.RegisterType((*TableOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1beta1.TableOptions")
|
||||
}
|
||||
func (m *PartialObjectMetadata) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *PartialObjectMetadata) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.ObjectMeta.Size()))
|
||||
n1, err := m.ObjectMeta.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *PartialObjectMetadataList) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *PartialObjectMetadataList) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Items) > 0 {
|
||||
for _, msg := range m.Items {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(msg.Size()))
|
||||
n, err := msg.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n
|
||||
}
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *TableOptions) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *TableOptions) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.IncludeObject)))
|
||||
i += copy(dAtA[i:], m.IncludeObject)
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func (m *PartialObjectMetadata) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
l = m.ObjectMeta.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *PartialObjectMetadataList) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Items) > 0 {
|
||||
for _, e := range m.Items {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *TableOptions) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.IncludeObject)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
func sovGenerated(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (this *PartialObjectMetadata) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&PartialObjectMetadata{`,
|
||||
`ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *PartialObjectMetadataList) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&PartialObjectMetadataList{`,
|
||||
`Items:` + strings.Replace(fmt.Sprintf("%v", this.Items), "PartialObjectMetadata", "PartialObjectMetadata", 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *TableOptions) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&TableOptions{`,
|
||||
`IncludeObject:` + fmt.Sprintf("%v", this.IncludeObject) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func valueToStringGenerated(v interface{}) string {
|
||||
rv := reflect.ValueOf(v)
|
||||
if rv.IsNil() {
|
||||
return "nil"
|
||||
}
|
||||
pv := reflect.Indirect(rv).Interface()
|
||||
return fmt.Sprintf("*%v", pv)
|
||||
}
|
||||
func (m *PartialObjectMetadata) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: PartialObjectMetadata: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PartialObjectMetadata: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *PartialObjectMetadataList) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: PartialObjectMetadataList: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PartialObjectMetadataList: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Items = append(m.Items, &PartialObjectMetadata{})
|
||||
if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *TableOptions) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: TableOptions: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: TableOptions: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field IncludeObject", 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 > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.IncludeObject = IncludeObjectPolicy(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipGenerated(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 375 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xcd, 0x0a, 0xd3, 0x40,
|
||||
0x10, 0xc7, 0xb3, 0x48, 0xd1, 0x6e, 0xed, 0x25, 0x22, 0xd4, 0x1e, 0x36, 0xa5, 0xa7, 0x0a, 0x76,
|
||||
0xd7, 0x16, 0x11, 0x8f, 0x92, 0x5b, 0x41, 0x69, 0x09, 0x9e, 0x3c, 0xb9, 0x49, 0xc6, 0x74, 0xcd,
|
||||
0xc7, 0x86, 0xec, 0xa6, 0xd0, 0x8b, 0xf8, 0x08, 0x3e, 0x56, 0x8f, 0x3d, 0xf6, 0x14, 0x6c, 0x7c,
|
||||
0x0b, 0x4f, 0x92, 0x0f, 0xec, 0x87, 0x15, 0x7b, 0x9b, 0xf9, 0x0f, 0xbf, 0x5f, 0x66, 0xb2, 0xd8,
|
||||
0x09, 0xdf, 0x28, 0x2a, 0x24, 0x0b, 0x73, 0x17, 0xb2, 0x04, 0x34, 0x28, 0xb6, 0x81, 0xc4, 0x97,
|
||||
0x19, 0x6b, 0x07, 0x3c, 0x15, 0x31, 0xf7, 0xd6, 0x22, 0x81, 0x6c, 0xcb, 0xd2, 0x30, 0xa8, 0x02,
|
||||
0xc5, 0x62, 0xd0, 0x9c, 0x6d, 0x66, 0x2e, 0x68, 0x3e, 0x63, 0x01, 0x24, 0x90, 0x71, 0x0d, 0x3e,
|
||||
0x4d, 0x33, 0xa9, 0xa5, 0xf9, 0xbc, 0x41, 0xe9, 0x39, 0x4a, 0xd3, 0x30, 0xa8, 0x02, 0x45, 0x2b,
|
||||
0x94, 0xb6, 0xe8, 0x70, 0x1a, 0x08, 0xbd, 0xce, 0x5d, 0xea, 0xc9, 0x98, 0x05, 0x32, 0x90, 0xac,
|
||||
0x36, 0xb8, 0xf9, 0xe7, 0xba, 0xab, 0x9b, 0xba, 0x6a, 0xcc, 0xc3, 0x57, 0xf7, 0x2c, 0x75, 0xbd,
|
||||
0xcf, 0xf0, 0x9f, 0xa7, 0x64, 0x79, 0xa2, 0x45, 0x0c, 0x7f, 0x01, 0xaf, 0xff, 0x07, 0x28, 0x6f,
|
||||
0x0d, 0x31, 0xbf, 0xe6, 0xc6, 0x5b, 0xfc, 0x74, 0xc5, 0x33, 0x2d, 0x78, 0xb4, 0x74, 0xbf, 0x80,
|
||||
0xa7, 0xdf, 0x83, 0xe6, 0x3e, 0xd7, 0xdc, 0xfc, 0x84, 0x1f, 0xc5, 0x6d, 0x3d, 0x40, 0x23, 0x34,
|
||||
0xe9, 0xcd, 0x5f, 0xd2, 0x7b, 0x7e, 0x12, 0x3d, 0x79, 0x6c, 0x73, 0x57, 0x58, 0x46, 0x59, 0x58,
|
||||
0xf8, 0x94, 0x39, 0x7f, 0xac, 0xe3, 0xaf, 0xf8, 0xd9, 0xcd, 0x4f, 0xbf, 0x13, 0x4a, 0x9b, 0x1c,
|
||||
0x77, 0x84, 0x86, 0x58, 0x0d, 0xd0, 0xe8, 0xc1, 0xa4, 0x37, 0x7f, 0x4b, 0xef, 0x7e, 0x20, 0x7a,
|
||||
0x53, 0x6a, 0x77, 0xcb, 0xc2, 0xea, 0x2c, 0x2a, 0xa5, 0xd3, 0x98, 0xc7, 0x2e, 0x7e, 0xfc, 0x81,
|
||||
0xbb, 0x11, 0x2c, 0x53, 0x2d, 0x64, 0xa2, 0x4c, 0x07, 0xf7, 0x45, 0xe2, 0x45, 0xb9, 0x0f, 0x0d,
|
||||
0x5a, 0x9f, 0xdd, 0xb5, 0x5f, 0xb4, 0x47, 0xf4, 0x17, 0xe7, 0xc3, 0x5f, 0x85, 0xf5, 0xe4, 0x22,
|
||||
0x58, 0xc9, 0x48, 0x78, 0x5b, 0xe7, 0x52, 0x61, 0x4f, 0x77, 0x47, 0x62, 0xec, 0x8f, 0xc4, 0x38,
|
||||
0x1c, 0x89, 0xf1, 0xad, 0x24, 0x68, 0x57, 0x12, 0xb4, 0x2f, 0x09, 0x3a, 0x94, 0x04, 0xfd, 0x28,
|
||||
0x09, 0xfa, 0xfe, 0x93, 0x18, 0x1f, 0x1f, 0xb6, 0xab, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf3,
|
||||
0xe1, 0xde, 0x86, 0xdb, 0x02, 0x00, 0x00,
|
||||
}
|
57
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
generated
vendored
57
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
generated
vendored
@ -1,57 +0,0 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
|
||||
|
||||
syntax = 'proto2';
|
||||
|
||||
package k8s.io.apimachinery.pkg.apis.meta.v1beta1;
|
||||
|
||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1beta1";
|
||||
|
||||
// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients
|
||||
// to get access to a particular ObjectMeta schema without knowing the details of the version.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
message PartialObjectMetadata {
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
}
|
||||
|
||||
// PartialObjectMetadataList contains a list of objects containing only their metadata
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
message PartialObjectMetadataList {
|
||||
// items contains each of the included items.
|
||||
repeated PartialObjectMetadata items = 1;
|
||||
}
|
||||
|
||||
// TableOptions are used when a Table is requested by the caller.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
message TableOptions {
|
||||
// includeObject decides whether to include each object along with its columnar information.
|
||||
// Specifying "None" will return no object, specifying "Object" will return the full object contents, and
|
||||
// specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind
|
||||
// in version v1beta1 of the meta.k8s.io API group.
|
||||
optional string includeObject = 1;
|
||||
}
|
||||
|
57
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/register.go
generated
vendored
57
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/register.go
generated
vendored
@ -1,57 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 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 v1beta1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name for this API.
|
||||
const GroupName = "meta.k8s.io"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
|
||||
|
||||
// Kind takes an unqualified kind and returns a Group qualified GroupKind
|
||||
func Kind(kind string) schema.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// scheme is the registry for the common types that adhere to the meta v1beta1 API spec.
|
||||
var scheme = runtime.NewScheme()
|
||||
|
||||
// ParameterCodec knows about query parameters used with the meta v1beta1 API spec.
|
||||
var ParameterCodec = runtime.NewParameterCodec(scheme)
|
||||
|
||||
func init() {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&Table{},
|
||||
&TableOptions{},
|
||||
&PartialObjectMetadata{},
|
||||
&PartialObjectMetadataList{},
|
||||
)
|
||||
|
||||
if err := scheme.AddConversionFuncs(
|
||||
Convert_Slice_string_To_v1beta1_IncludeObjectPolicy,
|
||||
); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// register manually. This usually goes through the SchemeBuilder, which we cannot use here.
|
||||
//scheme.AddGeneratedDeepCopyFuncs(GetGeneratedDeepCopyFuncs()...)
|
||||
}
|
161
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types.go
generated
vendored
161
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types.go
generated
vendored
@ -1,161 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 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 v1beta1 is alpha objects from meta that will be introduced.
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// TODO: Table does not generate to protobuf because of the interface{} - fix protobuf
|
||||
// generation to support a meta type that can accept any valid JSON.
|
||||
|
||||
// Table is a tabular representation of a set of API resources. The server transforms the
|
||||
// object into a set of preferred columns for quickly reviewing the objects.
|
||||
// +protobuf=false
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type Table struct {
|
||||
v1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
v1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
// columnDefinitions describes each column in the returned items array. The number of cells per row
|
||||
// will always match the number of column definitions.
|
||||
ColumnDefinitions []TableColumnDefinition `json:"columnDefinitions"`
|
||||
// rows is the list of items in the table.
|
||||
Rows []TableRow `json:"rows"`
|
||||
}
|
||||
|
||||
// TableColumnDefinition contains information about a column returned in the Table.
|
||||
// +protobuf=false
|
||||
type TableColumnDefinition struct {
|
||||
// name is a human readable name for the column.
|
||||
Name string `json:"name"`
|
||||
// type is an OpenAPI type definition for this column.
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
|
||||
Type string `json:"type"`
|
||||
// format is an optional OpenAPI type definition for this column. The 'name' format is applied
|
||||
// to the primary identifier column to assist in clients identifying column is the resource name.
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
|
||||
Format string `json:"format"`
|
||||
// description is a human readable description of this column.
|
||||
Description string `json:"description"`
|
||||
// priority is an integer defining the relative importance of this column compared to others. Lower
|
||||
// numbers are considered higher priority. Columns that may be omitted in limited space scenarios
|
||||
// should be given a higher priority.
|
||||
Priority int32 `json:"priority"`
|
||||
}
|
||||
|
||||
// TableRow is an individual row in a table.
|
||||
// +protobuf=false
|
||||
type TableRow struct {
|
||||
// cells will be as wide as headers and may contain strings, numbers (float64 or int64), booleans, simple
|
||||
// maps, or lists, or null. See the type field of the column definition for a more detailed description.
|
||||
Cells []interface{} `json:"cells"`
|
||||
// conditions describe additional status of a row that are relevant for a human user.
|
||||
// +optional
|
||||
Conditions []TableRowCondition `json:"conditions,omitempty"`
|
||||
// This field contains the requested additional information about each object based on the includeObject
|
||||
// policy when requesting the Table. If "None", this field is empty, if "Object" this will be the
|
||||
// default serialization of the object for the current API version, and if "Metadata" (the default) will
|
||||
// contain the object metadata. Check the returned kind and apiVersion of the object before parsing.
|
||||
// +optional
|
||||
Object runtime.RawExtension `json:"object,omitempty"`
|
||||
}
|
||||
|
||||
// TableRowCondition allows a row to be marked with additional information.
|
||||
// +protobuf=false
|
||||
type TableRowCondition struct {
|
||||
// Type of row condition.
|
||||
Type RowConditionType `json:"type"`
|
||||
// Status of the condition, one of True, False, Unknown.
|
||||
Status ConditionStatus `json:"status"`
|
||||
// (brief) machine readable reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// Human readable message indicating details about last transition.
|
||||
// +optional
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
type RowConditionType string
|
||||
|
||||
// These are valid conditions of a row. This list is not exhaustive and new conditions may be
|
||||
// included by other resources.
|
||||
const (
|
||||
// RowCompleted means the underlying resource has reached completion and may be given less
|
||||
// visual priority than other resources.
|
||||
RowCompleted RowConditionType = "Completed"
|
||||
)
|
||||
|
||||
type ConditionStatus string
|
||||
|
||||
// These are valid condition statuses. "ConditionTrue" means a resource is in the condition.
|
||||
// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes
|
||||
// can't decide if a resource is in the condition or not. In the future, we could add other
|
||||
// intermediate conditions, e.g. ConditionDegraded.
|
||||
const (
|
||||
ConditionTrue ConditionStatus = "True"
|
||||
ConditionFalse ConditionStatus = "False"
|
||||
ConditionUnknown ConditionStatus = "Unknown"
|
||||
)
|
||||
|
||||
// IncludeObjectPolicy controls which portion of the object is returned with a Table.
|
||||
type IncludeObjectPolicy string
|
||||
|
||||
const (
|
||||
// IncludeNone returns no object.
|
||||
IncludeNone IncludeObjectPolicy = "None"
|
||||
// IncludeMetadata serializes the object containing only its metadata field.
|
||||
IncludeMetadata IncludeObjectPolicy = "Metadata"
|
||||
// IncludeObject contains the full object.
|
||||
IncludeObject IncludeObjectPolicy = "Object"
|
||||
)
|
||||
|
||||
// TableOptions are used when a Table is requested by the caller.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type TableOptions struct {
|
||||
v1.TypeMeta `json:",inline"`
|
||||
// includeObject decides whether to include each object along with its columnar information.
|
||||
// Specifying "None" will return no object, specifying "Object" will return the full object contents, and
|
||||
// specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind
|
||||
// in version v1beta1 of the meta.k8s.io API group.
|
||||
IncludeObject IncludeObjectPolicy `json:"includeObject,omitempty" protobuf:"bytes,1,opt,name=includeObject,casttype=IncludeObjectPolicy"`
|
||||
}
|
||||
|
||||
// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients
|
||||
// to get access to a particular ObjectMeta schema without knowing the details of the version.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type PartialObjectMetadata struct {
|
||||
v1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
}
|
||||
|
||||
// PartialObjectMetadataList contains a list of objects containing only their metadata
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type PartialObjectMetadataList struct {
|
||||
v1.TypeMeta `json:",inline"`
|
||||
|
||||
// items contains each of the included items.
|
||||
Items []*PartialObjectMetadata `json:"items" protobuf:"bytes,1,rep,name=items"`
|
||||
}
|
104
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go
generated
vendored
104
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go
generated
vendored
@ -1,104 +0,0 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
// This file contains a collection of methods that can be used from go-restful to
|
||||
// generate Swagger API documentation for its models. Please read this PR for more
|
||||
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
|
||||
//
|
||||
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
|
||||
// they are on one line! For multiple line or blocks that you want to ignore use ---.
|
||||
// Any context after a --- is ignored.
|
||||
//
|
||||
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
|
||||
var map_PartialObjectMetadata = map[string]string{
|
||||
"": "PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients to get access to a particular ObjectMeta schema without knowing the details of the version.",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
|
||||
}
|
||||
|
||||
func (PartialObjectMetadata) SwaggerDoc() map[string]string {
|
||||
return map_PartialObjectMetadata
|
||||
}
|
||||
|
||||
var map_PartialObjectMetadataList = map[string]string{
|
||||
"": "PartialObjectMetadataList contains a list of objects containing only their metadata",
|
||||
"items": "items contains each of the included items.",
|
||||
}
|
||||
|
||||
func (PartialObjectMetadataList) SwaggerDoc() map[string]string {
|
||||
return map_PartialObjectMetadataList
|
||||
}
|
||||
|
||||
var map_Table = map[string]string{
|
||||
"": "Table is a tabular representation of a set of API resources. The server transforms the object into a set of preferred columns for quickly reviewing the objects.",
|
||||
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"columnDefinitions": "columnDefinitions describes each column in the returned items array. The number of cells per row will always match the number of column definitions.",
|
||||
"rows": "rows is the list of items in the table.",
|
||||
}
|
||||
|
||||
func (Table) SwaggerDoc() map[string]string {
|
||||
return map_Table
|
||||
}
|
||||
|
||||
var map_TableColumnDefinition = map[string]string{
|
||||
"": "TableColumnDefinition contains information about a column returned in the Table.",
|
||||
"name": "name is a human readable name for the column.",
|
||||
"type": "type is an OpenAPI type definition for this column. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.",
|
||||
"format": "format is an optional OpenAPI type definition for this column. The 'name' format is applied to the primary identifier column to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.",
|
||||
"description": "description is a human readable description of this column.",
|
||||
"priority": "priority is an integer defining the relative importance of this column compared to others. Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a higher priority.",
|
||||
}
|
||||
|
||||
func (TableColumnDefinition) SwaggerDoc() map[string]string {
|
||||
return map_TableColumnDefinition
|
||||
}
|
||||
|
||||
var map_TableOptions = map[string]string{
|
||||
"": "TableOptions are used when a Table is requested by the caller.",
|
||||
"includeObject": "includeObject decides whether to include each object along with its columnar information. Specifying \"None\" will return no object, specifying \"Object\" will return the full object contents, and specifying \"Metadata\" (the default) will return the object's metadata in the PartialObjectMetadata kind in version v1beta1 of the meta.k8s.io API group.",
|
||||
}
|
||||
|
||||
func (TableOptions) SwaggerDoc() map[string]string {
|
||||
return map_TableOptions
|
||||
}
|
||||
|
||||
var map_TableRow = map[string]string{
|
||||
"": "TableRow is an individual row in a table.",
|
||||
"cells": "cells will be as wide as headers and may contain strings, numbers (float64 or int64), booleans, simple maps, or lists, or null. See the type field of the column definition for a more detailed description.",
|
||||
"conditions": "conditions describe additional status of a row that are relevant for a human user.",
|
||||
"object": "This field contains the requested additional information about each object based on the includeObject policy when requesting the Table. If \"None\", this field is empty, if \"Object\" this will be the default serialization of the object for the current API version, and if \"Metadata\" (the default) will contain the object metadata. Check the returned kind and apiVersion of the object before parsing.",
|
||||
}
|
||||
|
||||
func (TableRow) SwaggerDoc() map[string]string {
|
||||
return map_TableRow
|
||||
}
|
||||
|
||||
var map_TableRowCondition = map[string]string{
|
||||
"": "TableRowCondition allows a row to be marked with additional information.",
|
||||
"type": "Type of row condition.",
|
||||
"status": "Status of the condition, one of True, False, Unknown.",
|
||||
"reason": "(brief) machine readable reason for the condition's last transition.",
|
||||
"message": "Human readable message indicating details about last transition.",
|
||||
}
|
||||
|
||||
func (TableRowCondition) SwaggerDoc() map[string]string {
|
||||
return map_TableRowCondition
|
||||
}
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS END HERE
|
189
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.deepcopy.go
generated
vendored
189
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.deepcopy.go
generated
vendored
@ -1,189 +0,0 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PartialObjectMetadata) DeepCopyInto(out *PartialObjectMetadata) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartialObjectMetadata.
|
||||
func (in *PartialObjectMetadata) DeepCopy() *PartialObjectMetadata {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PartialObjectMetadata)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PartialObjectMetadata) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]*PartialObjectMetadata, len(*in))
|
||||
for i := range *in {
|
||||
if (*in)[i] != nil {
|
||||
in, out := &(*in)[i], &(*out)[i]
|
||||
*out = new(PartialObjectMetadata)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartialObjectMetadataList.
|
||||
func (in *PartialObjectMetadataList) DeepCopy() *PartialObjectMetadataList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PartialObjectMetadataList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PartialObjectMetadataList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Table) DeepCopyInto(out *Table) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.ColumnDefinitions != nil {
|
||||
in, out := &in.ColumnDefinitions, &out.ColumnDefinitions
|
||||
*out = make([]TableColumnDefinition, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Rows != nil {
|
||||
in, out := &in.Rows, &out.Rows
|
||||
*out = make([]TableRow, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Table.
|
||||
func (in *Table) DeepCopy() *Table {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Table)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Table) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableColumnDefinition) DeepCopyInto(out *TableColumnDefinition) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableColumnDefinition.
|
||||
func (in *TableColumnDefinition) DeepCopy() *TableColumnDefinition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableColumnDefinition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableOptions) DeepCopyInto(out *TableOptions) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableOptions.
|
||||
func (in *TableOptions) DeepCopy() *TableOptions {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableOptions)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *TableOptions) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableRow) DeepCopyInto(out *TableRow) {
|
||||
clone := in.DeepCopy()
|
||||
*out = *clone
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TableRowCondition) DeepCopyInto(out *TableRowCondition) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TableRowCondition.
|
||||
func (in *TableRowCondition) DeepCopy() *TableRowCondition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TableRowCondition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
32
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.defaults.go
generated
vendored
32
vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.defaults.go
generated
vendored
@ -1,32 +0,0 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by defaulter-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// RegisterDefaults adds defaulters functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
// All generated defaulters are covering - they call all nested defaulters.
|
||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||
return nil
|
||||
}
|
165
vendor/k8s.io/apimachinery/pkg/conversion/converter.go
generated
vendored
165
vendor/k8s.io/apimachinery/pkg/conversion/converter.go
generated
vendored
@ -54,7 +54,8 @@ type Converter struct {
|
||||
generatedConversionFuncs ConversionFuncs
|
||||
|
||||
// Set of conversions that should be treated as a no-op
|
||||
ignoredConversions map[typePair]struct{}
|
||||
ignoredConversions map[typePair]struct{}
|
||||
ignoredUntypedConversions map[typePair]struct{}
|
||||
|
||||
// This is a map from a source field type and name, to a list of destination
|
||||
// field type and name.
|
||||
@ -83,17 +84,23 @@ type Converter struct {
|
||||
// NewConverter creates a new Converter object.
|
||||
func NewConverter(nameFn NameFunc) *Converter {
|
||||
c := &Converter{
|
||||
conversionFuncs: NewConversionFuncs(),
|
||||
generatedConversionFuncs: NewConversionFuncs(),
|
||||
ignoredConversions: make(map[typePair]struct{}),
|
||||
nameFunc: nameFn,
|
||||
structFieldDests: make(map[typeNamePair][]typeNamePair),
|
||||
structFieldSources: make(map[typeNamePair][]typeNamePair),
|
||||
conversionFuncs: NewConversionFuncs(),
|
||||
generatedConversionFuncs: NewConversionFuncs(),
|
||||
ignoredConversions: make(map[typePair]struct{}),
|
||||
ignoredUntypedConversions: make(map[typePair]struct{}),
|
||||
nameFunc: nameFn,
|
||||
structFieldDests: make(map[typeNamePair][]typeNamePair),
|
||||
structFieldSources: make(map[typeNamePair][]typeNamePair),
|
||||
|
||||
inputFieldMappingFuncs: make(map[reflect.Type]FieldMappingFunc),
|
||||
inputDefaultFlags: make(map[reflect.Type]FieldMatchingFlags),
|
||||
}
|
||||
c.RegisterConversionFunc(Convert_Slice_byte_To_Slice_byte)
|
||||
c.RegisterUntypedConversionFunc(
|
||||
(*[]byte)(nil), (*[]byte)(nil),
|
||||
func(a, b interface{}, s Scope) error {
|
||||
return Convert_Slice_byte_To_Slice_byte(a.(*[]byte), b.(*[]byte), s)
|
||||
},
|
||||
)
|
||||
return c
|
||||
}
|
||||
|
||||
@ -131,10 +138,6 @@ type Scope interface {
|
||||
// parameters, you'll run out of stack space before anything useful happens.
|
||||
Convert(src, dest interface{}, flags FieldMatchingFlags) error
|
||||
|
||||
// DefaultConvert performs the default conversion, without calling a conversion func
|
||||
// on the current stack frame. This makes it safe to call from a conversion func.
|
||||
DefaultConvert(src, dest interface{}, flags FieldMatchingFlags) error
|
||||
|
||||
// SrcTags and DestTags contain the struct tags that src and dest had, respectively.
|
||||
// If the enclosing object was not a struct, then these will contain no tags, of course.
|
||||
SrcTag() reflect.StructTag
|
||||
@ -153,31 +156,14 @@ type FieldMappingFunc func(key string, sourceTag, destTag reflect.StructTag) (so
|
||||
|
||||
func NewConversionFuncs() ConversionFuncs {
|
||||
return ConversionFuncs{
|
||||
fns: make(map[typePair]reflect.Value),
|
||||
untyped: make(map[typePair]ConversionFunc),
|
||||
}
|
||||
}
|
||||
|
||||
type ConversionFuncs struct {
|
||||
fns map[typePair]reflect.Value
|
||||
untyped map[typePair]ConversionFunc
|
||||
}
|
||||
|
||||
// Add adds the provided conversion functions to the lookup table - they must have the signature
|
||||
// `func(type1, type2, Scope) error`. Functions are added in the order passed and will override
|
||||
// previously registered pairs.
|
||||
func (c ConversionFuncs) Add(fns ...interface{}) error {
|
||||
for _, fn := range fns {
|
||||
fv := reflect.ValueOf(fn)
|
||||
ft := fv.Type()
|
||||
if err := verifyConversionFunctionSignature(ft); err != nil {
|
||||
return err
|
||||
}
|
||||
c.fns[typePair{ft.In(0).Elem(), ft.In(1).Elem()}] = fv
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddUntyped adds the provided conversion function to the lookup table for the types that are
|
||||
// supplied as a and b. a and b must be pointers or an error is returned. This method overwrites
|
||||
// previously defined functions.
|
||||
@ -197,12 +183,6 @@ func (c ConversionFuncs) AddUntyped(a, b interface{}, fn ConversionFunc) error {
|
||||
// both other and c, with other conversions taking precedence.
|
||||
func (c ConversionFuncs) Merge(other ConversionFuncs) ConversionFuncs {
|
||||
merged := NewConversionFuncs()
|
||||
for k, v := range c.fns {
|
||||
merged.fns[k] = v
|
||||
}
|
||||
for k, v := range other.fns {
|
||||
merged.fns[k] = v
|
||||
}
|
||||
for k, v := range c.untyped {
|
||||
merged.untyped[k] = v
|
||||
}
|
||||
@ -290,12 +270,6 @@ func (s *scope) Convert(src, dest interface{}, flags FieldMatchingFlags) error {
|
||||
return s.converter.Convert(src, dest, flags, s.meta)
|
||||
}
|
||||
|
||||
// DefaultConvert continues a conversion, performing a default conversion (no conversion func)
|
||||
// for the current stack frame.
|
||||
func (s *scope) DefaultConvert(src, dest interface{}, flags FieldMatchingFlags) error {
|
||||
return s.converter.DefaultConvert(src, dest, flags, s.meta)
|
||||
}
|
||||
|
||||
// SrcTag returns the tag of the struct containing the current source item, if any.
|
||||
func (s *scope) SrcTag() reflect.StructTag {
|
||||
return s.srcStack.top().tag
|
||||
@ -360,29 +334,6 @@ func verifyConversionFunctionSignature(ft reflect.Type) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterConversionFunc registers a conversion func with the
|
||||
// Converter. conversionFunc must take three parameters: a pointer to the input
|
||||
// type, a pointer to the output type, and a conversion.Scope (which should be
|
||||
// used if recursive conversion calls are desired). It must return an error.
|
||||
//
|
||||
// Example:
|
||||
// c.RegisterConversionFunc(
|
||||
// func(in *Pod, out *v1.Pod, s Scope) error {
|
||||
// // conversion logic...
|
||||
// return nil
|
||||
// })
|
||||
// DEPRECATED: Will be removed in favor of RegisterUntypedConversionFunc
|
||||
func (c *Converter) RegisterConversionFunc(conversionFunc interface{}) error {
|
||||
return c.conversionFuncs.Add(conversionFunc)
|
||||
}
|
||||
|
||||
// Similar to RegisterConversionFunc, but registers conversion function that were
|
||||
// automatically generated.
|
||||
// DEPRECATED: Will be removed in favor of RegisterGeneratedUntypedConversionFunc
|
||||
func (c *Converter) RegisterGeneratedConversionFunc(conversionFunc interface{}) error {
|
||||
return c.generatedConversionFuncs.Add(conversionFunc)
|
||||
}
|
||||
|
||||
// RegisterUntypedConversionFunc registers a function that converts between a and b by passing objects of those
|
||||
// types to the provided function. The function *must* accept objects of a and b - this machinery will not enforce
|
||||
// any other guarantee.
|
||||
@ -409,6 +360,7 @@ func (c *Converter) RegisterIgnoredConversion(from, to interface{}) error {
|
||||
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
|
||||
}
|
||||
|
||||
@ -470,18 +422,6 @@ func (c *Converter) Convert(src, dest interface{}, flags FieldMatchingFlags, met
|
||||
return c.doConversion(src, dest, flags, meta, c.convert)
|
||||
}
|
||||
|
||||
// DefaultConvert will translate src to dest if it knows how. Both must be pointers.
|
||||
// No conversion func is used. If the default copying mechanism
|
||||
// doesn't work on this type pair, an error will be returned.
|
||||
// Read the comments on the various FieldMatchingFlags constants to understand
|
||||
// what the 'flags' parameter does.
|
||||
// 'meta' is given to allow you to pass information to conversion functions,
|
||||
// it is not used by DefaultConvert() other than storing it in the scope.
|
||||
// Not safe for objects with cyclic references!
|
||||
func (c *Converter) DefaultConvert(src, dest interface{}, flags FieldMatchingFlags, meta *Meta) error {
|
||||
return c.doConversion(src, dest, flags, meta, c.defaultConvert)
|
||||
}
|
||||
|
||||
type conversionFunc func(sv, dv reflect.Value, scope *scope) error
|
||||
|
||||
func (c *Converter) doConversion(src, dest interface{}, flags FieldMatchingFlags, meta *Meta, f conversionFunc) error {
|
||||
@ -491,59 +431,51 @@ func (c *Converter) doConversion(src, dest interface{}, flags FieldMatchingFlags
|
||||
flags: flags,
|
||||
meta: meta,
|
||||
}
|
||||
|
||||
// ignore conversions of this type
|
||||
if _, ok := c.ignoredUntypedConversions[pair]; ok {
|
||||
return nil
|
||||
}
|
||||
if fn, ok := c.conversionFuncs.untyped[pair]; ok {
|
||||
return fn(src, dest, scope)
|
||||
}
|
||||
if fn, ok := c.generatedConversionFuncs.untyped[pair]; ok {
|
||||
return fn(src, dest, scope)
|
||||
}
|
||||
// TODO: consider everything past this point deprecated - we want to support only point to point top level
|
||||
// conversions
|
||||
|
||||
dv, err := EnforcePtr(dest)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !dv.CanAddr() && !dv.CanSet() {
|
||||
return fmt.Errorf("can't write to dest")
|
||||
}
|
||||
sv, err := EnforcePtr(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return fmt.Errorf("converting (%s) to (%s): unknown conversion", sv.Type(), dv.Type())
|
||||
|
||||
// TODO: Everything past this point is deprecated.
|
||||
// Remove in 1.20 once we're sure it didn't break anything.
|
||||
|
||||
// Leave something on the stack, so that calls to struct tag getters never fail.
|
||||
scope.srcStack.push(scopeStackElem{})
|
||||
scope.destStack.push(scopeStackElem{})
|
||||
return f(sv, dv, scope)
|
||||
}
|
||||
|
||||
// callCustom calls 'custom' with sv & dv. custom must be a conversion function.
|
||||
func (c *Converter) callCustom(sv, dv, custom reflect.Value, scope *scope) error {
|
||||
if !sv.CanAddr() {
|
||||
sv2 := reflect.New(sv.Type())
|
||||
sv2.Elem().Set(sv)
|
||||
sv = sv2
|
||||
} else {
|
||||
sv = sv.Addr()
|
||||
}
|
||||
// callUntyped calls predefined conversion func.
|
||||
func (c *Converter) callUntyped(sv, dv reflect.Value, f ConversionFunc, scope *scope) error {
|
||||
if !dv.CanAddr() {
|
||||
if !dv.CanSet() {
|
||||
return scope.errorf("can't addr or set dest.")
|
||||
}
|
||||
dvOrig := dv
|
||||
dv := reflect.New(dvOrig.Type())
|
||||
defer func() { dvOrig.Set(dv) }()
|
||||
return scope.errorf("cant addr dest")
|
||||
}
|
||||
var svPointer reflect.Value
|
||||
if sv.CanAddr() {
|
||||
svPointer = sv.Addr()
|
||||
} else {
|
||||
dv = dv.Addr()
|
||||
svPointer = reflect.New(sv.Type())
|
||||
svPointer.Elem().Set(sv)
|
||||
}
|
||||
args := []reflect.Value{sv, dv, reflect.ValueOf(scope)}
|
||||
ret := custom.Call(args)[0].Interface()
|
||||
// This convolution is necessary because nil interfaces won't convert
|
||||
// to errors.
|
||||
if ret == nil {
|
||||
return nil
|
||||
}
|
||||
return ret.(error)
|
||||
dvPointer := dv.Addr()
|
||||
return f(svPointer.Interface(), dvPointer.Interface(), scope)
|
||||
}
|
||||
|
||||
// convert recursively copies sv into dv, calling an appropriate conversion function if
|
||||
@ -561,27 +493,14 @@ func (c *Converter) convert(sv, dv reflect.Value, scope *scope) error {
|
||||
}
|
||||
|
||||
// Convert sv to dv.
|
||||
if fv, ok := c.conversionFuncs.fns[pair]; ok {
|
||||
if c.Debug != nil {
|
||||
c.Debug.Logf("Calling custom conversion of '%v' to '%v'", st, dt)
|
||||
}
|
||||
return c.callCustom(sv, dv, fv, scope)
|
||||
pair = typePair{reflect.PtrTo(sv.Type()), reflect.PtrTo(dv.Type())}
|
||||
if f, ok := c.conversionFuncs.untyped[pair]; ok {
|
||||
return c.callUntyped(sv, dv, f, scope)
|
||||
}
|
||||
if fv, ok := c.generatedConversionFuncs.fns[pair]; ok {
|
||||
if c.Debug != nil {
|
||||
c.Debug.Logf("Calling generated conversion of '%v' to '%v'", st, dt)
|
||||
}
|
||||
return c.callCustom(sv, dv, fv, scope)
|
||||
if f, ok := c.generatedConversionFuncs.untyped[pair]; ok {
|
||||
return c.callUntyped(sv, dv, f, scope)
|
||||
}
|
||||
|
||||
return c.defaultConvert(sv, dv, scope)
|
||||
}
|
||||
|
||||
// defaultConvert recursively copies sv into dv. no conversion function is called
|
||||
// for the current stack frame (but conversion functions may be called for nested objects)
|
||||
func (c *Converter) defaultConvert(sv, dv reflect.Value, scope *scope) error {
|
||||
dt, st := dv.Type(), sv.Type()
|
||||
|
||||
if !dv.CanSet() {
|
||||
return scope.errorf("Cannot set dest. (Tried to deep copy something with unexported fields?)")
|
||||
}
|
||||
|
4
vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go
generated
vendored
4
vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go
generated
vendored
@ -54,10 +54,6 @@ func jsonTag(field reflect.StructField) (string, bool) {
|
||||
return tag, omitempty
|
||||
}
|
||||
|
||||
func formatValue(value interface{}) string {
|
||||
return fmt.Sprintf("%v", value)
|
||||
}
|
||||
|
||||
func isPointerKind(kind reflect.Kind) bool {
|
||||
return kind == reflect.Ptr
|
||||
}
|
||||
|
16
vendor/k8s.io/apimachinery/pkg/fields/selector.go
generated
vendored
16
vendor/k8s.io/apimachinery/pkg/fields/selector.go
generated
vendored
@ -57,13 +57,15 @@ type Selector interface {
|
||||
|
||||
type nothingSelector struct{}
|
||||
|
||||
func (n nothingSelector) Matches(_ Fields) bool { return false }
|
||||
func (n nothingSelector) Empty() bool { return false }
|
||||
func (n nothingSelector) String() string { return "" }
|
||||
func (n nothingSelector) Requirements() Requirements { return nil }
|
||||
func (n nothingSelector) DeepCopySelector() Selector { return n }
|
||||
func (n nothingSelector) RequiresExactMatch(field string) (value string, found bool) { return "", false }
|
||||
func (n nothingSelector) Transform(fn TransformFunc) (Selector, error) { return n, nil }
|
||||
func (n nothingSelector) Matches(_ Fields) bool { return false }
|
||||
func (n nothingSelector) Empty() bool { return false }
|
||||
func (n nothingSelector) String() string { return "" }
|
||||
func (n nothingSelector) Requirements() Requirements { return nil }
|
||||
func (n nothingSelector) DeepCopySelector() Selector { return n }
|
||||
func (n nothingSelector) RequiresExactMatch(field string) (value string, found bool) {
|
||||
return "", false
|
||||
}
|
||||
func (n nothingSelector) Transform(fn TransformFunc) (Selector, error) { return n, nil }
|
||||
|
||||
// Nothing returns a selector that matches no fields
|
||||
func Nothing() Selector {
|
||||
|
16
vendor/k8s.io/apimachinery/pkg/labels/labels.go
generated
vendored
16
vendor/k8s.io/apimachinery/pkg/labels/labels.go
generated
vendored
@ -57,14 +57,22 @@ func (ls Set) Get(label string) string {
|
||||
return ls[label]
|
||||
}
|
||||
|
||||
// AsSelector converts labels into a selectors.
|
||||
// AsSelector converts labels into a selectors. It does not
|
||||
// perform any validation, which means the server will reject
|
||||
// the request if the Set contains invalid values.
|
||||
func (ls Set) AsSelector() Selector {
|
||||
return SelectorFromSet(ls)
|
||||
}
|
||||
|
||||
// AsValidatedSelector converts labels into a selectors.
|
||||
// The Set is validated client-side, which allows to catch errors early.
|
||||
func (ls Set) AsValidatedSelector() (Selector, error) {
|
||||
return ValidatedSelectorFromSet(ls)
|
||||
}
|
||||
|
||||
// AsSelectorPreValidated converts labels into a selector, but
|
||||
// assumes that labels are already validated and thus don't
|
||||
// preform any validation.
|
||||
// assumes that labels are already validated and thus doesn't
|
||||
// perform any validation.
|
||||
// According to our measurements this is significantly faster
|
||||
// in codepaths that matter at high scale.
|
||||
func (ls Set) AsSelectorPreValidated() Selector {
|
||||
@ -172,7 +180,7 @@ func ConvertSelectorToLabelsMap(selector string) (Set, error) {
|
||||
return labelsMap, err
|
||||
}
|
||||
value := strings.TrimSpace(l[1])
|
||||
if err := validateLabelValue(value); err != nil {
|
||||
if err := validateLabelValue(key, value); err != nil {
|
||||
return labelsMap, err
|
||||
}
|
||||
labelsMap[key] = value
|
||||
|
62
vendor/k8s.io/apimachinery/pkg/labels/selector.go
generated
vendored
62
vendor/k8s.io/apimachinery/pkg/labels/selector.go
generated
vendored
@ -26,7 +26,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/selection"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// Requirements is AND of all requirements.
|
||||
@ -54,6 +54,11 @@ type Selector interface {
|
||||
|
||||
// Make a deep copy of the selector.
|
||||
DeepCopySelector() Selector
|
||||
|
||||
// RequiresExactMatch allows a caller to introspect whether a given selector
|
||||
// requires a single specific label to be set, and if so returns the value it
|
||||
// requires.
|
||||
RequiresExactMatch(label string) (value string, found bool)
|
||||
}
|
||||
|
||||
// Everything returns a selector that matches all labels.
|
||||
@ -69,6 +74,9 @@ func (n nothingSelector) String() string { return "" }
|
||||
func (n nothingSelector) Add(_ ...Requirement) Selector { return n }
|
||||
func (n nothingSelector) Requirements() (Requirements, bool) { return nil, false }
|
||||
func (n nothingSelector) DeepCopySelector() Selector { return n }
|
||||
func (n nothingSelector) RequiresExactMatch(label string) (value string, found bool) {
|
||||
return "", false
|
||||
}
|
||||
|
||||
// Nothing returns a selector that matches no labels
|
||||
func Nothing() Selector {
|
||||
@ -162,7 +170,7 @@ func NewRequirement(key string, op selection.Operator, vals []string) (*Requirem
|
||||
}
|
||||
|
||||
for i := range vals {
|
||||
if err := validateLabelValue(vals[i]); err != nil {
|
||||
if err := validateLabelValue(key, vals[i]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@ -215,7 +223,7 @@ func (r *Requirement) Matches(ls Labels) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// There should be only one strValue in r.strValues, and can be converted to a integer.
|
||||
// There should be only one strValue in r.strValues, and can be converted to an integer.
|
||||
if len(r.strValues) != 1 {
|
||||
klog.V(10).Infof("Invalid values count %+v of requirement %#v, for 'Gt', 'Lt' operators, exactly one value is required", len(r.strValues), r)
|
||||
return false
|
||||
@ -358,6 +366,23 @@ func (lsel internalSelector) String() string {
|
||||
return strings.Join(reqs, ",")
|
||||
}
|
||||
|
||||
// RequiresExactMatch introspect whether a given selector requires a single specific field
|
||||
// to be set, and if so returns the value it requires.
|
||||
func (lsel internalSelector) RequiresExactMatch(label string) (value string, found bool) {
|
||||
for ix := range lsel {
|
||||
if lsel[ix].key == label {
|
||||
switch lsel[ix].operator {
|
||||
case selection.Equals, selection.DoubleEquals, selection.In:
|
||||
if len(lsel[ix].strValues) == 1 {
|
||||
return lsel[ix].strValues[0], true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
// Token represents constant definition for lexer token
|
||||
type Token int
|
||||
|
||||
@ -837,32 +862,39 @@ func validateLabelKey(k string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateLabelValue(v string) error {
|
||||
func validateLabelValue(k, v string) error {
|
||||
if errs := validation.IsValidLabelValue(v); len(errs) != 0 {
|
||||
return fmt.Errorf("invalid label value: %q: %s", v, strings.Join(errs, "; "))
|
||||
return fmt.Errorf("invalid label value: %q: at key: %q: %s", v, k, strings.Join(errs, "; "))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SelectorFromSet returns a Selector which will match exactly the given Set. A
|
||||
// nil and empty Sets are considered equivalent to Everything().
|
||||
// It does not perform any validation, which means the server will reject
|
||||
// the request if the Set contains invalid values.
|
||||
func SelectorFromSet(ls Set) Selector {
|
||||
return SelectorFromValidatedSet(ls)
|
||||
}
|
||||
|
||||
// ValidatedSelectorFromSet returns a Selector which will match exactly the given Set. A
|
||||
// nil and empty Sets are considered equivalent to Everything().
|
||||
// The Set is validated client-side, which allows to catch errors early.
|
||||
func ValidatedSelectorFromSet(ls Set) (Selector, error) {
|
||||
if ls == nil || len(ls) == 0 {
|
||||
return internalSelector{}
|
||||
return internalSelector{}, nil
|
||||
}
|
||||
var requirements internalSelector
|
||||
requirements := make([]Requirement, 0, len(ls))
|
||||
for label, value := range ls {
|
||||
r, err := NewRequirement(label, selection.Equals, []string{value})
|
||||
if err == nil {
|
||||
requirements = append(requirements, *r)
|
||||
} else {
|
||||
//TODO: double check errors when input comes from serialization?
|
||||
return internalSelector{}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
requirements = append(requirements, *r)
|
||||
}
|
||||
// sort to have deterministic string representation
|
||||
sort.Sort(ByKey(requirements))
|
||||
return requirements
|
||||
return internalSelector(requirements), nil
|
||||
}
|
||||
|
||||
// SelectorFromValidatedSet returns a Selector which will match exactly the given Set.
|
||||
@ -872,13 +904,13 @@ func SelectorFromValidatedSet(ls Set) Selector {
|
||||
if ls == nil || len(ls) == 0 {
|
||||
return internalSelector{}
|
||||
}
|
||||
var requirements internalSelector
|
||||
requirements := make([]Requirement, 0, len(ls))
|
||||
for label, value := range ls {
|
||||
requirements = append(requirements, Requirement{key: label, operator: selection.Equals, strValues: []string{value}})
|
||||
}
|
||||
// sort to have deterministic string representation
|
||||
sort.Sort(ByKey(requirements))
|
||||
return requirements
|
||||
return internalSelector(requirements)
|
||||
}
|
||||
|
||||
// ParseToRequirements takes a string representing a selector and returns a list of
|
||||
|
92
vendor/k8s.io/apimachinery/pkg/runtime/codec.go
generated
vendored
92
vendor/k8s.io/apimachinery/pkg/runtime/codec.go
generated
vendored
@ -19,13 +19,17 @@ package runtime
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/conversion/queryparams"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// codec binds an encoder and decoder.
|
||||
@ -100,10 +104,19 @@ type NoopEncoder struct {
|
||||
|
||||
var _ Serializer = NoopEncoder{}
|
||||
|
||||
const noopEncoderIdentifier Identifier = "noop"
|
||||
|
||||
func (n NoopEncoder) Encode(obj Object, w io.Writer) error {
|
||||
// There is no need to handle runtime.CacheableObject, as we don't
|
||||
// process the obj at all.
|
||||
return fmt.Errorf("encoding is not allowed for this codec: %v", reflect.TypeOf(n.Decoder))
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (n NoopEncoder) Identifier() Identifier {
|
||||
return noopEncoderIdentifier
|
||||
}
|
||||
|
||||
// NoopDecoder converts an Encoder to a Serializer or Codec for code that expects them but only uses encoding.
|
||||
type NoopDecoder struct {
|
||||
Encoder
|
||||
@ -193,19 +206,51 @@ func (c *parameterCodec) EncodeParameters(obj Object, to schema.GroupVersion) (u
|
||||
type base64Serializer struct {
|
||||
Encoder
|
||||
Decoder
|
||||
|
||||
identifier Identifier
|
||||
}
|
||||
|
||||
func NewBase64Serializer(e Encoder, d Decoder) Serializer {
|
||||
return &base64Serializer{e, d}
|
||||
return &base64Serializer{
|
||||
Encoder: e,
|
||||
Decoder: d,
|
||||
identifier: identifier(e),
|
||||
}
|
||||
}
|
||||
|
||||
func identifier(e Encoder) Identifier {
|
||||
result := map[string]string{
|
||||
"name": "base64",
|
||||
}
|
||||
if e != nil {
|
||||
result["encoder"] = string(e.Identifier())
|
||||
}
|
||||
identifier, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed marshaling identifier for base64Serializer: %v", err)
|
||||
}
|
||||
return Identifier(identifier)
|
||||
}
|
||||
|
||||
func (s base64Serializer) Encode(obj Object, stream io.Writer) error {
|
||||
if co, ok := obj.(CacheableObject); ok {
|
||||
return co.CacheEncode(s.Identifier(), s.doEncode, stream)
|
||||
}
|
||||
return s.doEncode(obj, stream)
|
||||
}
|
||||
|
||||
func (s base64Serializer) doEncode(obj Object, stream io.Writer) error {
|
||||
e := base64.NewEncoder(base64.StdEncoding, stream)
|
||||
err := s.Encoder.Encode(obj, e)
|
||||
e.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (s base64Serializer) Identifier() Identifier {
|
||||
return s.identifier
|
||||
}
|
||||
|
||||
func (s base64Serializer) Decode(data []byte, defaults *schema.GroupVersionKind, into Object) (Object, *schema.GroupVersionKind, error) {
|
||||
out := make([]byte, base64.StdEncoding.DecodedLen(len(data)))
|
||||
n, err := base64.StdEncoding.Decode(out, data)
|
||||
@ -238,6 +283,11 @@ var (
|
||||
DisabledGroupVersioner GroupVersioner = disabledGroupVersioner{}
|
||||
)
|
||||
|
||||
const (
|
||||
internalGroupVersionerIdentifier = "internal"
|
||||
disabledGroupVersionerIdentifier = "disabled"
|
||||
)
|
||||
|
||||
type internalGroupVersioner struct{}
|
||||
|
||||
// KindForGroupVersionKinds returns an internal Kind if one is found, or converts the first provided kind to the internal version.
|
||||
@ -253,6 +303,11 @@ func (internalGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersi
|
||||
return schema.GroupVersionKind{}, false
|
||||
}
|
||||
|
||||
// Identifier implements GroupVersioner interface.
|
||||
func (internalGroupVersioner) Identifier() string {
|
||||
return internalGroupVersionerIdentifier
|
||||
}
|
||||
|
||||
type disabledGroupVersioner struct{}
|
||||
|
||||
// KindForGroupVersionKinds returns false for any input.
|
||||
@ -260,19 +315,9 @@ func (disabledGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersi
|
||||
return schema.GroupVersionKind{}, false
|
||||
}
|
||||
|
||||
// GroupVersioners implements GroupVersioner and resolves to the first exact match for any kind.
|
||||
type GroupVersioners []GroupVersioner
|
||||
|
||||
// KindForGroupVersionKinds returns the first match of any of the group versioners, or false if no match occurred.
|
||||
func (gvs GroupVersioners) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) {
|
||||
for _, gv := range gvs {
|
||||
target, ok := gv.KindForGroupVersionKinds(kinds)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
return target, true
|
||||
}
|
||||
return schema.GroupVersionKind{}, false
|
||||
// Identifier implements GroupVersioner interface.
|
||||
func (disabledGroupVersioner) Identifier() string {
|
||||
return disabledGroupVersionerIdentifier
|
||||
}
|
||||
|
||||
// Assert that schema.GroupVersion and GroupVersions implement GroupVersioner
|
||||
@ -330,3 +375,22 @@ func (v multiGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersio
|
||||
}
|
||||
return schema.GroupVersionKind{}, false
|
||||
}
|
||||
|
||||
// Identifier implements GroupVersioner interface.
|
||||
func (v multiGroupVersioner) Identifier() string {
|
||||
groupKinds := make([]string, 0, len(v.acceptedGroupKinds))
|
||||
for _, gk := range v.acceptedGroupKinds {
|
||||
groupKinds = append(groupKinds, gk.String())
|
||||
}
|
||||
result := map[string]string{
|
||||
"name": "multi",
|
||||
"target": v.target.String(),
|
||||
"accepted": strings.Join(groupKinds, ","),
|
||||
"coerce": strconv.FormatBool(v.coerce),
|
||||
}
|
||||
identifier, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed marshaling Identifier for %#v: %v", v, err)
|
||||
}
|
||||
return string(identifier)
|
||||
}
|
||||
|
10
vendor/k8s.io/apimachinery/pkg/runtime/codec_check.go
generated
vendored
10
vendor/k8s.io/apimachinery/pkg/runtime/codec_check.go
generated
vendored
@ -21,6 +21,7 @@ import (
|
||||
"reflect"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
)
|
||||
|
||||
// CheckCodec makes sure that the codec can encode objects like internalType,
|
||||
@ -32,7 +33,14 @@ func CheckCodec(c Codec, internalType Object, externalTypes ...schema.GroupVersi
|
||||
return fmt.Errorf("Internal type not encodable: %v", err)
|
||||
}
|
||||
for _, et := range externalTypes {
|
||||
exBytes := []byte(fmt.Sprintf(`{"kind":"%v","apiVersion":"%v"}`, et.Kind, et.GroupVersion().String()))
|
||||
typeMeta := TypeMeta{
|
||||
Kind: et.Kind,
|
||||
APIVersion: et.GroupVersion().String(),
|
||||
}
|
||||
exBytes, err := json.Marshal(&typeMeta)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
obj, err := Decode(c, exBytes)
|
||||
if err != nil {
|
||||
return fmt.Errorf("external type %s not interpretable: %v", et, err)
|
||||
|
131
vendor/k8s.io/apimachinery/pkg/runtime/conversion.go
generated
vendored
131
vendor/k8s.io/apimachinery/pkg/runtime/conversion.go
generated
vendored
@ -53,27 +53,21 @@ func JSONKeyMapper(key string, sourceTag, destTag reflect.StructTag) (string, st
|
||||
return key, key
|
||||
}
|
||||
|
||||
// DefaultStringConversions are helpers for converting []string and string to real values.
|
||||
var DefaultStringConversions = []interface{}{
|
||||
Convert_Slice_string_To_string,
|
||||
Convert_Slice_string_To_int,
|
||||
Convert_Slice_string_To_bool,
|
||||
Convert_Slice_string_To_int64,
|
||||
}
|
||||
|
||||
func Convert_Slice_string_To_string(input *[]string, out *string, s conversion.Scope) error {
|
||||
if len(*input) == 0 {
|
||||
func Convert_Slice_string_To_string(in *[]string, out *string, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
*out = ""
|
||||
return nil
|
||||
}
|
||||
*out = (*input)[0]
|
||||
*out = (*in)[0]
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_Slice_string_To_int(input *[]string, out *int, s conversion.Scope) error {
|
||||
if len(*input) == 0 {
|
||||
func Convert_Slice_string_To_int(in *[]string, out *int, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
*out = 0
|
||||
return nil
|
||||
}
|
||||
str := (*input)[0]
|
||||
str := (*in)[0]
|
||||
i, err := strconv.Atoi(str)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -83,15 +77,16 @@ func Convert_Slice_string_To_int(input *[]string, out *int, s conversion.Scope)
|
||||
}
|
||||
|
||||
// Convert_Slice_string_To_bool will convert a string parameter to boolean.
|
||||
// Only the absence of a value, a value of "false", or a value of "0" resolve to false.
|
||||
// Only the absence of a value (i.e. zero-length slice), a value of "false", or a
|
||||
// value of "0" resolve to false.
|
||||
// Any other value (including empty string) resolves to true.
|
||||
func Convert_Slice_string_To_bool(input *[]string, out *bool, s conversion.Scope) error {
|
||||
if len(*input) == 0 {
|
||||
func Convert_Slice_string_To_bool(in *[]string, out *bool, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
*out = false
|
||||
return nil
|
||||
}
|
||||
switch strings.ToLower((*input)[0]) {
|
||||
case "false", "0":
|
||||
switch {
|
||||
case (*in)[0] == "0", strings.EqualFold((*in)[0], "false"):
|
||||
*out = false
|
||||
default:
|
||||
*out = true
|
||||
@ -99,15 +94,103 @@ func Convert_Slice_string_To_bool(input *[]string, out *bool, s conversion.Scope
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_Slice_string_To_int64(input *[]string, out *int64, s conversion.Scope) error {
|
||||
if len(*input) == 0 {
|
||||
*out = 0
|
||||
// Convert_Slice_string_To_bool will convert a string parameter to boolean.
|
||||
// Only the absence of a value (i.e. zero-length slice), a value of "false", or a
|
||||
// value of "0" resolve to false.
|
||||
// Any other value (including empty string) resolves to true.
|
||||
func Convert_Slice_string_To_Pointer_bool(in *[]string, out **bool, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
boolVar := false
|
||||
*out = &boolVar
|
||||
return nil
|
||||
}
|
||||
str := (*input)[0]
|
||||
i, err := strconv.ParseInt(str, 10, 64)
|
||||
switch {
|
||||
case (*in)[0] == "0", strings.EqualFold((*in)[0], "false"):
|
||||
boolVar := false
|
||||
*out = &boolVar
|
||||
default:
|
||||
boolVar := true
|
||||
*out = &boolVar
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func string_to_int64(in string) (int64, error) {
|
||||
return strconv.ParseInt(in, 10, 64)
|
||||
}
|
||||
|
||||
func Convert_string_To_int64(in *string, out *int64, s conversion.Scope) error {
|
||||
if in == nil {
|
||||
*out = 0
|
||||
return nil
|
||||
}
|
||||
i, err := string_to_int64(*in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*out = i
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_Slice_string_To_int64(in *[]string, out *int64, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
*out = 0
|
||||
return nil
|
||||
}
|
||||
i, err := string_to_int64((*in)[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*out = i
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_string_To_Pointer_int64(in *string, out **int64, s conversion.Scope) error {
|
||||
if in == nil {
|
||||
*out = nil
|
||||
return nil
|
||||
}
|
||||
i, err := string_to_int64(*in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*out = &i
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_Slice_string_To_Pointer_int64(in *[]string, out **int64, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
*out = nil
|
||||
return nil
|
||||
}
|
||||
i, err := string_to_int64((*in)[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*out = &i
|
||||
return nil
|
||||
}
|
||||
|
||||
func RegisterStringConversions(s *Scheme) error {
|
||||
if err := s.AddConversionFunc((*[]string)(nil), (*string)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Slice_string_To_string(a.(*[]string), b.(*string), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*[]string)(nil), (*int)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Slice_string_To_int(a.(*[]string), b.(*int), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*[]string)(nil), (*bool)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Slice_string_To_bool(a.(*[]string), b.(*bool), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*[]string)(nil), (*int64)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_Slice_string_To_int64(a.(*[]string), b.(*int64), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
126
vendor/k8s.io/apimachinery/pkg/runtime/converter.go
generated
vendored
126
vendor/k8s.io/apimachinery/pkg/runtime/converter.go
generated
vendored
@ -17,7 +17,6 @@ limitations under the License.
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
encodingjson "encoding/json"
|
||||
"fmt"
|
||||
"math"
|
||||
@ -32,8 +31,9 @@ import (
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"sigs.k8s.io/structured-merge-diff/v4/value"
|
||||
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// UnstructuredConverter is an interface for converting between interface{}
|
||||
@ -68,13 +68,8 @@ func newFieldsCache() *fieldsCache {
|
||||
}
|
||||
|
||||
var (
|
||||
marshalerType = reflect.TypeOf(new(encodingjson.Marshaler)).Elem()
|
||||
unmarshalerType = reflect.TypeOf(new(encodingjson.Unmarshaler)).Elem()
|
||||
mapStringInterfaceType = reflect.TypeOf(map[string]interface{}{})
|
||||
stringType = reflect.TypeOf(string(""))
|
||||
int64Type = reflect.TypeOf(int64(0))
|
||||
float64Type = reflect.TypeOf(float64(0))
|
||||
boolType = reflect.TypeOf(bool(false))
|
||||
fieldCache = newFieldsCache()
|
||||
|
||||
// DefaultUnstructuredConverter performs unstructured to Go typed object conversions.
|
||||
@ -94,7 +89,7 @@ func parseBool(key string) bool {
|
||||
}
|
||||
value, err := strconv.ParseBool(key)
|
||||
if err != nil {
|
||||
utilruntime.HandleError(fmt.Errorf("Couldn't parse '%s' as bool for unstructured mismatch detection", key))
|
||||
utilruntime.HandleError(fmt.Errorf("couldn't parse '%s' as bool for unstructured mismatch detection", key))
|
||||
}
|
||||
return value
|
||||
}
|
||||
@ -208,13 +203,9 @@ func fromUnstructured(sv, dv reflect.Value) error {
|
||||
}
|
||||
|
||||
// Check if the object has a custom JSON marshaller/unmarshaller.
|
||||
if reflect.PtrTo(dt).Implements(unmarshalerType) {
|
||||
data, err := json.Marshal(sv.Interface())
|
||||
if err != nil {
|
||||
return fmt.Errorf("error encoding %s to json: %v", st.String(), err)
|
||||
}
|
||||
unmarshaler := dv.Addr().Interface().(encodingjson.Unmarshaler)
|
||||
return unmarshaler.UnmarshalJSON(data)
|
||||
entry := value.TypeReflectEntryOf(dv.Type())
|
||||
if entry.CanConvertFromUnstructured() {
|
||||
return entry.FromUnstructured(sv, dv)
|
||||
}
|
||||
|
||||
switch dt.Kind() {
|
||||
@ -256,6 +247,7 @@ func fieldInfoFromField(structType reflect.Type, field int) *fieldInfo {
|
||||
for i := range items {
|
||||
if items[i] == "omitempty" {
|
||||
info.omitempty = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -483,112 +475,28 @@ func toUnstructuredViaJSON(obj interface{}, u *map[string]interface{}) error {
|
||||
return json.Unmarshal(data, u)
|
||||
}
|
||||
|
||||
var (
|
||||
nullBytes = []byte("null")
|
||||
trueBytes = []byte("true")
|
||||
falseBytes = []byte("false")
|
||||
)
|
||||
|
||||
func getMarshaler(v reflect.Value) (encodingjson.Marshaler, bool) {
|
||||
// Check value receivers if v is not a pointer and pointer receivers if v is a pointer
|
||||
if v.Type().Implements(marshalerType) {
|
||||
return v.Interface().(encodingjson.Marshaler), true
|
||||
}
|
||||
// Check pointer receivers if v is not a pointer
|
||||
if v.Kind() != reflect.Ptr && v.CanAddr() {
|
||||
v = v.Addr()
|
||||
if v.Type().Implements(marshalerType) {
|
||||
return v.Interface().(encodingjson.Marshaler), true
|
||||
}
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func toUnstructured(sv, dv reflect.Value) error {
|
||||
// Check if the object has a custom JSON marshaller/unmarshaller.
|
||||
if marshaler, ok := getMarshaler(sv); ok {
|
||||
if sv.Kind() == reflect.Ptr && sv.IsNil() {
|
||||
// We're done - we don't need to store anything.
|
||||
return nil
|
||||
}
|
||||
|
||||
data, err := marshaler.MarshalJSON()
|
||||
// Check if the object has a custom string converter.
|
||||
entry := value.TypeReflectEntryOf(sv.Type())
|
||||
if entry.CanConvertToUnstructured() {
|
||||
v, err := entry.ToUnstructured(sv)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch {
|
||||
case len(data) == 0:
|
||||
return fmt.Errorf("error decoding from json: empty value")
|
||||
|
||||
case bytes.Equal(data, nullBytes):
|
||||
// We're done - we don't need to store anything.
|
||||
|
||||
case bytes.Equal(data, trueBytes):
|
||||
dv.Set(reflect.ValueOf(true))
|
||||
|
||||
case bytes.Equal(data, falseBytes):
|
||||
dv.Set(reflect.ValueOf(false))
|
||||
|
||||
case data[0] == '"':
|
||||
var result string
|
||||
err := json.Unmarshal(data, &result)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error decoding string from json: %v", err)
|
||||
}
|
||||
dv.Set(reflect.ValueOf(result))
|
||||
|
||||
case data[0] == '{':
|
||||
result := make(map[string]interface{})
|
||||
err := json.Unmarshal(data, &result)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error decoding object from json: %v", err)
|
||||
}
|
||||
dv.Set(reflect.ValueOf(result))
|
||||
|
||||
case data[0] == '[':
|
||||
result := make([]interface{}, 0)
|
||||
err := json.Unmarshal(data, &result)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error decoding array from json: %v", err)
|
||||
}
|
||||
dv.Set(reflect.ValueOf(result))
|
||||
|
||||
default:
|
||||
var (
|
||||
resultInt int64
|
||||
resultFloat float64
|
||||
err error
|
||||
)
|
||||
if err = json.Unmarshal(data, &resultInt); err == nil {
|
||||
dv.Set(reflect.ValueOf(resultInt))
|
||||
} else if err = json.Unmarshal(data, &resultFloat); err == nil {
|
||||
dv.Set(reflect.ValueOf(resultFloat))
|
||||
} else {
|
||||
return fmt.Errorf("error decoding number from json: %v", err)
|
||||
}
|
||||
if v != nil {
|
||||
dv.Set(reflect.ValueOf(v))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
st, dt := sv.Type(), dv.Type()
|
||||
st := sv.Type()
|
||||
switch st.Kind() {
|
||||
case reflect.String:
|
||||
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
|
||||
dv.Set(reflect.New(stringType))
|
||||
}
|
||||
dv.Set(reflect.ValueOf(sv.String()))
|
||||
return nil
|
||||
case reflect.Bool:
|
||||
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
|
||||
dv.Set(reflect.New(boolType))
|
||||
}
|
||||
dv.Set(reflect.ValueOf(sv.Bool()))
|
||||
return nil
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
|
||||
dv.Set(reflect.New(int64Type))
|
||||
}
|
||||
dv.Set(reflect.ValueOf(sv.Int()))
|
||||
return nil
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
@ -596,15 +504,9 @@ func toUnstructured(sv, dv reflect.Value) error {
|
||||
if uVal > math.MaxInt64 {
|
||||
return fmt.Errorf("unsigned value %d does not fit into int64 (overflow)", uVal)
|
||||
}
|
||||
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
|
||||
dv.Set(reflect.New(int64Type))
|
||||
}
|
||||
dv.Set(reflect.ValueOf(int64(uVal)))
|
||||
return nil
|
||||
case reflect.Float32, reflect.Float64:
|
||||
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
|
||||
dv.Set(reflect.New(float64Type))
|
||||
}
|
||||
dv.Set(reflect.ValueOf(sv.Float()))
|
||||
return nil
|
||||
case reflect.Map:
|
||||
|
15
vendor/k8s.io/apimachinery/pkg/runtime/embedded.go
generated
vendored
15
vendor/k8s.io/apimachinery/pkg/runtime/embedded.go
generated
vendored
@ -134,9 +134,16 @@ func Convert_runtime_RawExtension_To_runtime_Object(in *RawExtension, out *Objec
|
||||
return nil
|
||||
}
|
||||
|
||||
func DefaultEmbeddedConversions() []interface{} {
|
||||
return []interface{}{
|
||||
Convert_runtime_Object_To_runtime_RawExtension,
|
||||
Convert_runtime_RawExtension_To_runtime_Object,
|
||||
func RegisterEmbeddedConversions(s *Scheme) error {
|
||||
if err := s.AddConversionFunc((*Object)(nil), (*RawExtension)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_runtime_Object_To_runtime_RawExtension(a.(*Object), b.(*RawExtension), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*RawExtension)(nil), (*Object)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_runtime_RawExtension_To_runtime_Object(a.(*RawExtension), b.(*Object), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
29
vendor/k8s.io/apimachinery/pkg/runtime/error.go
generated
vendored
29
vendor/k8s.io/apimachinery/pkg/runtime/error.go
generated
vendored
@ -120,3 +120,32 @@ func IsMissingVersion(err error) bool {
|
||||
_, ok := err.(*missingVersionErr)
|
||||
return ok
|
||||
}
|
||||
|
||||
// strictDecodingError is a base error type that is returned by a strict Decoder such
|
||||
// as UniversalStrictDecoder.
|
||||
type strictDecodingError struct {
|
||||
message string
|
||||
data string
|
||||
}
|
||||
|
||||
// NewStrictDecodingError creates a new strictDecodingError object.
|
||||
func NewStrictDecodingError(message string, data string) error {
|
||||
return &strictDecodingError{
|
||||
message: message,
|
||||
data: data,
|
||||
}
|
||||
}
|
||||
|
||||
func (e *strictDecodingError) Error() string {
|
||||
return fmt.Sprintf("strict decoder error for %s: %s", e.data, e.message)
|
||||
}
|
||||
|
||||
// IsStrictDecodingError returns true if the error indicates that the provided object
|
||||
// strictness violations.
|
||||
func IsStrictDecodingError(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
_, ok := err.(*strictDecodingError)
|
||||
return ok
|
||||
}
|
||||
|
407
vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
generated
vendored
407
vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
generated
vendored
@ -17,31 +17,18 @@ limitations under the License.
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
|
||||
|
||||
/*
|
||||
Package runtime is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
RawExtension
|
||||
TypeMeta
|
||||
Unknown
|
||||
*/
|
||||
package runtime
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
|
||||
io "io"
|
||||
math "math"
|
||||
|
||||
math_bits "math/bits"
|
||||
reflect "reflect"
|
||||
strings "strings"
|
||||
|
||||
reflect "reflect"
|
||||
|
||||
io "io"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -53,29 +40,134 @@ var _ = math.Inf
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
func (m *RawExtension) Reset() { *m = RawExtension{} }
|
||||
func (*RawExtension) ProtoMessage() {}
|
||||
func (*RawExtension) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
func (m *RawExtension) Reset() { *m = RawExtension{} }
|
||||
func (*RawExtension) ProtoMessage() {}
|
||||
func (*RawExtension) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_9d3c45d7f546725c, []int{0}
|
||||
}
|
||||
func (m *RawExtension) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *RawExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
func (m *RawExtension) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_RawExtension.Merge(m, src)
|
||||
}
|
||||
func (m *RawExtension) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *RawExtension) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_RawExtension.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
func (m *TypeMeta) Reset() { *m = TypeMeta{} }
|
||||
func (*TypeMeta) ProtoMessage() {}
|
||||
func (*TypeMeta) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
|
||||
var xxx_messageInfo_RawExtension proto.InternalMessageInfo
|
||||
|
||||
func (m *Unknown) Reset() { *m = Unknown{} }
|
||||
func (*Unknown) ProtoMessage() {}
|
||||
func (*Unknown) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
|
||||
func (m *TypeMeta) Reset() { *m = TypeMeta{} }
|
||||
func (*TypeMeta) ProtoMessage() {}
|
||||
func (*TypeMeta) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_9d3c45d7f546725c, []int{1}
|
||||
}
|
||||
func (m *TypeMeta) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *TypeMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
func (m *TypeMeta) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TypeMeta.Merge(m, src)
|
||||
}
|
||||
func (m *TypeMeta) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *TypeMeta) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TypeMeta.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TypeMeta proto.InternalMessageInfo
|
||||
|
||||
func (m *Unknown) Reset() { *m = Unknown{} }
|
||||
func (*Unknown) ProtoMessage() {}
|
||||
func (*Unknown) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_9d3c45d7f546725c, []int{2}
|
||||
}
|
||||
func (m *Unknown) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Unknown) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
func (m *Unknown) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Unknown.Merge(m, src)
|
||||
}
|
||||
func (m *Unknown) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *Unknown) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Unknown.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Unknown proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*RawExtension)(nil), "k8s.io.apimachinery.pkg.runtime.RawExtension")
|
||||
proto.RegisterType((*TypeMeta)(nil), "k8s.io.apimachinery.pkg.runtime.TypeMeta")
|
||||
proto.RegisterType((*Unknown)(nil), "k8s.io.apimachinery.pkg.runtime.Unknown")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto", fileDescriptor_9d3c45d7f546725c)
|
||||
}
|
||||
|
||||
var fileDescriptor_9d3c45d7f546725c = []byte{
|
||||
// 378 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x8f, 0x4f, 0xab, 0x13, 0x31,
|
||||
0x14, 0xc5, 0x27, 0xaf, 0x85, 0x3e, 0xd3, 0xc2, 0x93, 0xb8, 0x70, 0x74, 0x91, 0x79, 0x74, 0xe5,
|
||||
0x5b, 0xbc, 0x04, 0x1e, 0x08, 0x6e, 0x3b, 0xa5, 0xa0, 0x88, 0x20, 0xc1, 0x3f, 0xe0, 0xca, 0x74,
|
||||
0x26, 0x4e, 0xc3, 0xd0, 0x9b, 0x21, 0xcd, 0x38, 0x76, 0xe7, 0x47, 0xf0, 0x63, 0x75, 0xd9, 0x65,
|
||||
0x57, 0xc5, 0x8e, 0x1f, 0xc2, 0xad, 0x34, 0x4d, 0x6b, 0xd5, 0x85, 0xbb, 0xe4, 0x9e, 0xf3, 0x3b,
|
||||
0xf7, 0x1e, 0xfc, 0xbc, 0x7c, 0xb6, 0x60, 0xda, 0xf0, 0xb2, 0x9e, 0x2a, 0x0b, 0xca, 0xa9, 0x05,
|
||||
0xff, 0xac, 0x20, 0x37, 0x96, 0x07, 0x41, 0x56, 0x7a, 0x2e, 0xb3, 0x99, 0x06, 0x65, 0x97, 0xbc,
|
||||
0x2a, 0x0b, 0x6e, 0x6b, 0x70, 0x7a, 0xae, 0x78, 0xa1, 0x40, 0x59, 0xe9, 0x54, 0xce, 0x2a, 0x6b,
|
||||
0x9c, 0x21, 0xc9, 0x01, 0x60, 0xe7, 0x00, 0xab, 0xca, 0x82, 0x05, 0xe0, 0xf1, 0x6d, 0xa1, 0xdd,
|
||||
0xac, 0x9e, 0xb2, 0xcc, 0xcc, 0x79, 0x61, 0x0a, 0xc3, 0x3d, 0x37, 0xad, 0x3f, 0xf9, 0x9f, 0xff,
|
||||
0xf8, 0xd7, 0x21, 0x6f, 0x78, 0x83, 0x07, 0x42, 0x36, 0x93, 0x2f, 0x4e, 0xc1, 0x42, 0x1b, 0x20,
|
||||
0x8f, 0x70, 0xc7, 0xca, 0x26, 0x46, 0xd7, 0xe8, 0xc9, 0x20, 0xed, 0xb5, 0xdb, 0xa4, 0x23, 0x64,
|
||||
0x23, 0xf6, 0xb3, 0xe1, 0x47, 0x7c, 0xf9, 0x66, 0x59, 0xa9, 0x57, 0xca, 0x49, 0x72, 0x87, 0xb1,
|
||||
0xac, 0xf4, 0x3b, 0x65, 0xf7, 0x90, 0x77, 0xdf, 0x4b, 0xc9, 0x6a, 0x9b, 0x44, 0xed, 0x36, 0xc1,
|
||||
0xa3, 0xd7, 0x2f, 0x82, 0x22, 0xce, 0x5c, 0xe4, 0x1a, 0x77, 0x4b, 0x0d, 0x79, 0x7c, 0xe1, 0xdd,
|
||||
0x83, 0xe0, 0xee, 0xbe, 0xd4, 0x90, 0x0b, 0xaf, 0x0c, 0x7f, 0x22, 0xdc, 0x7b, 0x0b, 0x25, 0x98,
|
||||
0x06, 0xc8, 0x7b, 0x7c, 0xe9, 0xc2, 0x36, 0x9f, 0xdf, 0xbf, 0xbb, 0x61, 0xff, 0xe9, 0xce, 0x8e,
|
||||
0xe7, 0xa5, 0xf7, 0x43, 0xf8, 0xe9, 0x60, 0x71, 0x0a, 0x3b, 0x36, 0xbc, 0xf8, 0xb7, 0x21, 0x19,
|
||||
0xe1, 0xab, 0xcc, 0x80, 0x53, 0xe0, 0x26, 0x90, 0x99, 0x5c, 0x43, 0x11, 0x77, 0xfc, 0xb1, 0x0f,
|
||||
0x43, 0xde, 0xd5, 0xf8, 0x4f, 0x59, 0xfc, 0xed, 0x27, 0x4f, 0x71, 0x3f, 0x8c, 0xf6, 0xab, 0xe3,
|
||||
0xae, 0xc7, 0x1f, 0x04, 0xbc, 0x3f, 0xfe, 0x2d, 0x89, 0x73, 0x5f, 0x7a, 0xbb, 0xda, 0xd1, 0x68,
|
||||
0xbd, 0xa3, 0xd1, 0x66, 0x47, 0xa3, 0xaf, 0x2d, 0x45, 0xab, 0x96, 0xa2, 0x75, 0x4b, 0xd1, 0xa6,
|
||||
0xa5, 0xe8, 0x7b, 0x4b, 0xd1, 0xb7, 0x1f, 0x34, 0xfa, 0xd0, 0x0b, 0x45, 0x7f, 0x05, 0x00, 0x00,
|
||||
0xff, 0xff, 0xe3, 0x33, 0x18, 0x0b, 0x50, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *RawExtension) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -83,23 +175,29 @@ func (m *RawExtension) Marshal() (dAtA []byte, err error) {
|
||||
}
|
||||
|
||||
func (m *RawExtension) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *RawExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Raw != nil {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i -= len(m.Raw)
|
||||
copy(dAtA[i:], m.Raw)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Raw)))
|
||||
i += copy(dAtA[i:], m.Raw)
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return i, nil
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *TypeMeta) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -107,25 +205,32 @@ func (m *TypeMeta) Marshal() (dAtA []byte, err error) {
|
||||
}
|
||||
|
||||
func (m *TypeMeta) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *TypeMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersion)))
|
||||
i += copy(dAtA[i:], m.APIVersion)
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i -= len(m.Kind)
|
||||
copy(dAtA[i:], m.Kind)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind)))
|
||||
i += copy(dAtA[i:], m.Kind)
|
||||
return i, nil
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
i -= len(m.APIVersion)
|
||||
copy(dAtA[i:], m.APIVersion)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersion)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *Unknown) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -133,45 +238,60 @@ func (m *Unknown) Marshal() (dAtA []byte, err error) {
|
||||
}
|
||||
|
||||
func (m *Unknown) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Unknown) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.TypeMeta.Size()))
|
||||
n1, err := m.TypeMeta.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
if m.Raw != nil {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Raw)))
|
||||
i += copy(dAtA[i:], m.Raw)
|
||||
}
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.ContentEncoding)))
|
||||
i += copy(dAtA[i:], m.ContentEncoding)
|
||||
dAtA[i] = 0x22
|
||||
i++
|
||||
i -= len(m.ContentType)
|
||||
copy(dAtA[i:], m.ContentType)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.ContentType)))
|
||||
i += copy(dAtA[i:], m.ContentType)
|
||||
return i, nil
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
i -= len(m.ContentEncoding)
|
||||
copy(dAtA[i:], m.ContentEncoding)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.ContentEncoding)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
if m.Raw != nil {
|
||||
i -= len(m.Raw)
|
||||
copy(dAtA[i:], m.Raw)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Raw)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
{
|
||||
size, err := m.TypeMeta.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovGenerated(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
return base
|
||||
}
|
||||
func (m *RawExtension) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Raw != nil {
|
||||
@ -182,6 +302,9 @@ func (m *RawExtension) Size() (n int) {
|
||||
}
|
||||
|
||||
func (m *TypeMeta) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.APIVersion)
|
||||
@ -192,6 +315,9 @@ func (m *TypeMeta) Size() (n int) {
|
||||
}
|
||||
|
||||
func (m *Unknown) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = m.TypeMeta.Size()
|
||||
@ -208,14 +334,7 @@ func (m *Unknown) Size() (n int) {
|
||||
}
|
||||
|
||||
func sovGenerated(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
@ -277,7 +396,7 @@ func (m *RawExtension) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -305,7 +424,7 @@ func (m *RawExtension) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= (int(b) & 0x7F) << shift
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -314,6 +433,9 @@ func (m *RawExtension) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -331,6 +453,9 @@ func (m *RawExtension) Unmarshal(dAtA []byte) error {
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -358,7 +483,7 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -386,7 +511,7 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -396,6 +521,9 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -415,7 +543,7 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -425,6 +553,9 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -439,6 +570,9 @@ func (m *TypeMeta) Unmarshal(dAtA []byte) error {
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -466,7 +600,7 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -494,7 +628,7 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -503,6 +637,9 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -524,7 +661,7 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= (int(b) & 0x7F) << shift
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -533,6 +670,9 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -555,7 +695,7 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -565,6 +705,9 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -584,7 +727,7 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -594,6 +737,9 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -608,6 +754,9 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -623,6 +772,7 @@ func (m *Unknown) Unmarshal(dAtA []byte) error {
|
||||
func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -654,10 +804,8 @@ func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -674,85 +822,34 @@ func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
return iNdEx, nil
|
||||
iNdEx += length
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipGenerated(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
depth++
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupGenerated
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 378 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x8f, 0x4f, 0xab, 0x13, 0x31,
|
||||
0x14, 0xc5, 0x27, 0xaf, 0x85, 0x3e, 0xd3, 0xc2, 0x93, 0xb8, 0x70, 0x74, 0x91, 0x79, 0x74, 0xe5,
|
||||
0x5b, 0xbc, 0x04, 0x1e, 0x08, 0x6e, 0x3b, 0xa5, 0xa0, 0x88, 0x20, 0xc1, 0x3f, 0xe0, 0xca, 0x74,
|
||||
0x26, 0x4e, 0xc3, 0xd0, 0x9b, 0x21, 0xcd, 0x38, 0x76, 0xe7, 0x47, 0xf0, 0x63, 0x75, 0xd9, 0x65,
|
||||
0x57, 0xc5, 0x8e, 0x1f, 0xc2, 0xad, 0x34, 0x4d, 0x6b, 0xd5, 0x85, 0xbb, 0xe4, 0x9e, 0xf3, 0x3b,
|
||||
0xf7, 0x1e, 0xfc, 0xbc, 0x7c, 0xb6, 0x60, 0xda, 0xf0, 0xb2, 0x9e, 0x2a, 0x0b, 0xca, 0xa9, 0x05,
|
||||
0xff, 0xac, 0x20, 0x37, 0x96, 0x07, 0x41, 0x56, 0x7a, 0x2e, 0xb3, 0x99, 0x06, 0x65, 0x97, 0xbc,
|
||||
0x2a, 0x0b, 0x6e, 0x6b, 0x70, 0x7a, 0xae, 0x78, 0xa1, 0x40, 0x59, 0xe9, 0x54, 0xce, 0x2a, 0x6b,
|
||||
0x9c, 0x21, 0xc9, 0x01, 0x60, 0xe7, 0x00, 0xab, 0xca, 0x82, 0x05, 0xe0, 0xf1, 0x6d, 0xa1, 0xdd,
|
||||
0xac, 0x9e, 0xb2, 0xcc, 0xcc, 0x79, 0x61, 0x0a, 0xc3, 0x3d, 0x37, 0xad, 0x3f, 0xf9, 0x9f, 0xff,
|
||||
0xf8, 0xd7, 0x21, 0x6f, 0x78, 0x83, 0x07, 0x42, 0x36, 0x93, 0x2f, 0x4e, 0xc1, 0x42, 0x1b, 0x20,
|
||||
0x8f, 0x70, 0xc7, 0xca, 0x26, 0x46, 0xd7, 0xe8, 0xc9, 0x20, 0xed, 0xb5, 0xdb, 0xa4, 0x23, 0x64,
|
||||
0x23, 0xf6, 0xb3, 0xe1, 0x47, 0x7c, 0xf9, 0x66, 0x59, 0xa9, 0x57, 0xca, 0x49, 0x72, 0x87, 0xb1,
|
||||
0xac, 0xf4, 0x3b, 0x65, 0xf7, 0x90, 0x77, 0xdf, 0x4b, 0xc9, 0x6a, 0x9b, 0x44, 0xed, 0x36, 0xc1,
|
||||
0xa3, 0xd7, 0x2f, 0x82, 0x22, 0xce, 0x5c, 0xe4, 0x1a, 0x77, 0x4b, 0x0d, 0x79, 0x7c, 0xe1, 0xdd,
|
||||
0x83, 0xe0, 0xee, 0xbe, 0xd4, 0x90, 0x0b, 0xaf, 0x0c, 0x7f, 0x22, 0xdc, 0x7b, 0x0b, 0x25, 0x98,
|
||||
0x06, 0xc8, 0x7b, 0x7c, 0xe9, 0xc2, 0x36, 0x9f, 0xdf, 0xbf, 0xbb, 0x61, 0xff, 0xe9, 0xce, 0x8e,
|
||||
0xe7, 0xa5, 0xf7, 0x43, 0xf8, 0xe9, 0x60, 0x71, 0x0a, 0x3b, 0x36, 0xbc, 0xf8, 0xb7, 0x21, 0x19,
|
||||
0xe1, 0xab, 0xcc, 0x80, 0x53, 0xe0, 0x26, 0x90, 0x99, 0x5c, 0x43, 0x11, 0x77, 0xfc, 0xb1, 0x0f,
|
||||
0x43, 0xde, 0xd5, 0xf8, 0x4f, 0x59, 0xfc, 0xed, 0x27, 0x4f, 0x71, 0x3f, 0x8c, 0xf6, 0xab, 0xe3,
|
||||
0xae, 0xc7, 0x1f, 0x04, 0xbc, 0x3f, 0xfe, 0x2d, 0x89, 0x73, 0x5f, 0x7a, 0xbb, 0xda, 0xd1, 0x68,
|
||||
0xbd, 0xa3, 0xd1, 0x66, 0x47, 0xa3, 0xaf, 0x2d, 0x45, 0xab, 0x96, 0xa2, 0x75, 0x4b, 0xd1, 0xa6,
|
||||
0xa5, 0xe8, 0x7b, 0x4b, 0xd1, 0xb7, 0x1f, 0x34, 0xfa, 0xd0, 0x0b, 0x45, 0x7f, 0x05, 0x00, 0x00,
|
||||
0xff, 0xff, 0xe3, 0x33, 0x18, 0x0b, 0x50, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
53
vendor/k8s.io/apimachinery/pkg/runtime/helper.go
generated
vendored
53
vendor/k8s.io/apimachinery/pkg/runtime/helper.go
generated
vendored
@ -51,7 +51,7 @@ func UnsafeObjectConvertor(scheme *Scheme) ObjectConvertor {
|
||||
func SetField(src interface{}, v reflect.Value, fieldName string) error {
|
||||
field := v.FieldByName(fieldName)
|
||||
if !field.IsValid() {
|
||||
return fmt.Errorf("couldn't find %v field in %#v", fieldName, v.Interface())
|
||||
return fmt.Errorf("couldn't find %v field in %T", fieldName, v.Interface())
|
||||
}
|
||||
srcValue := reflect.ValueOf(src)
|
||||
if srcValue.Type().AssignableTo(field.Type()) {
|
||||
@ -70,7 +70,7 @@ func SetField(src interface{}, v reflect.Value, fieldName string) error {
|
||||
func Field(v reflect.Value, fieldName string, dest interface{}) error {
|
||||
field := v.FieldByName(fieldName)
|
||||
if !field.IsValid() {
|
||||
return fmt.Errorf("couldn't find %v field in %#v", fieldName, v.Interface())
|
||||
return fmt.Errorf("couldn't find %v field in %T", fieldName, v.Interface())
|
||||
}
|
||||
destValue, err := conversion.EnforcePtr(dest)
|
||||
if err != nil {
|
||||
@ -93,7 +93,7 @@ func Field(v reflect.Value, fieldName string, dest interface{}) error {
|
||||
func FieldPtr(v reflect.Value, fieldName string, dest interface{}) error {
|
||||
field := v.FieldByName(fieldName)
|
||||
if !field.IsValid() {
|
||||
return fmt.Errorf("couldn't find %v field in %#v", fieldName, v.Interface())
|
||||
return fmt.Errorf("couldn't find %v field in %T", fieldName, v.Interface())
|
||||
}
|
||||
v, err := conversion.EnforcePtr(dest)
|
||||
if err != nil {
|
||||
@ -210,3 +210,50 @@ type defaultFramer struct{}
|
||||
|
||||
func (defaultFramer) NewFrameReader(r io.ReadCloser) io.ReadCloser { return r }
|
||||
func (defaultFramer) NewFrameWriter(w io.Writer) io.Writer { return w }
|
||||
|
||||
// WithVersionEncoder serializes an object and ensures the GVK is set.
|
||||
type WithVersionEncoder struct {
|
||||
Version GroupVersioner
|
||||
Encoder
|
||||
ObjectTyper
|
||||
}
|
||||
|
||||
// Encode does not do conversion. It sets the gvk during serialization.
|
||||
func (e WithVersionEncoder) Encode(obj Object, stream io.Writer) error {
|
||||
gvks, _, err := e.ObjectTyper.ObjectKinds(obj)
|
||||
if err != nil {
|
||||
if IsNotRegisteredError(err) {
|
||||
return e.Encoder.Encode(obj, stream)
|
||||
}
|
||||
return err
|
||||
}
|
||||
kind := obj.GetObjectKind()
|
||||
oldGVK := kind.GroupVersionKind()
|
||||
gvk := gvks[0]
|
||||
if e.Version != nil {
|
||||
preferredGVK, ok := e.Version.KindForGroupVersionKinds(gvks)
|
||||
if ok {
|
||||
gvk = preferredGVK
|
||||
}
|
||||
}
|
||||
kind.SetGroupVersionKind(gvk)
|
||||
err = e.Encoder.Encode(obj, stream)
|
||||
kind.SetGroupVersionKind(oldGVK)
|
||||
return err
|
||||
}
|
||||
|
||||
// WithoutVersionDecoder clears the group version kind of a deserialized object.
|
||||
type WithoutVersionDecoder struct {
|
||||
Decoder
|
||||
}
|
||||
|
||||
// Decode does not do conversion. It removes the gvk during deserialization.
|
||||
func (d WithoutVersionDecoder) Decode(data []byte, defaults *schema.GroupVersionKind, into Object) (Object, *schema.GroupVersionKind, error) {
|
||||
obj, gvk, err := d.Decoder.Decode(data, defaults, into)
|
||||
if obj != nil {
|
||||
kind := obj.GetObjectKind()
|
||||
// clearing the gvk is just a convention of a codec
|
||||
kind.SetGroupVersionKind(schema.GroupVersionKind{})
|
||||
}
|
||||
return obj, gvk, err
|
||||
}
|
||||
|
92
vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
generated
vendored
92
vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
generated
vendored
@ -37,13 +37,36 @@ type GroupVersioner interface {
|
||||
// Scheme.New(target) and then perform a conversion between the current Go type and the destination Go type.
|
||||
// Sophisticated implementations may use additional information about the input kinds to pick a destination kind.
|
||||
KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (target schema.GroupVersionKind, ok bool)
|
||||
// Identifier returns string representation of the object.
|
||||
// Identifiers of two different encoders should be equal only if for every input
|
||||
// kinds they return the same result.
|
||||
Identifier() string
|
||||
}
|
||||
|
||||
// Identifier represents an identifier.
|
||||
// Identitier of two different objects should be equal if and only if for every
|
||||
// input the output they produce is exactly the same.
|
||||
type Identifier string
|
||||
|
||||
// Encoder writes objects to a serialized form
|
||||
type Encoder interface {
|
||||
// Encode writes an object to a stream. Implementations may return errors if the versions are
|
||||
// incompatible, or if no conversion is defined.
|
||||
Encode(obj Object, w io.Writer) error
|
||||
// Identifier returns an identifier of the encoder.
|
||||
// Identifiers of two different encoders should be equal if and only if for every input
|
||||
// object it will be encoded to the same representation by both of them.
|
||||
//
|
||||
// Identifier is inteted for use with CacheableObject#CacheEncode method. In order to
|
||||
// correctly handle CacheableObject, Encode() method should look similar to below, where
|
||||
// doEncode() is the encoding logic of implemented encoder:
|
||||
// func (e *MyEncoder) Encode(obj Object, w io.Writer) error {
|
||||
// if co, ok := obj.(CacheableObject); ok {
|
||||
// return co.CacheEncode(e.Identifier(), e.doEncode, w)
|
||||
// }
|
||||
// return e.doEncode(obj, w)
|
||||
// }
|
||||
Identifier() Identifier
|
||||
}
|
||||
|
||||
// Decoder attempts to load an object from data.
|
||||
@ -91,6 +114,10 @@ type Framer interface {
|
||||
type SerializerInfo struct {
|
||||
// MediaType is the value that represents this serializer over the wire.
|
||||
MediaType string
|
||||
// MediaTypeType is the first part of the MediaType ("application" in "application/json").
|
||||
MediaTypeType string
|
||||
// MediaTypeSubType is the second part of the MediaType ("json" in "application/json").
|
||||
MediaTypeSubType string
|
||||
// EncodesAsText indicates this serializer can be encoded to UTF-8 safely.
|
||||
EncodesAsText bool
|
||||
// Serializer is the individual object serializer for this media type.
|
||||
@ -128,6 +155,28 @@ type NegotiatedSerializer interface {
|
||||
DecoderToVersion(serializer Decoder, gv GroupVersioner) Decoder
|
||||
}
|
||||
|
||||
// ClientNegotiator handles turning an HTTP content type into the appropriate encoder.
|
||||
// Use NewClientNegotiator or NewVersionedClientNegotiator to create this interface from
|
||||
// a NegotiatedSerializer.
|
||||
type ClientNegotiator interface {
|
||||
// Encoder returns the appropriate encoder for the provided contentType (e.g. application/json)
|
||||
// and any optional mediaType parameters (e.g. pretty=1), or an error. If no serializer is found
|
||||
// a NegotiateError will be returned. The current client implementations consider params to be
|
||||
// optional modifiers to the contentType and will ignore unrecognized parameters.
|
||||
Encoder(contentType string, params map[string]string) (Encoder, error)
|
||||
// Decoder returns the appropriate decoder for the provided contentType (e.g. application/json)
|
||||
// and any optional mediaType parameters (e.g. pretty=1), or an error. If no serializer is found
|
||||
// a NegotiateError will be returned. The current client implementations consider params to be
|
||||
// optional modifiers to the contentType and will ignore unrecognized parameters.
|
||||
Decoder(contentType string, params map[string]string) (Decoder, error)
|
||||
// StreamDecoder returns the appropriate stream decoder for the provided contentType (e.g.
|
||||
// application/json) and any optional mediaType parameters (e.g. pretty=1), or an error. If no
|
||||
// serializer is found a NegotiateError will be returned. The Serializer and Framer will always
|
||||
// be returned if a Decoder is returned. The current client implementations consider params to be
|
||||
// optional modifiers to the contentType and will ignore unrecognized parameters.
|
||||
StreamDecoder(contentType string, params map[string]string) (Decoder, Serializer, Framer, error)
|
||||
}
|
||||
|
||||
// StorageSerializer is an interface used for obtaining encoders, decoders, and serializers
|
||||
// that can read and write data at rest. This would commonly be used by client tools that must
|
||||
// read files, or server side storage interfaces that persist restful objects.
|
||||
@ -206,6 +255,25 @@ type ObjectCreater interface {
|
||||
New(kind schema.GroupVersionKind) (out Object, err error)
|
||||
}
|
||||
|
||||
// EquivalentResourceMapper provides information about resources that address the same underlying data as a specified resource
|
||||
type EquivalentResourceMapper interface {
|
||||
// EquivalentResourcesFor returns a list of resources that address the same underlying data as resource.
|
||||
// If subresource is specified, only equivalent resources which also have the same subresource are included.
|
||||
// The specified resource can be included in the returned list.
|
||||
EquivalentResourcesFor(resource schema.GroupVersionResource, subresource string) []schema.GroupVersionResource
|
||||
// KindFor returns the kind expected by the specified resource[/subresource].
|
||||
// A zero value is returned if the kind is unknown.
|
||||
KindFor(resource schema.GroupVersionResource, subresource string) schema.GroupVersionKind
|
||||
}
|
||||
|
||||
// EquivalentResourceRegistry provides an EquivalentResourceMapper interface,
|
||||
// and allows registering known resource[/subresource] -> kind
|
||||
type EquivalentResourceRegistry interface {
|
||||
EquivalentResourceMapper
|
||||
// RegisterKindFor registers the existence of the specified resource[/subresource] along with its expected kind.
|
||||
RegisterKindFor(resource schema.GroupVersionResource, subresource string, kind schema.GroupVersionKind)
|
||||
}
|
||||
|
||||
// ResourceVersioner provides methods for setting and retrieving
|
||||
// the resource version from an API object.
|
||||
type ResourceVersioner interface {
|
||||
@ -233,10 +301,34 @@ type Object interface {
|
||||
DeepCopyObject() Object
|
||||
}
|
||||
|
||||
// CacheableObject allows an object to cache its different serializations
|
||||
// to avoid performing the same serialization multiple times.
|
||||
type CacheableObject interface {
|
||||
// CacheEncode writes an object to a stream. The <encode> function will
|
||||
// be used in case of cache miss. The <encode> function takes ownership
|
||||
// of the object.
|
||||
// If CacheableObject is a wrapper, then deep-copy of the wrapped object
|
||||
// should be passed to <encode> function.
|
||||
// CacheEncode assumes that for two different calls with the same <id>,
|
||||
// <encode> function will also be the same.
|
||||
CacheEncode(id Identifier, encode func(Object, io.Writer) error, w io.Writer) error
|
||||
// GetObject returns a deep-copy of an object to be encoded - the caller of
|
||||
// GetObject() is the owner of returned object. The reason for making a copy
|
||||
// is to avoid bugs, where caller modifies the object and forgets to copy it,
|
||||
// thus modifying the object for everyone.
|
||||
// The object returned by GetObject should be the same as the one that is supposed
|
||||
// to be passed to <encode> function in CacheEncode method.
|
||||
// If CacheableObject is a wrapper, the copy of wrapped object should be returned.
|
||||
GetObject() Object
|
||||
}
|
||||
|
||||
// Unstructured objects store values as map[string]interface{}, with only values that can be serialized
|
||||
// to JSON allowed.
|
||||
type Unstructured interface {
|
||||
Object
|
||||
// NewEmptyInstance returns a new instance of the concrete type containing only kind/apiVersion and no other data.
|
||||
// This should be called instead of reflect.New() for unstructured types because the go type alone does not preserve kind/apiVersion info.
|
||||
NewEmptyInstance() Unstructured
|
||||
// UnstructuredContent returns a non-nil map with this object's contents. Values may be
|
||||
// []interface{}, map[string]interface{}, or any primitive type. Contents are typically serialized to
|
||||
// and from JSON. SetUnstructuredContent should be used to mutate the contents.
|
||||
|
98
vendor/k8s.io/apimachinery/pkg/runtime/mapper.go
generated
vendored
Normal file
98
vendor/k8s.io/apimachinery/pkg/runtime/mapper.go
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
type equivalentResourceRegistry struct {
|
||||
// keyFunc computes a key for the specified resource (this allows honoring colocated resources across API groups).
|
||||
// if null, or if "" is returned, resource.String() is used as the key
|
||||
keyFunc func(resource schema.GroupResource) string
|
||||
// resources maps key -> subresource -> equivalent resources (subresource is not included in the returned resources).
|
||||
// main resources are stored with subresource="".
|
||||
resources map[string]map[string][]schema.GroupVersionResource
|
||||
// kinds maps resource -> subresource -> kind
|
||||
kinds map[schema.GroupVersionResource]map[string]schema.GroupVersionKind
|
||||
// keys caches the computed key for each GroupResource
|
||||
keys map[schema.GroupResource]string
|
||||
|
||||
mutex sync.RWMutex
|
||||
}
|
||||
|
||||
var _ EquivalentResourceMapper = (*equivalentResourceRegistry)(nil)
|
||||
var _ EquivalentResourceRegistry = (*equivalentResourceRegistry)(nil)
|
||||
|
||||
// NewEquivalentResourceRegistry creates a resource registry that considers all versions of a GroupResource to be equivalent.
|
||||
func NewEquivalentResourceRegistry() EquivalentResourceRegistry {
|
||||
return &equivalentResourceRegistry{}
|
||||
}
|
||||
|
||||
// NewEquivalentResourceRegistryWithIdentity creates a resource mapper with a custom identity function.
|
||||
// If "" is returned by the function, GroupResource#String is used as the identity.
|
||||
// GroupResources with the same identity string are considered equivalent.
|
||||
func NewEquivalentResourceRegistryWithIdentity(keyFunc func(schema.GroupResource) string) EquivalentResourceRegistry {
|
||||
return &equivalentResourceRegistry{keyFunc: keyFunc}
|
||||
}
|
||||
|
||||
func (r *equivalentResourceRegistry) EquivalentResourcesFor(resource schema.GroupVersionResource, subresource string) []schema.GroupVersionResource {
|
||||
r.mutex.RLock()
|
||||
defer r.mutex.RUnlock()
|
||||
return r.resources[r.keys[resource.GroupResource()]][subresource]
|
||||
}
|
||||
func (r *equivalentResourceRegistry) KindFor(resource schema.GroupVersionResource, subresource string) schema.GroupVersionKind {
|
||||
r.mutex.RLock()
|
||||
defer r.mutex.RUnlock()
|
||||
return r.kinds[resource][subresource]
|
||||
}
|
||||
func (r *equivalentResourceRegistry) RegisterKindFor(resource schema.GroupVersionResource, subresource string, kind schema.GroupVersionKind) {
|
||||
r.mutex.Lock()
|
||||
defer r.mutex.Unlock()
|
||||
if r.kinds == nil {
|
||||
r.kinds = map[schema.GroupVersionResource]map[string]schema.GroupVersionKind{}
|
||||
}
|
||||
if r.kinds[resource] == nil {
|
||||
r.kinds[resource] = map[string]schema.GroupVersionKind{}
|
||||
}
|
||||
r.kinds[resource][subresource] = kind
|
||||
|
||||
// get the shared key of the parent resource
|
||||
key := ""
|
||||
gr := resource.GroupResource()
|
||||
if r.keyFunc != nil {
|
||||
key = r.keyFunc(gr)
|
||||
}
|
||||
if key == "" {
|
||||
key = gr.String()
|
||||
}
|
||||
|
||||
if r.keys == nil {
|
||||
r.keys = map[schema.GroupResource]string{}
|
||||
}
|
||||
r.keys[gr] = key
|
||||
|
||||
if r.resources == nil {
|
||||
r.resources = map[string]map[string][]schema.GroupVersionResource{}
|
||||
}
|
||||
if r.resources[key] == nil {
|
||||
r.resources[key] = map[string][]schema.GroupVersionResource{}
|
||||
}
|
||||
r.resources[key][subresource] = append(r.resources[key][subresource], resource)
|
||||
}
|
146
vendor/k8s.io/apimachinery/pkg/runtime/negotiate.go
generated
vendored
Normal file
146
vendor/k8s.io/apimachinery/pkg/runtime/negotiate.go
generated
vendored
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// NegotiateError is returned when a ClientNegotiator is unable to locate
|
||||
// a serializer for the requested operation.
|
||||
type NegotiateError struct {
|
||||
ContentType string
|
||||
Stream bool
|
||||
}
|
||||
|
||||
func (e NegotiateError) Error() string {
|
||||
if e.Stream {
|
||||
return fmt.Sprintf("no stream serializers registered for %s", e.ContentType)
|
||||
}
|
||||
return fmt.Sprintf("no serializers registered for %s", e.ContentType)
|
||||
}
|
||||
|
||||
type clientNegotiator struct {
|
||||
serializer NegotiatedSerializer
|
||||
encode, decode GroupVersioner
|
||||
}
|
||||
|
||||
func (n *clientNegotiator) Encoder(contentType string, params map[string]string) (Encoder, error) {
|
||||
// TODO: `pretty=1` is handled in NegotiateOutputMediaType, consider moving it to this method
|
||||
// if client negotiators truly need to use it
|
||||
mediaTypes := n.serializer.SupportedMediaTypes()
|
||||
info, ok := SerializerInfoForMediaType(mediaTypes, contentType)
|
||||
if !ok {
|
||||
if len(contentType) != 0 || len(mediaTypes) == 0 {
|
||||
return nil, NegotiateError{ContentType: contentType}
|
||||
}
|
||||
info = mediaTypes[0]
|
||||
}
|
||||
return n.serializer.EncoderForVersion(info.Serializer, n.encode), nil
|
||||
}
|
||||
|
||||
func (n *clientNegotiator) Decoder(contentType string, params map[string]string) (Decoder, error) {
|
||||
mediaTypes := n.serializer.SupportedMediaTypes()
|
||||
info, ok := SerializerInfoForMediaType(mediaTypes, contentType)
|
||||
if !ok {
|
||||
if len(contentType) != 0 || len(mediaTypes) == 0 {
|
||||
return nil, NegotiateError{ContentType: contentType}
|
||||
}
|
||||
info = mediaTypes[0]
|
||||
}
|
||||
return n.serializer.DecoderToVersion(info.Serializer, n.decode), nil
|
||||
}
|
||||
|
||||
func (n *clientNegotiator) StreamDecoder(contentType string, params map[string]string) (Decoder, Serializer, Framer, error) {
|
||||
mediaTypes := n.serializer.SupportedMediaTypes()
|
||||
info, ok := SerializerInfoForMediaType(mediaTypes, contentType)
|
||||
if !ok {
|
||||
if len(contentType) != 0 || len(mediaTypes) == 0 {
|
||||
return nil, nil, nil, NegotiateError{ContentType: contentType, Stream: true}
|
||||
}
|
||||
info = mediaTypes[0]
|
||||
}
|
||||
if info.StreamSerializer == nil {
|
||||
return nil, nil, nil, NegotiateError{ContentType: info.MediaType, Stream: true}
|
||||
}
|
||||
return n.serializer.DecoderToVersion(info.Serializer, n.decode), info.StreamSerializer.Serializer, info.StreamSerializer.Framer, nil
|
||||
}
|
||||
|
||||
// NewClientNegotiator will attempt to retrieve the appropriate encoder, decoder, or
|
||||
// stream decoder for a given content type. Does not perform any conversion, but will
|
||||
// encode the object to the desired group, version, and kind. Use when creating a client.
|
||||
func NewClientNegotiator(serializer NegotiatedSerializer, gv schema.GroupVersion) ClientNegotiator {
|
||||
return &clientNegotiator{
|
||||
serializer: serializer,
|
||||
encode: gv,
|
||||
}
|
||||
}
|
||||
|
||||
// NewInternalClientNegotiator applies the default client rules for connecting to a Kubernetes apiserver
|
||||
// where objects are converted to gv prior to sending and decoded to their internal representation prior
|
||||
// to retrieval.
|
||||
//
|
||||
// DEPRECATED: Internal clients are deprecated and will be removed in a future Kubernetes release.
|
||||
func NewInternalClientNegotiator(serializer NegotiatedSerializer, gv schema.GroupVersion) ClientNegotiator {
|
||||
decode := schema.GroupVersions{
|
||||
{
|
||||
Group: gv.Group,
|
||||
Version: APIVersionInternal,
|
||||
},
|
||||
// always include the legacy group as a decoding target to handle non-error `Status` return types
|
||||
{
|
||||
Group: "",
|
||||
Version: APIVersionInternal,
|
||||
},
|
||||
}
|
||||
return &clientNegotiator{
|
||||
encode: gv,
|
||||
decode: decode,
|
||||
serializer: serializer,
|
||||
}
|
||||
}
|
||||
|
||||
// NewSimpleClientNegotiator will negotiate for a single serializer. This should only be used
|
||||
// for testing or when the caller is taking responsibility for setting the GVK on encoded objects.
|
||||
func NewSimpleClientNegotiator(info SerializerInfo, gv schema.GroupVersion) ClientNegotiator {
|
||||
return &clientNegotiator{
|
||||
serializer: &simpleNegotiatedSerializer{info: info},
|
||||
encode: gv,
|
||||
}
|
||||
}
|
||||
|
||||
type simpleNegotiatedSerializer struct {
|
||||
info SerializerInfo
|
||||
}
|
||||
|
||||
func NewSimpleNegotiatedSerializer(info SerializerInfo) NegotiatedSerializer {
|
||||
return &simpleNegotiatedSerializer{info: info}
|
||||
}
|
||||
|
||||
func (n *simpleNegotiatedSerializer) SupportedMediaTypes() []SerializerInfo {
|
||||
return []SerializerInfo{n.info}
|
||||
}
|
||||
|
||||
func (n *simpleNegotiatedSerializer) EncoderForVersion(e Encoder, _ GroupVersioner) Encoder {
|
||||
return e
|
||||
}
|
||||
|
||||
func (n *simpleNegotiatedSerializer) DecoderToVersion(d Decoder, _gv GroupVersioner) Decoder {
|
||||
return d
|
||||
}
|
30
vendor/k8s.io/apimachinery/pkg/runtime/register.go
generated
vendored
30
vendor/k8s.io/apimachinery/pkg/runtime/register.go
generated
vendored
@ -29,33 +29,3 @@ func (obj *TypeMeta) GroupVersionKind() schema.GroupVersionKind {
|
||||
}
|
||||
|
||||
func (obj *TypeMeta) GetObjectKind() schema.ObjectKind { return obj }
|
||||
|
||||
// GetObjectKind implements Object for VersionedObjects, returning an empty ObjectKind
|
||||
// interface if no objects are provided, or the ObjectKind interface of the object in the
|
||||
// highest array position.
|
||||
func (obj *VersionedObjects) GetObjectKind() schema.ObjectKind {
|
||||
last := obj.Last()
|
||||
if last == nil {
|
||||
return schema.EmptyObjectKind
|
||||
}
|
||||
return last.GetObjectKind()
|
||||
}
|
||||
|
||||
// First returns the leftmost object in the VersionedObjects array, which is usually the
|
||||
// object as serialized on the wire.
|
||||
func (obj *VersionedObjects) First() Object {
|
||||
if len(obj.Objects) == 0 {
|
||||
return nil
|
||||
}
|
||||
return obj.Objects[0]
|
||||
}
|
||||
|
||||
// Last is the rightmost object in the VersionedObjects array, which is the object after
|
||||
// all transformations have been applied. This is the same object that would be returned
|
||||
// by Decode in a normal invocation (without VersionedObjects in the into argument).
|
||||
func (obj *VersionedObjects) Last() Object {
|
||||
if len(obj.Objects) == 0 {
|
||||
return nil
|
||||
}
|
||||
return obj.Objects[len(obj.Objects)-1]
|
||||
}
|
||||
|
18
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
generated
vendored
18
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
generated
vendored
@ -17,22 +17,14 @@ limitations under the License.
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
|
||||
|
||||
/*
|
||||
Package schema is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
*/
|
||||
package schema
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
|
||||
math "math"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -44,13 +36,13 @@ var _ = math.Inf
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto", fileDescriptorGenerated)
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto", fileDescriptor_0462724132518e0d)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
var fileDescriptor_0462724132518e0d = []byte{
|
||||
// 185 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0xcc, 0xaf, 0x6e, 0xc3, 0x30,
|
||||
0x10, 0xc7, 0x71, 0x9b, 0x0c, 0x0c, 0x0e, 0x0e, 0x1c, 0x1c, 0xda, 0x7c, 0x74, 0xb8, 0x2f, 0x50,
|
||||
|
23
vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
generated
vendored
23
vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
generated
vendored
@ -176,21 +176,17 @@ func (gv GroupVersion) Empty() bool {
|
||||
// String puts "group" and "version" into a single "group/version" string. For the legacy v1
|
||||
// it returns "v1".
|
||||
func (gv GroupVersion) String() string {
|
||||
// special case the internal apiVersion for the legacy kube types
|
||||
if gv.Empty() {
|
||||
return ""
|
||||
}
|
||||
|
||||
// special case of "v1" for backward compatibility
|
||||
if len(gv.Group) == 0 && gv.Version == "v1" {
|
||||
return gv.Version
|
||||
}
|
||||
if len(gv.Group) > 0 {
|
||||
return gv.Group + "/" + gv.Version
|
||||
}
|
||||
return gv.Version
|
||||
}
|
||||
|
||||
// Identifier implements runtime.GroupVersioner interface.
|
||||
func (gv GroupVersion) Identifier() string {
|
||||
return gv.String()
|
||||
}
|
||||
|
||||
// KindForGroupVersionKinds identifies the preferred GroupVersionKind out of a list. It returns ok false
|
||||
// if none of the options match the group. It prefers a match to group and version over just group.
|
||||
// TODO: Move GroupVersion to a package under pkg/runtime, since it's used by scheme.
|
||||
@ -246,6 +242,15 @@ func (gv GroupVersion) WithResource(resource string) GroupVersionResource {
|
||||
// in fewer places.
|
||||
type GroupVersions []GroupVersion
|
||||
|
||||
// Identifier implements runtime.GroupVersioner interface.
|
||||
func (gvs GroupVersions) Identifier() string {
|
||||
groupVersions := make([]string, 0, len(gvs))
|
||||
for i := range gvs {
|
||||
groupVersions = append(groupVersions, gvs[i].String())
|
||||
}
|
||||
return fmt.Sprintf("[%s]", strings.Join(groupVersions, ","))
|
||||
}
|
||||
|
||||
// KindForGroupVersionKinds identifies the preferred GroupVersionKind out of a list. It returns ok false
|
||||
// if none of the options match the group.
|
||||
func (gvs GroupVersions) KindForGroupVersionKinds(kinds []GroupVersionKind) (GroupVersionKind, bool) {
|
||||
|
58
vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
generated
vendored
58
vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
generated
vendored
@ -102,10 +102,10 @@ func NewScheme() *Scheme {
|
||||
}
|
||||
s.converter = conversion.NewConverter(s.nameFunc)
|
||||
|
||||
utilruntime.Must(s.AddConversionFuncs(DefaultEmbeddedConversions()...))
|
||||
// Enable couple default conversions by default.
|
||||
utilruntime.Must(RegisterEmbeddedConversions(s))
|
||||
utilruntime.Must(RegisterStringConversions(s))
|
||||
|
||||
// Enable map[string][]string conversions by default
|
||||
utilruntime.Must(s.AddConversionFuncs(DefaultStringConversions...))
|
||||
utilruntime.Must(s.RegisterInputDefaults(&map[string][]string{}, JSONKeyMapper, conversion.AllowDifferentFieldTypeNames|conversion.IgnoreMissingFields))
|
||||
utilruntime.Must(s.RegisterInputDefaults(&url.Values{}, JSONKeyMapper, conversion.AllowDifferentFieldTypeNames|conversion.IgnoreMissingFields))
|
||||
return s
|
||||
@ -211,6 +211,19 @@ func (s *Scheme) AddKnownTypeWithName(gvk schema.GroupVersionKind, obj Object) {
|
||||
}
|
||||
}
|
||||
s.typeToGVK[t] = append(s.typeToGVK[t], gvk)
|
||||
|
||||
// if the type implements DeepCopyInto(<obj>), register a self-conversion
|
||||
if m := reflect.ValueOf(obj).MethodByName("DeepCopyInto"); m.IsValid() && m.Type().NumIn() == 1 && m.Type().NumOut() == 0 && m.Type().In(0) == reflect.TypeOf(obj) {
|
||||
if err := s.AddGeneratedConversionFunc(obj, obj, func(a, b interface{}, scope conversion.Scope) error {
|
||||
// copy a to b
|
||||
reflect.ValueOf(a).MethodByName("DeepCopyInto").Call([]reflect.Value{reflect.ValueOf(b)})
|
||||
// clear TypeMeta to match legacy reflective conversion
|
||||
b.(Object).GetObjectKind().SetGroupVersionKind(schema.GroupVersionKind{})
|
||||
return nil
|
||||
}); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// KnownTypes returns the types known for the given version.
|
||||
@ -308,45 +321,6 @@ func (s *Scheme) AddIgnoredConversionType(from, to interface{}) error {
|
||||
return s.converter.RegisterIgnoredConversion(from, to)
|
||||
}
|
||||
|
||||
// AddConversionFuncs adds functions to the list of conversion functions. The given
|
||||
// functions should know how to convert between two of your API objects, or their
|
||||
// sub-objects. We deduce how to call these functions from the types of their two
|
||||
// parameters; see the comment for Converter.Register.
|
||||
//
|
||||
// Note that, if you need to copy sub-objects that didn't change, you can use the
|
||||
// conversion.Scope object that will be passed to your conversion function.
|
||||
// Additionally, all conversions started by Scheme will set the SrcVersion and
|
||||
// DestVersion fields on the Meta object. Example:
|
||||
//
|
||||
// s.AddConversionFuncs(
|
||||
// func(in *InternalObject, out *ExternalObject, scope conversion.Scope) error {
|
||||
// // You can depend on Meta() being non-nil, and this being set to
|
||||
// // the source version, e.g., ""
|
||||
// s.Meta().SrcVersion
|
||||
// // You can depend on this being set to the destination version,
|
||||
// // e.g., "v1".
|
||||
// s.Meta().DestVersion
|
||||
// // Call scope.Convert to copy sub-fields.
|
||||
// s.Convert(&in.SubFieldThatMoved, &out.NewLocation.NewName, 0)
|
||||
// return nil
|
||||
// },
|
||||
// )
|
||||
//
|
||||
// (For more detail about conversion functions, see Converter.Register's comment.)
|
||||
//
|
||||
// Also note that the default behavior, if you don't add a conversion function, is to
|
||||
// sanely copy fields that have the same names and same type names. It's OK if the
|
||||
// destination type has extra fields, but it must not remove any. So you only need to
|
||||
// add conversion functions for things with changed/removed fields.
|
||||
func (s *Scheme) AddConversionFuncs(conversionFuncs ...interface{}) error {
|
||||
for _, f := range conversionFuncs {
|
||||
if err := s.converter.RegisterConversionFunc(f); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddConversionFunc registers a function that converts between a and b by passing objects of those
|
||||
// types to the provided function. The function *must* accept objects of a and b - this machinery will not enforce
|
||||
// any other guarantee.
|
||||
|
141
vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
generated
vendored
141
vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
generated
vendored
@ -17,9 +17,13 @@ limitations under the License.
|
||||
package serializer
|
||||
|
||||
import (
|
||||
"mime"
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/json"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/protobuf"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/recognizer"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/versioning"
|
||||
)
|
||||
@ -44,30 +48,53 @@ type serializerType struct {
|
||||
StreamSerializer runtime.Serializer
|
||||
}
|
||||
|
||||
func newSerializersForScheme(scheme *runtime.Scheme, mf json.MetaFactory) []serializerType {
|
||||
jsonSerializer := json.NewSerializer(mf, scheme, scheme, false)
|
||||
jsonPrettySerializer := json.NewSerializer(mf, scheme, scheme, true)
|
||||
yamlSerializer := json.NewYAMLSerializer(mf, scheme, scheme)
|
||||
func newSerializersForScheme(scheme *runtime.Scheme, mf json.MetaFactory, options CodecFactoryOptions) []serializerType {
|
||||
jsonSerializer := json.NewSerializerWithOptions(
|
||||
mf, scheme, scheme,
|
||||
json.SerializerOptions{Yaml: false, Pretty: false, Strict: options.Strict},
|
||||
)
|
||||
jsonSerializerType := serializerType{
|
||||
AcceptContentTypes: []string{runtime.ContentTypeJSON},
|
||||
ContentType: runtime.ContentTypeJSON,
|
||||
FileExtensions: []string{"json"},
|
||||
EncodesAsText: true,
|
||||
Serializer: jsonSerializer,
|
||||
|
||||
Framer: json.Framer,
|
||||
StreamSerializer: jsonSerializer,
|
||||
}
|
||||
if options.Pretty {
|
||||
jsonSerializerType.PrettySerializer = json.NewSerializerWithOptions(
|
||||
mf, scheme, scheme,
|
||||
json.SerializerOptions{Yaml: false, Pretty: true, Strict: options.Strict},
|
||||
)
|
||||
}
|
||||
|
||||
yamlSerializer := json.NewSerializerWithOptions(
|
||||
mf, scheme, scheme,
|
||||
json.SerializerOptions{Yaml: true, Pretty: false, Strict: options.Strict},
|
||||
)
|
||||
protoSerializer := protobuf.NewSerializer(scheme, scheme)
|
||||
protoRawSerializer := protobuf.NewRawSerializer(scheme, scheme)
|
||||
|
||||
serializers := []serializerType{
|
||||
jsonSerializerType,
|
||||
{
|
||||
AcceptContentTypes: []string{"application/json"},
|
||||
ContentType: "application/json",
|
||||
FileExtensions: []string{"json"},
|
||||
EncodesAsText: true,
|
||||
Serializer: jsonSerializer,
|
||||
PrettySerializer: jsonPrettySerializer,
|
||||
|
||||
Framer: json.Framer,
|
||||
StreamSerializer: jsonSerializer,
|
||||
},
|
||||
{
|
||||
AcceptContentTypes: []string{"application/yaml"},
|
||||
ContentType: "application/yaml",
|
||||
AcceptContentTypes: []string{runtime.ContentTypeYAML},
|
||||
ContentType: runtime.ContentTypeYAML,
|
||||
FileExtensions: []string{"yaml"},
|
||||
EncodesAsText: true,
|
||||
Serializer: yamlSerializer,
|
||||
},
|
||||
{
|
||||
AcceptContentTypes: []string{runtime.ContentTypeProtobuf},
|
||||
ContentType: runtime.ContentTypeProtobuf,
|
||||
FileExtensions: []string{"pb"},
|
||||
Serializer: protoSerializer,
|
||||
|
||||
Framer: protobuf.LengthDelimitedFramer,
|
||||
StreamSerializer: protoRawSerializer,
|
||||
},
|
||||
}
|
||||
|
||||
for _, fn := range serializerExtensions {
|
||||
@ -89,14 +116,56 @@ type CodecFactory struct {
|
||||
legacySerializer runtime.Serializer
|
||||
}
|
||||
|
||||
// CodecFactoryOptions holds the options for configuring CodecFactory behavior
|
||||
type CodecFactoryOptions struct {
|
||||
// Strict configures all serializers in strict mode
|
||||
Strict bool
|
||||
// Pretty includes a pretty serializer along with the non-pretty one
|
||||
Pretty bool
|
||||
}
|
||||
|
||||
// CodecFactoryOptionsMutator takes a pointer to an options struct and then modifies it.
|
||||
// Functions implementing this type can be passed to the NewCodecFactory() constructor.
|
||||
type CodecFactoryOptionsMutator func(*CodecFactoryOptions)
|
||||
|
||||
// EnablePretty enables including a pretty serializer along with the non-pretty one
|
||||
func EnablePretty(options *CodecFactoryOptions) {
|
||||
options.Pretty = true
|
||||
}
|
||||
|
||||
// DisablePretty disables including a pretty serializer along with the non-pretty one
|
||||
func DisablePretty(options *CodecFactoryOptions) {
|
||||
options.Pretty = false
|
||||
}
|
||||
|
||||
// EnableStrict enables configuring all serializers in strict mode
|
||||
func EnableStrict(options *CodecFactoryOptions) {
|
||||
options.Strict = true
|
||||
}
|
||||
|
||||
// DisableStrict disables configuring all serializers in strict mode
|
||||
func DisableStrict(options *CodecFactoryOptions) {
|
||||
options.Strict = false
|
||||
}
|
||||
|
||||
// NewCodecFactory provides methods for retrieving serializers for the supported wire formats
|
||||
// and conversion wrappers to define preferred internal and external versions. In the future,
|
||||
// as the internal version is used less, callers may instead use a defaulting serializer and
|
||||
// only convert objects which are shared internally (Status, common API machinery).
|
||||
//
|
||||
// Mutators can be passed to change the CodecFactoryOptions before construction of the factory.
|
||||
// It is recommended to explicitly pass mutators instead of relying on defaults.
|
||||
// By default, Pretty is enabled -- this is conformant with previously supported behavior.
|
||||
//
|
||||
// TODO: allow other codecs to be compiled in?
|
||||
// TODO: accept a scheme interface
|
||||
func NewCodecFactory(scheme *runtime.Scheme) CodecFactory {
|
||||
serializers := newSerializersForScheme(scheme, json.DefaultMetaFactory)
|
||||
func NewCodecFactory(scheme *runtime.Scheme, mutators ...CodecFactoryOptionsMutator) CodecFactory {
|
||||
options := CodecFactoryOptions{Pretty: true}
|
||||
for _, fn := range mutators {
|
||||
fn(&options)
|
||||
}
|
||||
|
||||
serializers := newSerializersForScheme(scheme, json.DefaultMetaFactory, options)
|
||||
return newCodecFactory(scheme, serializers)
|
||||
}
|
||||
|
||||
@ -120,6 +189,15 @@ func newCodecFactory(scheme *runtime.Scheme, serializers []serializerType) Codec
|
||||
Serializer: d.Serializer,
|
||||
PrettySerializer: d.PrettySerializer,
|
||||
}
|
||||
|
||||
mediaType, _, err := mime.ParseMediaType(info.MediaType)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
parts := strings.SplitN(mediaType, "/", 2)
|
||||
info.MediaTypeType = parts[0]
|
||||
info.MediaTypeSubType = parts[1]
|
||||
|
||||
if d.StreamSerializer != nil {
|
||||
info.StreamSerializer = &runtime.StreamSerializerInfo{
|
||||
Serializer: d.StreamSerializer,
|
||||
@ -148,6 +226,12 @@ func newCodecFactory(scheme *runtime.Scheme, serializers []serializerType) Codec
|
||||
}
|
||||
}
|
||||
|
||||
// WithoutConversion returns a NegotiatedSerializer that performs no conversion, even if the
|
||||
// caller requests it.
|
||||
func (f CodecFactory) WithoutConversion() runtime.NegotiatedSerializer {
|
||||
return WithoutConversionCodecFactory{f}
|
||||
}
|
||||
|
||||
// SupportedMediaTypes returns the RFC2046 media types that this factory has serializers for.
|
||||
func (f CodecFactory) SupportedMediaTypes() []runtime.SerializerInfo {
|
||||
return f.accepts
|
||||
@ -215,23 +299,26 @@ func (f CodecFactory) EncoderForVersion(encoder runtime.Encoder, gv runtime.Grou
|
||||
return f.CodecForVersions(encoder, nil, gv, nil)
|
||||
}
|
||||
|
||||
// DirectCodecFactory provides methods for retrieving "DirectCodec"s, which do not do conversion.
|
||||
type DirectCodecFactory struct {
|
||||
// WithoutConversionCodecFactory is a CodecFactory that will explicitly ignore requests to perform conversion.
|
||||
// This wrapper is used while code migrates away from using conversion (such as external clients) and in the future
|
||||
// will be unnecessary when we change the signature of NegotiatedSerializer.
|
||||
type WithoutConversionCodecFactory struct {
|
||||
CodecFactory
|
||||
}
|
||||
|
||||
// EncoderForVersion returns an encoder that does not do conversion.
|
||||
func (f DirectCodecFactory) EncoderForVersion(serializer runtime.Encoder, version runtime.GroupVersioner) runtime.Encoder {
|
||||
return versioning.DirectEncoder{
|
||||
// EncoderForVersion returns an encoder that does not do conversion, but does set the group version kind of the object
|
||||
// when serialized.
|
||||
func (f WithoutConversionCodecFactory) EncoderForVersion(serializer runtime.Encoder, version runtime.GroupVersioner) runtime.Encoder {
|
||||
return runtime.WithVersionEncoder{
|
||||
Version: version,
|
||||
Encoder: serializer,
|
||||
ObjectTyper: f.CodecFactory.scheme,
|
||||
}
|
||||
}
|
||||
|
||||
// DecoderToVersion returns an decoder that does not do conversion. gv is ignored.
|
||||
func (f DirectCodecFactory) DecoderToVersion(serializer runtime.Decoder, _ runtime.GroupVersioner) runtime.Decoder {
|
||||
return versioning.DirectDecoder{
|
||||
// DecoderToVersion returns an decoder that does not do conversion.
|
||||
func (f WithoutConversionCodecFactory) DecoderToVersion(serializer runtime.Decoder, _ runtime.GroupVersioner) runtime.Decoder {
|
||||
return runtime.WithoutVersionDecoder{
|
||||
Decoder: serializer,
|
||||
}
|
||||
}
|
||||
|
141
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
generated
vendored
141
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
generated
vendored
@ -31,38 +31,78 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/recognizer"
|
||||
"k8s.io/apimachinery/pkg/util/framer"
|
||||
utilyaml "k8s.io/apimachinery/pkg/util/yaml"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// NewSerializer creates a JSON serializer that handles encoding versioned objects into the proper JSON form. If typer
|
||||
// is not nil, the object has the group, version, and kind fields set.
|
||||
// Deprecated: use NewSerializerWithOptions instead.
|
||||
func NewSerializer(meta MetaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper, pretty bool) *Serializer {
|
||||
return &Serializer{
|
||||
meta: meta,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
yaml: false,
|
||||
pretty: pretty,
|
||||
}
|
||||
return NewSerializerWithOptions(meta, creater, typer, SerializerOptions{false, pretty, false})
|
||||
}
|
||||
|
||||
// NewYAMLSerializer creates a YAML serializer that handles encoding versioned objects into the proper YAML form. If typer
|
||||
// is not nil, the object has the group, version, and kind fields set. This serializer supports only the subset of YAML that
|
||||
// matches JSON, and will error if constructs are used that do not serialize to JSON.
|
||||
// Deprecated: use NewSerializerWithOptions instead.
|
||||
func NewYAMLSerializer(meta MetaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper) *Serializer {
|
||||
return NewSerializerWithOptions(meta, creater, typer, SerializerOptions{true, false, false})
|
||||
}
|
||||
|
||||
// NewSerializerWithOptions creates a JSON/YAML serializer that handles encoding versioned objects into the proper JSON/YAML
|
||||
// form. If typer is not nil, the object has the group, version, and kind fields set. Options are copied into the Serializer
|
||||
// and are immutable.
|
||||
func NewSerializerWithOptions(meta MetaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper, options SerializerOptions) *Serializer {
|
||||
return &Serializer{
|
||||
meta: meta,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
yaml: true,
|
||||
meta: meta,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
options: options,
|
||||
identifier: identifier(options),
|
||||
}
|
||||
}
|
||||
|
||||
// identifier computes Identifier of Encoder based on the given options.
|
||||
func identifier(options SerializerOptions) runtime.Identifier {
|
||||
result := map[string]string{
|
||||
"name": "json",
|
||||
"yaml": strconv.FormatBool(options.Yaml),
|
||||
"pretty": strconv.FormatBool(options.Pretty),
|
||||
}
|
||||
identifier, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed marshaling identifier for json Serializer: %v", err)
|
||||
}
|
||||
return runtime.Identifier(identifier)
|
||||
}
|
||||
|
||||
// SerializerOptions holds the options which are used to configure a JSON/YAML serializer.
|
||||
// example:
|
||||
// (1) To configure a JSON serializer, set `Yaml` to `false`.
|
||||
// (2) To configure a YAML serializer, set `Yaml` to `true`.
|
||||
// (3) To configure a strict serializer that can return strictDecodingError, set `Strict` to `true`.
|
||||
type SerializerOptions struct {
|
||||
// Yaml: configures the Serializer to work with JSON(false) or YAML(true).
|
||||
// When `Yaml` is enabled, this serializer only supports the subset of YAML that
|
||||
// matches JSON, and will error if constructs are used that do not serialize to JSON.
|
||||
Yaml bool
|
||||
|
||||
// Pretty: configures a JSON enabled Serializer(`Yaml: false`) to produce human-readable output.
|
||||
// This option is silently ignored when `Yaml` is `true`.
|
||||
Pretty bool
|
||||
|
||||
// Strict: configures the Serializer to return strictDecodingError's when duplicate fields are present decoding JSON or YAML.
|
||||
// Note that enabling this option is not as performant as the non-strict variant, and should not be used in fast paths.
|
||||
Strict bool
|
||||
}
|
||||
|
||||
type Serializer struct {
|
||||
meta MetaFactory
|
||||
options SerializerOptions
|
||||
creater runtime.ObjectCreater
|
||||
typer runtime.ObjectTyper
|
||||
yaml bool
|
||||
pretty bool
|
||||
|
||||
identifier runtime.Identifier
|
||||
}
|
||||
|
||||
// Serializer implements Serializer
|
||||
@ -119,11 +159,28 @@ func CaseSensitiveJsonIterator() jsoniter.API {
|
||||
return config
|
||||
}
|
||||
|
||||
// Private copy of jsoniter to try to shield against possible mutations
|
||||
// StrictCaseSensitiveJsonIterator returns a jsoniterator API that's configured to be
|
||||
// case-sensitive, but also disallows unknown fields when unmarshalling. It is compatible with
|
||||
// the encoding/json standard library.
|
||||
func StrictCaseSensitiveJsonIterator() jsoniter.API {
|
||||
config := jsoniter.Config{
|
||||
EscapeHTML: true,
|
||||
SortMapKeys: true,
|
||||
ValidateJsonRawMessage: true,
|
||||
CaseSensitive: true,
|
||||
DisallowUnknownFields: true,
|
||||
}.Froze()
|
||||
// Force jsoniter to decode number to interface{} via int64/float64, if possible.
|
||||
config.RegisterExtension(&customNumberExtension{})
|
||||
return config
|
||||
}
|
||||
|
||||
// Private copies of jsoniter to try to shield against possible mutations
|
||||
// from outside. Still does not protect from package level jsoniter.Register*() functions - someone calling them
|
||||
// in some other library will mess with every usage of the jsoniter library in the whole program.
|
||||
// See https://github.com/json-iterator/go/issues/265
|
||||
var caseSensitiveJsonIterator = CaseSensitiveJsonIterator()
|
||||
var strictCaseSensitiveJsonIterator = StrictCaseSensitiveJsonIterator()
|
||||
|
||||
// gvkWithDefaults returns group kind and version defaulting from provided default
|
||||
func gvkWithDefaults(actual, defaultGVK schema.GroupVersionKind) schema.GroupVersionKind {
|
||||
@ -149,18 +206,8 @@ func gvkWithDefaults(actual, defaultGVK schema.GroupVersionKind) schema.GroupVer
|
||||
// On success or most errors, the method will return the calculated schema kind.
|
||||
// The gvk calculate priority will be originalData > default gvk > into
|
||||
func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
|
||||
if versioned, ok := into.(*runtime.VersionedObjects); ok {
|
||||
into = versioned.Last()
|
||||
obj, actual, err := s.Decode(originalData, gvk, into)
|
||||
if err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
versioned.Objects = []runtime.Object{obj}
|
||||
return versioned, actual, nil
|
||||
}
|
||||
|
||||
data := originalData
|
||||
if s.yaml {
|
||||
if s.options.Yaml {
|
||||
altered, err := yaml.YAMLToJSON(data)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@ -216,12 +263,45 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
||||
if err := caseSensitiveJsonIterator.Unmarshal(data, obj); err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
|
||||
// If the deserializer is non-strict, return successfully here.
|
||||
if !s.options.Strict {
|
||||
return obj, actual, nil
|
||||
}
|
||||
|
||||
// In strict mode pass the data trough the YAMLToJSONStrict converter.
|
||||
// This is done to catch duplicate fields regardless of encoding (JSON or YAML). For JSON data,
|
||||
// the output would equal the input, unless there is a parsing error such as duplicate fields.
|
||||
// As we know this was successful in the non-strict case, the only error that may be returned here
|
||||
// is because of the newly-added strictness. hence we know we can return the typed strictDecoderError
|
||||
// the actual error is that the object contains duplicate fields.
|
||||
altered, err := yaml.YAMLToJSONStrict(originalData)
|
||||
if err != nil {
|
||||
return nil, actual, runtime.NewStrictDecodingError(err.Error(), string(originalData))
|
||||
}
|
||||
// As performance is not an issue for now for the strict deserializer (one has regardless to do
|
||||
// the unmarshal twice), we take the sanitized, altered data that is guaranteed to have no duplicated
|
||||
// fields, and unmarshal this into a copy of the already-populated obj. Any error that occurs here is
|
||||
// due to that a matching field doesn't exist in the object. hence we can return a typed strictDecoderError,
|
||||
// the actual error is that the object contains unknown field.
|
||||
strictObj := obj.DeepCopyObject()
|
||||
if err := strictCaseSensitiveJsonIterator.Unmarshal(altered, strictObj); err != nil {
|
||||
return nil, actual, runtime.NewStrictDecodingError(err.Error(), string(originalData))
|
||||
}
|
||||
// Always return the same object as the non-strict serializer to avoid any deviations.
|
||||
return obj, actual, nil
|
||||
}
|
||||
|
||||
// Encode serializes the provided object to the given writer.
|
||||
func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if s.yaml {
|
||||
if co, ok := obj.(runtime.CacheableObject); ok {
|
||||
return co.CacheEncode(s.Identifier(), s.doEncode, w)
|
||||
}
|
||||
return s.doEncode(obj, w)
|
||||
}
|
||||
|
||||
func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
|
||||
if s.options.Yaml {
|
||||
json, err := caseSensitiveJsonIterator.Marshal(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -234,7 +314,7 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if s.pretty {
|
||||
if s.options.Pretty {
|
||||
data, err := caseSensitiveJsonIterator.MarshalIndent(obj, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
@ -246,9 +326,14 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
return encoder.Encode(obj)
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (s *Serializer) Identifier() runtime.Identifier {
|
||||
return s.identifier
|
||||
}
|
||||
|
||||
// RecognizesData implements the RecognizingDecoder interface.
|
||||
func (s *Serializer) RecognizesData(peek io.Reader) (ok, unknown bool, err error) {
|
||||
if s.yaml {
|
||||
if s.options.Yaml {
|
||||
// we could potentially look for '---'
|
||||
return false, true, nil
|
||||
}
|
||||
|
117
vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go
generated
vendored
117
vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go
generated
vendored
@ -69,27 +69,25 @@ func IsNotMarshalable(err error) bool {
|
||||
// NewSerializer creates a Protobuf serializer that handles encoding versioned objects into the proper wire form. If a typer
|
||||
// is passed, the encoded object will have group, version, and kind fields set. If typer is nil, the objects will be written
|
||||
// as-is (any type info passed with the object will be used).
|
||||
//
|
||||
// This encoding scheme is experimental, and is subject to change at any time.
|
||||
func NewSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper, defaultContentType string) *Serializer {
|
||||
func NewSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper) *Serializer {
|
||||
return &Serializer{
|
||||
prefix: protoEncodingPrefix,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
contentType: defaultContentType,
|
||||
prefix: protoEncodingPrefix,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
}
|
||||
}
|
||||
|
||||
type Serializer struct {
|
||||
prefix []byte
|
||||
creater runtime.ObjectCreater
|
||||
typer runtime.ObjectTyper
|
||||
contentType string
|
||||
prefix []byte
|
||||
creater runtime.ObjectCreater
|
||||
typer runtime.ObjectTyper
|
||||
}
|
||||
|
||||
var _ runtime.Serializer = &Serializer{}
|
||||
var _ recognizer.RecognizingDecoder = &Serializer{}
|
||||
|
||||
const serializerIdentifier runtime.Identifier = "protobuf"
|
||||
|
||||
// Decode attempts to convert the provided data into a protobuf message, extract the stored schema kind, apply the provided default
|
||||
// gvk, and then load that data into an object matching the desired schema kind or the provided into. If into is *runtime.Unknown,
|
||||
// the raw data will be extracted and no decoding will be performed. If into is not registered with the typer, then the object will
|
||||
@ -97,23 +95,6 @@ var _ recognizer.RecognizingDecoder = &Serializer{}
|
||||
// not fully qualified with kind/version/group, the type of the into will be used to alter the returned gvk. On success or most
|
||||
// errors, the method will return the calculated schema kind.
|
||||
func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
|
||||
if versioned, ok := into.(*runtime.VersionedObjects); ok {
|
||||
into = versioned.Last()
|
||||
obj, actual, err := s.Decode(originalData, gvk, into)
|
||||
if err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
// the last item in versioned becomes into, so if versioned was not originally empty we reset the object
|
||||
// array so the first position is the decoded object and the second position is the outermost object.
|
||||
// if there were no objects in the versioned list passed to us, only add ourselves.
|
||||
if into != nil && into != obj {
|
||||
versioned.Objects = []runtime.Object{obj, into}
|
||||
} else {
|
||||
versioned.Objects = []runtime.Object{obj}
|
||||
}
|
||||
return versioned, actual, err
|
||||
}
|
||||
|
||||
prefixLen := len(s.prefix)
|
||||
switch {
|
||||
case len(originalData) == 0:
|
||||
@ -138,7 +119,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
||||
if intoUnknown, ok := into.(*runtime.Unknown); ok && intoUnknown != nil {
|
||||
*intoUnknown = unk
|
||||
if ok, _, _ := s.RecognizesData(bytes.NewBuffer(unk.Raw)); ok {
|
||||
intoUnknown.ContentType = s.contentType
|
||||
intoUnknown.ContentType = runtime.ContentTypeProtobuf
|
||||
}
|
||||
return intoUnknown, &actual, nil
|
||||
}
|
||||
@ -180,6 +161,13 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
||||
|
||||
// Encode serializes the provided object to the given writer.
|
||||
func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if co, ok := obj.(runtime.CacheableObject); ok {
|
||||
return co.CacheEncode(s.Identifier(), s.doEncode, w)
|
||||
}
|
||||
return s.doEncode(obj, w)
|
||||
}
|
||||
|
||||
func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
|
||||
prefixSize := uint64(len(s.prefix))
|
||||
|
||||
var unk runtime.Unknown
|
||||
@ -207,7 +195,7 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
switch t := obj.(type) {
|
||||
case bufferedMarshaller:
|
||||
// this path performs a single allocation during write but requires the caller to implement
|
||||
// the more efficient Size and MarshalTo methods
|
||||
// the more efficient Size and MarshalToSizedBuffer methods
|
||||
encodedSize := uint64(t.Size())
|
||||
estimatedSize := prefixSize + estimateUnknownSize(&unk, encodedSize)
|
||||
data := make([]byte, estimatedSize)
|
||||
@ -249,6 +237,11 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (s *Serializer) Identifier() runtime.Identifier {
|
||||
return serializerIdentifier
|
||||
}
|
||||
|
||||
// RecognizesData implements the RecognizingDecoder interface.
|
||||
func (s *Serializer) RecognizesData(peek io.Reader) (bool, bool, error) {
|
||||
prefix := make([]byte, 4)
|
||||
@ -287,6 +280,12 @@ type bufferedMarshaller interface {
|
||||
runtime.ProtobufMarshaller
|
||||
}
|
||||
|
||||
// Like bufferedMarshaller, but is able to marshal backwards, which is more efficient since it doesn't call Size() as frequently.
|
||||
type bufferedReverseMarshaller interface {
|
||||
proto.Sizer
|
||||
runtime.ProtobufReverseMarshaller
|
||||
}
|
||||
|
||||
// estimateUnknownSize returns the expected bytes consumed by a given runtime.Unknown
|
||||
// object with a nil RawJSON struct and the expected size of the provided buffer. The
|
||||
// returned size will not be correct if RawJSOn is set on unk.
|
||||
@ -303,24 +302,24 @@ func estimateUnknownSize(unk *runtime.Unknown, byteSize uint64) uint64 {
|
||||
// encoded object, and thus is not self describing (callers must know what type is being described in order to decode).
|
||||
//
|
||||
// This encoding scheme is experimental, and is subject to change at any time.
|
||||
func NewRawSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper, defaultContentType string) *RawSerializer {
|
||||
func NewRawSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper) *RawSerializer {
|
||||
return &RawSerializer{
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
contentType: defaultContentType,
|
||||
creater: creater,
|
||||
typer: typer,
|
||||
}
|
||||
}
|
||||
|
||||
// RawSerializer encodes and decodes objects without adding a runtime.Unknown wrapper (objects are encoded without identifying
|
||||
// type).
|
||||
type RawSerializer struct {
|
||||
creater runtime.ObjectCreater
|
||||
typer runtime.ObjectTyper
|
||||
contentType string
|
||||
creater runtime.ObjectCreater
|
||||
typer runtime.ObjectTyper
|
||||
}
|
||||
|
||||
var _ runtime.Serializer = &RawSerializer{}
|
||||
|
||||
const rawSerializerIdentifier runtime.Identifier = "raw-protobuf"
|
||||
|
||||
// Decode attempts to convert the provided data into a protobuf message, extract the stored schema kind, apply the provided default
|
||||
// gvk, and then load that data into an object matching the desired schema kind or the provided into. If into is *runtime.Unknown,
|
||||
// the raw data will be extracted and no decoding will be performed. If into is not registered with the typer, then the object will
|
||||
@ -332,20 +331,6 @@ func (s *RawSerializer) Decode(originalData []byte, gvk *schema.GroupVersionKind
|
||||
return nil, nil, fmt.Errorf("this serializer requires an object to decode into: %#v", s)
|
||||
}
|
||||
|
||||
if versioned, ok := into.(*runtime.VersionedObjects); ok {
|
||||
into = versioned.Last()
|
||||
obj, actual, err := s.Decode(originalData, gvk, into)
|
||||
if err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
if into != nil && into != obj {
|
||||
versioned.Objects = []runtime.Object{obj, into}
|
||||
} else {
|
||||
versioned.Objects = []runtime.Object{obj}
|
||||
}
|
||||
return versioned, actual, err
|
||||
}
|
||||
|
||||
if len(originalData) == 0 {
|
||||
// TODO: treat like decoding {} from JSON with defaulting
|
||||
return nil, nil, fmt.Errorf("empty data")
|
||||
@ -358,7 +343,7 @@ func (s *RawSerializer) Decode(originalData []byte, gvk *schema.GroupVersionKind
|
||||
if intoUnknown, ok := into.(*runtime.Unknown); ok && intoUnknown != nil {
|
||||
intoUnknown.Raw = data
|
||||
intoUnknown.ContentEncoding = ""
|
||||
intoUnknown.ContentType = s.contentType
|
||||
intoUnknown.ContentType = runtime.ContentTypeProtobuf
|
||||
intoUnknown.SetGroupVersionKind(*actual)
|
||||
return intoUnknown, actual, nil
|
||||
}
|
||||
@ -411,12 +396,35 @@ func unmarshalToObject(typer runtime.ObjectTyper, creater runtime.ObjectCreater,
|
||||
if err := proto.Unmarshal(data, pb); err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
if actual != nil {
|
||||
obj.GetObjectKind().SetGroupVersionKind(*actual)
|
||||
}
|
||||
return obj, actual, nil
|
||||
}
|
||||
|
||||
// Encode serializes the provided object to the given writer. Overrides is ignored.
|
||||
func (s *RawSerializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if co, ok := obj.(runtime.CacheableObject); ok {
|
||||
return co.CacheEncode(s.Identifier(), s.doEncode, w)
|
||||
}
|
||||
return s.doEncode(obj, w)
|
||||
}
|
||||
|
||||
func (s *RawSerializer) doEncode(obj runtime.Object, w io.Writer) error {
|
||||
switch t := obj.(type) {
|
||||
case bufferedReverseMarshaller:
|
||||
// this path performs a single allocation during write but requires the caller to implement
|
||||
// the more efficient Size and MarshalToSizedBuffer methods
|
||||
encodedSize := uint64(t.Size())
|
||||
data := make([]byte, encodedSize)
|
||||
|
||||
n, err := t.MarshalToSizedBuffer(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = w.Write(data[:n])
|
||||
return err
|
||||
|
||||
case bufferedMarshaller:
|
||||
// this path performs a single allocation during write but requires the caller to implement
|
||||
// the more efficient Size and MarshalTo methods
|
||||
@ -444,6 +452,11 @@ func (s *RawSerializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (s *RawSerializer) Identifier() runtime.Identifier {
|
||||
return rawSerializerIdentifier
|
||||
}
|
||||
|
||||
var LengthDelimitedFramer = lengthDelimitedFramer{}
|
||||
|
||||
type lengthDelimitedFramer struct{}
|
||||
|
48
vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf_extension.go
generated
vendored
48
vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf_extension.go
generated
vendored
@ -1,48 +0,0 @@
|
||||
/*
|
||||
Copyright 2014 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package serializer
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/protobuf"
|
||||
)
|
||||
|
||||
const (
|
||||
// contentTypeProtobuf is the protobuf type exposed for Kubernetes. It is private to prevent others from
|
||||
// depending on it unintentionally.
|
||||
// TODO: potentially move to pkg/api (since it's part of the Kube public API) and pass it in to the
|
||||
// CodecFactory on initialization.
|
||||
contentTypeProtobuf = "application/vnd.kubernetes.protobuf"
|
||||
)
|
||||
|
||||
func protobufSerializer(scheme *runtime.Scheme) (serializerType, bool) {
|
||||
serializer := protobuf.NewSerializer(scheme, scheme, contentTypeProtobuf)
|
||||
raw := protobuf.NewRawSerializer(scheme, scheme, contentTypeProtobuf)
|
||||
return serializerType{
|
||||
AcceptContentTypes: []string{contentTypeProtobuf},
|
||||
ContentType: contentTypeProtobuf,
|
||||
FileExtensions: []string{"pb"},
|
||||
Serializer: serializer,
|
||||
|
||||
Framer: protobuf.LengthDelimitedFramer,
|
||||
StreamSerializer: raw,
|
||||
}, true
|
||||
}
|
||||
|
||||
func init() {
|
||||
serializerExtensions = append(serializerExtensions, protobufSerializer)
|
||||
}
|
158
vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
generated
vendored
158
vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
generated
vendored
@ -17,12 +17,15 @@ limitations under the License.
|
||||
package versioning
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// NewDefaultingCodecForScheme is a convenience method for callers that are using a scheme.
|
||||
@ -62,6 +65,8 @@ func NewCodec(
|
||||
encodeVersion: encodeVersion,
|
||||
decodeVersion: decodeVersion,
|
||||
|
||||
identifier: identifier(encodeVersion, encoder),
|
||||
|
||||
originalSchemeName: originalSchemeName,
|
||||
}
|
||||
return internal
|
||||
@ -78,19 +83,47 @@ type codec struct {
|
||||
encodeVersion runtime.GroupVersioner
|
||||
decodeVersion runtime.GroupVersioner
|
||||
|
||||
identifier runtime.Identifier
|
||||
|
||||
// originalSchemeName is optional, but when filled in it holds the name of the scheme from which this codec originates
|
||||
originalSchemeName string
|
||||
}
|
||||
|
||||
var identifiersMap sync.Map
|
||||
|
||||
type codecIdentifier struct {
|
||||
EncodeGV string `json:"encodeGV,omitempty"`
|
||||
Encoder string `json:"encoder,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// identifier computes Identifier of Encoder based on codec parameters.
|
||||
func identifier(encodeGV runtime.GroupVersioner, encoder runtime.Encoder) runtime.Identifier {
|
||||
result := codecIdentifier{
|
||||
Name: "versioning",
|
||||
}
|
||||
|
||||
if encodeGV != nil {
|
||||
result.EncodeGV = encodeGV.Identifier()
|
||||
}
|
||||
if encoder != nil {
|
||||
result.Encoder = string(encoder.Identifier())
|
||||
}
|
||||
if id, ok := identifiersMap.Load(result); ok {
|
||||
return id.(runtime.Identifier)
|
||||
}
|
||||
identifier, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed marshaling identifier for codec: %v", err)
|
||||
}
|
||||
identifiersMap.Store(result, runtime.Identifier(identifier))
|
||||
return runtime.Identifier(identifier)
|
||||
}
|
||||
|
||||
// Decode attempts a decode of the object, then tries to convert it to the internal version. If into is provided and the decoding is
|
||||
// successful, the returned runtime.Object will be the value passed as into. Note that this may bypass conversion if you pass an
|
||||
// into that matches the serialized version.
|
||||
func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
|
||||
versioned, isVersioned := into.(*runtime.VersionedObjects)
|
||||
if isVersioned {
|
||||
into = versioned.Last()
|
||||
}
|
||||
|
||||
// If the into object is unstructured and expresses an opinion about its group/version,
|
||||
// create a new instance of the type so we always exercise the conversion path (skips short-circuiting on `into == obj`)
|
||||
decodeInto := into
|
||||
@ -106,50 +139,30 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
|
||||
}
|
||||
|
||||
if d, ok := obj.(runtime.NestedObjectDecoder); ok {
|
||||
if err := d.DecodeNestedObjects(DirectDecoder{c.decoder}); err != nil {
|
||||
if err := d.DecodeNestedObjects(runtime.WithoutVersionDecoder{c.decoder}); err != nil {
|
||||
return nil, gvk, err
|
||||
}
|
||||
}
|
||||
|
||||
// if we specify a target, use generic conversion.
|
||||
if into != nil {
|
||||
if into == obj {
|
||||
if isVersioned {
|
||||
return versioned, gvk, nil
|
||||
}
|
||||
return into, gvk, nil
|
||||
}
|
||||
|
||||
// perform defaulting if requested
|
||||
if c.defaulter != nil {
|
||||
// create a copy to ensure defaulting is not applied to the original versioned objects
|
||||
if isVersioned {
|
||||
versioned.Objects = []runtime.Object{obj.DeepCopyObject()}
|
||||
}
|
||||
c.defaulter.Default(obj)
|
||||
} else {
|
||||
if isVersioned {
|
||||
versioned.Objects = []runtime.Object{obj}
|
||||
}
|
||||
}
|
||||
|
||||
// Short-circuit conversion if the into object is same object
|
||||
if into == obj {
|
||||
return into, gvk, nil
|
||||
}
|
||||
|
||||
if err := c.convertor.Convert(obj, into, c.decodeVersion); err != nil {
|
||||
return nil, gvk, err
|
||||
}
|
||||
|
||||
if isVersioned {
|
||||
versioned.Objects = append(versioned.Objects, into)
|
||||
return versioned, gvk, nil
|
||||
}
|
||||
return into, gvk, nil
|
||||
}
|
||||
|
||||
// Convert if needed.
|
||||
if isVersioned {
|
||||
// create a copy, because ConvertToVersion does not guarantee non-mutation of objects
|
||||
versioned.Objects = []runtime.Object{obj.DeepCopyObject()}
|
||||
}
|
||||
|
||||
// perform defaulting if requested
|
||||
if c.defaulter != nil {
|
||||
c.defaulter.Default(obj)
|
||||
@ -159,18 +172,19 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
|
||||
if err != nil {
|
||||
return nil, gvk, err
|
||||
}
|
||||
if isVersioned {
|
||||
if versioned.Last() != out {
|
||||
versioned.Objects = append(versioned.Objects, out)
|
||||
}
|
||||
return versioned, gvk, nil
|
||||
}
|
||||
return out, gvk, nil
|
||||
}
|
||||
|
||||
// Encode ensures the provided object is output in the appropriate group and version, invoking
|
||||
// conversion if necessary. Unversioned objects (according to the ObjectTyper) are output as is.
|
||||
func (c *codec) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if co, ok := obj.(runtime.CacheableObject); ok {
|
||||
return co.CacheEncode(c.Identifier(), c.doEncode, w)
|
||||
}
|
||||
return c.doEncode(obj, w)
|
||||
}
|
||||
|
||||
func (c *codec) doEncode(obj runtime.Object, w io.Writer) error {
|
||||
switch obj := obj.(type) {
|
||||
case *runtime.Unknown:
|
||||
return c.encoder.Encode(obj, w)
|
||||
@ -199,84 +213,38 @@ func (c *codec) Encode(obj runtime.Object, w io.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
objectKind := obj.GetObjectKind()
|
||||
old := objectKind.GroupVersionKind()
|
||||
// restore the old GVK after encoding
|
||||
defer objectKind.SetGroupVersionKind(old)
|
||||
|
||||
if c.encodeVersion == nil || isUnversioned {
|
||||
if e, ok := obj.(runtime.NestedObjectEncoder); ok {
|
||||
if err := e.EncodeNestedObjects(DirectEncoder{Encoder: c.encoder, ObjectTyper: c.typer}); err != nil {
|
||||
if err := e.EncodeNestedObjects(runtime.WithVersionEncoder{Encoder: c.encoder, ObjectTyper: c.typer}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
objectKind := obj.GetObjectKind()
|
||||
old := objectKind.GroupVersionKind()
|
||||
objectKind.SetGroupVersionKind(gvks[0])
|
||||
err = c.encoder.Encode(obj, w)
|
||||
objectKind.SetGroupVersionKind(old)
|
||||
return err
|
||||
return c.encoder.Encode(obj, w)
|
||||
}
|
||||
|
||||
// Perform a conversion if necessary
|
||||
objectKind := obj.GetObjectKind()
|
||||
old := objectKind.GroupVersionKind()
|
||||
out, err := c.convertor.ConvertToVersion(obj, c.encodeVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if e, ok := out.(runtime.NestedObjectEncoder); ok {
|
||||
if err := e.EncodeNestedObjects(DirectEncoder{Version: c.encodeVersion, Encoder: c.encoder, ObjectTyper: c.typer}); err != nil {
|
||||
if err := e.EncodeNestedObjects(runtime.WithVersionEncoder{Version: c.encodeVersion, Encoder: c.encoder, ObjectTyper: c.typer}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Conversion is responsible for setting the proper group, version, and kind onto the outgoing object
|
||||
err = c.encoder.Encode(out, w)
|
||||
// restore the old GVK, in case conversion returned the same object
|
||||
objectKind.SetGroupVersionKind(old)
|
||||
return err
|
||||
return c.encoder.Encode(out, w)
|
||||
}
|
||||
|
||||
// DirectEncoder serializes an object and ensures the GVK is set.
|
||||
type DirectEncoder struct {
|
||||
Version runtime.GroupVersioner
|
||||
runtime.Encoder
|
||||
runtime.ObjectTyper
|
||||
}
|
||||
|
||||
// Encode does not do conversion. It sets the gvk during serialization.
|
||||
func (e DirectEncoder) Encode(obj runtime.Object, stream io.Writer) error {
|
||||
gvks, _, err := e.ObjectTyper.ObjectKinds(obj)
|
||||
if err != nil {
|
||||
if runtime.IsNotRegisteredError(err) {
|
||||
return e.Encoder.Encode(obj, stream)
|
||||
}
|
||||
return err
|
||||
}
|
||||
kind := obj.GetObjectKind()
|
||||
oldGVK := kind.GroupVersionKind()
|
||||
gvk := gvks[0]
|
||||
if e.Version != nil {
|
||||
preferredGVK, ok := e.Version.KindForGroupVersionKinds(gvks)
|
||||
if ok {
|
||||
gvk = preferredGVK
|
||||
}
|
||||
}
|
||||
kind.SetGroupVersionKind(gvk)
|
||||
err = e.Encoder.Encode(obj, stream)
|
||||
kind.SetGroupVersionKind(oldGVK)
|
||||
return err
|
||||
}
|
||||
|
||||
// DirectDecoder clears the group version kind of a deserialized object.
|
||||
type DirectDecoder struct {
|
||||
runtime.Decoder
|
||||
}
|
||||
|
||||
// Decode does not do conversion. It removes the gvk during deserialization.
|
||||
func (d DirectDecoder) Decode(data []byte, defaults *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
|
||||
obj, gvk, err := d.Decoder.Decode(data, defaults, into)
|
||||
if obj != nil {
|
||||
kind := obj.GetObjectKind()
|
||||
// clearing the gvk is just a convention of a codec
|
||||
kind.SetGroupVersionKind(schema.GroupVersionKind{})
|
||||
}
|
||||
return obj, gvk, err
|
||||
// Identifier implements runtime.Encoder interface.
|
||||
func (c *codec) Identifier() runtime.Identifier {
|
||||
return c.identifier
|
||||
}
|
||||
|
20
vendor/k8s.io/apimachinery/pkg/runtime/types.go
generated
vendored
20
vendor/k8s.io/apimachinery/pkg/runtime/types.go
generated
vendored
@ -41,8 +41,9 @@ type TypeMeta struct {
|
||||
}
|
||||
|
||||
const (
|
||||
ContentTypeJSON string = "application/json"
|
||||
ContentTypeYAML string = "application/yaml"
|
||||
ContentTypeJSON string = "application/json"
|
||||
ContentTypeYAML string = "application/yaml"
|
||||
ContentTypeProtobuf string = "application/vnd.kubernetes.protobuf"
|
||||
)
|
||||
|
||||
// RawExtension is used to hold extensions in external versions.
|
||||
@ -94,7 +95,7 @@ type RawExtension struct {
|
||||
// Raw is the underlying serialization of this object.
|
||||
//
|
||||
// TODO: Determine how to detect ContentType and ContentEncoding of 'Raw' data.
|
||||
Raw []byte `protobuf:"bytes,1,opt,name=raw"`
|
||||
Raw []byte `json:"-" protobuf:"bytes,1,opt,name=raw"`
|
||||
// Object can hold a representation of this extension - useful for working with versioned
|
||||
// structs.
|
||||
Object Object `json:"-"`
|
||||
@ -123,16 +124,3 @@ type Unknown struct {
|
||||
// Unspecified means ContentTypeJSON.
|
||||
ContentType string `protobuf:"bytes,4,opt,name=contentType"`
|
||||
}
|
||||
|
||||
// VersionedObjects is used by Decoders to give callers a way to access all versions
|
||||
// of an object during the decoding process.
|
||||
//
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:deepcopy-gen=true
|
||||
type VersionedObjects struct {
|
||||
// Objects is the set of objects retrieved during decoding, in order of conversion.
|
||||
// The 0 index is the object as serialized on the wire. If conversion has occurred,
|
||||
// other objects may be present. The right most object is the same as would be returned
|
||||
// by a normal Decode call.
|
||||
Objects []Object
|
||||
}
|
||||
|
94
vendor/k8s.io/apimachinery/pkg/runtime/types_proto.go
generated
vendored
94
vendor/k8s.io/apimachinery/pkg/runtime/types_proto.go
generated
vendored
@ -24,46 +24,66 @@ type ProtobufMarshaller interface {
|
||||
MarshalTo(data []byte) (int, error)
|
||||
}
|
||||
|
||||
type ProtobufReverseMarshaller interface {
|
||||
MarshalToSizedBuffer(data []byte) (int, error)
|
||||
}
|
||||
|
||||
// NestedMarshalTo allows a caller to avoid extra allocations during serialization of an Unknown
|
||||
// that will contain an object that implements ProtobufMarshaller.
|
||||
// that will contain an object that implements ProtobufMarshaller or ProtobufReverseMarshaller.
|
||||
func (m *Unknown) NestedMarshalTo(data []byte, b ProtobufMarshaller, size uint64) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
data[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(m.TypeMeta.Size()))
|
||||
n1, err := m.TypeMeta.MarshalTo(data[i:])
|
||||
// Calculate the full size of the message.
|
||||
msgSize := m.Size()
|
||||
if b != nil {
|
||||
msgSize += int(size) + sovGenerated(size) + 1
|
||||
}
|
||||
|
||||
// Reverse marshal the fields of m.
|
||||
i := msgSize
|
||||
i -= len(m.ContentType)
|
||||
copy(data[i:], m.ContentType)
|
||||
i = encodeVarintGenerated(data, i, uint64(len(m.ContentType)))
|
||||
i--
|
||||
data[i] = 0x22
|
||||
i -= len(m.ContentEncoding)
|
||||
copy(data[i:], m.ContentEncoding)
|
||||
i = encodeVarintGenerated(data, i, uint64(len(m.ContentEncoding)))
|
||||
i--
|
||||
data[i] = 0x1a
|
||||
if b != nil {
|
||||
if r, ok := b.(ProtobufReverseMarshaller); ok {
|
||||
n1, err := r.MarshalToSizedBuffer(data[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= int(size)
|
||||
if uint64(n1) != size {
|
||||
// programmer error: the Size() method for protobuf does not match the results of LashramOt, which means the proto
|
||||
// struct returned would be wrong.
|
||||
return 0, fmt.Errorf("the Size() value of %T was %d, but NestedMarshalTo wrote %d bytes to data", b, size, n1)
|
||||
}
|
||||
} else {
|
||||
i -= int(size)
|
||||
n1, err := b.MarshalTo(data[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if uint64(n1) != size {
|
||||
// programmer error: the Size() method for protobuf does not match the results of MarshalTo, which means the proto
|
||||
// struct returned would be wrong.
|
||||
return 0, fmt.Errorf("the Size() value of %T was %d, but NestedMarshalTo wrote %d bytes to data", b, size, n1)
|
||||
}
|
||||
}
|
||||
i = encodeVarintGenerated(data, i, size)
|
||||
i--
|
||||
data[i] = 0x12
|
||||
}
|
||||
n2, err := m.TypeMeta.MarshalToSizedBuffer(data[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
|
||||
if b != nil {
|
||||
data[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, size)
|
||||
n2, err := b.MarshalTo(data[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if uint64(n2) != size {
|
||||
// programmer error: the Size() method for protobuf does not match the results of MarshalTo, which means the proto
|
||||
// struct returned would be wrong.
|
||||
return 0, fmt.Errorf("the Size() value of %T was %d, but NestedMarshalTo wrote %d bytes to data", b, size, n2)
|
||||
}
|
||||
i += n2
|
||||
}
|
||||
|
||||
data[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(len(m.ContentEncoding)))
|
||||
i += copy(data[i:], m.ContentEncoding)
|
||||
|
||||
data[i] = 0x22
|
||||
i++
|
||||
i = encodeVarintGenerated(data, i, uint64(len(m.ContentType)))
|
||||
i += copy(data[i:], m.ContentType)
|
||||
return i, nil
|
||||
i -= n2
|
||||
i = encodeVarintGenerated(data, i, uint64(n2))
|
||||
i--
|
||||
data[i] = 0xa
|
||||
return msgSize - i, nil
|
||||
}
|
||||
|
33
vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go
generated
vendored
33
vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go
generated
vendored
@ -73,36 +73,3 @@ func (in *Unknown) DeepCopyObject() Object {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VersionedObjects) DeepCopyInto(out *VersionedObjects) {
|
||||
*out = *in
|
||||
if in.Objects != nil {
|
||||
in, out := &in.Objects, &out.Objects
|
||||
*out = make([]Object, len(*in))
|
||||
for i := range *in {
|
||||
if (*in)[i] != nil {
|
||||
(*out)[i] = (*in)[i].DeepCopyObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VersionedObjects.
|
||||
func (in *VersionedObjects) DeepCopy() *VersionedObjects {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VersionedObjects)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new Object.
|
||||
func (in *VersionedObjects) DeepCopyObject() Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
119
vendor/k8s.io/apimachinery/pkg/util/clock/clock.go
generated
vendored
119
vendor/k8s.io/apimachinery/pkg/util/clock/clock.go
generated
vendored
@ -21,11 +21,18 @@ import (
|
||||
"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 {
|
||||
Now() time.Time
|
||||
Since(time.Time) time.Duration
|
||||
PassiveClock
|
||||
After(time.Duration) <-chan time.Time
|
||||
NewTimer(time.Duration) Timer
|
||||
Sleep(time.Duration)
|
||||
@ -45,31 +52,39 @@ func (RealClock) Since(ts time.Time) time.Duration {
|
||||
return time.Since(ts)
|
||||
}
|
||||
|
||||
// Same as time.After(d).
|
||||
// After is the same as time.After(d).
|
||||
func (RealClock) After(d time.Duration) <-chan time.Time {
|
||||
return time.After(d)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// FakeClock implements Clock, but returns an arbitrary time.
|
||||
type FakeClock struct {
|
||||
// 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
|
||||
@ -80,30 +95,44 @@ type fakeClockWaiter struct {
|
||||
stepInterval time.Duration
|
||||
skipIfBlocked bool
|
||||
destChan chan time.Time
|
||||
fired bool
|
||||
}
|
||||
|
||||
func NewFakeClock(t time.Time) *FakeClock {
|
||||
return &FakeClock{
|
||||
// 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 *FakeClock) Now() time.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 *FakeClock) Since(ts time.Time) time.Duration {
|
||||
func (f *FakePassiveClock) Since(ts time.Time) time.Duration {
|
||||
f.lock.RLock()
|
||||
defer f.lock.RUnlock()
|
||||
return f.time.Sub(ts)
|
||||
}
|
||||
|
||||
// Fake version of time.After(d).
|
||||
// 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()
|
||||
@ -116,7 +145,7 @@ func (f *FakeClock) After(d time.Duration) <-chan time.Time {
|
||||
return ch
|
||||
}
|
||||
|
||||
// Fake version of time.NewTimer(d).
|
||||
// NewTimer is the Fake version of time.NewTimer(d).
|
||||
func (f *FakeClock) NewTimer(d time.Duration) Timer {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
@ -133,6 +162,7 @@ func (f *FakeClock) NewTimer(d time.Duration) Timer {
|
||||
return timer
|
||||
}
|
||||
|
||||
// NewTicker returns a new Ticker.
|
||||
func (f *FakeClock) NewTicker(d time.Duration) Ticker {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
@ -150,14 +180,14 @@ func (f *FakeClock) NewTicker(d time.Duration) Ticker {
|
||||
}
|
||||
}
|
||||
|
||||
// Move clock by Duration, notify anyone that's called After, Tick, or NewTimer
|
||||
// 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))
|
||||
}
|
||||
|
||||
// Sets the time.
|
||||
// SetTime sets the time on a FakeClock.
|
||||
func (f *FakeClock) SetTime(t time.Time) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
@ -175,12 +205,10 @@ func (f *FakeClock) setTimeLocked(t time.Time) {
|
||||
if w.skipIfBlocked {
|
||||
select {
|
||||
case w.destChan <- t:
|
||||
w.fired = true
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
w.destChan <- t
|
||||
w.fired = true
|
||||
}
|
||||
|
||||
if w.stepInterval > 0 {
|
||||
@ -197,7 +225,7 @@ func (f *FakeClock) setTimeLocked(t time.Time) {
|
||||
f.waiters = newWaiters
|
||||
}
|
||||
|
||||
// Returns true if After has been called on f but not yet satisfied (so you can
|
||||
// HasWaiters returns true if After has been called on f but not yet satisfied (so you can
|
||||
// write race-free tests).
|
||||
func (f *FakeClock) HasWaiters() bool {
|
||||
f.lock.RLock()
|
||||
@ -205,6 +233,7 @@ func (f *FakeClock) HasWaiters() bool {
|
||||
return len(f.waiters) > 0
|
||||
}
|
||||
|
||||
// Sleep pauses the FakeClock for duration d.
|
||||
func (f *FakeClock) Sleep(d time.Duration) {
|
||||
f.Step(d)
|
||||
}
|
||||
@ -226,24 +255,25 @@ func (i *IntervalClock) Since(ts time.Time) time.Duration {
|
||||
return i.Time.Sub(ts)
|
||||
}
|
||||
|
||||
// Unimplemented, will panic.
|
||||
// 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")
|
||||
}
|
||||
|
||||
// Unimplemented, will panic.
|
||||
// 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")
|
||||
}
|
||||
|
||||
// Unimplemented, will panic.
|
||||
// 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")
|
||||
}
|
||||
@ -287,38 +317,53 @@ func (f *fakeTimer) C() <-chan time.Time {
|
||||
return f.waiter.destChan
|
||||
}
|
||||
|
||||
// Stop stops the timer and returns true if the timer has not yet fired, or false otherwise.
|
||||
// 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()
|
||||
|
||||
newWaiters := make([]fakeClockWaiter, 0, len(f.fakeClock.waiters))
|
||||
for i := range f.fakeClock.waiters {
|
||||
w := &f.fakeClock.waiters[i]
|
||||
if w != &f.waiter {
|
||||
newWaiters = append(newWaiters, *w)
|
||||
// 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 !f.waiter.fired
|
||||
return stopped
|
||||
}
|
||||
|
||||
// Reset resets the timer to the fake clock's "now" + d. It returns true if the timer has not yet
|
||||
// fired, or false otherwise.
|
||||
// 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
|
||||
// this call returns false. This is like time.Timer::Reset.
|
||||
func (f *fakeTimer) Reset(d time.Duration) bool {
|
||||
f.fakeClock.lock.Lock()
|
||||
defer f.fakeClock.lock.Unlock()
|
||||
|
||||
active := !f.waiter.fired
|
||||
|
||||
f.waiter.fired = false
|
||||
f.waiter.targetTime = f.fakeClock.time.Add(d)
|
||||
|
||||
return active
|
||||
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
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Ticker defines the Ticker interface
|
||||
type Ticker interface {
|
||||
C() <-chan time.Time
|
||||
Stop()
|
||||
|
32
vendor/k8s.io/apimachinery/pkg/util/errors/errors.go
generated
vendored
32
vendor/k8s.io/apimachinery/pkg/util/errors/errors.go
generated
vendored
@ -28,9 +28,14 @@ type MessageCountMap map[string]int
|
||||
|
||||
// Aggregate represents an object that contains multiple errors, but does not
|
||||
// necessarily have singular semantic meaning.
|
||||
// The aggregate can be used with `errors.Is()` to check for the occurrence of
|
||||
// a specific error type.
|
||||
// Errors.As() is not supported, because the caller presumably cares about a
|
||||
// specific error of potentially multiple that match the given type.
|
||||
type Aggregate interface {
|
||||
error
|
||||
Errors() []error
|
||||
Is(error) bool
|
||||
}
|
||||
|
||||
// NewAggregate converts a slice of errors into an Aggregate interface, which
|
||||
@ -71,16 +76,17 @@ func (agg aggregate) Error() string {
|
||||
}
|
||||
seenerrs := sets.NewString()
|
||||
result := ""
|
||||
agg.visit(func(err error) {
|
||||
agg.visit(func(err error) bool {
|
||||
msg := err.Error()
|
||||
if seenerrs.Has(msg) {
|
||||
return
|
||||
return false
|
||||
}
|
||||
seenerrs.Insert(msg)
|
||||
if len(seenerrs) > 1 {
|
||||
result += ", "
|
||||
}
|
||||
result += msg
|
||||
return false
|
||||
})
|
||||
if len(seenerrs) == 1 {
|
||||
return result
|
||||
@ -88,19 +94,33 @@ func (agg aggregate) Error() string {
|
||||
return "[" + result + "]"
|
||||
}
|
||||
|
||||
func (agg aggregate) visit(f func(err error)) {
|
||||
func (agg aggregate) Is(target error) bool {
|
||||
return agg.visit(func(err error) bool {
|
||||
return errors.Is(err, target)
|
||||
})
|
||||
}
|
||||
|
||||
func (agg aggregate) visit(f func(err error) bool) bool {
|
||||
for _, err := range agg {
|
||||
switch err := err.(type) {
|
||||
case aggregate:
|
||||
err.visit(f)
|
||||
if match := err.visit(f); match {
|
||||
return match
|
||||
}
|
||||
case Aggregate:
|
||||
for _, nestedErr := range err.Errors() {
|
||||
f(nestedErr)
|
||||
if match := f(nestedErr); match {
|
||||
return match
|
||||
}
|
||||
}
|
||||
default:
|
||||
f(err)
|
||||
if match := f(err); match {
|
||||
return match
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Errors is part of the Aggregate interface.
|
||||
|
218
vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go
generated
vendored
218
vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go
generated
vendored
@ -17,25 +17,16 @@ limitations under the License.
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto
|
||||
|
||||
/*
|
||||
Package intstr is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
IntOrString
|
||||
*/
|
||||
package intstr
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
|
||||
math "math"
|
||||
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -47,19 +38,71 @@ var _ = math.Inf
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
func (m *IntOrString) Reset() { *m = IntOrString{} }
|
||||
func (*IntOrString) ProtoMessage() {}
|
||||
func (*IntOrString) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
func (m *IntOrString) Reset() { *m = IntOrString{} }
|
||||
func (*IntOrString) ProtoMessage() {}
|
||||
func (*IntOrString) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_94e046ae3ce6121c, []int{0}
|
||||
}
|
||||
func (m *IntOrString) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *IntOrString) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
func (m *IntOrString) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_IntOrString.Merge(m, src)
|
||||
}
|
||||
func (m *IntOrString) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *IntOrString) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_IntOrString.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_IntOrString proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*IntOrString)(nil), "k8s.io.apimachinery.pkg.util.intstr.IntOrString")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto", fileDescriptor_94e046ae3ce6121c)
|
||||
}
|
||||
|
||||
var fileDescriptor_94e046ae3ce6121c = []byte{
|
||||
// 292 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x8f, 0x31, 0x4b, 0x33, 0x31,
|
||||
0x1c, 0xc6, 0x93, 0xb7, 0x7d, 0x8b, 0x9e, 0xe0, 0x50, 0x1c, 0x8a, 0x43, 0x7a, 0x28, 0xc8, 0x0d,
|
||||
0x9a, 0xac, 0xe2, 0xd8, 0xad, 0x20, 0x08, 0x57, 0x71, 0x70, 0xbb, 0x6b, 0x63, 0x1a, 0xae, 0x4d,
|
||||
0x42, 0xee, 0x7f, 0xc2, 0x6d, 0xfd, 0x08, 0xba, 0x39, 0xfa, 0x71, 0x6e, 0xec, 0xd8, 0x41, 0x8a,
|
||||
0x17, 0xbf, 0x85, 0x93, 0x5c, 0xee, 0x40, 0xa7, 0xe4, 0x79, 0x9e, 0xdf, 0x2f, 0x90, 0xe0, 0x36,
|
||||
0xbb, 0xce, 0xa9, 0xd4, 0x2c, 0x2b, 0x52, 0x6e, 0x15, 0x07, 0x9e, 0xb3, 0x67, 0xae, 0x16, 0xda,
|
||||
0xb2, 0x6e, 0x48, 0x8c, 0x5c, 0x27, 0xf3, 0xa5, 0x54, 0xdc, 0x96, 0xcc, 0x64, 0x82, 0x15, 0x20,
|
||||
0x57, 0x4c, 0x2a, 0xc8, 0xc1, 0x32, 0xc1, 0x15, 0xb7, 0x09, 0xf0, 0x05, 0x35, 0x56, 0x83, 0x1e,
|
||||
0x9e, 0xb7, 0x12, 0xfd, 0x2b, 0x51, 0x93, 0x09, 0xda, 0x48, 0xb4, 0x95, 0x4e, 0xaf, 0x84, 0x84,
|
||||
0x65, 0x91, 0xd2, 0xb9, 0x5e, 0x33, 0xa1, 0x85, 0x66, 0xde, 0x4d, 0x8b, 0x27, 0x9f, 0x7c, 0xf0,
|
||||
0xb7, 0xf6, 0xcd, 0xb3, 0x57, 0x1c, 0x1c, 0x4d, 0x15, 0xdc, 0xd9, 0x19, 0x58, 0xa9, 0xc4, 0x30,
|
||||
0x0a, 0xfa, 0x50, 0x1a, 0x3e, 0xc2, 0x21, 0x8e, 0x7a, 0x93, 0x93, 0x6a, 0x3f, 0x46, 0x6e, 0x3f,
|
||||
0xee, 0xdf, 0x97, 0x86, 0x7f, 0x77, 0x67, 0xec, 0x89, 0xe1, 0x45, 0x30, 0x90, 0x0a, 0x1e, 0x92,
|
||||
0xd5, 0xe8, 0x5f, 0x88, 0xa3, 0xff, 0x93, 0xe3, 0x8e, 0x1d, 0x4c, 0x7d, 0x1b, 0x77, 0x6b, 0xc3,
|
||||
0xe5, 0x60, 0x1b, 0xae, 0x17, 0xe2, 0xe8, 0xf0, 0x97, 0x9b, 0xf9, 0x36, 0xee, 0xd6, 0x9b, 0x83,
|
||||
0xb7, 0xf7, 0x31, 0xda, 0x7c, 0x84, 0x68, 0x72, 0x59, 0xd5, 0x04, 0x6d, 0x6b, 0x82, 0x76, 0x35,
|
||||
0x41, 0x1b, 0x47, 0x70, 0xe5, 0x08, 0xde, 0x3a, 0x82, 0x77, 0x8e, 0xe0, 0x4f, 0x47, 0xf0, 0xcb,
|
||||
0x17, 0x41, 0x8f, 0x83, 0xf6, 0xc3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x52, 0xa0, 0xb5, 0xc9,
|
||||
0x64, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *IntOrString) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -67,33 +110,44 @@ func (m *IntOrString) Marshal() (dAtA []byte, err error) {
|
||||
}
|
||||
|
||||
func (m *IntOrString) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *IntOrString) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
dAtA[i] = 0x8
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.Type))
|
||||
dAtA[i] = 0x10
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.IntVal))
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
i -= len(m.StrVal)
|
||||
copy(dAtA[i:], m.StrVal)
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.StrVal)))
|
||||
i += copy(dAtA[i:], m.StrVal)
|
||||
return i, nil
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.IntVal))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.Type))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovGenerated(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
return base
|
||||
}
|
||||
func (m *IntOrString) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
n += 1 + sovGenerated(uint64(m.Type))
|
||||
@ -104,14 +158,7 @@ func (m *IntOrString) Size() (n int) {
|
||||
}
|
||||
|
||||
func sovGenerated(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
@ -131,7 +178,7 @@ func (m *IntOrString) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -159,7 +206,7 @@ func (m *IntOrString) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Type |= (Type(b) & 0x7F) << shift
|
||||
m.Type |= Type(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -178,7 +225,7 @@ func (m *IntOrString) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.IntVal |= (int32(b) & 0x7F) << shift
|
||||
m.IntVal |= int32(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -197,7 +244,7 @@ func (m *IntOrString) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@ -207,6 +254,9 @@ func (m *IntOrString) Unmarshal(dAtA []byte) error {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -221,6 +271,9 @@ func (m *IntOrString) Unmarshal(dAtA []byte) error {
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
@ -236,6 +289,7 @@ func (m *IntOrString) Unmarshal(dAtA []byte) error {
|
||||
func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -267,10 +321,8 @@ func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -287,80 +339,34 @@ func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
return iNdEx, nil
|
||||
iNdEx += length
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipGenerated(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
depth++
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupGenerated
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 292 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x8f, 0x31, 0x4b, 0x33, 0x31,
|
||||
0x1c, 0xc6, 0x93, 0xb7, 0x7d, 0x8b, 0x9e, 0xe0, 0x50, 0x1c, 0x8a, 0x43, 0x7a, 0x28, 0xc8, 0x0d,
|
||||
0x9a, 0xac, 0xe2, 0xd8, 0xad, 0x20, 0x08, 0x57, 0x71, 0x70, 0xbb, 0x6b, 0x63, 0x1a, 0xae, 0x4d,
|
||||
0x42, 0xee, 0x7f, 0xc2, 0x6d, 0xfd, 0x08, 0xba, 0x39, 0xfa, 0x71, 0x6e, 0xec, 0xd8, 0x41, 0x8a,
|
||||
0x17, 0xbf, 0x85, 0x93, 0x5c, 0xee, 0x40, 0xa7, 0xe4, 0x79, 0x9e, 0xdf, 0x2f, 0x90, 0xe0, 0x36,
|
||||
0xbb, 0xce, 0xa9, 0xd4, 0x2c, 0x2b, 0x52, 0x6e, 0x15, 0x07, 0x9e, 0xb3, 0x67, 0xae, 0x16, 0xda,
|
||||
0xb2, 0x6e, 0x48, 0x8c, 0x5c, 0x27, 0xf3, 0xa5, 0x54, 0xdc, 0x96, 0xcc, 0x64, 0x82, 0x15, 0x20,
|
||||
0x57, 0x4c, 0x2a, 0xc8, 0xc1, 0x32, 0xc1, 0x15, 0xb7, 0x09, 0xf0, 0x05, 0x35, 0x56, 0x83, 0x1e,
|
||||
0x9e, 0xb7, 0x12, 0xfd, 0x2b, 0x51, 0x93, 0x09, 0xda, 0x48, 0xb4, 0x95, 0x4e, 0xaf, 0x84, 0x84,
|
||||
0x65, 0x91, 0xd2, 0xb9, 0x5e, 0x33, 0xa1, 0x85, 0x66, 0xde, 0x4d, 0x8b, 0x27, 0x9f, 0x7c, 0xf0,
|
||||
0xb7, 0xf6, 0xcd, 0xb3, 0x57, 0x1c, 0x1c, 0x4d, 0x15, 0xdc, 0xd9, 0x19, 0x58, 0xa9, 0xc4, 0x30,
|
||||
0x0a, 0xfa, 0x50, 0x1a, 0x3e, 0xc2, 0x21, 0x8e, 0x7a, 0x93, 0x93, 0x6a, 0x3f, 0x46, 0x6e, 0x3f,
|
||||
0xee, 0xdf, 0x97, 0x86, 0x7f, 0x77, 0x67, 0xec, 0x89, 0xe1, 0x45, 0x30, 0x90, 0x0a, 0x1e, 0x92,
|
||||
0xd5, 0xe8, 0x5f, 0x88, 0xa3, 0xff, 0x93, 0xe3, 0x8e, 0x1d, 0x4c, 0x7d, 0x1b, 0x77, 0x6b, 0xc3,
|
||||
0xe5, 0x60, 0x1b, 0xae, 0x17, 0xe2, 0xe8, 0xf0, 0x97, 0x9b, 0xf9, 0x36, 0xee, 0xd6, 0x9b, 0x83,
|
||||
0xb7, 0xf7, 0x31, 0xda, 0x7c, 0x84, 0x68, 0x72, 0x59, 0xd5, 0x04, 0x6d, 0x6b, 0x82, 0x76, 0x35,
|
||||
0x41, 0x1b, 0x47, 0x70, 0xe5, 0x08, 0xde, 0x3a, 0x82, 0x77, 0x8e, 0xe0, 0x4f, 0x47, 0xf0, 0xcb,
|
||||
0x17, 0x41, 0x8f, 0x83, 0xf6, 0xc3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x52, 0xa0, 0xb5, 0xc9,
|
||||
0x64, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
11
vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
generated
vendored
11
vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
generated
vendored
@ -26,7 +26,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/google/gofuzz"
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// IntOrString is a type that can hold an int32 or a string. When used in
|
||||
@ -45,7 +45,7 @@ type IntOrString struct {
|
||||
}
|
||||
|
||||
// Type represents the stored type of IntOrString.
|
||||
type Type int
|
||||
type Type int64
|
||||
|
||||
const (
|
||||
Int Type = iota // The IntOrString holds an int.
|
||||
@ -97,7 +97,8 @@ func (intstr *IntOrString) String() string {
|
||||
}
|
||||
|
||||
// IntValue returns the IntVal if type Int, or if
|
||||
// it is a String, will attempt a conversion to int.
|
||||
// it is a String, will attempt a conversion to int,
|
||||
// returning 0 if a parsing error occurs.
|
||||
func (intstr *IntOrString) IntValue() int {
|
||||
if intstr.Type == String {
|
||||
i, _ := strconv.Atoi(intstr.StrVal)
|
||||
@ -122,11 +123,11 @@ func (intstr IntOrString) MarshalJSON() ([]byte, error) {
|
||||
// the OpenAPI spec of this type.
|
||||
//
|
||||
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
|
||||
func (_ IntOrString) OpenAPISchemaType() []string { return []string{"string"} }
|
||||
func (IntOrString) OpenAPISchemaType() []string { return []string{"string"} }
|
||||
|
||||
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
func (_ IntOrString) OpenAPISchemaFormat() string { return "int-or-string" }
|
||||
func (IntOrString) OpenAPISchemaFormat() string { return "int-or-string" }
|
||||
|
||||
func (intstr *IntOrString) Fuzz(c fuzz.Continue) {
|
||||
if intstr == nil {
|
||||
|
53
vendor/k8s.io/apimachinery/pkg/util/json/json.go
generated
vendored
53
vendor/k8s.io/apimachinery/pkg/util/json/json.go
generated
vendored
@ -19,6 +19,7 @@ package json
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
@ -34,6 +35,9 @@ func Marshal(v interface{}) ([]byte, error) {
|
||||
return json.Marshal(v)
|
||||
}
|
||||
|
||||
// limit recursive depth to prevent stack overflow errors
|
||||
const maxDepth = 10000
|
||||
|
||||
// Unmarshal unmarshals the given data
|
||||
// If v is a *map[string]interface{}, numbers are converted to int64 or float64
|
||||
func Unmarshal(data []byte, v interface{}) error {
|
||||
@ -48,7 +52,7 @@ func Unmarshal(data []byte, v interface{}) error {
|
||||
return err
|
||||
}
|
||||
// If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64
|
||||
return convertMapNumbers(*v)
|
||||
return convertMapNumbers(*v, 0)
|
||||
|
||||
case *[]interface{}:
|
||||
// Build a decoder from the given data
|
||||
@ -60,25 +64,54 @@ func Unmarshal(data []byte, v interface{}) error {
|
||||
return err
|
||||
}
|
||||
// If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64
|
||||
return convertSliceNumbers(*v)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
func convertInterfaceNumbers(v *interface{}, depth int) error {
|
||||
var err error
|
||||
switch v2 := (*v).(type) {
|
||||
case json.Number:
|
||||
*v, err = convertNumber(v2)
|
||||
case map[string]interface{}:
|
||||
err = convertMapNumbers(v2, depth+1)
|
||||
case []interface{}:
|
||||
err = convertSliceNumbers(v2, depth+1)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// convertMapNumbers traverses the map, converting any json.Number values to int64 or float64.
|
||||
// values which are map[string]interface{} or []interface{} are recursively visited
|
||||
func convertMapNumbers(m map[string]interface{}) error {
|
||||
func convertMapNumbers(m map[string]interface{}, depth int) error {
|
||||
if depth > maxDepth {
|
||||
return fmt.Errorf("exceeded max depth of %d", maxDepth)
|
||||
}
|
||||
|
||||
var err error
|
||||
for k, v := range m {
|
||||
switch v := v.(type) {
|
||||
case json.Number:
|
||||
m[k], err = convertNumber(v)
|
||||
case map[string]interface{}:
|
||||
err = convertMapNumbers(v)
|
||||
err = convertMapNumbers(v, depth+1)
|
||||
case []interface{}:
|
||||
err = convertSliceNumbers(v)
|
||||
err = convertSliceNumbers(v, depth+1)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
@ -89,16 +122,20 @@ func convertMapNumbers(m map[string]interface{}) error {
|
||||
|
||||
// convertSliceNumbers traverses the slice, converting any json.Number values to int64 or float64.
|
||||
// values which are map[string]interface{} or []interface{} are recursively visited
|
||||
func convertSliceNumbers(s []interface{}) error {
|
||||
func convertSliceNumbers(s []interface{}, depth int) error {
|
||||
if depth > maxDepth {
|
||||
return fmt.Errorf("exceeded max depth of %d", maxDepth)
|
||||
}
|
||||
|
||||
var err error
|
||||
for i, v := range s {
|
||||
switch v := v.(type) {
|
||||
case json.Number:
|
||||
s[i], err = convertNumber(v)
|
||||
case map[string]interface{}:
|
||||
err = convertMapNumbers(v)
|
||||
err = convertMapNumbers(v, depth+1)
|
||||
case []interface{}:
|
||||
err = convertSliceNumbers(v)
|
||||
err = convertSliceNumbers(v, depth+1)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
|
2
vendor/k8s.io/apimachinery/pkg/util/naming/from_stack.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/util/naming/from_stack.go
generated
vendored
@ -82,7 +82,7 @@ var stackCreator = regexp.MustCompile(`(?m)^created by (.*)\n\s+(.*):(\d+) \+0x[
|
||||
func extractStackCreator() (string, int, bool) {
|
||||
stack := debug.Stack()
|
||||
matches := stackCreator.FindStringSubmatch(string(stack))
|
||||
if matches == nil || len(matches) != 4 {
|
||||
if len(matches) != 4 {
|
||||
return "", 0, false
|
||||
}
|
||||
line, err := strconv.Atoi(matches[3])
|
||||
|
376
vendor/k8s.io/apimachinery/pkg/util/net/http.go
generated
vendored
376
vendor/k8s.io/apimachinery/pkg/util/net/http.go
generated
vendored
@ -21,18 +21,24 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/net/http2"
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// JoinPreservingTrailingSlash does a path.Join of the specified elements,
|
||||
@ -55,6 +61,15 @@ func JoinPreservingTrailingSlash(elem ...string) string {
|
||||
return result
|
||||
}
|
||||
|
||||
// IsTimeout returns true if the given error is a network timeout error
|
||||
func IsTimeout(err error) bool {
|
||||
var neterr net.Error
|
||||
if errors.As(err, &neterr) {
|
||||
return neterr != nil && neterr.Timeout()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsProbableEOF returns true if the given error resembles a connection termination
|
||||
// scenario that would justify assuming that the watch is empty.
|
||||
// These errors are what the Go http stack returns back to us which are general
|
||||
@ -65,13 +80,16 @@ func IsProbableEOF(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
if uerr, ok := err.(*url.Error); ok {
|
||||
var uerr *url.Error
|
||||
if errors.As(err, &uerr) {
|
||||
err = uerr.Err
|
||||
}
|
||||
msg := err.Error()
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
return true
|
||||
case err == io.ErrUnexpectedEOF:
|
||||
return true
|
||||
case msg == "http: can't write HTTP request on broken connection":
|
||||
return true
|
||||
case strings.Contains(msg, "http2: server sent GOAWAY and closed the connection"):
|
||||
@ -101,6 +119,9 @@ func SetOldTransportDefaults(t *http.Transport) *http.Transport {
|
||||
if t.TLSHandshakeTimeout == 0 {
|
||||
t.TLSHandshakeTimeout = defaultTransport.TLSHandshakeTimeout
|
||||
}
|
||||
if t.IdleConnTimeout == 0 {
|
||||
t.IdleConnTimeout = defaultTransport.IdleConnTimeout
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
@ -111,14 +132,77 @@ func SetTransportDefaults(t *http.Transport) *http.Transport {
|
||||
// Allow clients to disable http2 if needed.
|
||||
if s := os.Getenv("DISABLE_HTTP2"); len(s) > 0 {
|
||||
klog.Infof("HTTP2 has been explicitly disabled")
|
||||
} else {
|
||||
if err := http2.ConfigureTransport(t); err != nil {
|
||||
} else if allowsHTTP2(t) {
|
||||
if err := configureHTTP2Transport(t); err != nil {
|
||||
klog.Warningf("Transport failed http2 configuration: %v", err)
|
||||
}
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
func readIdleTimeoutSeconds() int {
|
||||
ret := 30
|
||||
// User can set the readIdleTimeout to 0 to disable the HTTP/2
|
||||
// connection health check.
|
||||
if s := os.Getenv("HTTP2_READ_IDLE_TIMEOUT_SECONDS"); len(s) > 0 {
|
||||
i, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
klog.Warningf("Illegal HTTP2_READ_IDLE_TIMEOUT_SECONDS(%q): %v."+
|
||||
" Default value %d is used", s, err, ret)
|
||||
return ret
|
||||
}
|
||||
ret = i
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func pingTimeoutSeconds() int {
|
||||
ret := 15
|
||||
if s := os.Getenv("HTTP2_PING_TIMEOUT_SECONDS"); len(s) > 0 {
|
||||
i, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
klog.Warningf("Illegal HTTP2_PING_TIMEOUT_SECONDS(%q): %v."+
|
||||
" Default value %d is used", s, err, ret)
|
||||
return ret
|
||||
}
|
||||
ret = i
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func configureHTTP2Transport(t *http.Transport) error {
|
||||
t2, err := http2.ConfigureTransports(t)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// The following enables the HTTP/2 connection health check added in
|
||||
// https://github.com/golang/net/pull/55. The health check detects and
|
||||
// closes broken transport layer connections. Without the health check,
|
||||
// a broken connection can linger too long, e.g., a broken TCP
|
||||
// connection will be closed by the Linux kernel after 13 to 30 minutes
|
||||
// by default, which caused
|
||||
// https://github.com/kubernetes/client-go/issues/374 and
|
||||
// https://github.com/kubernetes/kubernetes/issues/87615.
|
||||
t2.ReadIdleTimeout = time.Duration(readIdleTimeoutSeconds()) * time.Second
|
||||
t2.PingTimeout = time.Duration(pingTimeoutSeconds()) * time.Second
|
||||
return nil
|
||||
}
|
||||
|
||||
func allowsHTTP2(t *http.Transport) bool {
|
||||
if t.TLSClientConfig == nil || len(t.TLSClientConfig.NextProtos) == 0 {
|
||||
// the transport expressed no NextProto preference, allow
|
||||
return true
|
||||
}
|
||||
for _, p := range t.TLSClientConfig.NextProtos {
|
||||
if p == http2.NextProtoTLS {
|
||||
// the transport explicitly allowed http/2
|
||||
return true
|
||||
}
|
||||
}
|
||||
// the transport explicitly set NextProtos and excluded http/2
|
||||
return false
|
||||
}
|
||||
|
||||
type RoundTripperWrapper interface {
|
||||
http.RoundTripper
|
||||
WrappedRoundTripper() http.RoundTripper
|
||||
@ -188,13 +272,17 @@ func GetHTTPClient(req *http.Request) string {
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
// SourceIPs splits the comma separated X-Forwarded-For header or returns the X-Real-Ip header or req.RemoteAddr,
|
||||
// in that order, ignoring invalid IPs. It returns nil if all of these are empty or invalid.
|
||||
// SourceIPs splits the comma separated X-Forwarded-For header and joins it with
|
||||
// the X-Real-Ip header and/or req.RemoteAddr, ignoring invalid IPs.
|
||||
// The X-Real-Ip is omitted if it's already present in the X-Forwarded-For chain.
|
||||
// The req.RemoteAddr is always the last IP in the returned list.
|
||||
// It returns nil if all of these are empty or invalid.
|
||||
func SourceIPs(req *http.Request) []net.IP {
|
||||
var srcIPs []net.IP
|
||||
|
||||
hdr := req.Header
|
||||
// First check the X-Forwarded-For header for requests via proxy.
|
||||
hdrForwardedFor := hdr.Get("X-Forwarded-For")
|
||||
forwardedForIPs := []net.IP{}
|
||||
if hdrForwardedFor != "" {
|
||||
// X-Forwarded-For can be a csv of IPs in case of multiple proxies.
|
||||
// Use the first valid one.
|
||||
@ -202,38 +290,49 @@ func SourceIPs(req *http.Request) []net.IP {
|
||||
for _, part := range parts {
|
||||
ip := net.ParseIP(strings.TrimSpace(part))
|
||||
if ip != nil {
|
||||
forwardedForIPs = append(forwardedForIPs, ip)
|
||||
srcIPs = append(srcIPs, ip)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(forwardedForIPs) > 0 {
|
||||
return forwardedForIPs
|
||||
}
|
||||
|
||||
// Try the X-Real-Ip header.
|
||||
hdrRealIp := hdr.Get("X-Real-Ip")
|
||||
if hdrRealIp != "" {
|
||||
ip := net.ParseIP(hdrRealIp)
|
||||
if ip != nil {
|
||||
return []net.IP{ip}
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to Remote Address in request, which will give the correct client IP when there is no proxy.
|
||||
// Always include the request Remote Address as it cannot be easily spoofed.
|
||||
var remoteIP 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 {
|
||||
if remoteIP := net.ParseIP(host); remoteIP != nil {
|
||||
return []net.IP{remoteIP}
|
||||
remoteIP = net.ParseIP(host)
|
||||
}
|
||||
// Fallback if Remote Address was just IP.
|
||||
if remoteIP == nil {
|
||||
remoteIP = net.ParseIP(req.RemoteAddr)
|
||||
}
|
||||
|
||||
// Don't duplicate remote IP if it's already the last address in the chain.
|
||||
if remoteIP != nil && (len(srcIPs) == 0 || !remoteIP.Equal(srcIPs[len(srcIPs)-1])) {
|
||||
srcIPs = append(srcIPs, remoteIP)
|
||||
}
|
||||
|
||||
return srcIPs
|
||||
}
|
||||
|
||||
// Checks whether the given IP address is contained in the list of IPs.
|
||||
func containsIP(ips []net.IP, ip net.IP) bool {
|
||||
for _, v := range ips {
|
||||
if v.Equal(ip) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback if Remote Address was just IP.
|
||||
if remoteIP := net.ParseIP(req.RemoteAddr); remoteIP != nil {
|
||||
return []net.IP{remoteIP}
|
||||
}
|
||||
|
||||
return nil
|
||||
return false
|
||||
}
|
||||
|
||||
// Extracts and returns the clients IP from the given request.
|
||||
@ -407,7 +506,7 @@ redirectLoop:
|
||||
|
||||
// Only follow redirects to the same host. Otherwise, propagate the redirect response back.
|
||||
if requireSameHostRedirects && location.Hostname() != originalLocation.Hostname() {
|
||||
break redirectLoop
|
||||
return nil, nil, fmt.Errorf("hostname mismatch: expected %s, found %s", originalLocation.Hostname(), location.Hostname())
|
||||
}
|
||||
|
||||
// Reset the connection.
|
||||
@ -443,3 +542,232 @@ func CloneHeader(in http.Header) http.Header {
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// WarningHeader contains a single RFC2616 14.46 warnings header
|
||||
type WarningHeader struct {
|
||||
// Codeindicates the type of warning. 299 is a miscellaneous persistent warning
|
||||
Code int
|
||||
// Agent contains the name or pseudonym of the server adding the Warning header.
|
||||
// A single "-" is recommended when agent is unknown.
|
||||
Agent string
|
||||
// Warning text
|
||||
Text string
|
||||
}
|
||||
|
||||
// ParseWarningHeaders extract RFC2616 14.46 warnings headers from the specified set of header values.
|
||||
// Multiple comma-separated warnings per header are supported.
|
||||
// If errors are encountered on a header, the remainder of that header are skipped and subsequent headers are parsed.
|
||||
// Returns successfully parsed warnings and any errors encountered.
|
||||
func ParseWarningHeaders(headers []string) ([]WarningHeader, []error) {
|
||||
var (
|
||||
results []WarningHeader
|
||||
errs []error
|
||||
)
|
||||
for _, header := range headers {
|
||||
for len(header) > 0 {
|
||||
result, remainder, err := ParseWarningHeader(header)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
break
|
||||
}
|
||||
results = append(results, result)
|
||||
header = remainder
|
||||
}
|
||||
}
|
||||
return results, errs
|
||||
}
|
||||
|
||||
var (
|
||||
codeMatcher = regexp.MustCompile(`^[0-9]{3}$`)
|
||||
wordDecoder = &mime.WordDecoder{}
|
||||
)
|
||||
|
||||
// ParseWarningHeader extracts one RFC2616 14.46 warning from the specified header,
|
||||
// returning an error if the header does not contain a correctly formatted warning.
|
||||
// Any remaining content in the header is returned.
|
||||
func ParseWarningHeader(header string) (result WarningHeader, remainder string, err error) {
|
||||
// https://tools.ietf.org/html/rfc2616#section-14.46
|
||||
// updated by
|
||||
// https://tools.ietf.org/html/rfc7234#section-5.5
|
||||
// https://tools.ietf.org/html/rfc7234#appendix-A
|
||||
// Some requirements regarding production and processing of the Warning
|
||||
// header fields have been relaxed, as it is not widely implemented.
|
||||
// Furthermore, the Warning header field no longer uses RFC 2047
|
||||
// encoding, nor does it allow multiple languages, as these aspects were
|
||||
// not implemented.
|
||||
//
|
||||
// Format is one of:
|
||||
// warn-code warn-agent "warn-text"
|
||||
// warn-code warn-agent "warn-text" "warn-date"
|
||||
//
|
||||
// warn-code is a three digit number
|
||||
// warn-agent is unquoted and contains no spaces
|
||||
// warn-text is quoted with backslash escaping (RFC2047-encoded according to RFC2616, not encoded according to RFC7234)
|
||||
// warn-date is optional, quoted, and in HTTP-date format (no embedded or escaped quotes)
|
||||
//
|
||||
// additional warnings can optionally be included in the same header by comma-separating them:
|
||||
// warn-code warn-agent "warn-text" "warn-date"[, warn-code warn-agent "warn-text" "warn-date", ...]
|
||||
|
||||
// tolerate leading whitespace
|
||||
header = strings.TrimSpace(header)
|
||||
|
||||
parts := strings.SplitN(header, " ", 3)
|
||||
if len(parts) != 3 {
|
||||
return WarningHeader{}, "", errors.New("invalid warning header: fewer than 3 segments")
|
||||
}
|
||||
code, agent, textDateRemainder := parts[0], parts[1], parts[2]
|
||||
|
||||
// verify code format
|
||||
if !codeMatcher.Match([]byte(code)) {
|
||||
return WarningHeader{}, "", errors.New("invalid warning header: code segment is not 3 digits between 100-299")
|
||||
}
|
||||
codeInt, _ := strconv.ParseInt(code, 10, 64)
|
||||
|
||||
// verify agent presence
|
||||
if len(agent) == 0 {
|
||||
return WarningHeader{}, "", errors.New("invalid warning header: empty agent segment")
|
||||
}
|
||||
if !utf8.ValidString(agent) || hasAnyRunes(agent, unicode.IsControl) {
|
||||
return WarningHeader{}, "", errors.New("invalid warning header: invalid agent")
|
||||
}
|
||||
|
||||
// verify textDateRemainder presence
|
||||
if len(textDateRemainder) == 0 {
|
||||
return WarningHeader{}, "", errors.New("invalid warning header: empty text segment")
|
||||
}
|
||||
|
||||
// extract text
|
||||
text, dateAndRemainder, err := parseQuotedString(textDateRemainder)
|
||||
if err != nil {
|
||||
return WarningHeader{}, "", fmt.Errorf("invalid warning header: %v", err)
|
||||
}
|
||||
// tolerate RFC2047-encoded text from warnings produced according to RFC2616
|
||||
if decodedText, err := wordDecoder.DecodeHeader(text); err == nil {
|
||||
text = decodedText
|
||||
}
|
||||
if !utf8.ValidString(text) || hasAnyRunes(text, unicode.IsControl) {
|
||||
return WarningHeader{}, "", errors.New("invalid warning header: invalid text")
|
||||
}
|
||||
result = WarningHeader{Code: int(codeInt), Agent: agent, Text: text}
|
||||
|
||||
if len(dateAndRemainder) > 0 {
|
||||
if dateAndRemainder[0] == '"' {
|
||||
// consume date
|
||||
foundEndQuote := false
|
||||
for i := 1; i < len(dateAndRemainder); i++ {
|
||||
if dateAndRemainder[i] == '"' {
|
||||
foundEndQuote = true
|
||||
remainder = strings.TrimSpace(dateAndRemainder[i+1:])
|
||||
break
|
||||
}
|
||||
}
|
||||
if !foundEndQuote {
|
||||
return WarningHeader{}, "", errors.New("invalid warning header: unterminated date segment")
|
||||
}
|
||||
} else {
|
||||
remainder = dateAndRemainder
|
||||
}
|
||||
}
|
||||
if len(remainder) > 0 {
|
||||
if remainder[0] == ',' {
|
||||
// consume comma if present
|
||||
remainder = strings.TrimSpace(remainder[1:])
|
||||
} else {
|
||||
return WarningHeader{}, "", errors.New("invalid warning header: unexpected token after warn-date")
|
||||
}
|
||||
}
|
||||
|
||||
return result, remainder, nil
|
||||
}
|
||||
|
||||
func parseQuotedString(quotedString string) (string, string, error) {
|
||||
if len(quotedString) == 0 {
|
||||
return "", "", errors.New("invalid quoted string: 0-length")
|
||||
}
|
||||
|
||||
if quotedString[0] != '"' {
|
||||
return "", "", errors.New("invalid quoted string: missing initial quote")
|
||||
}
|
||||
|
||||
quotedString = quotedString[1:]
|
||||
var remainder string
|
||||
escaping := false
|
||||
closedQuote := false
|
||||
result := &bytes.Buffer{}
|
||||
loop:
|
||||
for i := 0; i < len(quotedString); i++ {
|
||||
b := quotedString[i]
|
||||
switch b {
|
||||
case '"':
|
||||
if escaping {
|
||||
result.WriteByte(b)
|
||||
escaping = false
|
||||
} else {
|
||||
closedQuote = true
|
||||
remainder = strings.TrimSpace(quotedString[i+1:])
|
||||
break loop
|
||||
}
|
||||
case '\\':
|
||||
if escaping {
|
||||
result.WriteByte(b)
|
||||
escaping = false
|
||||
} else {
|
||||
escaping = true
|
||||
}
|
||||
default:
|
||||
result.WriteByte(b)
|
||||
escaping = false
|
||||
}
|
||||
}
|
||||
|
||||
if !closedQuote {
|
||||
return "", "", errors.New("invalid quoted string: missing closing quote")
|
||||
}
|
||||
return result.String(), remainder, nil
|
||||
}
|
||||
|
||||
func NewWarningHeader(code int, agent, text string) (string, error) {
|
||||
if code < 0 || code > 999 {
|
||||
return "", errors.New("code must be between 0 and 999")
|
||||
}
|
||||
if len(agent) == 0 {
|
||||
agent = "-"
|
||||
} else if !utf8.ValidString(agent) || strings.ContainsAny(agent, `\"`) || hasAnyRunes(agent, unicode.IsSpace, unicode.IsControl) {
|
||||
return "", errors.New("agent must be valid UTF-8 and must not contain spaces, quotes, backslashes, or control characters")
|
||||
}
|
||||
if !utf8.ValidString(text) || hasAnyRunes(text, unicode.IsControl) {
|
||||
return "", errors.New("text must be valid UTF-8 and must not contain control characters")
|
||||
}
|
||||
return fmt.Sprintf("%03d %s %s", code, agent, makeQuotedString(text)), nil
|
||||
}
|
||||
|
||||
func hasAnyRunes(s string, runeCheckers ...func(rune) bool) bool {
|
||||
for _, r := range s {
|
||||
for _, checker := range runeCheckers {
|
||||
if checker(r) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func makeQuotedString(s string) string {
|
||||
result := &bytes.Buffer{}
|
||||
// opening quote
|
||||
result.WriteRune('"')
|
||||
for _, c := range s {
|
||||
switch c {
|
||||
case '"', '\\':
|
||||
// escape " and \
|
||||
result.WriteRune('\\')
|
||||
result.WriteRune(c)
|
||||
default:
|
||||
// write everything else as-is
|
||||
result.WriteRune(c)
|
||||
}
|
||||
}
|
||||
// closing quote
|
||||
result.WriteRune('"')
|
||||
return result.String()
|
||||
}
|
||||
|
75
vendor/k8s.io/apimachinery/pkg/util/net/interface.go
generated
vendored
75
vendor/k8s.io/apimachinery/pkg/util/net/interface.go
generated
vendored
@ -26,7 +26,7 @@ import (
|
||||
|
||||
"strings"
|
||||
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
type AddressFamily uint
|
||||
@ -36,6 +36,18 @@ const (
|
||||
familyIPv6 AddressFamily = 6
|
||||
)
|
||||
|
||||
type AddressFamilyPreference []AddressFamily
|
||||
|
||||
var (
|
||||
preferIPv4 = AddressFamilyPreference{familyIPv4, familyIPv6}
|
||||
preferIPv6 = AddressFamilyPreference{familyIPv6, familyIPv4}
|
||||
)
|
||||
|
||||
const (
|
||||
// LoopbackInterfaceName is the default name of the loopback interface
|
||||
LoopbackInterfaceName = "lo"
|
||||
)
|
||||
|
||||
const (
|
||||
ipv4RouteFile = "/proc/net/route"
|
||||
ipv6RouteFile = "/proc/net/ipv6_route"
|
||||
@ -53,7 +65,7 @@ type RouteFile struct {
|
||||
parse func(input io.Reader) ([]Route, error)
|
||||
}
|
||||
|
||||
// noRoutesError can be returned by ChooseBindAddress() in case of no routes
|
||||
// noRoutesError can be returned in case of no routes
|
||||
type noRoutesError struct {
|
||||
message string
|
||||
}
|
||||
@ -254,7 +266,7 @@ func getIPFromInterface(intfName string, forFamily AddressFamily, nw networkInte
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// memberOF tells if the IP is of the desired family. Used for checking interface addresses.
|
||||
// memberOf tells if the IP is of the desired family. Used for checking interface addresses.
|
||||
func memberOf(ip net.IP, family AddressFamily) bool {
|
||||
if ip.To4() != nil {
|
||||
return family == familyIPv4
|
||||
@ -265,8 +277,8 @@ func memberOf(ip net.IP, family AddressFamily) bool {
|
||||
|
||||
// chooseIPFromHostInterfaces looks at all system interfaces, trying to find one that is up that
|
||||
// has a global unicast address (non-loopback, non-link local, non-point2point), and returns the IP.
|
||||
// Searches for IPv4 addresses, and then IPv6 addresses.
|
||||
func chooseIPFromHostInterfaces(nw networkInterfacer) (net.IP, error) {
|
||||
// addressFamilies determines whether it prefers IPv4 or IPv6
|
||||
func chooseIPFromHostInterfaces(nw networkInterfacer, addressFamilies AddressFamilyPreference) (net.IP, error) {
|
||||
intfs, err := nw.Interfaces()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -274,7 +286,7 @@ func chooseIPFromHostInterfaces(nw networkInterfacer) (net.IP, error) {
|
||||
if len(intfs) == 0 {
|
||||
return nil, fmt.Errorf("no interfaces found on host.")
|
||||
}
|
||||
for _, family := range []AddressFamily{familyIPv4, familyIPv6} {
|
||||
for _, family := range addressFamilies {
|
||||
klog.V(4).Infof("Looking for system interface with a global IPv%d address", uint(family))
|
||||
for _, intf := range intfs {
|
||||
if !isInterfaceUp(&intf) {
|
||||
@ -321,15 +333,19 @@ func chooseIPFromHostInterfaces(nw networkInterfacer) (net.IP, error) {
|
||||
// IP of the interface with a gateway on it (with priority given to IPv4). For a node
|
||||
// with no internet connection, it returns error.
|
||||
func ChooseHostInterface() (net.IP, error) {
|
||||
return chooseHostInterface(preferIPv4)
|
||||
}
|
||||
|
||||
func chooseHostInterface(addressFamilies AddressFamilyPreference) (net.IP, error) {
|
||||
var nw networkInterfacer = networkInterface{}
|
||||
if _, err := os.Stat(ipv4RouteFile); os.IsNotExist(err) {
|
||||
return chooseIPFromHostInterfaces(nw)
|
||||
return chooseIPFromHostInterfaces(nw, addressFamilies)
|
||||
}
|
||||
routes, err := getAllDefaultRoutes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return chooseHostInterfaceFromRoute(routes, nw)
|
||||
return chooseHostInterfaceFromRoute(routes, nw, addressFamilies)
|
||||
}
|
||||
|
||||
// networkInterfacer defines an interface for several net library functions. Production
|
||||
@ -377,10 +393,10 @@ func getAllDefaultRoutes() ([]Route, error) {
|
||||
}
|
||||
|
||||
// chooseHostInterfaceFromRoute cycles through each default route provided, looking for a
|
||||
// global IP address from the interface for the route. Will first look all each IPv4 route for
|
||||
// an IPv4 IP, and then will look at each IPv6 route for an IPv6 IP.
|
||||
func chooseHostInterfaceFromRoute(routes []Route, nw networkInterfacer) (net.IP, error) {
|
||||
for _, family := range []AddressFamily{familyIPv4, familyIPv6} {
|
||||
// global IP address from the interface for the route. addressFamilies determines whether it
|
||||
// prefers IPv4 or IPv6
|
||||
func chooseHostInterfaceFromRoute(routes []Route, nw networkInterfacer, addressFamilies AddressFamilyPreference) (net.IP, error) {
|
||||
for _, family := range addressFamilies {
|
||||
klog.V(4).Infof("Looking for default routes with IPv%d addresses", uint(family))
|
||||
for _, route := range routes {
|
||||
if route.Family != family {
|
||||
@ -401,12 +417,19 @@ func chooseHostInterfaceFromRoute(routes []Route, nw networkInterfacer) (net.IP,
|
||||
return nil, fmt.Errorf("unable to select an IP from default routes.")
|
||||
}
|
||||
|
||||
// If bind-address is usable, return it directly
|
||||
// If bind-address is not usable (unset, 0.0.0.0, or loopback), we will use the host's default
|
||||
// interface.
|
||||
func ChooseBindAddress(bindAddress net.IP) (net.IP, error) {
|
||||
// ResolveBindAddress returns the IP address of a daemon, based on the given bindAddress:
|
||||
// If bindAddress is unset, it returns the host's default IP, as with ChooseHostInterface().
|
||||
// If bindAddress is unspecified or loopback, it returns the default IP of the same
|
||||
// address family as bindAddress.
|
||||
// Otherwise, it just returns bindAddress.
|
||||
func ResolveBindAddress(bindAddress net.IP) (net.IP, error) {
|
||||
addressFamilies := preferIPv4
|
||||
if bindAddress != nil && memberOf(bindAddress, familyIPv6) {
|
||||
addressFamilies = preferIPv6
|
||||
}
|
||||
|
||||
if bindAddress == nil || bindAddress.IsUnspecified() || bindAddress.IsLoopback() {
|
||||
hostIP, err := ChooseHostInterface()
|
||||
hostIP, err := chooseHostInterface(addressFamilies)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -414,3 +437,21 @@ func ChooseBindAddress(bindAddress net.IP) (net.IP, error) {
|
||||
}
|
||||
return bindAddress, nil
|
||||
}
|
||||
|
||||
// ChooseBindAddressForInterface choose a global IP for a specific interface, with priority given to IPv4.
|
||||
// This is required in case of network setups where default routes are present, but network
|
||||
// interfaces use only link-local addresses (e.g. as described in RFC5549).
|
||||
// e.g when using BGP to announce a host IP over link-local ip addresses and this ip address is attached to the lo interface.
|
||||
func ChooseBindAddressForInterface(intfName string) (net.IP, error) {
|
||||
var nw networkInterfacer = networkInterface{}
|
||||
for _, family := range preferIPv4 {
|
||||
ip, err := getIPFromInterface(intfName, family, nw)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if ip != nil {
|
||||
return ip, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("unable to select an IP from %s network interface", intfName)
|
||||
}
|
||||
|
26
vendor/k8s.io/apimachinery/pkg/util/net/util.go
generated
vendored
26
vendor/k8s.io/apimachinery/pkg/util/net/util.go
generated
vendored
@ -17,9 +17,8 @@ limitations under the License.
|
||||
package net
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"reflect"
|
||||
"syscall"
|
||||
)
|
||||
@ -40,17 +39,18 @@ func IPNetEqual(ipnet1, ipnet2 *net.IPNet) bool {
|
||||
|
||||
// Returns if the given err is "connection reset by peer" error.
|
||||
func IsConnectionReset(err error) bool {
|
||||
if urlErr, ok := err.(*url.Error); ok {
|
||||
err = urlErr.Err
|
||||
}
|
||||
if opErr, ok := err.(*net.OpError); ok {
|
||||
err = opErr.Err
|
||||
}
|
||||
if osErr, ok := err.(*os.SyscallError); ok {
|
||||
err = osErr.Err
|
||||
}
|
||||
if errno, ok := err.(syscall.Errno); ok && errno == syscall.ECONNRESET {
|
||||
return true
|
||||
var errno syscall.Errno
|
||||
if errors.As(err, &errno) {
|
||||
return errno == syscall.ECONNRESET
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Returns if the given err is "connection refused" error
|
||||
func IsConnectionRefused(err error) bool {
|
||||
var errno syscall.Errno
|
||||
if errors.As(err, &errno) {
|
||||
return errno == syscall.ECONNREFUSED
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
52
vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
generated
vendored
52
vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
generated
vendored
@ -18,11 +18,12 @@ package runtime
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -40,11 +41,7 @@ var PanicHandlers = []func(interface{}){logPanic}
|
||||
// called in case of panic. HandleCrash actually crashes, after calling the
|
||||
// handlers and logging the panic message.
|
||||
//
|
||||
// TODO: remove this function. We are switching to a world where it's safe for
|
||||
// apiserver to panic, since it will be restarted by kubelet. At the beginning
|
||||
// of the Kubernetes project, nothing was going to restart apiserver and so
|
||||
// catching panics was important. But it's actually much simpler for monitoring
|
||||
// software if we just exit when an unexpected panic happens.
|
||||
// E.g., you can provide one or more additional handlers for something like shutting down go routines gracefully.
|
||||
func HandleCrash(additionalHandlers ...func(interface{})) {
|
||||
if r := recover(); r != nil {
|
||||
for _, fn := range PanicHandlers {
|
||||
@ -60,29 +57,28 @@ func HandleCrash(additionalHandlers ...func(interface{})) {
|
||||
}
|
||||
}
|
||||
|
||||
// logPanic logs the caller tree when a panic occurs.
|
||||
// logPanic logs the caller tree when a panic occurs (except in the special case of http.ErrAbortHandler).
|
||||
func logPanic(r interface{}) {
|
||||
callers := getCallers(r)
|
||||
if r == http.ErrAbortHandler {
|
||||
// honor the http.ErrAbortHandler sentinel panic value:
|
||||
// ErrAbortHandler is a sentinel panic value to abort a handler.
|
||||
// While any panic from ServeHTTP aborts the response to the client,
|
||||
// panicking with ErrAbortHandler also suppresses logging of a stack trace to the server's error log.
|
||||
return
|
||||
}
|
||||
|
||||
// Same as stdlib http server code. Manually allocate stack trace buffer size
|
||||
// to prevent excessively large logs
|
||||
const size = 64 << 10
|
||||
stacktrace := make([]byte, size)
|
||||
stacktrace = stacktrace[:runtime.Stack(stacktrace, false)]
|
||||
if _, ok := r.(string); ok {
|
||||
klog.Errorf("Observed a panic: %s\n%v", r, callers)
|
||||
klog.Errorf("Observed a panic: %s\n%s", r, stacktrace)
|
||||
} else {
|
||||
klog.Errorf("Observed a panic: %#v (%v)\n%v", r, r, callers)
|
||||
klog.Errorf("Observed a panic: %#v (%v)\n%s", r, r, stacktrace)
|
||||
}
|
||||
}
|
||||
|
||||
func getCallers(r interface{}) string {
|
||||
callers := ""
|
||||
for i := 0; true; i++ {
|
||||
_, file, line, ok := runtime.Caller(i)
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
callers = callers + fmt.Sprintf("%v:%v\n", file, line)
|
||||
}
|
||||
|
||||
return callers
|
||||
}
|
||||
|
||||
// ErrorHandlers is a list of functions which will be invoked when an unreturnable
|
||||
// error occurs.
|
||||
// TODO(lavalamp): for testability, this and the below HandleError function
|
||||
@ -155,13 +151,17 @@ func GetCaller() string {
|
||||
// handlers to handle errors and panics the same way.
|
||||
func RecoverFromPanic(err *error) {
|
||||
if r := recover(); r != nil {
|
||||
callers := getCallers(r)
|
||||
// Same as stdlib http server code. Manually allocate stack trace buffer size
|
||||
// to prevent excessively large logs
|
||||
const size = 64 << 10
|
||||
stacktrace := make([]byte, size)
|
||||
stacktrace = stacktrace[:runtime.Stack(stacktrace, false)]
|
||||
|
||||
*err = fmt.Errorf(
|
||||
"recovered from panic %q. (err=%v) Call stack:\n%v",
|
||||
"recovered from panic %q. (err=%v) Call stack:\n%s",
|
||||
r,
|
||||
*err,
|
||||
callers)
|
||||
stacktrace)
|
||||
}
|
||||
}
|
||||
|
||||
|
6
vendor/k8s.io/apimachinery/pkg/util/sets/byte.go
generated
vendored
6
vendor/k8s.io/apimachinery/pkg/util/sets/byte.go
generated
vendored
@ -46,17 +46,19 @@ func ByteKeySet(theMap interface{}) Byte {
|
||||
}
|
||||
|
||||
// Insert adds items to the set.
|
||||
func (s Byte) Insert(items ...byte) {
|
||||
func (s Byte) Insert(items ...byte) Byte {
|
||||
for _, item := range items {
|
||||
s[item] = Empty{}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Delete removes all items from the set.
|
||||
func (s Byte) Delete(items ...byte) {
|
||||
func (s Byte) Delete(items ...byte) Byte {
|
||||
for _, item := range items {
|
||||
delete(s, item)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Has returns true if and only if item is contained in the set.
|
||||
|
6
vendor/k8s.io/apimachinery/pkg/util/sets/int.go
generated
vendored
6
vendor/k8s.io/apimachinery/pkg/util/sets/int.go
generated
vendored
@ -46,17 +46,19 @@ func IntKeySet(theMap interface{}) Int {
|
||||
}
|
||||
|
||||
// Insert adds items to the set.
|
||||
func (s Int) Insert(items ...int) {
|
||||
func (s Int) Insert(items ...int) Int {
|
||||
for _, item := range items {
|
||||
s[item] = Empty{}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Delete removes all items from the set.
|
||||
func (s Int) Delete(items ...int) {
|
||||
func (s Int) Delete(items ...int) Int {
|
||||
for _, item := range items {
|
||||
delete(s, item)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Has returns true if and only if item is contained in the set.
|
||||
|
205
vendor/k8s.io/apimachinery/pkg/util/sets/int32.go
generated
vendored
Normal file
205
vendor/k8s.io/apimachinery/pkg/util/sets/int32.go
generated
vendored
Normal file
@ -0,0 +1,205 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by set-gen. DO NOT EDIT.
|
||||
|
||||
package sets
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"sort"
|
||||
)
|
||||
|
||||
// sets.Int32 is a set of int32s, implemented via map[int32]struct{} for minimal memory consumption.
|
||||
type Int32 map[int32]Empty
|
||||
|
||||
// NewInt32 creates a Int32 from a list of values.
|
||||
func NewInt32(items ...int32) Int32 {
|
||||
ss := Int32{}
|
||||
ss.Insert(items...)
|
||||
return ss
|
||||
}
|
||||
|
||||
// Int32KeySet creates a Int32 from a keys of a map[int32](? extends interface{}).
|
||||
// If the value passed in is not actually a map, this will panic.
|
||||
func Int32KeySet(theMap interface{}) Int32 {
|
||||
v := reflect.ValueOf(theMap)
|
||||
ret := Int32{}
|
||||
|
||||
for _, keyValue := range v.MapKeys() {
|
||||
ret.Insert(keyValue.Interface().(int32))
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// Insert adds items to the set.
|
||||
func (s Int32) Insert(items ...int32) Int32 {
|
||||
for _, item := range items {
|
||||
s[item] = Empty{}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Delete removes all items from the set.
|
||||
func (s Int32) Delete(items ...int32) Int32 {
|
||||
for _, item := range items {
|
||||
delete(s, item)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Has returns true if and only if item is contained in the set.
|
||||
func (s Int32) Has(item int32) bool {
|
||||
_, contained := s[item]
|
||||
return contained
|
||||
}
|
||||
|
||||
// HasAll returns true if and only if all items are contained in the set.
|
||||
func (s Int32) HasAll(items ...int32) bool {
|
||||
for _, item := range items {
|
||||
if !s.Has(item) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// HasAny returns true if any items are contained in the set.
|
||||
func (s Int32) HasAny(items ...int32) bool {
|
||||
for _, item := range items {
|
||||
if s.Has(item) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Difference returns a set of objects that are not in s2
|
||||
// For example:
|
||||
// s1 = {a1, a2, a3}
|
||||
// s2 = {a1, a2, a4, a5}
|
||||
// s1.Difference(s2) = {a3}
|
||||
// s2.Difference(s1) = {a4, a5}
|
||||
func (s Int32) Difference(s2 Int32) Int32 {
|
||||
result := NewInt32()
|
||||
for key := range s {
|
||||
if !s2.Has(key) {
|
||||
result.Insert(key)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Union returns a new set which includes items in either s1 or s2.
|
||||
// For example:
|
||||
// s1 = {a1, a2}
|
||||
// s2 = {a3, a4}
|
||||
// s1.Union(s2) = {a1, a2, a3, a4}
|
||||
// s2.Union(s1) = {a1, a2, a3, a4}
|
||||
func (s1 Int32) Union(s2 Int32) Int32 {
|
||||
result := NewInt32()
|
||||
for key := range s1 {
|
||||
result.Insert(key)
|
||||
}
|
||||
for key := range s2 {
|
||||
result.Insert(key)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Intersection returns a new set which includes the item in BOTH s1 and s2
|
||||
// For example:
|
||||
// s1 = {a1, a2}
|
||||
// s2 = {a2, a3}
|
||||
// s1.Intersection(s2) = {a2}
|
||||
func (s1 Int32) Intersection(s2 Int32) Int32 {
|
||||
var walk, other Int32
|
||||
result := NewInt32()
|
||||
if s1.Len() < s2.Len() {
|
||||
walk = s1
|
||||
other = s2
|
||||
} else {
|
||||
walk = s2
|
||||
other = s1
|
||||
}
|
||||
for key := range walk {
|
||||
if other.Has(key) {
|
||||
result.Insert(key)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// IsSuperset returns true if and only if s1 is a superset of s2.
|
||||
func (s1 Int32) IsSuperset(s2 Int32) bool {
|
||||
for item := range s2 {
|
||||
if !s1.Has(item) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Equal returns true if and only if s1 is equal (as a set) to s2.
|
||||
// Two sets are equal if their membership is identical.
|
||||
// (In practice, this means same elements, order doesn't matter)
|
||||
func (s1 Int32) Equal(s2 Int32) bool {
|
||||
return len(s1) == len(s2) && s1.IsSuperset(s2)
|
||||
}
|
||||
|
||||
type sortableSliceOfInt32 []int32
|
||||
|
||||
func (s sortableSliceOfInt32) Len() int { return len(s) }
|
||||
func (s sortableSliceOfInt32) Less(i, j int) bool { return lessInt32(s[i], s[j]) }
|
||||
func (s sortableSliceOfInt32) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
|
||||
// List returns the contents as a sorted int32 slice.
|
||||
func (s Int32) List() []int32 {
|
||||
res := make(sortableSliceOfInt32, 0, len(s))
|
||||
for key := range s {
|
||||
res = append(res, key)
|
||||
}
|
||||
sort.Sort(res)
|
||||
return []int32(res)
|
||||
}
|
||||
|
||||
// UnsortedList returns the slice with contents in random order.
|
||||
func (s Int32) UnsortedList() []int32 {
|
||||
res := make([]int32, 0, len(s))
|
||||
for key := range s {
|
||||
res = append(res, key)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// Returns a single element from the set.
|
||||
func (s Int32) PopAny() (int32, bool) {
|
||||
for key := range s {
|
||||
s.Delete(key)
|
||||
return key, true
|
||||
}
|
||||
var zeroValue int32
|
||||
return zeroValue, false
|
||||
}
|
||||
|
||||
// Len returns the size of the set.
|
||||
func (s Int32) Len() int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
func lessInt32(lhs, rhs int32) bool {
|
||||
return lhs < rhs
|
||||
}
|
6
vendor/k8s.io/apimachinery/pkg/util/sets/int64.go
generated
vendored
6
vendor/k8s.io/apimachinery/pkg/util/sets/int64.go
generated
vendored
@ -46,17 +46,19 @@ func Int64KeySet(theMap interface{}) Int64 {
|
||||
}
|
||||
|
||||
// Insert adds items to the set.
|
||||
func (s Int64) Insert(items ...int64) {
|
||||
func (s Int64) Insert(items ...int64) Int64 {
|
||||
for _, item := range items {
|
||||
s[item] = Empty{}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Delete removes all items from the set.
|
||||
func (s Int64) Delete(items ...int64) {
|
||||
func (s Int64) Delete(items ...int64) Int64 {
|
||||
for _, item := range items {
|
||||
delete(s, item)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Has returns true if and only if item is contained in the set.
|
||||
|
6
vendor/k8s.io/apimachinery/pkg/util/sets/string.go
generated
vendored
6
vendor/k8s.io/apimachinery/pkg/util/sets/string.go
generated
vendored
@ -46,17 +46,19 @@ func StringKeySet(theMap interface{}) String {
|
||||
}
|
||||
|
||||
// Insert adds items to the set.
|
||||
func (s String) Insert(items ...string) {
|
||||
func (s String) Insert(items ...string) String {
|
||||
for _, item := range items {
|
||||
s[item] = Empty{}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Delete removes all items from the set.
|
||||
func (s String) Delete(items ...string) {
|
||||
func (s String) Delete(items ...string) String {
|
||||
for _, item := range items {
|
||||
delete(s, item)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Has returns true if and only if item is contained in the set.
|
||||
|
15
vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go
generated
vendored
15
vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go
generated
vendored
@ -116,6 +116,10 @@ const (
|
||||
// This is similar to ErrorTypeInvalid, but the error will not include the
|
||||
// too-long value. See TooLong().
|
||||
ErrorTypeTooLong ErrorType = "FieldValueTooLong"
|
||||
// ErrorTypeTooMany is used to report "too many". This is used to
|
||||
// report that a given list has too many items. This is similar to FieldValueTooLong,
|
||||
// but the error indicates quantity instead of length.
|
||||
ErrorTypeTooMany ErrorType = "FieldValueTooMany"
|
||||
// ErrorTypeInternal is used to report other errors that are not related
|
||||
// to user input. See InternalError().
|
||||
ErrorTypeInternal ErrorType = "InternalError"
|
||||
@ -138,6 +142,8 @@ func (t ErrorType) String() string {
|
||||
return "Forbidden"
|
||||
case ErrorTypeTooLong:
|
||||
return "Too long"
|
||||
case ErrorTypeTooMany:
|
||||
return "Too many"
|
||||
case ErrorTypeInternal:
|
||||
return "Internal error"
|
||||
default:
|
||||
@ -198,7 +204,14 @@ func Forbidden(field *Path, detail string) *Error {
|
||||
// Invalid, but the returned error will not include the too-long
|
||||
// value.
|
||||
func TooLong(field *Path, value interface{}, maxLength int) *Error {
|
||||
return &Error{ErrorTypeTooLong, field.String(), value, fmt.Sprintf("must have at most %d characters", maxLength)}
|
||||
return &Error{ErrorTypeTooLong, field.String(), value, fmt.Sprintf("must have at most %d bytes", maxLength)}
|
||||
}
|
||||
|
||||
// TooMany returns a *Error indicating "too many". This is used to
|
||||
// report that a given list has too many items. This is similar to TooLong,
|
||||
// but the returned error indicates quantity instead of length.
|
||||
func TooMany(field *Path, actualQuantity, maxQuantity int) *Error {
|
||||
return &Error{ErrorTypeTooMany, field.String(), actualQuantity, fmt.Sprintf("must have at most %d items", maxQuantity)}
|
||||
}
|
||||
|
||||
// InternalError returns a *Error indicating "internal error". This is used
|
||||
|
89
vendor/k8s.io/apimachinery/pkg/util/validation/validation.go
generated
vendored
89
vendor/k8s.io/apimachinery/pkg/util/validation/validation.go
generated
vendored
@ -70,7 +70,11 @@ func IsQualifiedName(value string) []string {
|
||||
return errs
|
||||
}
|
||||
|
||||
// IsFullyQualifiedName checks if the name is fully qualified.
|
||||
// IsFullyQualifiedName checks if the name is fully qualified. This is similar
|
||||
// to IsFullyQualifiedDomainName but requires a minimum of 3 segments instead of
|
||||
// 2 and does not accept a trailing . as valid.
|
||||
// TODO: This function is deprecated and preserved until all callers migrate to
|
||||
// IsFullyQualifiedDomainName; please don't add new callers.
|
||||
func IsFullyQualifiedName(fldPath *field.Path, name string) field.ErrorList {
|
||||
var allErrors field.ErrorList
|
||||
if len(name) == 0 {
|
||||
@ -85,6 +89,69 @@ func IsFullyQualifiedName(fldPath *field.Path, name string) field.ErrorList {
|
||||
return allErrors
|
||||
}
|
||||
|
||||
// IsFullyQualifiedDomainName checks if the domain name is fully qualified. This
|
||||
// is similar to IsFullyQualifiedName but only requires a minimum of 2 segments
|
||||
// instead of 3 and accepts a trailing . as valid.
|
||||
func IsFullyQualifiedDomainName(fldPath *field.Path, name string) field.ErrorList {
|
||||
var allErrors field.ErrorList
|
||||
if len(name) == 0 {
|
||||
return append(allErrors, field.Required(fldPath, ""))
|
||||
}
|
||||
if strings.HasSuffix(name, ".") {
|
||||
name = name[:len(name)-1]
|
||||
}
|
||||
if errs := IsDNS1123Subdomain(name); len(errs) > 0 {
|
||||
return append(allErrors, field.Invalid(fldPath, name, strings.Join(errs, ",")))
|
||||
}
|
||||
if len(strings.Split(name, ".")) < 2 {
|
||||
return append(allErrors, field.Invalid(fldPath, name, "should be a domain with at least two segments separated by dots"))
|
||||
}
|
||||
for _, label := range strings.Split(name, ".") {
|
||||
if errs := IsDNS1123Label(label); len(errs) > 0 {
|
||||
return append(allErrors, field.Invalid(fldPath, label, strings.Join(errs, ",")))
|
||||
}
|
||||
}
|
||||
return allErrors
|
||||
}
|
||||
|
||||
// Allowed characters in an HTTP Path as defined by RFC 3986. A HTTP path may
|
||||
// contain:
|
||||
// * unreserved characters (alphanumeric, '-', '.', '_', '~')
|
||||
// * percent-encoded octets
|
||||
// * sub-delims ("!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=")
|
||||
// * a colon character (":")
|
||||
const httpPathFmt string = `[A-Za-z0-9/\-._~%!$&'()*+,;=:]+`
|
||||
|
||||
var httpPathRegexp = regexp.MustCompile("^" + httpPathFmt + "$")
|
||||
|
||||
// IsDomainPrefixedPath checks if the given string is a domain-prefixed path
|
||||
// (e.g. acme.io/foo). All characters before the first "/" must be a valid
|
||||
// subdomain as defined by RFC 1123. All characters trailing the first "/" must
|
||||
// be valid HTTP Path characters as defined by RFC 3986.
|
||||
func IsDomainPrefixedPath(fldPath *field.Path, dpPath string) field.ErrorList {
|
||||
var allErrs field.ErrorList
|
||||
if len(dpPath) == 0 {
|
||||
return append(allErrs, field.Required(fldPath, ""))
|
||||
}
|
||||
|
||||
segments := strings.SplitN(dpPath, "/", 2)
|
||||
if len(segments) != 2 || len(segments[0]) == 0 || len(segments[1]) == 0 {
|
||||
return append(allErrs, field.Invalid(fldPath, dpPath, "must be a domain-prefixed path (such as \"acme.io/foo\")"))
|
||||
}
|
||||
|
||||
host := segments[0]
|
||||
for _, err := range IsDNS1123Subdomain(host) {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, host, err))
|
||||
}
|
||||
|
||||
path := segments[1]
|
||||
if !httpPathRegexp.MatchString(path) {
|
||||
return append(allErrs, field.Invalid(fldPath, path, RegexError("Invalid path", httpPathFmt)))
|
||||
}
|
||||
|
||||
return allErrs
|
||||
}
|
||||
|
||||
const labelValueFmt string = "(" + qualifiedNameFmt + ")?"
|
||||
const labelValueErrMsg string = "a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character"
|
||||
|
||||
@ -285,6 +352,26 @@ func IsValidIP(value string) []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 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)
|
||||
if ip == nil || ip.To4() == nil {
|
||||
allErrors = append(allErrors, field.Invalid(fldPath, value, "must be a valid IPv4 address"))
|
||||
}
|
||||
return allErrors
|
||||
}
|
||||
|
||||
// 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)
|
||||
if ip == nil || ip.To4() != nil {
|
||||
allErrors = append(allErrors, field.Invalid(fldPath, value, "must be a valid IPv6 address"))
|
||||
}
|
||||
return allErrors
|
||||
}
|
||||
|
||||
const percentFmt string = "[0-9]+%"
|
||||
const percentErrMsg string = "a valid percent string must be a numeric string followed by an ending '%'"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
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.
|
||||
@ -14,10 +14,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
|
||||
// +groupName=meta.k8s.io
|
||||
|
||||
package v1beta1 // import "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||
// Package wait provides tools for polling or listening for changes
|
||||
// to a condition.
|
||||
package wait // import "k8s.io/apimachinery/pkg/util/wait"
|
606
vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
generated
vendored
Normal file
606
vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
generated
vendored
Normal file
@ -0,0 +1,606 @@
|
||||
/*
|
||||
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 wait
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"math"
|
||||
"math/rand"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/clock"
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
)
|
||||
|
||||
// For any test of the style:
|
||||
// ...
|
||||
// <- time.After(timeout):
|
||||
// t.Errorf("Timed out")
|
||||
// The value for timeout should effectively be "forever." Obviously we don't want our tests to truly lock up forever, but 30s
|
||||
// is long enough that it is effectively forever for the things that can slow down a run on a heavily contended machine
|
||||
// (GC, seeks, etc), but not so long as to make a developer ctrl-c a test run if they do happen to break that test.
|
||||
var ForeverTestTimeout = time.Second * 30
|
||||
|
||||
// NeverStop may be passed to Until to make it never stop.
|
||||
var NeverStop <-chan struct{} = make(chan struct{})
|
||||
|
||||
// Group allows to start a group of goroutines and wait for their completion.
|
||||
type Group struct {
|
||||
wg sync.WaitGroup
|
||||
}
|
||||
|
||||
func (g *Group) Wait() {
|
||||
g.wg.Wait()
|
||||
}
|
||||
|
||||
// StartWithChannel starts f in a new goroutine in the group.
|
||||
// stopCh is passed to f as an argument. f should stop when stopCh is available.
|
||||
func (g *Group) StartWithChannel(stopCh <-chan struct{}, f func(stopCh <-chan struct{})) {
|
||||
g.Start(func() {
|
||||
f(stopCh)
|
||||
})
|
||||
}
|
||||
|
||||
// StartWithContext starts f in a new goroutine in the group.
|
||||
// ctx is passed to f as an argument. f should stop when ctx.Done() is available.
|
||||
func (g *Group) StartWithContext(ctx context.Context, f func(context.Context)) {
|
||||
g.Start(func() {
|
||||
f(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
// Start starts f in a new goroutine in the group.
|
||||
func (g *Group) Start(f func()) {
|
||||
g.wg.Add(1)
|
||||
go func() {
|
||||
defer g.wg.Done()
|
||||
f()
|
||||
}()
|
||||
}
|
||||
|
||||
// Forever calls f every period for ever.
|
||||
//
|
||||
// Forever is syntactic sugar on top of Until.
|
||||
func Forever(f func(), period time.Duration) {
|
||||
Until(f, period, NeverStop)
|
||||
}
|
||||
|
||||
// Until loops until stop channel is closed, running f every period.
|
||||
//
|
||||
// Until is syntactic sugar on top of JitterUntil with zero jitter factor and
|
||||
// with sliding = true (which means the timer for period starts after the f
|
||||
// completes).
|
||||
func Until(f func(), period time.Duration, stopCh <-chan struct{}) {
|
||||
JitterUntil(f, period, 0.0, true, stopCh)
|
||||
}
|
||||
|
||||
// UntilWithContext loops until context is done, running f every period.
|
||||
//
|
||||
// UntilWithContext is syntactic sugar on top of JitterUntilWithContext
|
||||
// with zero jitter factor and with sliding = true (which means the timer
|
||||
// for period starts after the f completes).
|
||||
func UntilWithContext(ctx context.Context, f func(context.Context), period time.Duration) {
|
||||
JitterUntilWithContext(ctx, f, period, 0.0, true)
|
||||
}
|
||||
|
||||
// NonSlidingUntil loops until stop channel is closed, running f every
|
||||
// period.
|
||||
//
|
||||
// NonSlidingUntil is syntactic sugar on top of JitterUntil with zero jitter
|
||||
// factor, with sliding = false (meaning the timer for period starts at the same
|
||||
// time as the function starts).
|
||||
func NonSlidingUntil(f func(), period time.Duration, stopCh <-chan struct{}) {
|
||||
JitterUntil(f, period, 0.0, false, stopCh)
|
||||
}
|
||||
|
||||
// NonSlidingUntilWithContext loops until context is done, running f every
|
||||
// period.
|
||||
//
|
||||
// NonSlidingUntilWithContext is syntactic sugar on top of JitterUntilWithContext
|
||||
// with zero jitter factor, with sliding = false (meaning the timer for period
|
||||
// starts at the same time as the function starts).
|
||||
func NonSlidingUntilWithContext(ctx context.Context, f func(context.Context), period time.Duration) {
|
||||
JitterUntilWithContext(ctx, f, period, 0.0, false)
|
||||
}
|
||||
|
||||
// JitterUntil loops until stop channel is closed, running f every period.
|
||||
//
|
||||
// If jitterFactor is positive, the period is jittered before every run of f.
|
||||
// If jitterFactor is not positive, the period is unchanged and not jittered.
|
||||
//
|
||||
// If sliding is true, the period is computed after f runs. If it is false then
|
||||
// period includes the runtime for f.
|
||||
//
|
||||
// Close stopCh to stop. f may not be invoked if stop channel is already
|
||||
// closed. Pass NeverStop to if you don't want it stop.
|
||||
func JitterUntil(f func(), period time.Duration, jitterFactor float64, sliding bool, stopCh <-chan struct{}) {
|
||||
BackoffUntil(f, NewJitteredBackoffManager(period, jitterFactor, &clock.RealClock{}), sliding, stopCh)
|
||||
}
|
||||
|
||||
// BackoffUntil loops until stop channel is closed, run f every duration given by BackoffManager.
|
||||
//
|
||||
// If sliding is true, the period is computed after f runs. If it is false then
|
||||
// period includes the runtime for f.
|
||||
func BackoffUntil(f func(), backoff BackoffManager, sliding bool, stopCh <-chan struct{}) {
|
||||
var t clock.Timer
|
||||
for {
|
||||
select {
|
||||
case <-stopCh:
|
||||
return
|
||||
default:
|
||||
}
|
||||
|
||||
if !sliding {
|
||||
t = backoff.Backoff()
|
||||
}
|
||||
|
||||
func() {
|
||||
defer runtime.HandleCrash()
|
||||
f()
|
||||
}()
|
||||
|
||||
if sliding {
|
||||
t = backoff.Backoff()
|
||||
}
|
||||
|
||||
// NOTE: b/c there is no priority selection in golang
|
||||
// it is possible for this to race, meaning we could
|
||||
// trigger t.C and stopCh, and t.C select falls through.
|
||||
// In order to mitigate we re-check stopCh at the beginning
|
||||
// of every loop to prevent extra executions of f().
|
||||
select {
|
||||
case <-stopCh:
|
||||
return
|
||||
case <-t.C():
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// JitterUntilWithContext loops until context is done, running f every period.
|
||||
//
|
||||
// If jitterFactor is positive, the period is jittered before every run of f.
|
||||
// If jitterFactor is not positive, the period is unchanged and not jittered.
|
||||
//
|
||||
// If sliding is true, the period is computed after f runs. If it is false then
|
||||
// period includes the runtime for f.
|
||||
//
|
||||
// Cancel context to stop. f may not be invoked if context is already expired.
|
||||
func JitterUntilWithContext(ctx context.Context, f func(context.Context), period time.Duration, jitterFactor float64, sliding bool) {
|
||||
JitterUntil(func() { f(ctx) }, period, jitterFactor, sliding, ctx.Done())
|
||||
}
|
||||
|
||||
// Jitter returns a time.Duration between duration and duration + maxFactor *
|
||||
// duration.
|
||||
//
|
||||
// This allows clients to avoid converging on periodic behavior. If maxFactor
|
||||
// is 0.0, a suggested default value will be chosen.
|
||||
func Jitter(duration time.Duration, maxFactor float64) time.Duration {
|
||||
if maxFactor <= 0.0 {
|
||||
maxFactor = 1.0
|
||||
}
|
||||
wait := duration + time.Duration(rand.Float64()*maxFactor*float64(duration))
|
||||
return wait
|
||||
}
|
||||
|
||||
// ErrWaitTimeout is returned when the condition exited without success.
|
||||
var ErrWaitTimeout = errors.New("timed out waiting for the condition")
|
||||
|
||||
// ConditionFunc returns true if the condition is satisfied, or an error
|
||||
// if the loop should be aborted.
|
||||
type ConditionFunc func() (done bool, err error)
|
||||
|
||||
// runConditionWithCrashProtection runs a ConditionFunc with crash protection
|
||||
func runConditionWithCrashProtection(condition ConditionFunc) (bool, error) {
|
||||
defer runtime.HandleCrash()
|
||||
return condition()
|
||||
}
|
||||
|
||||
// Backoff holds parameters applied to a Backoff function.
|
||||
type Backoff struct {
|
||||
// The initial duration.
|
||||
Duration time.Duration
|
||||
// Duration is multiplied by factor each iteration, if factor is not zero
|
||||
// and the limits imposed by Steps and Cap have not been reached.
|
||||
// Should not be negative.
|
||||
// The jitter does not contribute to the updates to the duration parameter.
|
||||
Factor float64
|
||||
// The sleep at each iteration is the duration plus an additional
|
||||
// amount chosen uniformly at random from the interval between
|
||||
// zero and `jitter*duration`.
|
||||
Jitter float64
|
||||
// The remaining number of iterations in which the duration
|
||||
// parameter may change (but progress can be stopped earlier by
|
||||
// hitting the cap). If not positive, the duration is not
|
||||
// changed. Used for exponential backoff in combination with
|
||||
// Factor and Cap.
|
||||
Steps int
|
||||
// A limit on revised values of the duration parameter. If a
|
||||
// multiplication by the factor parameter would make the duration
|
||||
// exceed the cap then the duration is set to the cap and the
|
||||
// steps parameter is set to zero.
|
||||
Cap time.Duration
|
||||
}
|
||||
|
||||
// Step (1) returns an amount of time to sleep determined by the
|
||||
// original Duration and Jitter and (2) mutates the provided Backoff
|
||||
// to update its Steps and Duration.
|
||||
func (b *Backoff) Step() time.Duration {
|
||||
if b.Steps < 1 {
|
||||
if b.Jitter > 0 {
|
||||
return Jitter(b.Duration, b.Jitter)
|
||||
}
|
||||
return b.Duration
|
||||
}
|
||||
b.Steps--
|
||||
|
||||
duration := b.Duration
|
||||
|
||||
// calculate the next step
|
||||
if b.Factor != 0 {
|
||||
b.Duration = time.Duration(float64(b.Duration) * b.Factor)
|
||||
if b.Cap > 0 && b.Duration > b.Cap {
|
||||
b.Duration = b.Cap
|
||||
b.Steps = 0
|
||||
}
|
||||
}
|
||||
|
||||
if b.Jitter > 0 {
|
||||
duration = Jitter(duration, b.Jitter)
|
||||
}
|
||||
return duration
|
||||
}
|
||||
|
||||
// contextForChannel derives a child context from a parent channel.
|
||||
//
|
||||
// The derived context's Done channel is closed when the returned cancel function
|
||||
// is called or when the parent channel is closed, whichever happens first.
|
||||
//
|
||||
// Note the caller must *always* call the CancelFunc, otherwise resources may be leaked.
|
||||
func contextForChannel(parentCh <-chan struct{}) (context.Context, context.CancelFunc) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
go func() {
|
||||
select {
|
||||
case <-parentCh:
|
||||
cancel()
|
||||
case <-ctx.Done():
|
||||
}
|
||||
}()
|
||||
return ctx, cancel
|
||||
}
|
||||
|
||||
// BackoffManager manages backoff with a particular scheme based on its underlying implementation. It provides
|
||||
// an interface to return a timer for backoff, and caller shall backoff until Timer.C() drains. If the second Backoff()
|
||||
// is called before the timer from the first Backoff() call finishes, the first timer will NOT be drained and result in
|
||||
// undetermined behavior.
|
||||
// The BackoffManager is supposed to be called in a single-threaded environment.
|
||||
type BackoffManager interface {
|
||||
Backoff() clock.Timer
|
||||
}
|
||||
|
||||
type exponentialBackoffManagerImpl struct {
|
||||
backoff *Backoff
|
||||
backoffTimer clock.Timer
|
||||
lastBackoffStart time.Time
|
||||
initialBackoff time.Duration
|
||||
backoffResetDuration time.Duration
|
||||
clock clock.Clock
|
||||
}
|
||||
|
||||
// NewExponentialBackoffManager returns a manager for managing exponential backoff. Each backoff is jittered and
|
||||
// backoff will not exceed the given max. If the backoff is not called within resetDuration, the backoff is reset.
|
||||
// This backoff manager is used to reduce load during upstream unhealthiness.
|
||||
func NewExponentialBackoffManager(initBackoff, maxBackoff, resetDuration time.Duration, backoffFactor, jitter float64, c clock.Clock) BackoffManager {
|
||||
return &exponentialBackoffManagerImpl{
|
||||
backoff: &Backoff{
|
||||
Duration: initBackoff,
|
||||
Factor: backoffFactor,
|
||||
Jitter: jitter,
|
||||
|
||||
// the current impl of wait.Backoff returns Backoff.Duration once steps are used up, which is not
|
||||
// what we ideally need here, we set it to max int and assume we will never use up the steps
|
||||
Steps: math.MaxInt32,
|
||||
Cap: maxBackoff,
|
||||
},
|
||||
backoffTimer: nil,
|
||||
initialBackoff: initBackoff,
|
||||
lastBackoffStart: c.Now(),
|
||||
backoffResetDuration: resetDuration,
|
||||
clock: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (b *exponentialBackoffManagerImpl) getNextBackoff() time.Duration {
|
||||
if b.clock.Now().Sub(b.lastBackoffStart) > b.backoffResetDuration {
|
||||
b.backoff.Steps = math.MaxInt32
|
||||
b.backoff.Duration = b.initialBackoff
|
||||
}
|
||||
b.lastBackoffStart = b.clock.Now()
|
||||
return b.backoff.Step()
|
||||
}
|
||||
|
||||
// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for exponential backoff.
|
||||
// The returned timer must be drained before calling Backoff() the second time
|
||||
func (b *exponentialBackoffManagerImpl) Backoff() clock.Timer {
|
||||
if b.backoffTimer == nil {
|
||||
b.backoffTimer = b.clock.NewTimer(b.getNextBackoff())
|
||||
} else {
|
||||
b.backoffTimer.Reset(b.getNextBackoff())
|
||||
}
|
||||
return b.backoffTimer
|
||||
}
|
||||
|
||||
type jitteredBackoffManagerImpl struct {
|
||||
clock clock.Clock
|
||||
duration time.Duration
|
||||
jitter float64
|
||||
backoffTimer clock.Timer
|
||||
}
|
||||
|
||||
// NewJitteredBackoffManager returns a BackoffManager that backoffs with given duration plus given jitter. If the jitter
|
||||
// is negative, backoff will not be jittered.
|
||||
func NewJitteredBackoffManager(duration time.Duration, jitter float64, c clock.Clock) BackoffManager {
|
||||
return &jitteredBackoffManagerImpl{
|
||||
clock: c,
|
||||
duration: duration,
|
||||
jitter: jitter,
|
||||
backoffTimer: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func (j *jitteredBackoffManagerImpl) getNextBackoff() time.Duration {
|
||||
jitteredPeriod := j.duration
|
||||
if j.jitter > 0.0 {
|
||||
jitteredPeriod = Jitter(j.duration, j.jitter)
|
||||
}
|
||||
return jitteredPeriod
|
||||
}
|
||||
|
||||
// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for jittered backoff.
|
||||
// The returned timer must be drained before calling Backoff() the second time
|
||||
func (j *jitteredBackoffManagerImpl) Backoff() clock.Timer {
|
||||
backoff := j.getNextBackoff()
|
||||
if j.backoffTimer == nil {
|
||||
j.backoffTimer = j.clock.NewTimer(backoff)
|
||||
} else {
|
||||
j.backoffTimer.Reset(backoff)
|
||||
}
|
||||
return j.backoffTimer
|
||||
}
|
||||
|
||||
// ExponentialBackoff repeats a condition check with exponential backoff.
|
||||
//
|
||||
// It repeatedly checks the condition and then sleeps, using `backoff.Step()`
|
||||
// to determine the length of the sleep and adjust Duration and Steps.
|
||||
// Stops and returns as soon as:
|
||||
// 1. the condition check returns true or an error,
|
||||
// 2. `backoff.Steps` checks of the condition have been done, or
|
||||
// 3. a sleep truncated by the cap on duration has been completed.
|
||||
// In case (1) the returned error is what the condition function returned.
|
||||
// In all other cases, ErrWaitTimeout is returned.
|
||||
func ExponentialBackoff(backoff Backoff, condition ConditionFunc) error {
|
||||
for backoff.Steps > 0 {
|
||||
if ok, err := runConditionWithCrashProtection(condition); err != nil || ok {
|
||||
return err
|
||||
}
|
||||
if backoff.Steps == 1 {
|
||||
break
|
||||
}
|
||||
time.Sleep(backoff.Step())
|
||||
}
|
||||
return ErrWaitTimeout
|
||||
}
|
||||
|
||||
// Poll tries a condition func until it returns true, an error, or the timeout
|
||||
// is reached.
|
||||
//
|
||||
// Poll always waits the interval before the run of 'condition'.
|
||||
// 'condition' will always be invoked at least once.
|
||||
//
|
||||
// Some intervals may be missed if the condition takes too long or the time
|
||||
// window is too short.
|
||||
//
|
||||
// If you want to Poll something forever, see PollInfinite.
|
||||
func Poll(interval, timeout time.Duration, condition ConditionFunc) error {
|
||||
return pollInternal(poller(interval, timeout), condition)
|
||||
}
|
||||
|
||||
func pollInternal(wait WaitFunc, condition ConditionFunc) error {
|
||||
done := make(chan struct{})
|
||||
defer close(done)
|
||||
return WaitFor(wait, condition, done)
|
||||
}
|
||||
|
||||
// PollImmediate tries a condition func until it returns true, an error, or the timeout
|
||||
// is reached.
|
||||
//
|
||||
// PollImmediate always checks 'condition' before waiting for the interval. 'condition'
|
||||
// will always be invoked at least once.
|
||||
//
|
||||
// Some intervals may be missed if the condition takes too long or the time
|
||||
// window is too short.
|
||||
//
|
||||
// If you want to immediately Poll something forever, see PollImmediateInfinite.
|
||||
func PollImmediate(interval, timeout time.Duration, condition ConditionFunc) error {
|
||||
return pollImmediateInternal(poller(interval, timeout), condition)
|
||||
}
|
||||
|
||||
func pollImmediateInternal(wait WaitFunc, condition ConditionFunc) error {
|
||||
done, err := runConditionWithCrashProtection(condition)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if done {
|
||||
return nil
|
||||
}
|
||||
return pollInternal(wait, condition)
|
||||
}
|
||||
|
||||
// PollInfinite tries a condition func until it returns true or an error
|
||||
//
|
||||
// PollInfinite always waits the interval before the run of 'condition'.
|
||||
//
|
||||
// Some intervals may be missed if the condition takes too long or the time
|
||||
// window is too short.
|
||||
func PollInfinite(interval time.Duration, condition ConditionFunc) error {
|
||||
done := make(chan struct{})
|
||||
defer close(done)
|
||||
return PollUntil(interval, condition, done)
|
||||
}
|
||||
|
||||
// PollImmediateInfinite tries a condition func until it returns true or an error
|
||||
//
|
||||
// PollImmediateInfinite runs the 'condition' before waiting for the interval.
|
||||
//
|
||||
// Some intervals may be missed if the condition takes too long or the time
|
||||
// window is too short.
|
||||
func PollImmediateInfinite(interval time.Duration, condition ConditionFunc) error {
|
||||
done, err := runConditionWithCrashProtection(condition)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if done {
|
||||
return nil
|
||||
}
|
||||
return PollInfinite(interval, condition)
|
||||
}
|
||||
|
||||
// PollUntil tries a condition func until it returns true, an error or stopCh is
|
||||
// closed.
|
||||
//
|
||||
// PollUntil always waits interval before the first run of 'condition'.
|
||||
// 'condition' will always be invoked at least once.
|
||||
func PollUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
|
||||
ctx, cancel := contextForChannel(stopCh)
|
||||
defer cancel()
|
||||
return WaitFor(poller(interval, 0), condition, ctx.Done())
|
||||
}
|
||||
|
||||
// PollImmediateUntil tries a condition func until it returns true, an error or stopCh is closed.
|
||||
//
|
||||
// PollImmediateUntil runs the 'condition' before waiting for the interval.
|
||||
// 'condition' will always be invoked at least once.
|
||||
func PollImmediateUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
|
||||
done, err := condition()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if done {
|
||||
return nil
|
||||
}
|
||||
select {
|
||||
case <-stopCh:
|
||||
return ErrWaitTimeout
|
||||
default:
|
||||
return PollUntil(interval, condition, stopCh)
|
||||
}
|
||||
}
|
||||
|
||||
// WaitFunc creates a channel that receives an item every time a test
|
||||
// should be executed and is closed when the last test should be invoked.
|
||||
type WaitFunc func(done <-chan struct{}) <-chan struct{}
|
||||
|
||||
// WaitFor continually checks 'fn' as driven by 'wait'.
|
||||
//
|
||||
// WaitFor gets a channel from 'wait()'', and then invokes 'fn' once for every value
|
||||
// placed on the channel and once more when the channel is closed. If the channel is closed
|
||||
// and 'fn' returns false without error, WaitFor returns ErrWaitTimeout.
|
||||
//
|
||||
// If 'fn' returns an error the loop ends and that error is returned. If
|
||||
// 'fn' returns true the loop ends and nil is returned.
|
||||
//
|
||||
// ErrWaitTimeout will be returned if the 'done' channel is closed without fn ever
|
||||
// returning true.
|
||||
//
|
||||
// When the done channel is closed, because the golang `select` statement is
|
||||
// "uniform pseudo-random", the `fn` might still run one or multiple time,
|
||||
// though eventually `WaitFor` will return.
|
||||
func WaitFor(wait WaitFunc, fn ConditionFunc, done <-chan struct{}) error {
|
||||
stopCh := make(chan struct{})
|
||||
defer close(stopCh)
|
||||
c := wait(stopCh)
|
||||
for {
|
||||
select {
|
||||
case _, open := <-c:
|
||||
ok, err := runConditionWithCrashProtection(fn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if ok {
|
||||
return nil
|
||||
}
|
||||
if !open {
|
||||
return ErrWaitTimeout
|
||||
}
|
||||
case <-done:
|
||||
return ErrWaitTimeout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// poller returns a WaitFunc that will send to the channel every interval until
|
||||
// timeout has elapsed and then closes the channel.
|
||||
//
|
||||
// Over very short intervals you may receive no ticks before the channel is
|
||||
// closed. A timeout of 0 is interpreted as an infinity, and in such a case
|
||||
// it would be the caller's responsibility to close the done channel.
|
||||
// Failure to do so would result in a leaked goroutine.
|
||||
//
|
||||
// Output ticks are not buffered. If the channel is not ready to receive an
|
||||
// item, the tick is skipped.
|
||||
func poller(interval, timeout time.Duration) WaitFunc {
|
||||
return WaitFunc(func(done <-chan struct{}) <-chan struct{} {
|
||||
ch := make(chan struct{})
|
||||
|
||||
go func() {
|
||||
defer close(ch)
|
||||
|
||||
tick := time.NewTicker(interval)
|
||||
defer tick.Stop()
|
||||
|
||||
var after <-chan time.Time
|
||||
if timeout != 0 {
|
||||
// time.After is more convenient, but it
|
||||
// potentially leaves timers around much longer
|
||||
// than necessary if we exit early.
|
||||
timer := time.NewTimer(timeout)
|
||||
after = timer.C
|
||||
defer timer.Stop()
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-tick.C:
|
||||
// If the consumer isn't ready for this signal drop it and
|
||||
// check the other channels.
|
||||
select {
|
||||
case ch <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
case <-after:
|
||||
return
|
||||
case <-done:
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return ch
|
||||
})
|
||||
}
|
6
vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go
generated
vendored
6
vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go
generated
vendored
@ -26,7 +26,7 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
|
||||
@ -92,6 +92,10 @@ type YAMLDecoder struct {
|
||||
// the caller in framing the chunk.
|
||||
func NewDocumentDecoder(r io.ReadCloser) io.ReadCloser {
|
||||
scanner := bufio.NewScanner(r)
|
||||
// the size of initial allocation for buffer 4k
|
||||
buf := make([]byte, 4*1024)
|
||||
// the maximum size used to buffer a token 5M
|
||||
scanner.Buffer(buf, 5*1024*1024)
|
||||
scanner.Split(splitYAMLDocument)
|
||||
return &YAMLDecoder{
|
||||
r: r,
|
||||
|
33
vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go
generated
vendored
33
vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go
generated
vendored
@ -17,13 +17,15 @@ limitations under the License.
|
||||
package watch
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/net"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// Decoder allows StreamWatcher to watch any stream for which a Decoder can be written.
|
||||
@ -39,19 +41,28 @@ type Decoder interface {
|
||||
Close()
|
||||
}
|
||||
|
||||
// Reporter hides the details of how an error is turned into a runtime.Object for
|
||||
// reporting on a watch stream since this package may not import a higher level report.
|
||||
type Reporter interface {
|
||||
// AsObject must convert err into a valid runtime.Object for the watch stream.
|
||||
AsObject(err error) runtime.Object
|
||||
}
|
||||
|
||||
// StreamWatcher turns any stream for which you can write a Decoder interface
|
||||
// into a watch.Interface.
|
||||
type StreamWatcher struct {
|
||||
sync.Mutex
|
||||
source Decoder
|
||||
result chan Event
|
||||
stopped bool
|
||||
source Decoder
|
||||
reporter Reporter
|
||||
result chan Event
|
||||
stopped bool
|
||||
}
|
||||
|
||||
// NewStreamWatcher creates a StreamWatcher from the given decoder.
|
||||
func NewStreamWatcher(d Decoder) *StreamWatcher {
|
||||
func NewStreamWatcher(d Decoder, r Reporter) *StreamWatcher {
|
||||
sw := &StreamWatcher{
|
||||
source: d,
|
||||
source: d,
|
||||
reporter: r,
|
||||
// It's easy for a consumer to add buffering via an extra
|
||||
// goroutine/channel, but impossible for them to remove it,
|
||||
// so nonbuffered is better.
|
||||
@ -102,11 +113,13 @@ func (sw *StreamWatcher) receive() {
|
||||
case io.ErrUnexpectedEOF:
|
||||
klog.V(1).Infof("Unexpected EOF during watch stream event decoding: %v", err)
|
||||
default:
|
||||
msg := "Unable to decode an event from the watch stream: %v"
|
||||
if net.IsProbableEOF(err) {
|
||||
klog.V(5).Infof(msg, err)
|
||||
if net.IsProbableEOF(err) || net.IsTimeout(err) {
|
||||
klog.V(5).Infof("Unable to decode an event from the watch stream: %v", err)
|
||||
} else {
|
||||
klog.Errorf(msg, err)
|
||||
sw.result <- Event{
|
||||
Type: Error,
|
||||
Object: sw.reporter.AsObject(fmt.Errorf("unable to decode an event from the watch stream: %v", err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
|
23
vendor/k8s.io/apimachinery/pkg/watch/watch.go
generated
vendored
23
vendor/k8s.io/apimachinery/pkg/watch/watch.go
generated
vendored
@ -20,7 +20,7 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
@ -32,8 +32,8 @@ type Interface interface {
|
||||
Stop()
|
||||
|
||||
// Returns a chan which will receive all the events. If an error occurs
|
||||
// or Stop() is called, this channel will be closed, in which case the
|
||||
// watch should be completely cleaned up.
|
||||
// or Stop() is called, the implementation will close this channel and
|
||||
// release any resources used by the watch.
|
||||
ResultChan() <-chan Event
|
||||
}
|
||||
|
||||
@ -44,8 +44,11 @@ const (
|
||||
Added EventType = "ADDED"
|
||||
Modified EventType = "MODIFIED"
|
||||
Deleted EventType = "DELETED"
|
||||
Bookmark EventType = "BOOKMARK"
|
||||
Error EventType = "ERROR"
|
||||
)
|
||||
|
||||
var (
|
||||
DefaultChanSize int32 = 100
|
||||
)
|
||||
|
||||
@ -57,6 +60,10 @@ type Event struct {
|
||||
// Object is:
|
||||
// * If Type is Added or Modified: the new state of the object.
|
||||
// * If Type is Deleted: the state of the object immediately before deletion.
|
||||
// * If Type is Bookmark: the object (instance of a type being watched) where
|
||||
// only ResourceVersion field is set. On successful restart of watch from a
|
||||
// bookmark resourceVersion, client is guaranteed to not get repeat event
|
||||
// nor miss any events.
|
||||
// * If Type is Error: *api.Status is recommended; other types may make sense
|
||||
// depending on context.
|
||||
Object runtime.Object
|
||||
@ -85,7 +92,7 @@ func (w emptyWatch) ResultChan() <-chan Event {
|
||||
// FakeWatcher lets you test anything that consumes a watch.Interface; threadsafe.
|
||||
type FakeWatcher struct {
|
||||
result chan Event
|
||||
Stopped bool
|
||||
stopped bool
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
@ -105,24 +112,24 @@ func NewFakeWithChanSize(size int, blocking bool) *FakeWatcher {
|
||||
func (f *FakeWatcher) Stop() {
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
if !f.Stopped {
|
||||
if !f.stopped {
|
||||
klog.V(4).Infof("Stopping fake watcher.")
|
||||
close(f.result)
|
||||
f.Stopped = true
|
||||
f.stopped = true
|
||||
}
|
||||
}
|
||||
|
||||
func (f *FakeWatcher) IsStopped() bool {
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
return f.Stopped
|
||||
return f.stopped
|
||||
}
|
||||
|
||||
// Reset prepares the watcher to be reused.
|
||||
func (f *FakeWatcher) Reset() {
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
f.Stopped = false
|
||||
f.stopped = false
|
||||
f.result = make(chan Event)
|
||||
}
|
||||
|
||||
|
4
vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go
generated
vendored
4
vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go
generated
vendored
@ -16,7 +16,7 @@ import (
|
||||
// that type.
|
||||
type Equalities map[reflect.Type]reflect.Value
|
||||
|
||||
// For convenience, panics on errrors
|
||||
// For convenience, panics on errors
|
||||
func EqualitiesOrDie(funcs ...interface{}) Equalities {
|
||||
e := Equalities{}
|
||||
if err := e.AddFuncs(funcs...); err != nil {
|
||||
@ -229,7 +229,7 @@ func (e Equalities) deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool,
|
||||
//
|
||||
// An empty slice *is* equal to a nil slice for our purposes; same for maps.
|
||||
//
|
||||
// Unexported field members cannot be compared and will cause an imformative panic; you must add an Equality
|
||||
// Unexported field members cannot be compared and will cause an informative panic; you must add an Equality
|
||||
// function for these types.
|
||||
func (e Equalities) DeepEqual(a1, a2 interface{}) bool {
|
||||
if a1 == nil || a2 == nil {
|
||||
|
Reference in New Issue
Block a user