Skip to content

Commit

Permalink
implement unsafe deletion, and wire it
Browse files Browse the repository at this point in the history
- implement unsafe deletion, and wire it
- aggregate corrupt object error(s) from the storage LIST operation
- extend storage error:
a) add a new type ErrCodeCorruptObj to represent a corrupt object:
b) add a new member 'InnerErr error' to StorageError to hold
   the inner error
- add API status error

Kubernetes-commit: 5d4b4a160dc551dc8979012eeabea1a098945603
  • Loading branch information
tkashem authored and k8s-publishing-bot committed Sep 20, 2024
1 parent 6ff8305 commit 16af2ff
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/api/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var knownReasons = map[metav1.StatusReason]struct{}{
metav1.StatusReasonGone: {},
metav1.StatusReasonInvalid: {},
metav1.StatusReasonServerTimeout: {},
metav1.StatusReasonStoreReadError: {},
metav1.StatusReasonTimeout: {},
metav1.StatusReasonTooManyRequests: {},
metav1.StatusReasonBadRequest: {},
Expand Down Expand Up @@ -775,6 +776,12 @@ func IsUnexpectedObjectError(err error) bool {
return err != nil && (ok || errors.As(err, &uoe))
}

// IsStoreReadError determines if err is due to either failure to transform the
// data from the storage, or failure to decode the object appropriately.
func IsStoreReadError(err error) bool {
return ReasonForError(err) == metav1.StatusReasonStoreReadError
}

// 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
Expand Down
16 changes: 16 additions & 0 deletions pkg/apis/meta/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,22 @@ const (
// Status code 500
StatusReasonServerTimeout StatusReason = "ServerTimeout"

// StatusReasonStoreReadError means that the server encountered an error while
// retrieving resources from the backend object store.
// This may be due to backend database error, or because processing of the read
// resource failed.
// Details:
// "kind" string - the kind attribute of the resource being acted on.
// "name" string - the prefix where the reading error(s) occurred
// "causes" []StatusCause
// - (optional):
// - "type" CauseType - CauseTypeUnexpectedServerResponse
// - "message" string - the error message from the store backend
// - "field" string - the full path with the key of the resource that failed reading
//
// Status code 500
StatusReasonStoreReadError StatusReason = "StorageReadError"

// StatusReasonTimeout means that the request could not be completed within the given time.
// Clients can get this response only when they specified a timeout param in the request,
// or if the server cannot complete the operation within a reasonable amount of time.
Expand Down

0 comments on commit 16af2ff

Please sign in to comment.