Documentation ¶
Overview ¶
Package common provides constants, errors, labels, annotations and helpers that are commonly needed by resolvers and clients need during remote resource resolution.
Ideally this package will never import directly or transitively any types from kubernetes, knative, tekton pipelines, etc. The intention is to keep this package tightly focused on shared primitives that are needed regardless of underlying implementation of resolver or client.
Index ¶
- Constants
- Variables
- func InjectRequestName(ctx context.Context, name string) context.Context
- func InjectRequestNamespace(ctx context.Context, namespace string) context.Context
- func ReasonError(err error) (string, error)
- func RequestName(ctx context.Context) string
- func RequestNamespace(ctx context.Context) string
- type Error
- type ErrorGettingResourcedeprecated
- type ErrorInvalidRequestdeprecated
- type ErrorInvalidResourceKeydeprecated
- type ErrorUpdatingRequestdeprecated
- type GetResourceError
- type InvalidRequestError
- type InvalidResourceKeyError
- type UpdatingRequestError
Constants ¶
const ( // ReasonResolutionFailed indicates that some part of the resolution // process failed. ReasonResolutionFailed = "ResolutionFailed" // ReasonResolutionTimedOut indicates that a resolver did not // manage to respond to a ResolutionRequest within a timeout. ReasonResolutionTimedOut = "ResolutionTimedOut" )
unhappy reasons
const ( // AnnotationKeyContentType is the annotation key passed back // with a resolved resource's content type. AnnotationKeyContentType = resolution.GroupName + "/content-type" )
const LabelKeyResolverType string = "resolution.tekton.dev/type"
LabelKeyResolverType is the label that determines which resolver will ultimately receive the request for a resource.
const ( // MessageWaitingForResolver is returned by a ResolutionRequest // when a resolver has not yet returned any data for it or // marked the request as invalid. MessageWaitingForResolver = "waiting for resolver" )
const ( // ReasonResolutionInProgress is used to indicate that there are // no issues with the parameters of a request and that a // resolver is working on the ResolutionRequest. ReasonResolutionInProgress = "ResolutionInProgress" )
processing reasons
const ( // ReasonResolutionSuccessful is used to indicate that // resolution of a resource has completed successfully. ReasonResolutionSuccessful = "ResolutionSuccessful" )
happy reasons
Variables ¶
var ( // ErrRequestInProgress is a sentinel value to indicate that // a resource request is still in progress. ErrRequestInProgress = NewError("RequestInProgress", errors.New("Resource request is still in-progress")) // ErrorRequestInProgress is an alias to ErrRequestInProgress // // Deprecated: use ErrRequestInProgress instead. ErrorRequestInProgress = ErrRequestInProgress )
Functions ¶
func InjectRequestName ¶ added in v0.41.0
InjectRequestName returns a new context with a request-scoped name. This value may only be set once per request; subsequent calls with the same context or a derived context will be ignored.
func InjectRequestNamespace ¶
InjectRequestNamespace returns a new context with a request-scoped namespace. This value may only be set once per request; subsequent calls with the same context or a derived context will be ignored.
func ReasonError ¶
ReasonError extracts the reason and underlying error embedded in a given error or returns some sane defaults if the error isn't a common.Error.
func RequestName ¶ added in v0.41.0
RequestName returns the name of the resolution request currently being processed or an empty string if none were registered.
func RequestNamespace ¶
RequestNamespace returns the namespace of the resolution request currently being processed or an empty string if the request somehow does not originate from a namespaced location.
Types ¶
type Error ¶
Error embeds both a short machine-readable string reason for resolution problems alongside the original error generated during the resolution flow.
type ErrorGettingResource
deprecated
type ErrorGettingResource = GetResourceError
ErrorGettingResource is an alias to type GetResourceError.
Deprecated: use type GetResourceError instead.
type ErrorInvalidRequest
deprecated
type ErrorInvalidRequest = InvalidRequestError
ErrorInvalidRequest is an alias to type InvalidRequestError.
Deprecated: use type InvalidRequestError instead.
type ErrorInvalidResourceKey
deprecated
type ErrorInvalidResourceKey = InvalidResourceKeyError
ErrorInvalidResourceKey is an alias to type InvalidResourceKeyError.
Deprecated: use type InvalidResourceKeyError instead.
type ErrorUpdatingRequest
deprecated
type ErrorUpdatingRequest = UpdatingRequestError
ErrorUpdatingRequest is an alias to UpdatingRequestError
Deprecated: use UpdatingRequestError instead.
type GetResourceError ¶ added in v0.46.0
GetResourceError is an error received during what should otherwise have been a successful resource request.
func (*GetResourceError) Error ¶ added in v0.46.0
func (e *GetResourceError) Error() string
func (*GetResourceError) Unwrap ¶ added in v0.46.0
func (e *GetResourceError) Unwrap() error
type InvalidRequestError ¶ added in v0.46.0
InvalidRequestError is an error received when a resource request is badly formed for some reason: either the parameters don't match the resolver's expectations or there is some other structural issue.
func (*InvalidRequestError) Error ¶ added in v0.46.0
func (e *InvalidRequestError) Error() string
type InvalidResourceKeyError ¶ added in v0.46.0
InvalidResourceKeyError indicates that a string key given to the Reconcile function does not match the expected "name" or "namespace/name" format.
func (*InvalidResourceKeyError) Error ¶ added in v0.46.0
func (e *InvalidResourceKeyError) Error() string
func (*InvalidResourceKeyError) Unwrap ¶ added in v0.46.0
func (e *InvalidResourceKeyError) Unwrap() error
type UpdatingRequestError ¶ added in v0.46.0
UpdatingRequestError is an error during any part of the update process for a ResolutionRequest, e.g. when attempting to patch the ResolutionRequest with resolved data.
func (*UpdatingRequestError) Error ¶ added in v0.46.0
func (e *UpdatingRequestError) Error() string
func (*UpdatingRequestError) Unwrap ¶ added in v0.46.0
func (e *UpdatingRequestError) Unwrap() error