mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: update kubernetes to v1.25.0
update kubernetes to latest v1.25.0 release. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
f47839d73d
commit
e3bf375035
30
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
30
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
@ -87,21 +87,21 @@ func (e *StatusError) DebugError() (string, []interface{}) {
|
||||
|
||||
// HasStatusCause returns true if the provided error has a details cause
|
||||
// with the provided type name.
|
||||
// It supports wrapped errors and returns false when the error is nil.
|
||||
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.
|
||||
// the error unwraps to 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
|
||||
status, ok := err.(APIStatus)
|
||||
if (ok || errors.As(err, &status)) && status.Status().Details != nil {
|
||||
for _, cause := range status.Status().Details.Causes {
|
||||
if cause.Type == name {
|
||||
return cause, true
|
||||
}
|
||||
}
|
||||
}
|
||||
return metav1.StatusCause{}, false
|
||||
@ -757,7 +757,8 @@ func IsRequestEntityTooLargeError(err error) bool {
|
||||
// and may be the result of another HTTP actor.
|
||||
// It supports wrapped errors and returns false when the error is nil.
|
||||
func IsUnexpectedServerError(err error) bool {
|
||||
if status := APIStatus(nil); errors.As(err, &status) && status.Status().Details != nil {
|
||||
status, ok := err.(APIStatus)
|
||||
if (ok || errors.As(err, &status)) && status.Status().Details != nil {
|
||||
for _, cause := range status.Status().Details.Causes {
|
||||
if cause.Type == metav1.CauseTypeUnexpectedServerResponse {
|
||||
return true
|
||||
@ -770,8 +771,8 @@ func IsUnexpectedServerError(err error) bool {
|
||||
// IsUnexpectedObjectError determines if err is due to an unexpected object from the master.
|
||||
// It supports wrapped errors and returns false when the error is nil.
|
||||
func IsUnexpectedObjectError(err error) bool {
|
||||
uoe := &UnexpectedObjectError{}
|
||||
return err != nil && errors.As(err, &uoe)
|
||||
uoe, ok := err.(*UnexpectedObjectError)
|
||||
return err != nil && (ok || errors.As(err, &uoe))
|
||||
}
|
||||
|
||||
// SuggestsClientDelay returns true if this error suggests a client delay as well as the
|
||||
@ -780,7 +781,8 @@ func IsUnexpectedObjectError(err error) bool {
|
||||
// request delay without retry.
|
||||
// It supports wrapped errors and returns false when the error is nil.
|
||||
func SuggestsClientDelay(err error) (int, bool) {
|
||||
if t := APIStatus(nil); errors.As(err, &t) && t.Status().Details != nil {
|
||||
t, ok := err.(APIStatus)
|
||||
if (ok || 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:
|
||||
@ -798,14 +800,14 @@ func SuggestsClientDelay(err error) (int, bool) {
|
||||
// It supports wrapped errors and returns StatusReasonUnknown when
|
||||
// the error is nil or doesn't have a status.
|
||||
func ReasonForError(err error) metav1.StatusReason {
|
||||
if status := APIStatus(nil); errors.As(err, &status) {
|
||||
if status, ok := err.(APIStatus); ok || errors.As(err, &status) {
|
||||
return status.Status().Reason
|
||||
}
|
||||
return metav1.StatusReasonUnknown
|
||||
}
|
||||
|
||||
func reasonAndCodeForError(err error) (metav1.StatusReason, int32) {
|
||||
if status := APIStatus(nil); errors.As(err, &status) {
|
||||
if status, ok := err.(APIStatus); ok || errors.As(err, &status) {
|
||||
return status.Status().Reason, status.Status().Code
|
||||
}
|
||||
return metav1.StatusReasonUnknown, 0
|
||||
|
6
vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go
generated
vendored
6
vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go
generated
vendored
@ -24,9 +24,9 @@ import (
|
||||
|
||||
// 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)
|
||||
// 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
|
||||
|
7
vendor/k8s.io/apimachinery/pkg/api/meta/help.go
generated
vendored
7
vendor/k8s.io/apimachinery/pkg/api/meta/help.go
generated
vendored
@ -40,7 +40,8 @@ var (
|
||||
|
||||
// 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.
|
||||
//
|
||||
// creating and enforcing that lists implement a list accessor.
|
||||
func IsListType(obj runtime.Object) bool {
|
||||
switch t := obj.(type) {
|
||||
case runtime.Unstructured:
|
||||
@ -97,7 +98,7 @@ func getItemsPtr(list runtime.Object) (interface{}, error) {
|
||||
return nil, errExpectFieldItems
|
||||
}
|
||||
switch items.Kind() {
|
||||
case reflect.Interface, reflect.Ptr:
|
||||
case reflect.Interface, reflect.Pointer:
|
||||
target := reflect.TypeOf(items.Interface()).Elem()
|
||||
if target.Kind() != reflect.Slice {
|
||||
return nil, errExpectSliceItems
|
||||
@ -130,7 +131,7 @@ func EachListItem(obj runtime.Object, fn func(runtime.Object) error) error {
|
||||
return nil
|
||||
}
|
||||
takeAddr := false
|
||||
if elemType := items.Type().Elem(); elemType.Kind() != reflect.Ptr && elemType.Kind() != reflect.Interface {
|
||||
if elemType := items.Type().Elem(); elemType.Kind() != reflect.Pointer && elemType.Kind() != reflect.Interface {
|
||||
if !items.Index(0).CanAddr() {
|
||||
return fmt.Errorf("unable to take address of items in %T for EachListItem", obj)
|
||||
}
|
||||
|
5
vendor/k8s.io/apimachinery/pkg/api/meta/meta.go
generated
vendored
5
vendor/k8s.io/apimachinery/pkg/api/meta/meta.go
generated
vendored
@ -130,7 +130,6 @@ func AsPartialObjectMetadata(m metav1.Object) *metav1.PartialObjectMetadata {
|
||||
Annotations: m.GetAnnotations(),
|
||||
OwnerReferences: m.GetOwnerReferences(),
|
||||
Finalizers: m.GetFinalizers(),
|
||||
ZZZ_DeprecatedClusterName: m.GetZZZ_DeprecatedClusterName(),
|
||||
ManagedFields: m.GetManagedFields(),
|
||||
},
|
||||
}
|
||||
@ -600,7 +599,7 @@ func (a genericAccessor) SetFinalizers(finalizers []string) {
|
||||
func (a genericAccessor) GetOwnerReferences() []metav1.OwnerReference {
|
||||
var ret []metav1.OwnerReference
|
||||
s := a.ownerReferences
|
||||
if s.Kind() != reflect.Ptr || s.Elem().Kind() != reflect.Slice {
|
||||
if s.Kind() != reflect.Pointer || s.Elem().Kind() != reflect.Slice {
|
||||
klog.Errorf("expect %v to be a pointer to slice", s)
|
||||
return ret
|
||||
}
|
||||
@ -618,7 +617,7 @@ func (a genericAccessor) GetOwnerReferences() []metav1.OwnerReference {
|
||||
|
||||
func (a genericAccessor) SetOwnerReferences(references []metav1.OwnerReference) {
|
||||
s := a.ownerReferences
|
||||
if s.Kind() != reflect.Ptr || s.Elem().Kind() != reflect.Slice {
|
||||
if s.Kind() != reflect.Pointer || s.Elem().Kind() != reflect.Slice {
|
||||
klog.Errorf("expect %v to be a pointer to slice", s)
|
||||
}
|
||||
s = s.Elem()
|
||||
|
27
vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
generated
vendored
27
vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
generated
vendored
@ -30,8 +30,11 @@ option go_package = "k8s.io/apimachinery/pkg/api/resource";
|
||||
//
|
||||
// The serialization format is:
|
||||
//
|
||||
// ```
|
||||
// <quantity> ::= <signedNumber><suffix>
|
||||
// (Note that <suffix> may be empty, from the "" case in <decimalSI>.)
|
||||
//
|
||||
// (Note that <suffix> may be empty, from the "" case in <decimalSI>.)
|
||||
//
|
||||
// <digit> ::= 0 | 1 | ... | 9
|
||||
// <digits> ::= <digit> | <digit><digits>
|
||||
// <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits>
|
||||
@ -39,10 +42,15 @@ option go_package = "k8s.io/apimachinery/pkg/api/resource";
|
||||
// <signedNumber> ::= <number> | <sign><number>
|
||||
// <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI>
|
||||
// <binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei
|
||||
// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
|
||||
//
|
||||
// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
|
||||
//
|
||||
// <decimalSI> ::= m | "" | k | M | G | T | P | E
|
||||
// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
|
||||
//
|
||||
// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
|
||||
//
|
||||
// <decimalExponent> ::= "e" <signedNumber> | "E" <signedNumber>
|
||||
// ```
|
||||
//
|
||||
// No matter which of the three exponent forms is used, no quantity may represent
|
||||
// a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal
|
||||
@ -56,14 +64,17 @@ option go_package = "k8s.io/apimachinery/pkg/api/resource";
|
||||
// Before serializing, Quantity will be put in "canonical form".
|
||||
// This means that Exponent/suffix will be adjusted up or down (with a
|
||||
// corresponding increase or decrease in Mantissa) such that:
|
||||
// a. No precision is lost
|
||||
// b. No fractional digits will be emitted
|
||||
// c. The exponent (or suffix) is as large as possible.
|
||||
//
|
||||
// - No precision is lost
|
||||
// - No fractional digits will be emitted
|
||||
// - The exponent (or suffix) is as large as possible.
|
||||
//
|
||||
// The sign will be omitted unless the number is negative.
|
||||
//
|
||||
// Examples:
|
||||
// 1.5 will be serialized as "1500m"
|
||||
// 1.5Gi will be serialized as "1536Mi"
|
||||
//
|
||||
// - 1.5 will be serialized as "1500m"
|
||||
// - 1.5Gi will be serialized as "1536Mi"
|
||||
//
|
||||
// Note that the quantity will NEVER be internally represented by a
|
||||
// floating point number. That is the whole point of this exercise.
|
||||
|
37
vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
generated
vendored
37
vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
generated
vendored
@ -34,8 +34,11 @@ import (
|
||||
//
|
||||
// The serialization format is:
|
||||
//
|
||||
// ```
|
||||
// <quantity> ::= <signedNumber><suffix>
|
||||
// (Note that <suffix> may be empty, from the "" case in <decimalSI>.)
|
||||
//
|
||||
// (Note that <suffix> may be empty, from the "" case in <decimalSI>.)
|
||||
//
|
||||
// <digit> ::= 0 | 1 | ... | 9
|
||||
// <digits> ::= <digit> | <digit><digits>
|
||||
// <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits>
|
||||
@ -43,10 +46,15 @@ import (
|
||||
// <signedNumber> ::= <number> | <sign><number>
|
||||
// <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI>
|
||||
// <binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei
|
||||
// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
|
||||
//
|
||||
// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
|
||||
//
|
||||
// <decimalSI> ::= m | "" | k | M | G | T | P | E
|
||||
// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
|
||||
//
|
||||
// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
|
||||
//
|
||||
// <decimalExponent> ::= "e" <signedNumber> | "E" <signedNumber>
|
||||
// ```
|
||||
//
|
||||
// No matter which of the three exponent forms is used, no quantity may represent
|
||||
// a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal
|
||||
@ -60,14 +68,17 @@ import (
|
||||
// Before serializing, Quantity will be put in "canonical form".
|
||||
// This means that Exponent/suffix will be adjusted up or down (with a
|
||||
// corresponding increase or decrease in Mantissa) such that:
|
||||
// a. No precision is lost
|
||||
// b. No fractional digits will be emitted
|
||||
// c. The exponent (or suffix) is as large as possible.
|
||||
//
|
||||
// - No precision is lost
|
||||
// - No fractional digits will be emitted
|
||||
// - The exponent (or suffix) is as large as possible.
|
||||
//
|
||||
// The sign will be omitted unless the number is negative.
|
||||
//
|
||||
// Examples:
|
||||
// 1.5 will be serialized as "1500m"
|
||||
// 1.5Gi will be serialized as "1536Mi"
|
||||
//
|
||||
// - 1.5 will be serialized as "1500m"
|
||||
// - 1.5Gi will be serialized as "1536Mi"
|
||||
//
|
||||
// Note that the quantity will NEVER be internally represented by a
|
||||
// floating point number. That is the whole point of this exercise.
|
||||
@ -404,10 +415,10 @@ func (Quantity) OpenAPIV3OneOfTypes() []string { return []string{"string", "numb
|
||||
// CanonicalizeBytes returns the canonical form of q and its suffix (see comment on Quantity).
|
||||
//
|
||||
// Note about BinarySI:
|
||||
// * If q.Format is set to BinarySI and q.Amount represents a non-zero value between
|
||||
// -1 and +1, it will be emitted as if q.Format were DecimalSI.
|
||||
// * Otherwise, if q.Format is set to BinarySI, fractional parts of q.Amount will be
|
||||
// rounded up. (1.1i becomes 2i.)
|
||||
// - If q.Format is set to BinarySI and q.Amount represents a non-zero value between
|
||||
// -1 and +1, it will be emitted as if q.Format were DecimalSI.
|
||||
// - Otherwise, if q.Format is set to BinarySI, fractional parts of q.Amount will be
|
||||
// rounded up. (1.1i becomes 2i.)
|
||||
func (q *Quantity) CanonicalizeBytes(out []byte) (result, suffix []byte) {
|
||||
if q.IsZero() {
|
||||
return zeroBytes, nil
|
||||
@ -643,7 +654,7 @@ func (q Quantity) MarshalJSON() ([]byte, error) {
|
||||
copy(out[1:], q.s)
|
||||
return out, nil
|
||||
}
|
||||
result := make([]byte, int64QuantityExpectedBytes, int64QuantityExpectedBytes)
|
||||
result := make([]byte, int64QuantityExpectedBytes)
|
||||
result[0] = '"'
|
||||
number, suffix := q.CanonicalizeBytes(result[1:1])
|
||||
// if the same slice was returned to us that we passed in, avoid another allocation by copying number into
|
||||
|
2
vendor/k8s.io/apimachinery/pkg/api/resource/suffix.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/api/resource/suffix.go
generated
vendored
@ -165,7 +165,7 @@ func (sh *suffixHandler) constructBytes(base, exponent int32, format Format) (s
|
||||
if exponent == 0 {
|
||||
return nil, true
|
||||
}
|
||||
result := make([]byte, 8, 8)
|
||||
result := make([]byte, 8)
|
||||
result[0] = 'e'
|
||||
number := strconv.AppendInt(result[1:1], int64(exponent), 10)
|
||||
if &result[1] == &number[0] {
|
||||
|
10
vendor/k8s.io/apimachinery/pkg/api/validation/objectmeta.go
generated
vendored
10
vendor/k8s.io/apimachinery/pkg/api/validation/objectmeta.go
generated
vendored
@ -40,13 +40,11 @@ var BannedOwners = map[schema.GroupVersionKind]struct{}{
|
||||
{Group: "", Version: "v1", Kind: "Event"}: {},
|
||||
}
|
||||
|
||||
// ValidateZZZ_DeprecatedClusterName can be used to check whether the given cluster name is valid.
|
||||
var ValidateZZZ_DeprecatedClusterName = NameIsDNS1035Label
|
||||
|
||||
// ValidateAnnotations validates that a set of annotations are correctly defined.
|
||||
func ValidateAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
for k := range annotations {
|
||||
// The rule is QualifiedName except that case doesn't matter, so convert to lowercase before checking.
|
||||
for _, msg := range validation.IsQualifiedName(strings.ToLower(k)) {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, k, msg))
|
||||
}
|
||||
@ -184,11 +182,6 @@ func ValidateObjectMetaAccessor(meta metav1.Object, requiresNamespace bool, name
|
||||
allErrs = append(allErrs, field.Forbidden(fldPath.Child("namespace"), "not allowed on this type"))
|
||||
}
|
||||
}
|
||||
if len(meta.GetZZZ_DeprecatedClusterName()) != 0 {
|
||||
for _, msg := range ValidateZZZ_DeprecatedClusterName(meta.GetZZZ_DeprecatedClusterName(), false) {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("clusterName"), meta.GetZZZ_DeprecatedClusterName(), msg))
|
||||
}
|
||||
}
|
||||
|
||||
allErrs = append(allErrs, ValidateNonnegativeField(meta.GetGeneration(), fldPath.Child("generation"))...)
|
||||
allErrs = append(allErrs, v1validation.ValidateLabels(meta.GetLabels(), fldPath.Child("labels"))...)
|
||||
@ -261,7 +254,6 @@ func ValidateObjectMetaAccessorUpdate(newMeta, oldMeta metav1.Object, fldPath *f
|
||||
allErrs = append(allErrs, ValidateImmutableField(newMeta.GetCreationTimestamp(), oldMeta.GetCreationTimestamp(), fldPath.Child("creationTimestamp"))...)
|
||||
allErrs = append(allErrs, ValidateImmutableField(newMeta.GetDeletionTimestamp(), oldMeta.GetDeletionTimestamp(), fldPath.Child("deletionTimestamp"))...)
|
||||
allErrs = append(allErrs, ValidateImmutableField(newMeta.GetDeletionGracePeriodSeconds(), oldMeta.GetDeletionGracePeriodSeconds(), fldPath.Child("deletionGracePeriodSeconds"))...)
|
||||
allErrs = append(allErrs, ValidateImmutableField(newMeta.GetZZZ_DeprecatedClusterName(), oldMeta.GetZZZ_DeprecatedClusterName(), fldPath.Child("clusterName"))...)
|
||||
|
||||
allErrs = append(allErrs, v1validation.ValidateLabels(newMeta.GetLabels(), fldPath.Child("labels"))...)
|
||||
allErrs = append(allErrs, ValidateAnnotations(newMeta.GetAnnotations(), fldPath.Child("annotations"))...)
|
||||
|
Reference in New Issue
Block a user