mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-24 12:18:06 +08:00
Bump buildkit to master and fix versions incompatible with go mod 1.13
Bump github.com/gogo/googleapis to v1.3.2 Bump github.com/docker/cli to master Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
This commit is contained in:
2
vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
generated
vendored
@@ -1,3 +1,5 @@
|
||||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
|
||||
reviewers:
|
||||
- thockin
|
||||
- lavalamp
|
||||
|
109
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
109
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
@@ -20,6 +20,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -31,7 +32,9 @@ import (
|
||||
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
|
||||
// DEPRECATED: please use http.StatusTooManyRequests, this will be removed in
|
||||
// the future version.
|
||||
StatusTooManyRequests = http.StatusTooManyRequests
|
||||
)
|
||||
|
||||
// StatusError is an error intended for consumption by a REST API server; it can also be
|
||||
@@ -82,7 +85,20 @@ func (u *UnexpectedObjectError) Error() string {
|
||||
func FromObject(obj runtime.Object) error {
|
||||
switch t := obj.(type) {
|
||||
case *metav1.Status:
|
||||
return &StatusError{*t}
|
||||
return &StatusError{ErrStatus: *t}
|
||||
case runtime.Unstructured:
|
||||
var status metav1.Status
|
||||
obj := t.UnstructuredContent()
|
||||
if !reflect.DeepEqual(obj["kind"], "Status") {
|
||||
break
|
||||
}
|
||||
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(t.UnstructuredContent(), &status); err != nil {
|
||||
return err
|
||||
}
|
||||
if status.APIVersion != "v1" && status.APIVersion != "meta.k8s.io/v1" {
|
||||
break
|
||||
}
|
||||
return &StatusError{ErrStatus: status}
|
||||
}
|
||||
return &UnexpectedObjectError{obj}
|
||||
}
|
||||
@@ -170,6 +186,20 @@ func NewConflict(qualifiedResource schema.GroupResource, name string, err error)
|
||||
}}
|
||||
}
|
||||
|
||||
// NewApplyConflict returns an error including details on the requests apply conflicts
|
||||
func NewApplyConflict(causes []metav1.StatusCause, message string) *StatusError {
|
||||
return &StatusError{ErrStatus: metav1.Status{
|
||||
Status: metav1.StatusFailure,
|
||||
Code: http.StatusConflict,
|
||||
Reason: metav1.StatusReasonConflict,
|
||||
Details: &metav1.StatusDetails{
|
||||
// TODO: Get obj details here?
|
||||
Causes: causes,
|
||||
},
|
||||
Message: message,
|
||||
}}
|
||||
}
|
||||
|
||||
// NewGone returns an error indicating the item no longer available at the server and no forwarding address is known.
|
||||
func NewGone(message string) *StatusError {
|
||||
return &StatusError{metav1.Status{
|
||||
@@ -321,12 +351,23 @@ 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),
|
||||
}}
|
||||
}
|
||||
|
||||
// NewRequestEntityTooLargeError returns an error indicating that the request
|
||||
// entity was too large.
|
||||
func NewRequestEntityTooLargeError(message string) *StatusError {
|
||||
return &StatusError{metav1.Status{
|
||||
Status: metav1.StatusFailure,
|
||||
Code: http.StatusRequestEntityTooLarge,
|
||||
Reason: metav1.StatusReasonRequestEntityTooLarge,
|
||||
Message: fmt.Sprintf("Request entity too large: %s", message),
|
||||
}}
|
||||
}
|
||||
|
||||
// NewGenericServerResponse returns a new error for server responses that are not in a recognizable form.
|
||||
func NewGenericServerResponse(code int, verb string, qualifiedResource schema.GroupResource, name, serverMessage string, retryAfterSeconds int, isUnexpectedResponse bool) *StatusError {
|
||||
reason := metav1.StatusReasonUnknown
|
||||
@@ -355,7 +396,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
|
||||
@@ -513,6 +558,19 @@ func IsTooManyRequests(err error) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRequestEntityTooLargeError determines if err is an error which indicates
|
||||
// the request entity is too large.
|
||||
func IsRequestEntityTooLargeError(err error) bool {
|
||||
if ReasonForError(err) == metav1.StatusReasonRequestEntityTooLarge {
|
||||
return true
|
||||
}
|
||||
switch t := err.(type) {
|
||||
case APIStatus:
|
||||
return t.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.
|
||||
func IsUnexpectedServerError(err error) bool {
|
||||
@@ -565,3 +623,46 @@ func ReasonForError(err error) metav1.StatusReason {
|
||||
}
|
||||
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user