resource

package
v0.62.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 18 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// ParamName is a param that explicitly assigns a name to the remote object
	ParamName = "name"

	// ParamURL is a param that hold the URL used for accesing the remote object
	ParamURL = "url"
)

Variables

This section is empty.

Functions

func CreateResolutionRequest added in v0.60.0

func CreateResolutionRequest(ctx context.Context, resolver common.ResolverName, name, namespace string, params []v1.Param, ownerRef metav1.OwnerReference) *v1beta1.ResolutionRequest

func GenerateDeterministicName

func GenerateDeterministicName(prefix, base string, params v1.Params) (string, error)

GenerateDeterministicName makes a best-effort attempt to create a unique but reproducible name for use in a Request. The returned value will have the format {prefix}-{hash} where {prefix} is given and {hash} is nameHasher(base) + nameHasher(param1) + nameHasher(param2) + ...

func GenerateDeterministicNameFromSpec added in v0.60.0

func GenerateDeterministicNameFromSpec(prefix, base string, resolutionSpec *v1beta1.ResolutionRequestSpec) (string, error)

GenerateDeterministicNameFromSpec makes a best-effort attempt to create a unique but reproducible name for use in a Request. The returned value will have the format {prefix}-{hash} where {prefix} is given and {hash} is nameHasher(base) + nameHasher(param1) + nameHasher(param2) + ...

func GenerateErrorLogString added in v0.60.0

func GenerateErrorLogString(resolverType string, params v1.Params) string

GenerateErrorLogString makes a best effort attempt to get the name of the task when a resolver error occurred. The TaskRef name does not have to be set, where the specific resolver gets the name from the parameters.

func GetNameAndNamespace added in v0.60.0

func GetNameAndNamespace(resolverName string, owner kmeta.OwnerRefable, name string, namespace string, req *v1beta1.ResolutionRequestSpec) (string, string, error)

GetNameAndNamespace determines the name and namespace for a resource request. It prioritizes explicit values, falling back to the owning object and "default" namespace. If needed, it generates a deterministic name to prevent duplicate requests within a context.

Types

type BasicRequest deprecated

type BasicRequest struct {
	// contains filtered or unexported fields
}

BasicRequest holds the fields needed to submit a new resource request.

Deprecated: Use github.com/tektoncd/pipeline/pkg/remoteresolution/resource.BasicRequest instead.

func (*BasicRequest) Name

func (req *BasicRequest) Name() string

Name returns the name attached to the request

func (*BasicRequest) Namespace

func (req *BasicRequest) Namespace() string

Namespace returns the namespace that the request is associated with

func (*BasicRequest) Params

func (req *BasicRequest) Params() v1.Params

Params are the map of parameters associated with this request

type CRDRequester deprecated

type CRDRequester struct {
	// contains filtered or unexported fields
}

CRDRequester implements the Requester interface using ResolutionRequest CRDs.

Deprecated: Use github.com/tektoncd/pipeline/pkg/remoteresolution/resource.CRDRequester instead.

func NewCRDRequester deprecated

func NewCRDRequester(clientset rrclient.Interface, lister rrlisters.ResolutionRequestLister) *CRDRequester

NewCRDRequester returns an implementation of Requester that uses ResolutionRequest CRD objects to mediate between the caller who wants a resource (e.g. Tekton Pipelines) and the responder who can fetch it (e.g. the gitresolver)

Deprecated: Use github.com/tektoncd/pipeline/pkg/remoteresolution/resource.NewCRDRequester instead.

func (*CRDRequester) Submit

func (r *CRDRequester) Submit(ctx context.Context, resolver ResolverName, req Request) (ResolvedResource, error)

Submit constructs a ResolutionRequest object and submits it to the kubernetes cluster, returning any errors experienced while doing so. If ResolutionRequest is succeeded then it returns the resolved data.

type OwnedRequest

type OwnedRequest = common.OwnedRequest

OwnedRequest is implemented by any type implementing Request that also needs to express a Kubernetes OwnerRef relationship as part of the request being made.

type ReadOnlyResolutionRequest added in v0.60.0

type ReadOnlyResolutionRequest struct {
	// contains filtered or unexported fields
}

ReadOnlyResolutionRequest is an opaque wrapper around ResolutionRequest that provides the methods needed to read data from it using the Resource interface without exposing the underlying API object.

func CrdIntoResource added in v0.60.0

func (ReadOnlyResolutionRequest) Annotations added in v0.60.0

func (r ReadOnlyResolutionRequest) Annotations() map[string]string

func (ReadOnlyResolutionRequest) Data added in v0.60.0

func (r ReadOnlyResolutionRequest) Data() ([]byte, error)

func (ReadOnlyResolutionRequest) RefSource added in v0.60.0

func (r ReadOnlyResolutionRequest) RefSource() *v1.RefSource

type Request

type Request = common.Request

Request is implemented by any type that represents a single request for a remote resource. Implementing this interface gives the underlying type an opportunity to control properties such as whether the name of a request has particular properties, whether the request should be made to a specific namespace, and precisely which parameters should be included.

func NewRequest deprecated

func NewRequest(name, namespace string, params v1.Params) Request

NewRequest returns an instance of a BasicRequest with the given name, namespace and params.

Deprecated: Use github.com/tektoncd/pipeline/pkg/remoteresolution/resource.NewRequest instead.

type Requester

type Requester = common.Requester

Requester is the interface implemented by a type that knows how to submit requests for remote resources.

type ResolvedResource

type ResolvedResource = common.ResolvedResource

ResolvedResource is implemented by any type that offers a read-only view of the data and metadata of a resolved remote resource.

type ResolverName

type ResolverName = common.ResolverName

ResolverName is the type used for a resolver's name and is mostly used to ensure the function signatures that accept it are clear on the purpose for the given string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL