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 InjectRequestNamespace(ctx context.Context, namespace string) context.Context
- func ReasonError(err error) (string, error)
- func RequestNamespace(ctx context.Context) string
- type Error
- type ErrorGettingResource
- type ErrorInvalidRequest
- type ErrorInvalidResourceKey
- type ErrorUpdatingRequest
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 ( // ErrorRequestInProgress is a sentinel value to indicate that // a resource request is still in progress. ErrorRequestInProgress = NewError("RequestInProgress", errors.New("Resource request is still in-progress")) )
Functions ¶
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 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 ¶
ErrorGettingResource is an error received during what should otherwise have been a successful resource request.
func (*ErrorGettingResource) Error ¶
func (e *ErrorGettingResource) Error() string
func (*ErrorGettingResource) Unwrap ¶
func (e *ErrorGettingResource) Unwrap() error
type ErrorInvalidRequest ¶
ErrorInvalidRequest 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 (*ErrorInvalidRequest) Error ¶
func (e *ErrorInvalidRequest) Error() string
type ErrorInvalidResourceKey ¶
ErrorInvalidResourceKey indicates that a string key given to the Reconcile function does not match the expected "name" or "namespace/name" format.
func (*ErrorInvalidResourceKey) Error ¶
func (e *ErrorInvalidResourceKey) Error() string
func (*ErrorInvalidResourceKey) Unwrap ¶
func (e *ErrorInvalidResourceKey) Unwrap() error
type ErrorUpdatingRequest ¶
ErrorUpdatingRequest 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 (*ErrorUpdatingRequest) Error ¶
func (e *ErrorUpdatingRequest) Error() string
func (*ErrorUpdatingRequest) Unwrap ¶
func (e *ErrorUpdatingRequest) Unwrap() error