diff --git a/docs/pipeline-api.md b/docs/pipeline-api.md index a53541e485b..7c080cb4f7a 100644 --- a/docs/pipeline-api.md +++ b/docs/pipeline-api.md @@ -5931,6 +5931,8 @@ Resource Types: Run
  • VerificationPolicy +
  • +PipelineResource
  • Run

    @@ -6258,6 +6260,136 @@ warn - don’t fail the taskrun/pipelinerun if verification fails but log wa +

    PipelineResource +

    +
    +

    PipelineResource describes a resource that is an input to or output from a +Task.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FieldDescription
    +apiVersion
    +string
    + +tekton.dev/v1alpha1 + +
    +kind
    +string +
    PipelineResource
    +metadata
    + + +Kubernetes meta/v1.ObjectMeta + + +
    +(Optional) +Refer to the Kubernetes API documentation for the fields of the +metadata field. +
    +spec
    + + +PipelineResourceSpec + + +
    +

    Spec holds the desired state of the PipelineResource from the client

    +
    +
    + + + + + + + + + + + + + + + + + +
    +description
    + +string + +
    +(Optional) +

    Description is a user-facing description of the resource that may be +used to populate a UI.

    +
    +type
    + +string + +
    +
    +params
    + + +[]ResourceParam + + +
    +
    +secrets
    + + +[]SecretParam + + +
    +(Optional) +

    Secrets to fetch to populate some of resource fields

    +
    +
    +status
    + + +PipelineResourceStatus + + +
    +(Optional) +

    Status is used to communicate the observed state of the PipelineResource from +the controller, but was unused as there is no controller for PipelineResource.

    +

    Authority

    @@ -6675,10 +6807,279 @@ Refer Go’s ParseDuration documentation for expected format: VerificationPolicySpec

    -(Appears on:VerificationPolicy) +(Appears on:VerificationPolicy) +

    +
    +

    VerificationPolicySpec defines the patterns and authorities.

    +
    + + + + + + + + + + + + + + + + + + + + + +
    FieldDescription
    +resources
    + + +[]ResourcePattern + + +
    +

    Resources defines the patterns of resources sources that should be subject to this policy. +For example, we may want to apply this Policy from a certain GitHub repo. +Then the ResourcesPattern should be valid regex. E.g. If using gitresolver, and we want to config keys from a certain git repo. +ResourcesPattern can be https://github.com/tektoncd/catalog.git, we will use regex to filter out those resources.

    +
    +authorities
    + + +[]Authority + + +
    +

    Authorities defines the rules for validating signatures.

    +
    +mode
    + + +ModeType + + +
    +(Optional) +

    Mode controls whether a failing policy will fail the taskrun/pipelinerun, or only log the warnings +enforce - fail the taskrun/pipelinerun if verification fails (default) +warn - don’t fail the taskrun/pipelinerun if verification fails but log warnings

    +
    +

    PipelineResourceSpec +

    +

    +(Appears on:PipelineResource, PipelineResourceBinding) +

    +
    +

    PipelineResourceSpec defines an individual resources used in the pipeline.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    FieldDescription
    +description
    + +string + +
    +(Optional) +

    Description is a user-facing description of the resource that may be +used to populate a UI.

    +
    +type
    + +string + +
    +
    +params
    + + +[]ResourceParam + + +
    +
    +secrets
    + + +[]SecretParam + + +
    +(Optional) +

    Secrets to fetch to populate some of resource fields

    +
    +

    PipelineResourceStatus +

    +

    +(Appears on:PipelineResource) +

    +
    +

    PipelineResourceStatus does not contain anything because PipelineResources on their own +do not have a status

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    +

    ResourceDeclaration +

    +

    +(Appears on:TaskResource) +

    +
    +

    ResourceDeclaration defines an input or output PipelineResource declared as a requirement +by another type such as a Task or Condition. The Name field will be used to refer to these +PipelineResources within the type’s definition, and when provided as an Input, the Name will be the +path to the volume mounted containing this PipelineResource as an input (e.g. +an input Resource named workspace will be mounted at /workspace).

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FieldDescription
    +name
    + +string + +
    +

    Name declares the name by which a resource is referenced in the +definition. Resources may be referenced by name in the definition of a +Task’s steps.

    +
    +type
    + +string + +
    +

    Type is the type of this resource;

    +
    +description
    + +string + +
    +(Optional) +

    Description is a user-facing description of the declared resource that may be +used to populate a UI.

    +
    +targetPath
    + +string + +
    +(Optional) +

    TargetPath is the path in workspace directory where the resource +will be copied.

    +
    +optional
    + +bool + +
    +

    Optional declares the resource as optional. +By default optional is set to false which makes a resource required. +optional: true - the resource is considered optional +optional: false - the resource is considered required (equivalent of not specifying it)

    +
    +

    ResourceParam +

    +

    +(Appears on:PipelineResourceSpec) +

    +
    +

    ResourceParam declares a string value to use for the parameter called Name, and is used in +the specific context of PipelineResources.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + + + + + +
    FieldDescription
    +name
    + +string + +
    +
    +value
    + +string + +
    +
    +

    SecretParam +

    +

    +(Appears on:PipelineResourceSpec)

    -

    VerificationPolicySpec defines the patterns and authorities.

    +

    SecretParam indicates which secret can be used to populate a field of the resource

    +

    Deprecated: Unused, preserved only for backwards compatibility

    @@ -6690,47 +7091,32 @@ Refer Go’s ParseDuration documentation for expected format: -[]ResourcePattern - +string @@ -6997,6 +7383,23 @@ TaskSpec
    -

    Resources defines the patterns of resources sources that should be subject to this policy. -For example, we may want to apply this Policy from a certain GitHub repo. -Then the ResourcesPattern should be valid regex. E.g. If using gitresolver, and we want to config keys from a certain git repo. -ResourcesPattern can be https://github.com/tektoncd/catalog.git, we will use regex to filter out those resources.

    -authorities
    +secretKey
    - -[]Authority - +string
    -

    Authorities defines the rules for validating signatures.

    -mode
    +secretName
    - -ModeType - +string
    -(Optional) -

    Mode controls whether a failing policy will fail the taskrun/pipelinerun, or only log the warnings -enforce - fail the taskrun/pipelinerun if verification fails (default) -warn - don’t fail the taskrun/pipelinerun if verification fails but log warnings

    + + + + + + + + + + + +
    +resources
    + + +TaskResources + + +
    +(Optional) +

    Resources is a list input and output resource to run the task +Resources are represented in TaskRuns as bindings to instances of +PipelineResources.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    params
    @@ -7410,6 +7813,19 @@ used to populate a UI.

    +resources
    + + +[]PipelineDeclaredResource + + +
    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    tasks
    @@ -7575,6 +7991,22 @@ PipelineSpec
    +resources
    + + +[]PipelineResourceBinding + + +
    +

    Resources is a list of bindings specifying which actual instances of +PipelineResources to use for the resources the Pipeline has declared +it needs.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    params
    @@ -7770,6 +8202,23 @@ TaskSpec + + + + + + + +
    +resources
    + + +TaskResources + + +
    +(Optional) +

    Resources is a list input and output resource to run the task +Resources are represented in TaskRuns as bindings to instances of +PipelineResources.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    params
    @@ -7986,6 +8435,20 @@ Params
    +resources
    + + +TaskRunResources + + +
    +(Optional) +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    serviceAccountName
    string @@ -8769,6 +9232,58 @@ The names of the params must match the names of the params
    +

    InternalTaskModifier +

    +
    +

    InternalTaskModifier implements TaskModifier for resources that are built-in to Tekton Pipelines.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + + + + + + + + + +
    FieldDescription
    +stepsToPrepend
    + + +[]Step + + +
    +
    +stepsToAppend
    + + +[]Step + + +
    +
    +volumes
    + + +[]Kubernetes core/v1.Volume + + +
    +

    Matrix

    @@ -8828,7 +9343,7 @@ IncludeParamsList

    Param

    -(Appears on:ResolutionRequestSpec) +(Appears on:TaskRunInputs, ResolutionRequestSpec)

    Param declares an ParamValues to use for the parameter called name.

    @@ -8968,13 +9483,146 @@ parameter.

    ParamType indicates the type of an input parameter; Used to distinguish between a single string and an array of strings.

    -

    ParamValue +

    ParamValue +

    +

    +(Appears on:Param, ParamSpec, PipelineResult, PipelineRunResult, TaskRunResult) +

    +
    +

    ResultValue is a type alias of ParamValue

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    FieldDescription
    +type
    + + +ParamType + + +
    +
    +stringVal
    + +string + +
    +

    Represents the stored type of ParamValues.

    +
    +arrayVal
    + +[]string + +
    +
    +objectVal
    + +map[string]string + +
    +
    +

    Params +([]github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param alias)

    +

    +(Appears on:RunSpec, CustomRunSpec, IncludeParams, Matrix, PipelineRunSpec, PipelineTask, ResolverRef, TaskRunSpec) +

    +
    +

    Params is a list of Param

    +
    +

    PipelineDeclaredResource +

    +

    +(Appears on:PipelineSpec) +

    +
    +

    PipelineDeclaredResource is used by a Pipeline to declare the types of the +PipelineResources that it will required to run and names which can be used to +refer to these PipelineResources in PipelineTaskResourceBindings.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + + + + + + + + + +
    FieldDescription
    +name
    + +string + +
    +

    Name is the name that will be used by the Pipeline to refer to this resource. +It does not directly correspond to the name of any PipelineResources Task +inputs or outputs, and it does not correspond to the actual names of the +PipelineResources that will be bound in the PipelineRun.

    +
    +type
    + +string + +
    +

    Type is the type of the PipelineResource.

    +
    +optional
    + +bool + +
    +

    Optional declares the resource as optional. +optional: true - the resource is considered optional +optional: false - the resource is considered required (default/equivalent of not specifying it)

    +
    +

    PipelineObject +

    +
    +

    PipelineObject is implemented by Pipeline

    +
    +

    PipelineRef

    -(Appears on:Param, ParamSpec, PipelineResult, PipelineRunResult, TaskRunResult) +(Appears on:PipelineRunSpec)

    -

    ResultValue is a type alias of ParamValue

    +

    PipelineRef can be used to refer to a specific instance of a Pipeline.

    @@ -8986,69 +9634,67 @@ Used to distinguish between a single string and an array of strings.

    -type
    +name
    - -ParamType - +string
    +

    Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names

    -stringVal
    +apiVersion
    string
    -

    Represents the stored type of ParamValues.

    +(Optional) +

    API version of the referent

    -arrayVal
    +bundle
    -[]string +string
    +(Optional) +

    Bundle url reference to a Tekton Bundle.

    +

    Deprecated: Please use ResolverRef with the bundles resolver instead.

    -objectVal
    +ResolverRef
    -map[string]string + +ResolverRef +
    +(Optional) +

    ResolverRef allows referencing a Pipeline in a remote location +like a git repo. This field is only supported when the alpha +feature gate is enabled.

    -

    Params -([]github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param alias)

    -

    -(Appears on:RunSpec, CustomRunSpec, IncludeParams, Matrix, PipelineRunSpec, PipelineTask, ResolverRef, TaskRunSpec) -

    -
    -

    Params is a list of Param

    -
    -

    PipelineObject -

    -
    -

    PipelineObject is implemented by Pipeline

    -
    -

    PipelineRef +

    PipelineResourceBinding

    -(Appears on:PipelineRunSpec) +(Appears on:PipelineRunSpec, TaskResourceBinding)

    -

    PipelineRef can be used to refer to a specific instance of a Pipeline.

    +

    PipelineResourceBinding connects a reference to an instance of a PipelineResource +with a PipelineResource dependency that the Pipeline has declared

    +

    Deprecated: Unused, preserved only for backwards compatibility

    @@ -9066,48 +9712,85 @@ string + + +
    -

    Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names

    +

    Name is the name of the PipelineResource in the Pipeline’s declaration

    -apiVersion
    +resourceRef
    -string + +PipelineResourceRef +
    (Optional) -

    API version of the referent

    +

    ResourceRef is a reference to the instance of the actual PipelineResource +that should be used

    -bundle
    +resourceSpec
    -string + +PipelineResourceSpec +
    (Optional) -

    Bundle url reference to a Tekton Bundle.

    -

    Deprecated: Please use ResolverRef with the bundles resolver instead.

    +

    ResourceSpec is specification of a resource that should be created and +consumed by the task

    +
    +

    PipelineResourceInterface +

    +
    +

    PipelineResourceInterface interface to be implemented by different PipelineResource types

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    +

    PipelineResourceRef +

    +

    +(Appears on:PipelineResourceBinding) +

    +
    +

    PipelineResourceRef can be used to refer to a specific instance of a Resource

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + @@ -9395,6 +10078,22 @@ PipelineSpec + + + + + + + + + + + + + + + +
    FieldDescription
    +name
    + +string + +
    +

    Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names

    -ResolverRef
    +apiVersion
    - -ResolverRef - +string
    (Optional) -

    ResolverRef allows referencing a Pipeline in a remote location -like a git repo. This field is only supported when the alpha -feature gate is enabled.

    +

    API version of the referent

    +resources
    + + +[]PipelineResourceBinding + + +
    +

    Resources is a list of bindings specifying which actual instances of +PipelineResources to use for the resources the Pipeline has declared +it needs.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    params
    @@ -9841,6 +10540,19 @@ used to populate a UI.

    +resources
    + + +[]PipelineDeclaredResource + + +
    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    tasks
    @@ -10037,6 +10749,20 @@ this Task executes. (Used to force a specific ordering in graph execution.)

    +resources
    + + +PipelineTaskResources + + +
    +(Optional) +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    params
    @@ -10080,29 +10806,165 @@ declared in the Task.

    -timeout
    +timeout
    + + +Kubernetes meta/v1.Duration + + +
    +(Optional) +

    Time after which the TaskRun times out. Defaults to 1 hour. +Specified TaskRun timeout should be less than 24h. +Refer Go’s ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration

    +
    +

    PipelineTaskInputResource +

    +

    +(Appears on:PipelineTaskResources) +

    +
    +

    PipelineTaskInputResource maps the name of a declared PipelineResource input +dependency in a Task to the resource in the Pipeline’s DeclaredPipelineResources +that should be used. This input may come from a previous task.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + + + + + + + + + +
    FieldDescription
    +name
    + +string + +
    +

    Name is the name of the PipelineResource as declared by the Task.

    +
    +resource
    + +string + +
    +

    Resource is the name of the DeclaredPipelineResource to use.

    +
    +from
    + +[]string + +
    +(Optional) +

    From is the list of PipelineTask names that the resource has to come from. +(Implies an ordering in the execution graph.)

    +
    +

    PipelineTaskMetadata +

    +

    +(Appears on:EmbeddedRunSpec, EmbeddedCustomRunSpec, EmbeddedTask, PipelineTaskRunSpec) +

    +
    +

    PipelineTaskMetadata contains the labels or annotations for an EmbeddedTask

    +
    + + + + + + + + + + + + + + + + + +
    FieldDescription
    +labels
    + +map[string]string + +
    +(Optional) +
    +annotations
    + +map[string]string + +
    +(Optional) +
    +

    PipelineTaskOutputResource +

    +

    +(Appears on:PipelineTaskResources) +

    +
    +

    PipelineTaskOutputResource maps the name of a declared PipelineResource output +dependency in a Task to the resource in the Pipeline’s DeclaredPipelineResources +that should be used.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + +
    FieldDescription
    +name
    + +string + +
    +

    Name is the name of the PipelineResource as declared by the Task.

    +
    +resource
    - -Kubernetes meta/v1.Duration - +string
    -(Optional) -

    Time after which the TaskRun times out. Defaults to 1 hour. -Specified TaskRun timeout should be less than 24h. -Refer Go’s ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration

    +

    Resource is the name of the DeclaredPipelineResource to use.

    -

    PipelineTaskMetadata +

    PipelineTaskParam

    -

    -(Appears on:EmbeddedRunSpec, EmbeddedCustomRunSpec, EmbeddedTask, PipelineTaskRunSpec) -

    -

    PipelineTaskMetadata contains the labels or annotations for an EmbeddedTask

    +

    PipelineTaskParam is used to provide arbitrary string parameters to a Task.

    @@ -10114,32 +10976,35 @@ Refer Go’s ParseDuration documentation for expected format: PipelineTaskParam +

    PipelineTaskResources

    +

    +(Appears on:PipelineTask) +

    -

    PipelineTaskParam is used to provide arbitrary string parameters to a Task.

    +

    PipelineTaskResources allows a Pipeline to declare how its DeclaredPipelineResources +should be provided to a Task as its inputs and outputs.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    @@ -10151,22 +11016,30 @@ map[string]string @@ -11121,7 +11994,7 @@ SkippingReason

    Step

    -(Appears on:TaskSpec) +(Appears on:InternalTaskModifier, TaskSpec)

    Step runs a subcomponent of a Task

    @@ -12066,6 +12939,12 @@ Default is false.

    TaskKind defines the type of Task used by the pipeline.

    +

    TaskModifier +

    +
    +

    TaskModifier is an interface to be implemented by different PipelineResources

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +

    TaskObject

    @@ -12158,6 +13037,141 @@ feature gate is enabled.

    -name
    +inputs
    -string + +[]PipelineTaskInputResource +
    +

    Inputs holds the mapping from the PipelineResources declared in +DeclaredPipelineResources to the input PipelineResources required by the Task.

    -value
    +outputs
    -string + +[]PipelineTaskOutputResource +
    +

    Outputs holds the mapping from the PipelineResources declared in +DeclaredPipelineResources to the input PipelineResources required by the Task.

    +

    TaskResource +

    +

    +(Appears on:TaskResources) +

    +
    +

    TaskResource defines an input or output Resource declared as a requirement +by a Task. The Name field will be used to refer to these Resources within +the Task definition, and when provided as an Input, the Name will be the +path to the volume mounted containing this Resource as an input (e.g. +an input Resource named workspace will be mounted at /workspace).

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + +
    FieldDescription
    +ResourceDeclaration
    + + +ResourceDeclaration + + +
    +

    +(Members of ResourceDeclaration are embedded into this type.) +

    +
    +

    TaskResourceBinding +

    +

    +(Appears on:TaskRunInputs, TaskRunOutputs, TaskRunResources) +

    +
    +

    TaskResourceBinding points to the PipelineResource that +will be used for the Task input or output called Name.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + + + + + +
    FieldDescription
    +PipelineResourceBinding
    + + +PipelineResourceBinding + + +
    +

    +(Members of PipelineResourceBinding are embedded into this type.) +

    +
    +paths
    + +[]string + +
    +(Optional) +

    Paths will probably be removed in #1284, and then PipelineResourceBinding can be used instead. +The optional Path field corresponds to a path on disk at which the Resource can be found +(used when providing the resource via mounted volume, overriding the default logic to fetch the Resource).

    +
    +

    TaskResources +

    +

    +(Appears on:TaskSpec) +

    +
    +

    TaskResources allows a Pipeline to declare how its DeclaredPipelineResources +should be provided to a Task as its inputs and outputs.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + + + + + +
    FieldDescription
    +inputs
    + + +[]TaskResource + + +
    +

    Inputs holds the mapping from the PipelineResources declared in +DeclaredPipelineResources to the input PipelineResources required by the Task.

    +
    +outputs
    + + +[]TaskResource + + +
    +

    Outputs holds the mapping from the PipelineResources declared in +DeclaredPipelineResources to the input PipelineResources required by the Task.

    +

    TaskResult

    @@ -12263,6 +13277,77 @@ conditions such as one used in spire results verification

    +

    TaskRunInputs +

    +
    +

    TaskRunInputs holds the input values that this task was invoked with.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + + + + + +
    FieldDescription
    +resources
    + + +[]TaskResourceBinding + + +
    +(Optional) +
    +params
    + + +[]Param + + +
    +(Optional) +
    +

    TaskRunOutputs +

    +
    +

    TaskRunOutputs holds the output values that this task was invoked with.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + +
    FieldDescription
    +resources
    + + +[]TaskResourceBinding + + +
    +(Optional) +

    TaskRunReason (string alias)

    @@ -12270,6 +13355,51 @@ conditions such as one used in spire results verification

    the Succeeded condition that are controlled by the TaskRun itself. Failure reasons that emerge from underlying resources are not included here

    +

    TaskRunResources +

    +

    +(Appears on:TaskRunSpec) +

    +
    +

    TaskRunResources allows a TaskRun to declare inputs and outputs TaskResourceBinding

    +

    Deprecated: Unused, preserved only for backwards compatibility

    +
    + + + + + + + + + + + + + + + + + +
    FieldDescription
    +inputs
    + + +[]TaskResourceBinding + + +
    +

    Inputs holds the inputs resources this task was invoked with

    +
    +outputs
    + + +[]TaskResourceBinding + + +
    +

    Outputs holds the inputs resources this task was invoked with

    +

    TaskRunResult

    @@ -12413,6 +13543,20 @@ Params +resources
    + + +TaskRunResources + + + + +(Optional) +

    Deprecated: Unused, preserved only for backwards compatibility

    + + + + serviceAccountName
    string @@ -12889,6 +14033,23 @@ Kubernetes core/v1.ResourceRequirements +resources
    + + +TaskResources + + + + +(Optional) +

    Resources is a list input and output resource to run the task +Resources are represented in TaskRuns as bindings to instances of +PipelineResources.

    +

    Deprecated: Unused, preserved only for backwards compatibility

    + + + + params
    diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 83bb68d4788..49e88afde99 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -32,6 +32,16 @@ GOFLAGS="-mod=vendor" # --output-base because this script should also be able to run inside the vendor dir of # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir # instead of the $GOPATH directly. For normal projects this can be dropped. + +# This generates deepcopy,client,informer and lister for the resource package (v1alpha1) +# This is separate from the pipeline package as resource are staying in v1alpha1 and they +# need to be separated (at least in terms of go package) from the pipeline's packages to +# not having dependency cycle. +bash ${REPO_ROOT_DIR}/hack/generate-groups.sh "deepcopy,client,informer,lister" \ + github.com/tektoncd/pipeline/pkg/client/resource github.com/tektoncd/pipeline/pkg/apis \ + "resource:v1alpha1" \ + --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt + # This generates deepcopy,client,informer and lister for the pipeline package (v1alpha1, v1beta1, and v1) bash ${REPO_ROOT_DIR}/hack/generate-groups.sh "deepcopy,client,informer,lister" \ github.com/tektoncd/pipeline/pkg/client github.com/tektoncd/pipeline/pkg/apis \ @@ -70,6 +80,14 @@ ${PREFIX}/deepcopy-gen \ -i github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1 # Knative Injection + +# This generates the knative injection packages for the resource package (v1alpha1). +# This is separate from the pipeline package for the same reason as client and all (see above). +bash ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \ + github.com/tektoncd/pipeline/pkg/client/resource github.com/tektoncd/pipeline/pkg/apis \ + "resource:v1alpha1" \ + --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt + # This generates the knative inject packages for the pipeline package (v1alpha1, v1beta1, v1). bash ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \ github.com/tektoncd/pipeline/pkg/client github.com/tektoncd/pipeline/pkg/apis \ diff --git a/pkg/apis/pipeline/v1beta1/openapi_generated.go b/pkg/apis/pipeline/v1beta1/openapi_generated.go index c8d5579cf89..dd0dec17bdf 100644 --- a/pkg/apis/pipeline/v1beta1/openapi_generated.go +++ b/pkg/apis/pipeline/v1beta1/openapi_generated.go @@ -44,13 +44,17 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.EmbeddedCustomRunSpec": schema_pkg_apis_pipeline_v1beta1_EmbeddedCustomRunSpec(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.EmbeddedTask": schema_pkg_apis_pipeline_v1beta1_EmbeddedTask(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.IncludeParams": schema_pkg_apis_pipeline_v1beta1_IncludeParams(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.InternalTaskModifier": schema_pkg_apis_pipeline_v1beta1_InternalTaskModifier(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Matrix": schema_pkg_apis_pipeline_v1beta1_Matrix(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param": schema_pkg_apis_pipeline_v1beta1_Param(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.ParamSpec": schema_pkg_apis_pipeline_v1beta1_ParamSpec(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.ParamValue": schema_pkg_apis_pipeline_v1beta1_ParamValue(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Pipeline": schema_pkg_apis_pipeline_v1beta1_Pipeline(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineDeclaredResource": schema_pkg_apis_pipeline_v1beta1_PipelineDeclaredResource(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineList": schema_pkg_apis_pipeline_v1beta1_PipelineList(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineRef": schema_pkg_apis_pipeline_v1beta1_PipelineRef(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResourceBinding": schema_pkg_apis_pipeline_v1beta1_PipelineResourceBinding(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResourceRef": schema_pkg_apis_pipeline_v1beta1_PipelineResourceRef(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResourceResult": schema_pkg_apis_pipeline_v1beta1_PipelineResourceResult(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResult": schema_pkg_apis_pipeline_v1beta1_PipelineResult(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineRun": schema_pkg_apis_pipeline_v1beta1_PipelineRun(ref), @@ -63,8 +67,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineRunTaskRunStatus": schema_pkg_apis_pipeline_v1beta1_PipelineRunTaskRunStatus(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineSpec": schema_pkg_apis_pipeline_v1beta1_PipelineSpec(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTask": schema_pkg_apis_pipeline_v1beta1_PipelineTask(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskInputResource": schema_pkg_apis_pipeline_v1beta1_PipelineTaskInputResource(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskMetadata": schema_pkg_apis_pipeline_v1beta1_PipelineTaskMetadata(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskOutputResource": schema_pkg_apis_pipeline_v1beta1_PipelineTaskOutputResource(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskParam": schema_pkg_apis_pipeline_v1beta1_PipelineTaskParam(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskResources": schema_pkg_apis_pipeline_v1beta1_PipelineTaskResources(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskRun": schema_pkg_apis_pipeline_v1beta1_PipelineTaskRun(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskRunSpec": schema_pkg_apis_pipeline_v1beta1_PipelineTaskRunSpec(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineWorkspaceDeclaration": schema_pkg_apis_pipeline_v1beta1_PipelineWorkspaceDeclaration(ref), @@ -82,10 +89,16 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Task": schema_pkg_apis_pipeline_v1beta1_Task(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskList": schema_pkg_apis_pipeline_v1beta1_TaskList(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRef": schema_pkg_apis_pipeline_v1beta1_TaskRef(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResource": schema_pkg_apis_pipeline_v1beta1_TaskResource(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResourceBinding": schema_pkg_apis_pipeline_v1beta1_TaskResourceBinding(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResources": schema_pkg_apis_pipeline_v1beta1_TaskResources(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResult": schema_pkg_apis_pipeline_v1beta1_TaskResult(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRun": schema_pkg_apis_pipeline_v1beta1_TaskRun(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunDebug": schema_pkg_apis_pipeline_v1beta1_TaskRunDebug(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunInputs": schema_pkg_apis_pipeline_v1beta1_TaskRunInputs(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunList": schema_pkg_apis_pipeline_v1beta1_TaskRunList(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunOutputs": schema_pkg_apis_pipeline_v1beta1_TaskRunOutputs(ref), + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunResources": schema_pkg_apis_pipeline_v1beta1_TaskRunResources(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunResult": schema_pkg_apis_pipeline_v1beta1_TaskRunResult(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunSidecarOverride": schema_pkg_apis_pipeline_v1beta1_TaskRunSidecarOverride(ref), "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunSpec": schema_pkg_apis_pipeline_v1beta1_TaskRunSpec(ref), @@ -924,6 +937,12 @@ func schema_pkg_apis_pipeline_v1beta1_EmbeddedTask(ref common.ReferenceCallback) Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskMetadata"), }, }, + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "Resources is a list input and output resource to run the task Resources are represented in TaskRuns as bindings to instances of PipelineResources.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResources"), + }, + }, "params": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ @@ -1062,7 +1081,7 @@ func schema_pkg_apis_pipeline_v1beta1_EmbeddedTask(ref common.ReferenceCallback) }, }, Dependencies: []string{ - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.ParamSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskMetadata", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Sidecar", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Step", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.StepTemplate", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResult", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspaceDeclaration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.ParamSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskMetadata", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Sidecar", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Step", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.StepTemplate", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResources", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResult", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspaceDeclaration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, } } @@ -1107,6 +1126,76 @@ func schema_pkg_apis_pipeline_v1beta1_IncludeParams(ref common.ReferenceCallback } } +func schema_pkg_apis_pipeline_v1beta1_InternalTaskModifier(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "InternalTaskModifier implements TaskModifier for resources that are built-in to Tekton Pipelines.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "stepsToPrepend": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Step"), + }, + }, + }, + }, + }, + "stepsToAppend": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Step"), + }, + }, + }, + }, + }, + "volumes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.Volume"), + }, + }, + }, + }, + }, + }, + Required: []string{"stepsToPrepend", "stepsToAppend", "volumes"}, + }, + }, + Dependencies: []string{ + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Step", "k8s.io/api/core/v1.Volume"}, + } +} + func schema_pkg_apis_pipeline_v1beta1_Matrix(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1353,6 +1442,43 @@ func schema_pkg_apis_pipeline_v1beta1_Pipeline(ref common.ReferenceCallback) com } } +func schema_pkg_apis_pipeline_v1beta1_PipelineDeclaredResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PipelineDeclaredResource is used by a Pipeline to declare the types of the PipelineResources that it will required to run and names which can be used to refer to these PipelineResources in PipelineTaskResourceBindings.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the name that will be used by the Pipeline to refer to this resource. It does not directly correspond to the name of any PipelineResources Task inputs or outputs, and it does not correspond to the actual names of the PipelineResources that will be bound in the PipelineRun.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type is the type of the PipelineResource.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "optional": { + SchemaProps: spec.SchemaProps{ + Description: "Optional declares the resource as optional. optional: true - the resource is considered optional optional: false - the resource is considered required (default/equivalent of not specifying it)", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"name", "type"}, + }, + }, + } +} + func schema_pkg_apis_pipeline_v1beta1_PipelineList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1436,6 +1562,67 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineRef(ref common.ReferenceCallback) } } +func schema_pkg_apis_pipeline_v1beta1_PipelineResourceBinding(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PipelineResourceBinding connects a reference to an instance of a PipelineResource with a PipelineResource dependency that the Pipeline has declared\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the name of the PipelineResource in the Pipeline's declaration", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceRef": { + SchemaProps: spec.SchemaProps{ + Description: "ResourceRef is a reference to the instance of the actual PipelineResource that should be used", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResourceRef"), + }, + }, + "resourceSpec": { + SchemaProps: spec.SchemaProps{ + Description: "ResourceSpec is specification of a resource that should be created and consumed by the task", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1.PipelineResourceSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResourceRef", "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1.PipelineResourceSpec"}, + } +} + +func schema_pkg_apis_pipeline_v1beta1_PipelineResourceRef(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PipelineResourceRef can be used to refer to a specific instance of a Resource\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "API version of the referent", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_pkg_apis_pipeline_v1beta1_PipelineResourceResult(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1713,6 +1900,25 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineRunSpec(ref common.ReferenceCallba Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineSpec"), }, }, + "resources": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Resources is a list of bindings specifying which actual instances of PipelineResources to use for the resources the Pipeline has declared it needs.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResourceBinding"), + }, + }, + }, + }, + }, "params": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ @@ -1805,7 +2011,7 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineRunSpec(ref common.ReferenceCallba }, }, Dependencies: []string{ - "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod.Template", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskRunSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TimeoutFields", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspaceBinding", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod.Template", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResourceBinding", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskRunSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TimeoutFields", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspaceBinding", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, } } @@ -2212,6 +2418,25 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineSpec(ref common.ReferenceCallback) Format: "", }, }, + "resources": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: Unused, preserved only for backwards compatibility", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineDeclaredResource"), + }, + }, + }, + }, + }, "tasks": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ @@ -2311,7 +2536,7 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineSpec(ref common.ReferenceCallback) }, }, Dependencies: []string{ - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.ParamSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResult", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTask", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineWorkspaceDeclaration"}, + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.ParamSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineDeclaredResource", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResult", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTask", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineWorkspaceDeclaration"}, } } @@ -2396,6 +2621,12 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineTask(ref common.ReferenceCallback) }, }, }, + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: Unused, preserved only for backwards compatibility", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskResources"), + }, + }, "params": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ @@ -2450,7 +2681,57 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineTask(ref common.ReferenceCallback) }, }, Dependencies: []string{ - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.EmbeddedTask", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Matrix", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WhenExpression", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspacePipelineTaskBinding", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.EmbeddedTask", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Matrix", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskResources", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WhenExpression", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspacePipelineTaskBinding", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + } +} + +func schema_pkg_apis_pipeline_v1beta1_PipelineTaskInputResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PipelineTaskInputResource maps the name of a declared PipelineResource input dependency in a Task to the resource in the Pipeline's DeclaredPipelineResources that should be used. This input may come from a previous task.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the name of the PipelineResource as declared by the Task.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Description: "Resource is the name of the DeclaredPipelineResource to use.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "from": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "From is the list of PipelineTask names that the resource has to come from. (Implies an ordering in the execution graph.)", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"name", "resource"}, + }, + }, } } @@ -2497,6 +2778,36 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineTaskMetadata(ref common.ReferenceC } } +func schema_pkg_apis_pipeline_v1beta1_PipelineTaskOutputResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PipelineTaskOutputResource maps the name of a declared PipelineResource output dependency in a Task to the resource in the Pipeline's DeclaredPipelineResources that should be used.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the name of the PipelineResource as declared by the Task.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Description: "Resource is the name of the DeclaredPipelineResource to use.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "resource"}, + }, + }, + } +} + func schema_pkg_apis_pipeline_v1beta1_PipelineTaskParam(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -2525,6 +2836,59 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineTaskParam(ref common.ReferenceCall } } +func schema_pkg_apis_pipeline_v1beta1_PipelineTaskResources(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PipelineTaskResources allows a Pipeline to declare how its DeclaredPipelineResources should be provided to a Task as its inputs and outputs.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "inputs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Inputs holds the mapping from the PipelineResources declared in DeclaredPipelineResources to the input PipelineResources required by the Task.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskInputResource"), + }, + }, + }, + }, + }, + "outputs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Outputs holds the mapping from the PipelineResources declared in DeclaredPipelineResources to the input PipelineResources required by the Task.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskOutputResource"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskInputResource", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskOutputResource"}, + } +} + func schema_pkg_apis_pipeline_v1beta1_PipelineTaskRun(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -3962,6 +4326,164 @@ func schema_pkg_apis_pipeline_v1beta1_TaskRef(ref common.ReferenceCallback) comm } } +func schema_pkg_apis_pipeline_v1beta1_TaskResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TaskResource defines an input or output Resource declared as a requirement by a Task. The Name field will be used to refer to these Resources within the Task definition, and when provided as an Input, the Name will be the path to the volume mounted containing this Resource as an input (e.g. an input Resource named `workspace` will be mounted at `/workspace`).\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name declares the name by which a resource is referenced in the definition. Resources may be referenced by name in the definition of a Task's steps.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type is the type of this resource;", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "description": { + SchemaProps: spec.SchemaProps{ + Description: "Description is a user-facing description of the declared resource that may be used to populate a UI.", + Type: []string{"string"}, + Format: "", + }, + }, + "targetPath": { + SchemaProps: spec.SchemaProps{ + Description: "TargetPath is the path in workspace directory where the resource will be copied.", + Type: []string{"string"}, + Format: "", + }, + }, + "optional": { + SchemaProps: spec.SchemaProps{ + Description: "Optional declares the resource as optional. By default optional is set to false which makes a resource required. optional: true - the resource is considered optional optional: false - the resource is considered required (equivalent of not specifying it)", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"name", "type"}, + }, + }, + } +} + +func schema_pkg_apis_pipeline_v1beta1_TaskResourceBinding(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TaskResourceBinding points to the PipelineResource that will be used for the Task input or output called Name.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the name of the PipelineResource in the Pipeline's declaration", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceRef": { + SchemaProps: spec.SchemaProps{ + Description: "ResourceRef is a reference to the instance of the actual PipelineResource that should be used", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResourceRef"), + }, + }, + "resourceSpec": { + SchemaProps: spec.SchemaProps{ + Description: "ResourceSpec is specification of a resource that should be created and consumed by the task", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1.PipelineResourceSpec"), + }, + }, + "paths": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Paths will probably be removed in #1284, and then PipelineResourceBinding can be used instead. The optional Path field corresponds to a path on disk at which the Resource can be found (used when providing the resource via mounted volume, overriding the default logic to fetch the Resource).", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineResourceRef", "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1.PipelineResourceSpec"}, + } +} + +func schema_pkg_apis_pipeline_v1beta1_TaskResources(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TaskResources allows a Pipeline to declare how its DeclaredPipelineResources should be provided to a Task as its inputs and outputs.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "inputs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Inputs holds the mapping from the PipelineResources declared in DeclaredPipelineResources to the input PipelineResources required by the Task.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResource"), + }, + }, + }, + }, + }, + "outputs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Outputs holds the mapping from the PipelineResources declared in DeclaredPipelineResources to the input PipelineResources required by the Task.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResource"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResource"}, + } +} + func schema_pkg_apis_pipeline_v1beta1_TaskResult(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -4094,6 +4616,57 @@ func schema_pkg_apis_pipeline_v1beta1_TaskRunDebug(ref common.ReferenceCallback) } } +func schema_pkg_apis_pipeline_v1beta1_TaskRunInputs(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TaskRunInputs holds the input values that this task was invoked with.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "resources": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResourceBinding"), + }, + }, + }, + }, + }, + "params": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResourceBinding"}, + } +} + func schema_pkg_apis_pipeline_v1beta1_TaskRunList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -4143,6 +4716,92 @@ func schema_pkg_apis_pipeline_v1beta1_TaskRunList(ref common.ReferenceCallback) } } +func schema_pkg_apis_pipeline_v1beta1_TaskRunOutputs(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TaskRunOutputs holds the output values that this task was invoked with.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "resources": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResourceBinding"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResourceBinding"}, + } +} + +func schema_pkg_apis_pipeline_v1beta1_TaskRunResources(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TaskRunResources allows a TaskRun to declare inputs and outputs TaskResourceBinding\n\nDeprecated: Unused, preserved only for backwards compatibility", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "inputs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Inputs holds the inputs resources this task was invoked with", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResourceBinding"), + }, + }, + }, + }, + }, + "outputs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Outputs holds the inputs resources this task was invoked with", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResourceBinding"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResourceBinding"}, + } +} + func schema_pkg_apis_pipeline_v1beta1_TaskRunResult(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -4242,6 +4901,12 @@ func schema_pkg_apis_pipeline_v1beta1_TaskRunSpec(ref common.ReferenceCallback) }, }, }, + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: Unused, preserved only for backwards compatibility", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunResources"), + }, + }, "serviceAccountName": { SchemaProps: spec.SchemaProps{ Default: "", @@ -4360,7 +5025,7 @@ func schema_pkg_apis_pipeline_v1beta1_TaskRunSpec(ref common.ReferenceCallback) }, }, Dependencies: []string{ - "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod.Template", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunDebug", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunSidecarOverride", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunStepOverride", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspaceBinding", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod.Template", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunDebug", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunResources", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunSidecarOverride", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRunStepOverride", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspaceBinding", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, } } @@ -4801,6 +5466,12 @@ func schema_pkg_apis_pipeline_v1beta1_TaskSpec(ref common.ReferenceCallback) com Description: "TaskSpec defines the desired state of Task.", Type: []string{"object"}, Properties: map[string]spec.Schema{ + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "Resources is a list input and output resource to run the task Resources are represented in TaskRuns as bindings to instances of PipelineResources.\n\nDeprecated: Unused, preserved only for backwards compatibility", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResources"), + }, + }, "params": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ @@ -4939,7 +5610,7 @@ func schema_pkg_apis_pipeline_v1beta1_TaskSpec(ref common.ReferenceCallback) com }, }, Dependencies: []string{ - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.ParamSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Sidecar", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Step", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.StepTemplate", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResult", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspaceDeclaration", "k8s.io/api/core/v1.Volume"}, + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.ParamSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Sidecar", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Step", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.StepTemplate", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResources", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskResult", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspaceDeclaration", "k8s.io/api/core/v1.Volume"}, } } diff --git a/pkg/apis/pipeline/v1beta1/pipeline_types.go b/pkg/apis/pipeline/v1beta1/pipeline_types.go index 8b55a8e1d25..7f3256387d6 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_types.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_types.go @@ -94,6 +94,9 @@ type PipelineSpec struct { // used to populate a UI. // +optional Description string `json:"description,omitempty"` + // Deprecated: Unused, preserved only for backwards compatibility + // +listType=atomic + Resources []PipelineDeclaredResource `json:"resources,omitempty"` // Tasks declares the graph of Tasks that execute when this Pipeline is run. // +listType=atomic Tasks []PipelineTask `json:"tasks,omitempty"` @@ -201,6 +204,10 @@ type PipelineTask struct { // +listType=atomic RunAfter []string `json:"runAfter,omitempty"` + // Deprecated: Unused, preserved only for backwards compatibility + // +optional + Resources *PipelineTaskResources `json:"resources,omitempty"` + // Parameters declares parameters passed to this task. // +optional // +listType=atomic @@ -451,6 +458,10 @@ func (pt PipelineTask) Validate(ctx context.Context) (errs *apis.FieldError) { errs = errs.Also(pt.validateEmbeddedOrType()) + if pt.Resources != nil { + errs = errs.Also(apis.ErrDisallowedFields("resources")) + } + cfg := config.FromContextOrDefaults(ctx) // Pipeline task having taskRef/taskSpec with APIVersion is classified as custom task switch { diff --git a/pkg/apis/pipeline/v1beta1/pipeline_validation.go b/pkg/apis/pipeline/v1beta1/pipeline_validation.go index 63554e355a1..449c2ead72e 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_validation.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_validation.go @@ -56,6 +56,9 @@ func (ps *PipelineSpec) Validate(ctx context.Context) (errs *apis.FieldError) { } // PipelineTask must have a valid unique label and at least one of taskRef or taskSpec should be specified errs = errs.Also(ValidatePipelineTasks(ctx, ps.Tasks, ps.Finally)) + if len(ps.Resources) > 0 { + errs = errs.Also(apis.ErrDisallowedFields("resources")) + } // Validate the pipeline task graph errs = errs.Also(validateGraph(ps.Tasks)) // The parameter variables should be valid diff --git a/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go b/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go index 186819fc286..e9d539c0a59 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go @@ -596,6 +596,47 @@ func TestPipelineSpec_Validate_Failure(t *testing.T) { Message: `missing field(s)`, Paths: []string{"tasks[1].when[0]", "finally[0].when[0]"}, }, + }, { + name: "uses resources", + ps: &PipelineSpec{ + Resources: []PipelineDeclaredResource{{Name: "foo"}}, + Tasks: []PipelineTask{{ + Name: "valid-pipeline-task", + TaskRef: &TaskRef{Name: "foo-task"}, + }}, + }, + expectedError: apis.FieldError{ + Message: `must not set the field(s)`, + Paths: []string{"resources"}, + }, + }, { + name: "uses resources in tasks", + ps: &PipelineSpec{ + Tasks: []PipelineTask{{ + Name: "pipeline-task", + TaskSpec: &EmbeddedTask{TaskSpec: TaskSpec{Resources: &TaskResources{}, Steps: []Step{{Image: "my-image"}}}}, + }}, + }, + expectedError: apis.FieldError{ + Message: `must not set the field(s)`, + Paths: []string{"tasks[0].taskSpec.resources"}, + }, + }, { + name: "uses resources in finally", + ps: &PipelineSpec{ + Tasks: []PipelineTask{{ + Name: "valid-pipeline-task", + TaskSpec: &EmbeddedTask{TaskSpec: TaskSpec{Steps: []Step{{Image: "my-image"}}}}, + }}, + Finally: []PipelineTask{{ + Name: "finally", + TaskSpec: &EmbeddedTask{TaskSpec: TaskSpec{Resources: &TaskResources{}, Steps: []Step{{Image: "my-image"}}}}, + }}, + }, + expectedError: apis.FieldError{ + Message: `must not set the field(s)`, + Paths: []string{"finally[0].taskSpec.resources"}, + }, }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/pkg/apis/pipeline/v1beta1/pipelinerun_types.go b/pkg/apis/pipeline/v1beta1/pipelinerun_types.go index 04032acc20e..244d58130e5 100644 --- a/pkg/apis/pipeline/v1beta1/pipelinerun_types.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_types.go @@ -223,6 +223,13 @@ type PipelineRunSpec struct { PipelineRef *PipelineRef `json:"pipelineRef,omitempty"` // +optional PipelineSpec *PipelineSpec `json:"pipelineSpec,omitempty"` + // Resources is a list of bindings specifying which actual instances of + // PipelineResources to use for the resources the Pipeline has declared + // it needs. + // + // Deprecated: Unused, preserved only for backwards compatibility + // +listType=atomic + Resources []PipelineResourceBinding `json:"resources,omitempty"` // Params is a list of parameter names and values. // +listType=atomic Params Params `json:"params,omitempty"` diff --git a/pkg/apis/pipeline/v1beta1/pipelinerun_validation.go b/pkg/apis/pipeline/v1beta1/pipelinerun_validation.go index c4d41851ad3..ed7ac5cce14 100644 --- a/pkg/apis/pipeline/v1beta1/pipelinerun_validation.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_validation.go @@ -131,6 +131,9 @@ func (ps *PipelineRunSpec) Validate(ctx context.Context) (errs *apis.FieldError) if ps.PodTemplate != nil { errs = errs.Also(validatePodTemplateEnv(ctx, *ps.PodTemplate)) } + if ps.Resources != nil { + errs = errs.Also(apis.ErrDisallowedFields("resources")) + } return errs } diff --git a/pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go b/pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go index e6b63e7810a..6e08fa86a87 100644 --- a/pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go @@ -496,6 +496,18 @@ func TestPipelineRun_Invalid(t *testing.T) { Message: "invalid value: PipelineRun cannot be Pending after it is started", Paths: []string{"spec.status"}, }, + }, { + name: "uses resources", + pr: v1beta1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "pipelinerunname", + }, + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "foo"}, + Resources: []v1beta1.PipelineResourceBinding{{Name: "bar"}}, + }, + }, + want: &apis.FieldError{Message: "must not set the field(s)", Paths: []string{"spec.resources"}}, }} for _, tc := range tests { diff --git a/pkg/apis/pipeline/v1beta1/resource_types.go b/pkg/apis/pipeline/v1beta1/resource_types.go index d40524860a4..47026a20987 100644 --- a/pkg/apis/pipeline/v1beta1/resource_types.go +++ b/pkg/apis/pipeline/v1beta1/resource_types.go @@ -21,6 +21,8 @@ import ( "fmt" "github.com/hashicorp/go-multierror" + resource "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + v1 "k8s.io/api/core/v1" ) // PipelineResourceResult is used to write key/value pairs to TaskRun pod termination messages. @@ -77,3 +79,230 @@ func (r *ResultType) UnmarshalJSON(data []byte) error { return nil } + +// ResourceParam declares a string value to use for the parameter called Name, and is used in +// the specific context of PipelineResources. +// +// Deprecated: Unused, preserved only for backwards compatibility +type ResourceParam = resource.ResourceParam + +// PipelineResourceType represents the type of endpoint the pipelineResource is, so that the +// controller will know this pipelineResource should be fetched and optionally what +// additional metatdata should be provided for it. +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineResourceType = resource.PipelineResourceType + +// PipelineDeclaredResource is used by a Pipeline to declare the types of the +// PipelineResources that it will required to run and names which can be used to +// refer to these PipelineResources in PipelineTaskResourceBindings. +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineDeclaredResource struct { + // Name is the name that will be used by the Pipeline to refer to this resource. + // It does not directly correspond to the name of any PipelineResources Task + // inputs or outputs, and it does not correspond to the actual names of the + // PipelineResources that will be bound in the PipelineRun. + Name string `json:"name"` + // Type is the type of the PipelineResource. + Type PipelineResourceType `json:"type"` + // Optional declares the resource as optional. + // optional: true - the resource is considered optional + // optional: false - the resource is considered required (default/equivalent of not specifying it) + Optional bool `json:"optional,omitempty"` +} + +// TaskResources allows a Pipeline to declare how its DeclaredPipelineResources +// should be provided to a Task as its inputs and outputs. +// +// Deprecated: Unused, preserved only for backwards compatibility +type TaskResources struct { + // Inputs holds the mapping from the PipelineResources declared in + // DeclaredPipelineResources to the input PipelineResources required by the Task. + // +listType=atomic + Inputs []TaskResource `json:"inputs,omitempty"` + // Outputs holds the mapping from the PipelineResources declared in + // DeclaredPipelineResources to the input PipelineResources required by the Task. + // +listType=atomic + Outputs []TaskResource `json:"outputs,omitempty"` +} + +// TaskResource defines an input or output Resource declared as a requirement +// by a Task. The Name field will be used to refer to these Resources within +// the Task definition, and when provided as an Input, the Name will be the +// path to the volume mounted containing this Resource as an input (e.g. +// an input Resource named `workspace` will be mounted at `/workspace`). +// +// Deprecated: Unused, preserved only for backwards compatibility +type TaskResource struct { + ResourceDeclaration `json:",inline"` +} + +// TaskRunResources allows a TaskRun to declare inputs and outputs TaskResourceBinding +// +// Deprecated: Unused, preserved only for backwards compatibility +type TaskRunResources struct { + // Inputs holds the inputs resources this task was invoked with + // +listType=atomic + Inputs []TaskResourceBinding `json:"inputs,omitempty"` + // Outputs holds the inputs resources this task was invoked with + // +listType=atomic + Outputs []TaskResourceBinding `json:"outputs,omitempty"` +} + +// TaskResourceBinding points to the PipelineResource that +// will be used for the Task input or output called Name. +// +// Deprecated: Unused, preserved only for backwards compatibility +type TaskResourceBinding struct { + PipelineResourceBinding `json:",inline"` + // Paths will probably be removed in #1284, and then PipelineResourceBinding can be used instead. + // The optional Path field corresponds to a path on disk at which the Resource can be found + // (used when providing the resource via mounted volume, overriding the default logic to fetch the Resource). + // +optional + // +listType=atomic + Paths []string `json:"paths,omitempty"` +} + +// ResourceDeclaration defines an input or output PipelineResource declared as a requirement +// by another type such as a Task or Condition. The Name field will be used to refer to these +// PipelineResources within the type's definition, and when provided as an Input, the Name will be the +// path to the volume mounted containing this PipelineResource as an input (e.g. +// an input Resource named `workspace` will be mounted at `/workspace`). +// +// Deprecated: Unused, preserved only for backwards compatibility +type ResourceDeclaration = resource.ResourceDeclaration + +// PipelineResourceBinding connects a reference to an instance of a PipelineResource +// with a PipelineResource dependency that the Pipeline has declared +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineResourceBinding struct { + // Name is the name of the PipelineResource in the Pipeline's declaration + Name string `json:"name,omitempty"` + // ResourceRef is a reference to the instance of the actual PipelineResource + // that should be used + // +optional + ResourceRef *PipelineResourceRef `json:"resourceRef,omitempty"` + + // ResourceSpec is specification of a resource that should be created and + // consumed by the task + // +optional + ResourceSpec *resource.PipelineResourceSpec `json:"resourceSpec,omitempty"` +} + +// PipelineTaskResources allows a Pipeline to declare how its DeclaredPipelineResources +// should be provided to a Task as its inputs and outputs. +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineTaskResources struct { + // Inputs holds the mapping from the PipelineResources declared in + // DeclaredPipelineResources to the input PipelineResources required by the Task. + // +listType=atomic + Inputs []PipelineTaskInputResource `json:"inputs,omitempty"` + // Outputs holds the mapping from the PipelineResources declared in + // DeclaredPipelineResources to the input PipelineResources required by the Task. + // +listType=atomic + Outputs []PipelineTaskOutputResource `json:"outputs,omitempty"` +} + +// PipelineTaskInputResource maps the name of a declared PipelineResource input +// dependency in a Task to the resource in the Pipeline's DeclaredPipelineResources +// that should be used. This input may come from a previous task. +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineTaskInputResource struct { + // Name is the name of the PipelineResource as declared by the Task. + Name string `json:"name"` + // Resource is the name of the DeclaredPipelineResource to use. + Resource string `json:"resource"` + // From is the list of PipelineTask names that the resource has to come from. + // (Implies an ordering in the execution graph.) + // +optional + // +listType=atomic + From []string `json:"from,omitempty"` +} + +// PipelineTaskOutputResource maps the name of a declared PipelineResource output +// dependency in a Task to the resource in the Pipeline's DeclaredPipelineResources +// that should be used. +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineTaskOutputResource struct { + // Name is the name of the PipelineResource as declared by the Task. + Name string `json:"name"` + // Resource is the name of the DeclaredPipelineResource to use. + Resource string `json:"resource"` +} + +// TaskRunInputs holds the input values that this task was invoked with. +// +// Deprecated: Unused, preserved only for backwards compatibility +type TaskRunInputs struct { + // +optional + // +listType=atomic + Resources []TaskResourceBinding `json:"resources,omitempty"` + // +optional + // +listType=atomic + Params []Param `json:"params,omitempty"` +} + +// TaskRunOutputs holds the output values that this task was invoked with. +// +// Deprecated: Unused, preserved only for backwards compatibility +type TaskRunOutputs struct { + // +optional + // +listType=atomic + Resources []TaskResourceBinding `json:"resources,omitempty"` +} + +// PipelineResourceRef can be used to refer to a specific instance of a Resource +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineResourceRef struct { + // Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names + Name string `json:"name,omitempty"` + // API version of the referent + // +optional + APIVersion string `json:"apiVersion,omitempty"` +} + +// PipelineResourceInterface interface to be implemented by different PipelineResource types +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineResourceInterface interface { + // GetName returns the name of this PipelineResource instance. + GetName() string + // GetType returns the type of this PipelineResource (often a super type, e.g. in the case of storage). + GetType() PipelineResourceType + // Replacements returns all the attributes that this PipelineResource has that + // can be used for variable replacement. + Replacements() map[string]string + // GetOutputTaskModifier returns the TaskModifier instance that should be used on a Task + // in order to add this kind of resource when it is being used as an output. + GetOutputTaskModifier(ts *TaskSpec, path string) (TaskModifier, error) + // GetInputTaskModifier returns the TaskModifier instance that should be used on a Task + // in order to add this kind of resource when it is being used as an input. + GetInputTaskModifier(ts *TaskSpec, path string) (TaskModifier, error) +} + +// TaskModifier is an interface to be implemented by different PipelineResources +// +// Deprecated: Unused, preserved only for backwards compatibility +type TaskModifier interface { + GetStepsToPrepend() []Step + GetStepsToAppend() []Step + GetVolumes() []v1.Volume +} + +// InternalTaskModifier implements TaskModifier for resources that are built-in to Tekton Pipelines. +// +// Deprecated: Unused, preserved only for backwards compatibility +type InternalTaskModifier struct { + // +listType=atomic + StepsToPrepend []Step `json:"stepsToPrepend"` + // +listType=atomic + StepsToAppend []Step `json:"stepsToAppend"` + // +listType=atomic + Volumes []v1.Volume `json:"volumes"` +} diff --git a/pkg/apis/pipeline/v1beta1/swagger.json b/pkg/apis/pipeline/v1beta1/swagger.json index 2ec0867077c..bacfd7bcb46 100644 --- a/pkg/apis/pipeline/v1beta1/swagger.json +++ b/pkg/apis/pipeline/v1beta1/swagger.json @@ -453,6 +453,10 @@ }, "x-kubernetes-list-type": "atomic" }, + "resources": { + "description": "Resources is a list input and output resource to run the task Resources are represented in TaskRuns as bindings to instances of PipelineResources.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "$ref": "#/definitions/v1beta1.TaskResources" + }, "results": { "description": "Results are values that this Task can output", "type": "array", @@ -528,6 +532,41 @@ } } }, + "v1beta1.InternalTaskModifier": { + "description": "InternalTaskModifier implements TaskModifier for resources that are built-in to Tekton Pipelines.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "required": [ + "stepsToPrepend", + "stepsToAppend", + "volumes" + ], + "properties": { + "stepsToAppend": { + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.Step" + }, + "x-kubernetes-list-type": "atomic" + }, + "stepsToPrepend": { + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.Step" + }, + "x-kubernetes-list-type": "atomic" + }, + "volumes": { + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1.Volume" + }, + "x-kubernetes-list-type": "atomic" + } + } + }, "v1beta1.Matrix": { "description": "Matrix is used to fan out Tasks in a Pipeline", "type": "object", @@ -663,6 +702,30 @@ } } }, + "v1beta1.PipelineDeclaredResource": { + "description": "PipelineDeclaredResource is used by a Pipeline to declare the types of the PipelineResources that it will required to run and names which can be used to refer to these PipelineResources in PipelineTaskResourceBindings.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "required": [ + "name", + "type" + ], + "properties": { + "name": { + "description": "Name is the name that will be used by the Pipeline to refer to this resource. It does not directly correspond to the name of any PipelineResources Task inputs or outputs, and it does not correspond to the actual names of the PipelineResources that will be bound in the PipelineRun.", + "type": "string", + "default": "" + }, + "optional": { + "description": "Optional declares the resource as optional. optional: true - the resource is considered optional optional: false - the resource is considered required (default/equivalent of not specifying it)", + "type": "boolean" + }, + "type": { + "description": "Type is the type of the PipelineResource.", + "type": "string", + "default": "" + } + } + }, "v1beta1.PipelineList": { "description": "PipelineList contains a list of Pipeline", "type": "object", @@ -709,6 +772,38 @@ } } }, + "v1beta1.PipelineResourceBinding": { + "description": "PipelineResourceBinding connects a reference to an instance of a PipelineResource with a PipelineResource dependency that the Pipeline has declared\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "properties": { + "name": { + "description": "Name is the name of the PipelineResource in the Pipeline's declaration", + "type": "string" + }, + "resourceRef": { + "description": "ResourceRef is a reference to the instance of the actual PipelineResource that should be used", + "$ref": "#/definitions/v1beta1.PipelineResourceRef" + }, + "resourceSpec": { + "description": "ResourceSpec is specification of a resource that should be created and consumed by the task", + "$ref": "#/definitions/v1alpha1.PipelineResourceSpec" + } + } + }, + "v1beta1.PipelineResourceRef": { + "description": "PipelineResourceRef can be used to refer to a specific instance of a Resource\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "properties": { + "apiVersion": { + "description": "API version of the referent", + "type": "string" + }, + "name": { + "description": "Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names", + "type": "string" + } + } + }, "v1beta1.PipelineResourceResult": { "description": "PipelineResourceResult is used to write key/value pairs to TaskRun pod termination messages. The key/value pairs may come from the entrypoint binary, or represent a TaskRunResult. If they represent a TaskRunResult, the key is the name of the result and the value is the JSON-serialized value of the result.", "type": "object", @@ -881,6 +976,15 @@ "description": "PodTemplate holds pod specific configuration", "$ref": "#/definitions/pod.Template" }, + "resources": { + "description": "Resources is a list of bindings specifying which actual instances of PipelineResources to use for the resources the Pipeline has declared it needs.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.PipelineResourceBinding" + }, + "x-kubernetes-list-type": "atomic" + }, "serviceAccountName": { "type": "string" }, @@ -1142,6 +1246,15 @@ }, "x-kubernetes-list-type": "atomic" }, + "resources": { + "description": "Deprecated: Unused, preserved only for backwards compatibility", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.PipelineDeclaredResource" + }, + "x-kubernetes-list-type": "atomic" + }, "results": { "description": "Results are values that this pipeline can output once run", "type": "array", @@ -1200,6 +1313,10 @@ }, "x-kubernetes-list-type": "atomic" }, + "resources": { + "description": "Deprecated: Unused, preserved only for backwards compatibility", + "$ref": "#/definitions/v1beta1.PipelineTaskResources" + }, "retries": { "description": "Retries represents how many times this task should be retried in case of task failure: ConditionSucceeded set to False", "type": "integer", @@ -1245,6 +1362,35 @@ } } }, + "v1beta1.PipelineTaskInputResource": { + "description": "PipelineTaskInputResource maps the name of a declared PipelineResource input dependency in a Task to the resource in the Pipeline's DeclaredPipelineResources that should be used. This input may come from a previous task.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "required": [ + "name", + "resource" + ], + "properties": { + "from": { + "description": "From is the list of PipelineTask names that the resource has to come from. (Implies an ordering in the execution graph.)", + "type": "array", + "items": { + "type": "string", + "default": "" + }, + "x-kubernetes-list-type": "atomic" + }, + "name": { + "description": "Name is the name of the PipelineResource as declared by the Task.", + "type": "string", + "default": "" + }, + "resource": { + "description": "Resource is the name of the DeclaredPipelineResource to use.", + "type": "string", + "default": "" + } + } + }, "v1beta1.PipelineTaskMetadata": { "description": "PipelineTaskMetadata contains the labels or annotations for an EmbeddedTask", "type": "object", @@ -1265,6 +1411,26 @@ } } }, + "v1beta1.PipelineTaskOutputResource": { + "description": "PipelineTaskOutputResource maps the name of a declared PipelineResource output dependency in a Task to the resource in the Pipeline's DeclaredPipelineResources that should be used.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "required": [ + "name", + "resource" + ], + "properties": { + "name": { + "description": "Name is the name of the PipelineResource as declared by the Task.", + "type": "string", + "default": "" + }, + "resource": { + "description": "Resource is the name of the DeclaredPipelineResource to use.", + "type": "string", + "default": "" + } + } + }, "v1beta1.PipelineTaskParam": { "description": "PipelineTaskParam is used to provide arbitrary string parameters to a Task.", "type": "object", @@ -1283,6 +1449,30 @@ } } }, + "v1beta1.PipelineTaskResources": { + "description": "PipelineTaskResources allows a Pipeline to declare how its DeclaredPipelineResources should be provided to a Task as its inputs and outputs.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "properties": { + "inputs": { + "description": "Inputs holds the mapping from the PipelineResources declared in DeclaredPipelineResources to the input PipelineResources required by the Task.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.PipelineTaskInputResource" + }, + "x-kubernetes-list-type": "atomic" + }, + "outputs": { + "description": "Outputs holds the mapping from the PipelineResources declared in DeclaredPipelineResources to the input PipelineResources required by the Task.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.PipelineTaskOutputResource" + }, + "x-kubernetes-list-type": "atomic" + } + } + }, "v1beta1.PipelineTaskRun": { "description": "PipelineTaskRun reports the results of running a step in the Task. Each task has the potential to succeed or fail (based on the exit code) and produces logs.", "type": "object", @@ -2201,6 +2391,89 @@ } } }, + "v1beta1.TaskResource": { + "description": "TaskResource defines an input or output Resource declared as a requirement by a Task. The Name field will be used to refer to these Resources within the Task definition, and when provided as an Input, the Name will be the path to the volume mounted containing this Resource as an input (e.g. an input Resource named `workspace` will be mounted at `/workspace`).\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "required": [ + "name", + "type" + ], + "properties": { + "description": { + "description": "Description is a user-facing description of the declared resource that may be used to populate a UI.", + "type": "string" + }, + "name": { + "description": "Name declares the name by which a resource is referenced in the definition. Resources may be referenced by name in the definition of a Task's steps.", + "type": "string", + "default": "" + }, + "optional": { + "description": "Optional declares the resource as optional. By default optional is set to false which makes a resource required. optional: true - the resource is considered optional optional: false - the resource is considered required (equivalent of not specifying it)", + "type": "boolean" + }, + "targetPath": { + "description": "TargetPath is the path in workspace directory where the resource will be copied.", + "type": "string" + }, + "type": { + "description": "Type is the type of this resource;", + "type": "string", + "default": "" + } + } + }, + "v1beta1.TaskResourceBinding": { + "description": "TaskResourceBinding points to the PipelineResource that will be used for the Task input or output called Name.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "properties": { + "name": { + "description": "Name is the name of the PipelineResource in the Pipeline's declaration", + "type": "string" + }, + "paths": { + "description": "Paths will probably be removed in #1284, and then PipelineResourceBinding can be used instead. The optional Path field corresponds to a path on disk at which the Resource can be found (used when providing the resource via mounted volume, overriding the default logic to fetch the Resource).", + "type": "array", + "items": { + "type": "string", + "default": "" + }, + "x-kubernetes-list-type": "atomic" + }, + "resourceRef": { + "description": "ResourceRef is a reference to the instance of the actual PipelineResource that should be used", + "$ref": "#/definitions/v1beta1.PipelineResourceRef" + }, + "resourceSpec": { + "description": "ResourceSpec is specification of a resource that should be created and consumed by the task", + "$ref": "#/definitions/v1alpha1.PipelineResourceSpec" + } + } + }, + "v1beta1.TaskResources": { + "description": "TaskResources allows a Pipeline to declare how its DeclaredPipelineResources should be provided to a Task as its inputs and outputs.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "properties": { + "inputs": { + "description": "Inputs holds the mapping from the PipelineResources declared in DeclaredPipelineResources to the input PipelineResources required by the Task.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.TaskResource" + }, + "x-kubernetes-list-type": "atomic" + }, + "outputs": { + "description": "Outputs holds the mapping from the PipelineResources declared in DeclaredPipelineResources to the input PipelineResources required by the Task.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.TaskResource" + }, + "x-kubernetes-list-type": "atomic" + } + } + }, "v1beta1.TaskResult": { "description": "TaskResult used to describe the results of a task", "type": "object", @@ -2271,6 +2544,28 @@ } } }, + "v1beta1.TaskRunInputs": { + "description": "TaskRunInputs holds the input values that this task was invoked with.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "properties": { + "params": { + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.Param" + }, + "x-kubernetes-list-type": "atomic" + }, + "resources": { + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.TaskResourceBinding" + }, + "x-kubernetes-list-type": "atomic" + } + } + }, "v1beta1.TaskRunList": { "description": "TaskRunList contains a list of TaskRun", "type": "object", @@ -2299,6 +2594,44 @@ } } }, + "v1beta1.TaskRunOutputs": { + "description": "TaskRunOutputs holds the output values that this task was invoked with.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "properties": { + "resources": { + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.TaskResourceBinding" + }, + "x-kubernetes-list-type": "atomic" + } + } + }, + "v1beta1.TaskRunResources": { + "description": "TaskRunResources allows a TaskRun to declare inputs and outputs TaskResourceBinding\n\nDeprecated: Unused, preserved only for backwards compatibility", + "type": "object", + "properties": { + "inputs": { + "description": "Inputs holds the inputs resources this task was invoked with", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.TaskResourceBinding" + }, + "x-kubernetes-list-type": "atomic" + }, + "outputs": { + "description": "Outputs holds the inputs resources this task was invoked with", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1beta1.TaskResourceBinding" + }, + "x-kubernetes-list-type": "atomic" + } + } + }, "v1beta1.TaskRunResult": { "description": "TaskRunResult used to describe the results of a task", "type": "object", @@ -2366,6 +2699,10 @@ "description": "PodTemplate holds pod specific configuration", "$ref": "#/definitions/pod.Template" }, + "resources": { + "description": "Deprecated: Unused, preserved only for backwards compatibility", + "$ref": "#/definitions/v1beta1.TaskRunResources" + }, "retries": { "description": "Retries represents how many times this TaskRun should be retried in the event of Task failure.", "type": "integer", @@ -2671,6 +3008,10 @@ }, "x-kubernetes-list-type": "atomic" }, + "resources": { + "description": "Resources is a list input and output resource to run the task Resources are represented in TaskRuns as bindings to instances of PipelineResources.\n\nDeprecated: Unused, preserved only for backwards compatibility", + "$ref": "#/definitions/v1beta1.TaskResources" + }, "results": { "description": "Results are values that this Task can output", "type": "array", diff --git a/pkg/apis/pipeline/v1beta1/task_types.go b/pkg/apis/pipeline/v1beta1/task_types.go index 19e14f49252..e163fd34140 100644 --- a/pkg/apis/pipeline/v1beta1/task_types.go +++ b/pkg/apis/pipeline/v1beta1/task_types.go @@ -81,6 +81,14 @@ func (*Task) GetGroupVersionKind() schema.GroupVersionKind { // TaskSpec defines the desired state of Task. type TaskSpec struct { + // Resources is a list input and output resource to run the task + // Resources are represented in TaskRuns as bindings to instances of + // PipelineResources. + // + // Deprecated: Unused, preserved only for backwards compatibility + // +optional + Resources *TaskResources `json:"resources,omitempty"` + // Params is a list of input parameters required to run the task. Params // must be supplied as inputs in TaskRuns unless they declare a default // value. diff --git a/pkg/apis/pipeline/v1beta1/task_validation.go b/pkg/apis/pipeline/v1beta1/task_validation.go index 9a40ed05ca9..8da451ebe51 100644 --- a/pkg/apis/pipeline/v1beta1/task_validation.go +++ b/pkg/apis/pipeline/v1beta1/task_validation.go @@ -99,6 +99,9 @@ func (ts *TaskSpec) Validate(ctx context.Context) (errs *apis.FieldError) { errs = errs.Also(validateTaskContextVariables(ctx, ts.Steps)) errs = errs.Also(validateTaskResultsVariables(ctx, ts.Steps, ts.Results)) errs = errs.Also(validateResults(ctx, ts.Results).ViaField("results")) + if ts.Resources != nil { + errs = errs.Also(apis.ErrDisallowedFields("resources")) + } return errs } diff --git a/pkg/apis/pipeline/v1beta1/task_validation_test.go b/pkg/apis/pipeline/v1beta1/task_validation_test.go index ad451b067b6..dda5ac70285 100644 --- a/pkg/apis/pipeline/v1beta1/task_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/task_validation_test.go @@ -532,6 +532,7 @@ func TestTaskSpecValidateError(t *testing.T) { StepTemplate *v1beta1.StepTemplate Workspaces []v1beta1.WorkspaceDeclaration Results []v1beta1.TaskResult + Resources *v1beta1.TaskResources } tests := []struct { name string @@ -1306,6 +1307,13 @@ func TestTaskSpecValidateError(t *testing.T) { Message: "invalid value: -10s", Paths: []string{"steps[0].negative timeout"}, }, + }, { + name: "with resources", + fields: fields{ + Steps: []v1beta1.Step{{Image: "my-image"}}, + Resources: &v1beta1.TaskResources{}, + }, + expectedError: apis.FieldError{Message: "must not set the field(s)", Paths: []string{"resources"}}, }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -1316,6 +1324,7 @@ func TestTaskSpecValidateError(t *testing.T) { StepTemplate: tt.fields.StepTemplate, Workspaces: tt.fields.Workspaces, Results: tt.fields.Results, + Resources: tt.fields.Resources, } ctx := config.EnableAlphaAPIFields(context.Background()) ts.SetDefaults(ctx) diff --git a/pkg/apis/pipeline/v1beta1/taskrun_types.go b/pkg/apis/pipeline/v1beta1/taskrun_types.go index 09482dbfdeb..005084b51cb 100644 --- a/pkg/apis/pipeline/v1beta1/taskrun_types.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_types.go @@ -41,6 +41,9 @@ type TaskRunSpec struct { // +optional // +listType=atomic Params Params `json:"params,omitempty"` + // Deprecated: Unused, preserved only for backwards compatibility + // +optional + Resources *TaskRunResources `json:"resources,omitempty"` // +optional ServiceAccountName string `json:"serviceAccountName"` // no more than one of the TaskRef and TaskSpec may be specified. diff --git a/pkg/apis/pipeline/v1beta1/taskrun_validation.go b/pkg/apis/pipeline/v1beta1/taskrun_validation.go index 637f6149038..ef414612b43 100644 --- a/pkg/apis/pipeline/v1beta1/taskrun_validation.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_validation.go @@ -109,6 +109,9 @@ func (ts *TaskRunSpec) Validate(ctx context.Context) (errs *apis.FieldError) { if ts.PodTemplate != nil { errs = errs.Also(validatePodTemplateEnv(ctx, *ts.PodTemplate)) } + if ts.Resources != nil { + errs = errs.Also(apis.ErrDisallowedFields("resources")) + } return errs } diff --git a/pkg/apis/pipeline/v1beta1/taskrun_validation_test.go b/pkg/apis/pipeline/v1beta1/taskrun_validation_test.go index fc0ca285769..c99b8afeb10 100644 --- a/pkg/apis/pipeline/v1beta1/taskrun_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_validation_test.go @@ -773,6 +773,24 @@ func TestTaskRunSpec_Invalidate(t *testing.T) { }, }, wantErr: apis.ErrGeneric("computeResources requires \"enable-api-fields\" feature gate to be \"alpha\" but it is \"stable\""), + }, { + name: "uses resources", + spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{ + Name: "foo", + }, + Resources: &v1beta1.TaskRunResources{}, + }, + wantErr: apis.ErrDisallowedFields("resources"), + }, { + name: "uses resources in task spec", + spec: v1beta1.TaskRunSpec{ + TaskSpec: &v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Image: "my-image"}}, + Resources: &v1beta1.TaskResources{}, + }, + }, + wantErr: apis.ErrDisallowedFields("resources").ViaField("taskSpec"), }} for _, ts := range tests { diff --git a/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go index 24a8d768952..c90b2f1b169 100644 --- a/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go @@ -24,6 +24,7 @@ package v1beta1 import ( config "github.com/tektoncd/pipeline/pkg/apis/config" pod "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" + v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" runv1beta1 "github.com/tektoncd/pipeline/pkg/apis/run/v1beta1" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -414,6 +415,43 @@ func (in IncludeParamsList) DeepCopy() IncludeParamsList { return *out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InternalTaskModifier) DeepCopyInto(out *InternalTaskModifier) { + *out = *in + if in.StepsToPrepend != nil { + in, out := &in.StepsToPrepend, &out.StepsToPrepend + *out = make([]Step, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.StepsToAppend != nil { + in, out := &in.StepsToAppend, &out.StepsToAppend + *out = make([]Step, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Volumes != nil { + in, out := &in.Volumes, &out.Volumes + *out = make([]corev1.Volume, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InternalTaskModifier. +func (in *InternalTaskModifier) DeepCopy() *InternalTaskModifier { + if in == nil { + return nil + } + out := new(InternalTaskModifier) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Matrix) DeepCopyInto(out *Matrix) { *out = *in @@ -588,6 +626,22 @@ func (in *Pipeline) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineDeclaredResource) DeepCopyInto(out *PipelineDeclaredResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineDeclaredResource. +func (in *PipelineDeclaredResource) DeepCopy() *PipelineDeclaredResource { + if in == nil { + return nil + } + out := new(PipelineDeclaredResource) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PipelineList) DeepCopyInto(out *PipelineList) { *out = *in @@ -638,6 +692,48 @@ func (in *PipelineRef) DeepCopy() *PipelineRef { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineResourceBinding) DeepCopyInto(out *PipelineResourceBinding) { + *out = *in + if in.ResourceRef != nil { + in, out := &in.ResourceRef, &out.ResourceRef + *out = new(PipelineResourceRef) + **out = **in + } + if in.ResourceSpec != nil { + in, out := &in.ResourceSpec, &out.ResourceSpec + *out = new(v1alpha1.PipelineResourceSpec) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceBinding. +func (in *PipelineResourceBinding) DeepCopy() *PipelineResourceBinding { + if in == nil { + return nil + } + out := new(PipelineResourceBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineResourceRef) DeepCopyInto(out *PipelineResourceRef) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceRef. +func (in *PipelineResourceRef) DeepCopy() *PipelineResourceRef { + if in == nil { + return nil + } + out := new(PipelineResourceRef) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PipelineResourceResult) DeepCopyInto(out *PipelineResourceResult) { *out = *in @@ -790,6 +886,13 @@ func (in *PipelineRunSpec) DeepCopyInto(out *PipelineRunSpec) { *out = new(PipelineSpec) (*in).DeepCopyInto(*out) } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]PipelineResourceBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } if in.Params != nil { in, out := &in.Params, &out.Params *out = make(Params, len(*in)) @@ -984,6 +1087,11 @@ func (in *PipelineRunTaskRunStatus) DeepCopy() *PipelineRunTaskRunStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PipelineSpec) DeepCopyInto(out *PipelineSpec) { *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]PipelineDeclaredResource, len(*in)) + copy(*out, *in) + } if in.Tasks != nil { in, out := &in.Tasks, &out.Tasks *out = make([]PipelineTask, len(*in)) @@ -1055,6 +1163,11 @@ func (in *PipelineTask) DeepCopyInto(out *PipelineTask) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(PipelineTaskResources) + (*in).DeepCopyInto(*out) + } if in.Params != nil { in, out := &in.Params, &out.Params *out = make(Params, len(*in)) @@ -1090,6 +1203,27 @@ func (in *PipelineTask) DeepCopy() *PipelineTask { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineTaskInputResource) DeepCopyInto(out *PipelineTaskInputResource) { + *out = *in + if in.From != nil { + in, out := &in.From, &out.From + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTaskInputResource. +func (in *PipelineTaskInputResource) DeepCopy() *PipelineTaskInputResource { + if in == nil { + return nil + } + out := new(PipelineTaskInputResource) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in PipelineTaskList) DeepCopyInto(out *PipelineTaskList) { { @@ -1142,6 +1276,22 @@ func (in *PipelineTaskMetadata) DeepCopy() *PipelineTaskMetadata { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineTaskOutputResource) DeepCopyInto(out *PipelineTaskOutputResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTaskOutputResource. +func (in *PipelineTaskOutputResource) DeepCopy() *PipelineTaskOutputResource { + if in == nil { + return nil + } + out := new(PipelineTaskOutputResource) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PipelineTaskParam) DeepCopyInto(out *PipelineTaskParam) { *out = *in @@ -1158,6 +1308,34 @@ func (in *PipelineTaskParam) DeepCopy() *PipelineTaskParam { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineTaskResources) DeepCopyInto(out *PipelineTaskResources) { + *out = *in + if in.Inputs != nil { + in, out := &in.Inputs, &out.Inputs + *out = make([]PipelineTaskInputResource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Outputs != nil { + in, out := &in.Outputs, &out.Outputs + *out = make([]PipelineTaskOutputResource, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTaskResources. +func (in *PipelineTaskResources) DeepCopy() *PipelineTaskResources { + if in == nil { + return nil + } + out := new(PipelineTaskResources) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PipelineTaskRun) DeepCopyInto(out *PipelineTaskRun) { *out = *in @@ -1740,6 +1918,71 @@ func (in *TaskRef) DeepCopy() *TaskRef { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskResource) DeepCopyInto(out *TaskResource) { + *out = *in + out.ResourceDeclaration = in.ResourceDeclaration + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskResource. +func (in *TaskResource) DeepCopy() *TaskResource { + if in == nil { + return nil + } + out := new(TaskResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskResourceBinding) DeepCopyInto(out *TaskResourceBinding) { + *out = *in + in.PipelineResourceBinding.DeepCopyInto(&out.PipelineResourceBinding) + if in.Paths != nil { + in, out := &in.Paths, &out.Paths + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskResourceBinding. +func (in *TaskResourceBinding) DeepCopy() *TaskResourceBinding { + if in == nil { + return nil + } + out := new(TaskResourceBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskResources) DeepCopyInto(out *TaskResources) { + *out = *in + if in.Inputs != nil { + in, out := &in.Inputs, &out.Inputs + *out = make([]TaskResource, len(*in)) + copy(*out, *in) + } + if in.Outputs != nil { + in, out := &in.Outputs, &out.Outputs + *out = make([]TaskResource, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskResources. +func (in *TaskResources) DeepCopy() *TaskResources { + if in == nil { + return nil + } + out := new(TaskResources) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TaskResult) DeepCopyInto(out *TaskResult) { *out = *in @@ -1812,6 +2055,36 @@ func (in *TaskRunDebug) DeepCopy() *TaskRunDebug { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskRunInputs) DeepCopyInto(out *TaskRunInputs) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]TaskResourceBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]Param, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRunInputs. +func (in *TaskRunInputs) DeepCopy() *TaskRunInputs { + if in == nil { + return nil + } + out := new(TaskRunInputs) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TaskRunList) DeepCopyInto(out *TaskRunList) { *out = *in @@ -1845,6 +2118,59 @@ func (in *TaskRunList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskRunOutputs) DeepCopyInto(out *TaskRunOutputs) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]TaskResourceBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRunOutputs. +func (in *TaskRunOutputs) DeepCopy() *TaskRunOutputs { + if in == nil { + return nil + } + out := new(TaskRunOutputs) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskRunResources) DeepCopyInto(out *TaskRunResources) { + *out = *in + if in.Inputs != nil { + in, out := &in.Inputs, &out.Inputs + *out = make([]TaskResourceBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Outputs != nil { + in, out := &in.Outputs, &out.Outputs + *out = make([]TaskResourceBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRunResources. +func (in *TaskRunResources) DeepCopy() *TaskRunResources { + if in == nil { + return nil + } + out := new(TaskRunResources) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TaskRunResult) DeepCopyInto(out *TaskRunResult) { *out = *in @@ -1894,6 +2220,11 @@ func (in *TaskRunSpec) DeepCopyInto(out *TaskRunSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(TaskRunResources) + (*in).DeepCopyInto(*out) + } if in.TaskRef != nil { in, out := &in.TaskRef, &out.TaskRef *out = new(TaskRef) @@ -2072,6 +2403,11 @@ func (in *TaskRunStepOverride) DeepCopy() *TaskRunStepOverride { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TaskSpec) DeepCopyInto(out *TaskSpec) { *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(TaskResources) + (*in).DeepCopyInto(*out) + } if in.Params != nil { in, out := &in.Params, &out.Params *out = make(ParamSpecs, len(*in)) diff --git a/pkg/apis/resource/v1alpha1/doc.go b/pkg/apis/resource/v1alpha1/doc.go new file mode 100644 index 00000000000..65c3fe6b915 --- /dev/null +++ b/pkg/apis/resource/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2019 The Tekton Authors +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1alpha1 contains API Schema definitions for the pipeline v1alpha1 API group +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/tektoncd/pipeline/pkg/apis/resource +// +k8s:defaulter-gen=TypeMeta +// +groupName=tekton.dev +package v1alpha1 diff --git a/pkg/apis/resource/v1alpha1/pipeline_resource_types.go b/pkg/apis/resource/v1alpha1/pipeline_resource_types.go new file mode 100644 index 00000000000..6cde87cb8a9 --- /dev/null +++ b/pkg/apis/resource/v1alpha1/pipeline_resource_types.go @@ -0,0 +1,134 @@ +/* +// Deprecated: Unused, preserved only for backwards compatibility +Copyright 2019 The Tekton Authors +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// The contents of this package are deprecated and unused. Preserved for backwards compatibility. +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PipelineResourceType represents the type of endpoint the pipelineResource is, so that the +// controller will know this pipelineResource shouldx be fetched and optionally what +// additional metatdata should be provided for it. +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineResourceType = string + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient:noStatus + +// PipelineResource describes a resource that is an input to or output from a +// Task. +// +// Deprecated: Unused, preserved only for backwards compatibility +// +k8s:openapi-gen=true +type PipelineResource struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec holds the desired state of the PipelineResource from the client + Spec PipelineResourceSpec `json:"spec,omitempty"` + + // Status is used to communicate the observed state of the PipelineResource from + // the controller, but was unused as there is no controller for PipelineResource. + // + // +optional + Status *PipelineResourceStatus `json:"status,omitempty"` +} + +// PipelineResourceStatus does not contain anything because PipelineResources on their own +// do not have a status +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineResourceStatus struct { +} + +// PipelineResourceSpec defines an individual resources used in the pipeline. +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineResourceSpec struct { + // Description is a user-facing description of the resource that may be + // used to populate a UI. + // +optional + Description string `json:"description,omitempty"` + Type PipelineResourceType `json:"type"` + // +listType=atomic + Params []ResourceParam `json:"params"` + // Secrets to fetch to populate some of resource fields + // +optional + // +listType=atomic + SecretParams []SecretParam `json:"secrets,omitempty"` +} + +// SecretParam indicates which secret can be used to populate a field of the resource +// +// Deprecated: Unused, preserved only for backwards compatibility +type SecretParam struct { + FieldName string `json:"fieldName"` + SecretKey string `json:"secretKey"` + SecretName string `json:"secretName"` +} + +// ResourceParam declares a string value to use for the parameter called Name, and is used in +// the specific context of PipelineResources. +// +// Deprecated: Unused, preserved only for backwards compatibility +type ResourceParam struct { + Name string `json:"name"` + Value string `json:"value"` +} + +// ResourceDeclaration defines an input or output PipelineResource declared as a requirement +// by another type such as a Task or Condition. The Name field will be used to refer to these +// PipelineResources within the type's definition, and when provided as an Input, the Name will be the +// path to the volume mounted containing this PipelineResource as an input (e.g. +// an input Resource named `workspace` will be mounted at `/workspace`). +// +// Deprecated: Unused, preserved only for backwards compatibility +type ResourceDeclaration struct { + // Name declares the name by which a resource is referenced in the + // definition. Resources may be referenced by name in the definition of a + // Task's steps. + Name string `json:"name"` + // Type is the type of this resource; + Type PipelineResourceType `json:"type"` + // Description is a user-facing description of the declared resource that may be + // used to populate a UI. + // +optional + Description string `json:"description,omitempty"` + // TargetPath is the path in workspace directory where the resource + // will be copied. + // +optional + TargetPath string `json:"targetPath,omitempty"` + // Optional declares the resource as optional. + // By default optional is set to false which makes a resource required. + // optional: true - the resource is considered optional + // optional: false - the resource is considered required (equivalent of not specifying it) + Optional bool `json:"optional,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PipelineResourceList contains a list of PipelineResources +// +// Deprecated: Unused, preserved only for backwards compatibility +type PipelineResourceList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []PipelineResource `json:"items"` +} diff --git a/pkg/apis/resource/v1alpha1/register.go b/pkg/apis/resource/v1alpha1/register.go new file mode 100644 index 00000000000..67ccbd27b7b --- /dev/null +++ b/pkg/apis/resource/v1alpha1/register.go @@ -0,0 +1,51 @@ +/* +Copyright 2019 The Tekton Authors +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "github.com/tektoncd/pipeline/pkg/apis/pipeline" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: pipeline.GroupName, Version: "v1alpha1"} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + + // AddToScheme adds Build types to the scheme. + AddToScheme = schemeBuilder.AddToScheme +) + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &PipelineResource{}, + &PipelineResourceList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/resource/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/resource/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..5f6ff368b62 --- /dev/null +++ b/pkg/apis/resource/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,181 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineResource) DeepCopyInto(out *PipelineResource) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(PipelineResourceStatus) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResource. +func (in *PipelineResource) DeepCopy() *PipelineResource { + if in == nil { + return nil + } + out := new(PipelineResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PipelineResource) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineResourceList) DeepCopyInto(out *PipelineResourceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PipelineResource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceList. +func (in *PipelineResourceList) DeepCopy() *PipelineResourceList { + if in == nil { + return nil + } + out := new(PipelineResourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PipelineResourceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineResourceSpec) DeepCopyInto(out *PipelineResourceSpec) { + *out = *in + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]ResourceParam, len(*in)) + copy(*out, *in) + } + if in.SecretParams != nil { + in, out := &in.SecretParams, &out.SecretParams + *out = make([]SecretParam, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceSpec. +func (in *PipelineResourceSpec) DeepCopy() *PipelineResourceSpec { + if in == nil { + return nil + } + out := new(PipelineResourceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineResourceStatus) DeepCopyInto(out *PipelineResourceStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceStatus. +func (in *PipelineResourceStatus) DeepCopy() *PipelineResourceStatus { + if in == nil { + return nil + } + out := new(PipelineResourceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceDeclaration) DeepCopyInto(out *ResourceDeclaration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDeclaration. +func (in *ResourceDeclaration) DeepCopy() *ResourceDeclaration { + if in == nil { + return nil + } + out := new(ResourceDeclaration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceParam) DeepCopyInto(out *ResourceParam) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceParam. +func (in *ResourceParam) DeepCopy() *ResourceParam { + if in == nil { + return nil + } + out := new(ResourceParam) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretParam) DeepCopyInto(out *SecretParam) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretParam. +func (in *SecretParam) DeepCopy() *SecretParam { + if in == nil { + return nil + } + out := new(SecretParam) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/client/resource/clientset/versioned/clientset.go b/pkg/client/resource/clientset/versioned/clientset.go new file mode 100644 index 00000000000..9a624825bbb --- /dev/null +++ b/pkg/client/resource/clientset/versioned/clientset.go @@ -0,0 +1,121 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + "fmt" + "net/http" + + tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + TektonV1alpha1() tektonv1alpha1.TektonV1alpha1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + tektonV1alpha1 *tektonv1alpha1.TektonV1alpha1Client +} + +// TektonV1alpha1 retrieves the TektonV1alpha1Client +func (c *Clientset) TektonV1alpha1() tektonv1alpha1.TektonV1alpha1Interface { + return c.tektonV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + + if configShallowCopy.UserAgent == "" { + configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() + } + + // share the transport between all clients + httpClient, err := rest.HTTPClientFor(&configShallowCopy) + if err != nil { + return nil, err + } + + return NewForConfigAndClient(&configShallowCopy, httpClient) +} + +// NewForConfigAndClient creates a new Clientset for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. +func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + + var cs Clientset + var err error + cs.tektonV1alpha1, err = tektonv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + cs, err := NewForConfig(c) + if err != nil { + panic(err) + } + return cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.tektonV1alpha1 = tektonv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/pkg/client/resource/clientset/versioned/doc.go b/pkg/client/resource/clientset/versioned/doc.go new file mode 100644 index 00000000000..0d13552ae28 --- /dev/null +++ b/pkg/client/resource/clientset/versioned/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/pkg/client/resource/clientset/versioned/fake/clientset_generated.go b/pkg/client/resource/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 00000000000..1d6881d7b97 --- /dev/null +++ b/pkg/client/resource/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,85 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + clientset "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned" + tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1" + faketektonv1alpha1 "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery + tracker testing.ObjectTracker +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +func (c *Clientset) Tracker() testing.ObjectTracker { + return c.tracker +} + +var ( + _ clientset.Interface = &Clientset{} + _ testing.FakeClient = &Clientset{} +) + +// TektonV1alpha1 retrieves the TektonV1alpha1Client +func (c *Clientset) TektonV1alpha1() tektonv1alpha1.TektonV1alpha1Interface { + return &faketektonv1alpha1.FakeTektonV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/client/resource/clientset/versioned/fake/doc.go b/pkg/client/resource/clientset/versioned/fake/doc.go new file mode 100644 index 00000000000..4e4dbb68181 --- /dev/null +++ b/pkg/client/resource/clientset/versioned/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/client/resource/clientset/versioned/fake/register.go b/pkg/client/resource/clientset/versioned/fake/register.go new file mode 100644 index 00000000000..e33dea7aa03 --- /dev/null +++ b/pkg/client/resource/clientset/versioned/fake/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) + +var localSchemeBuilder = runtime.SchemeBuilder{ + tektonv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/pkg/client/resource/clientset/versioned/scheme/doc.go b/pkg/client/resource/clientset/versioned/scheme/doc.go new file mode 100644 index 00000000000..0fb16cc0567 --- /dev/null +++ b/pkg/client/resource/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/pkg/client/resource/clientset/versioned/scheme/register.go b/pkg/client/resource/clientset/versioned/scheme/register.go new file mode 100644 index 00000000000..972999462fa --- /dev/null +++ b/pkg/client/resource/clientset/versioned/scheme/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + tektonv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/doc.go b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/doc.go new file mode 100644 index 00000000000..69ed294b828 --- /dev/null +++ b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/fake/doc.go b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/fake/doc.go new file mode 100644 index 00000000000..1a72e0befe2 --- /dev/null +++ b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/fake/fake_pipelineresource.go b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/fake/fake_pipelineresource.go new file mode 100644 index 00000000000..8ffb1b7ff81 --- /dev/null +++ b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/fake/fake_pipelineresource.go @@ -0,0 +1,130 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePipelineResources implements PipelineResourceInterface +type FakePipelineResources struct { + Fake *FakeTektonV1alpha1 + ns string +} + +var pipelineresourcesResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha1", Resource: "pipelineresources"} + +var pipelineresourcesKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha1", Kind: "PipelineResource"} + +// Get takes name of the pipelineResource, and returns the corresponding pipelineResource object, and an error if there is any. +func (c *FakePipelineResources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PipelineResource, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(pipelineresourcesResource, c.ns, name), &v1alpha1.PipelineResource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.PipelineResource), err +} + +// List takes label and field selectors, and returns the list of PipelineResources that match those selectors. +func (c *FakePipelineResources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PipelineResourceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(pipelineresourcesResource, pipelineresourcesKind, c.ns, opts), &v1alpha1.PipelineResourceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.PipelineResourceList{ListMeta: obj.(*v1alpha1.PipelineResourceList).ListMeta} + for _, item := range obj.(*v1alpha1.PipelineResourceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested pipelineResources. +func (c *FakePipelineResources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(pipelineresourcesResource, c.ns, opts)) + +} + +// Create takes the representation of a pipelineResource and creates it. Returns the server's representation of the pipelineResource, and an error, if there is any. +func (c *FakePipelineResources) Create(ctx context.Context, pipelineResource *v1alpha1.PipelineResource, opts v1.CreateOptions) (result *v1alpha1.PipelineResource, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(pipelineresourcesResource, c.ns, pipelineResource), &v1alpha1.PipelineResource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.PipelineResource), err +} + +// Update takes the representation of a pipelineResource and updates it. Returns the server's representation of the pipelineResource, and an error, if there is any. +func (c *FakePipelineResources) Update(ctx context.Context, pipelineResource *v1alpha1.PipelineResource, opts v1.UpdateOptions) (result *v1alpha1.PipelineResource, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(pipelineresourcesResource, c.ns, pipelineResource), &v1alpha1.PipelineResource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.PipelineResource), err +} + +// Delete takes name of the pipelineResource and deletes it. Returns an error if one occurs. +func (c *FakePipelineResources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(pipelineresourcesResource, c.ns, name, opts), &v1alpha1.PipelineResource{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePipelineResources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(pipelineresourcesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.PipelineResourceList{}) + return err +} + +// Patch applies the patch and returns the patched pipelineResource. +func (c *FakePipelineResources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PipelineResource, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(pipelineresourcesResource, c.ns, name, pt, data, subresources...), &v1alpha1.PipelineResource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.PipelineResource), err +} diff --git a/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/fake/fake_resource_client.go b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/fake/fake_resource_client.go new file mode 100644 index 00000000000..44cc7f52002 --- /dev/null +++ b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/fake/fake_resource_client.go @@ -0,0 +1,40 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeTektonV1alpha1 struct { + *testing.Fake +} + +func (c *FakeTektonV1alpha1) PipelineResources(namespace string) v1alpha1.PipelineResourceInterface { + return &FakePipelineResources{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeTektonV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/generated_expansion.go b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/generated_expansion.go new file mode 100644 index 00000000000..1536d99ffb8 --- /dev/null +++ b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type PipelineResourceExpansion interface{} diff --git a/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/pipelineresource.go b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/pipelineresource.go new file mode 100644 index 00000000000..ec03040eebe --- /dev/null +++ b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/pipelineresource.go @@ -0,0 +1,178 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + scheme "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PipelineResourcesGetter has a method to return a PipelineResourceInterface. +// A group's client should implement this interface. +type PipelineResourcesGetter interface { + PipelineResources(namespace string) PipelineResourceInterface +} + +// PipelineResourceInterface has methods to work with PipelineResource resources. +type PipelineResourceInterface interface { + Create(ctx context.Context, pipelineResource *v1alpha1.PipelineResource, opts v1.CreateOptions) (*v1alpha1.PipelineResource, error) + Update(ctx context.Context, pipelineResource *v1alpha1.PipelineResource, opts v1.UpdateOptions) (*v1alpha1.PipelineResource, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.PipelineResource, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PipelineResourceList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PipelineResource, err error) + PipelineResourceExpansion +} + +// pipelineResources implements PipelineResourceInterface +type pipelineResources struct { + client rest.Interface + ns string +} + +// newPipelineResources returns a PipelineResources +func newPipelineResources(c *TektonV1alpha1Client, namespace string) *pipelineResources { + return &pipelineResources{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the pipelineResource, and returns the corresponding pipelineResource object, and an error if there is any. +func (c *pipelineResources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PipelineResource, err error) { + result = &v1alpha1.PipelineResource{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pipelineresources"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PipelineResources that match those selectors. +func (c *pipelineResources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PipelineResourceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.PipelineResourceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pipelineresources"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested pipelineResources. +func (c *pipelineResources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("pipelineresources"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a pipelineResource and creates it. Returns the server's representation of the pipelineResource, and an error, if there is any. +func (c *pipelineResources) Create(ctx context.Context, pipelineResource *v1alpha1.PipelineResource, opts v1.CreateOptions) (result *v1alpha1.PipelineResource, err error) { + result = &v1alpha1.PipelineResource{} + err = c.client.Post(). + Namespace(c.ns). + Resource("pipelineresources"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(pipelineResource). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a pipelineResource and updates it. Returns the server's representation of the pipelineResource, and an error, if there is any. +func (c *pipelineResources) Update(ctx context.Context, pipelineResource *v1alpha1.PipelineResource, opts v1.UpdateOptions) (result *v1alpha1.PipelineResource, err error) { + result = &v1alpha1.PipelineResource{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pipelineresources"). + Name(pipelineResource.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(pipelineResource). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the pipelineResource and deletes it. Returns an error if one occurs. +func (c *pipelineResources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pipelineresources"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *pipelineResources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("pipelineresources"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched pipelineResource. +func (c *pipelineResources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PipelineResource, err error) { + result = &v1alpha1.PipelineResource{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("pipelineresources"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/resource_client.go b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/resource_client.go new file mode 100644 index 00000000000..eaf177014b9 --- /dev/null +++ b/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1/resource_client.go @@ -0,0 +1,107 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "net/http" + + v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type TektonV1alpha1Interface interface { + RESTClient() rest.Interface + PipelineResourcesGetter +} + +// TektonV1alpha1Client is used to interact with features provided by the tekton.dev group. +type TektonV1alpha1Client struct { + restClient rest.Interface +} + +func (c *TektonV1alpha1Client) PipelineResources(namespace string) PipelineResourceInterface { + return newPipelineResources(c, namespace) +} + +// NewForConfig creates a new TektonV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*TektonV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new TektonV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*TektonV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &TektonV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new TektonV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *TektonV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new TektonV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *TektonV1alpha1Client { + return &TektonV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *TektonV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/resource/informers/externalversions/factory.go b/pkg/client/resource/informers/externalversions/factory.go new file mode 100644 index 00000000000..c2d3a2292f3 --- /dev/null +++ b/pkg/client/resource/informers/externalversions/factory.go @@ -0,0 +1,180 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + versioned "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned" + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions/internalinterfaces" + resource "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions/resource" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Tekton() resource.Interface +} + +func (f *sharedInformerFactory) Tekton() resource.Interface { + return resource.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/client/resource/informers/externalversions/generic.go b/pkg/client/resource/informers/externalversions/generic.go new file mode 100644 index 00000000000..5d1d77acd6a --- /dev/null +++ b/pkg/client/resource/informers/externalversions/generic.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=tekton.dev, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("pipelineresources"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha1().PipelineResources().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/pkg/client/resource/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/client/resource/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 00000000000..1a7c773e02b --- /dev/null +++ b/pkg/client/resource/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,40 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + versioned "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +// TweakListOptionsFunc is a function that transforms a v1.ListOptions. +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/pkg/client/resource/informers/externalversions/resource/interface.go b/pkg/client/resource/informers/externalversions/resource/interface.go new file mode 100644 index 00000000000..aed88a590b4 --- /dev/null +++ b/pkg/client/resource/informers/externalversions/resource/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package resource + +import ( + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions/resource/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/resource/informers/externalversions/resource/v1alpha1/interface.go b/pkg/client/resource/informers/externalversions/resource/v1alpha1/interface.go new file mode 100644 index 00000000000..d541d43917f --- /dev/null +++ b/pkg/client/resource/informers/externalversions/resource/v1alpha1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PipelineResources returns a PipelineResourceInformer. + PipelineResources() PipelineResourceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PipelineResources returns a PipelineResourceInformer. +func (v *version) PipelineResources() PipelineResourceInformer { + return &pipelineResourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/resource/informers/externalversions/resource/v1alpha1/pipelineresource.go b/pkg/client/resource/informers/externalversions/resource/v1alpha1/pipelineresource.go new file mode 100644 index 00000000000..a814fe80082 --- /dev/null +++ b/pkg/client/resource/informers/externalversions/resource/v1alpha1/pipelineresource.go @@ -0,0 +1,90 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + resourcev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + versioned "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned" + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/tektoncd/pipeline/pkg/client/resource/listers/resource/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PipelineResourceInformer provides access to a shared informer and lister for +// PipelineResources. +type PipelineResourceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.PipelineResourceLister +} + +type pipelineResourceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPipelineResourceInformer constructs a new informer for PipelineResource type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPipelineResourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPipelineResourceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPipelineResourceInformer constructs a new informer for PipelineResource type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPipelineResourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha1().PipelineResources(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha1().PipelineResources(namespace).Watch(context.TODO(), options) + }, + }, + &resourcev1alpha1.PipelineResource{}, + resyncPeriod, + indexers, + ) +} + +func (f *pipelineResourceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPipelineResourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *pipelineResourceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&resourcev1alpha1.PipelineResource{}, f.defaultInformer) +} + +func (f *pipelineResourceInformer) Lister() v1alpha1.PipelineResourceLister { + return v1alpha1.NewPipelineResourceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/resource/injection/client/client.go b/pkg/client/resource/injection/client/client.go new file mode 100644 index 00000000000..e58dce9e3b8 --- /dev/null +++ b/pkg/client/resource/injection/client/client.go @@ -0,0 +1,243 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package client + +import ( + context "context" + json "encoding/json" + errors "errors" + fmt "fmt" + + v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + versioned "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned" + typedtektonv1alpha1 "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned/typed/resource/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + discovery "k8s.io/client-go/discovery" + dynamic "k8s.io/client-go/dynamic" + rest "k8s.io/client-go/rest" + injection "knative.dev/pkg/injection" + dynamicclient "knative.dev/pkg/injection/clients/dynamicclient" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterClient(withClientFromConfig) + injection.Default.RegisterClientFetcher(func(ctx context.Context) interface{} { + return Get(ctx) + }) + injection.Dynamic.RegisterDynamicClient(withClientFromDynamic) +} + +// Key is used as the key for associating information with a context.Context. +type Key struct{} + +func withClientFromConfig(ctx context.Context, cfg *rest.Config) context.Context { + return context.WithValue(ctx, Key{}, versioned.NewForConfigOrDie(cfg)) +} + +func withClientFromDynamic(ctx context.Context) context.Context { + return context.WithValue(ctx, Key{}, &wrapClient{dyn: dynamicclient.Get(ctx)}) +} + +// Get extracts the versioned.Interface client from the context. +func Get(ctx context.Context) versioned.Interface { + untyped := ctx.Value(Key{}) + if untyped == nil { + if injection.GetConfig(ctx) == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned.Interface from context. This context is not the application context (which is typically given to constructors via sharedmain).") + } else { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned.Interface from context.") + } + } + return untyped.(versioned.Interface) +} + +type wrapClient struct { + dyn dynamic.Interface +} + +var _ versioned.Interface = (*wrapClient)(nil) + +func (w *wrapClient) Discovery() discovery.DiscoveryInterface { + panic("Discovery called on dynamic client!") +} + +func convert(from interface{}, to runtime.Object) error { + bs, err := json.Marshal(from) + if err != nil { + return fmt.Errorf("Marshal() = %w", err) + } + if err := json.Unmarshal(bs, to); err != nil { + return fmt.Errorf("Unmarshal() = %w", err) + } + return nil +} + +// TektonV1alpha1 retrieves the TektonV1alpha1Client +func (w *wrapClient) TektonV1alpha1() typedtektonv1alpha1.TektonV1alpha1Interface { + return &wrapTektonV1alpha1{ + dyn: w.dyn, + } +} + +type wrapTektonV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapTektonV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapTektonV1alpha1) PipelineResources(namespace string) typedtektonv1alpha1.PipelineResourceInterface { + return &wrapTektonV1alpha1PipelineResourceImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "tekton.dev", + Version: "v1alpha1", + Resource: "pipelineresources", + }), + + namespace: namespace, + } +} + +type wrapTektonV1alpha1PipelineResourceImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedtektonv1alpha1.PipelineResourceInterface = (*wrapTektonV1alpha1PipelineResourceImpl)(nil) + +func (w *wrapTektonV1alpha1PipelineResourceImpl) Create(ctx context.Context, in *v1alpha1.PipelineResource, opts v1.CreateOptions) (*v1alpha1.PipelineResource, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "tekton.dev", + Version: "v1alpha1", + Kind: "PipelineResource", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.PipelineResource{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1PipelineResourceImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapTektonV1alpha1PipelineResourceImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapTektonV1alpha1PipelineResourceImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.PipelineResource, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.PipelineResource{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1PipelineResourceImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PipelineResourceList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.PipelineResourceList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1PipelineResourceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PipelineResource, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.PipelineResource{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1PipelineResourceImpl) Update(ctx context.Context, in *v1alpha1.PipelineResource, opts v1.UpdateOptions) (*v1alpha1.PipelineResource, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "tekton.dev", + Version: "v1alpha1", + Kind: "PipelineResource", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.PipelineResource{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1PipelineResourceImpl) UpdateStatus(ctx context.Context, in *v1alpha1.PipelineResource, opts v1.UpdateOptions) (*v1alpha1.PipelineResource, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "tekton.dev", + Version: "v1alpha1", + Kind: "PipelineResource", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.PipelineResource{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1PipelineResourceImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} diff --git a/pkg/client/resource/injection/client/fake/fake.go b/pkg/client/resource/injection/client/fake/fake.go new file mode 100644 index 00000000000..1447b8e6ace --- /dev/null +++ b/pkg/client/resource/injection/client/fake/fake.go @@ -0,0 +1,57 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned/fake" + client "github.com/tektoncd/pipeline/pkg/client/resource/injection/client" + runtime "k8s.io/apimachinery/pkg/runtime" + rest "k8s.io/client-go/rest" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Fake.RegisterClient(withClient) + injection.Fake.RegisterClientFetcher(func(ctx context.Context) interface{} { + return Get(ctx) + }) +} + +func withClient(ctx context.Context, cfg *rest.Config) context.Context { + ctx, _ = With(ctx) + return ctx +} + +func With(ctx context.Context, objects ...runtime.Object) (context.Context, *fake.Clientset) { + cs := fake.NewSimpleClientset(objects...) + return context.WithValue(ctx, client.Key{}, cs), cs +} + +// Get extracts the Kubernetes client from the context. +func Get(ctx context.Context) *fake.Clientset { + untyped := ctx.Value(client.Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned/fake.Clientset from context.") + } + return untyped.(*fake.Clientset) +} diff --git a/pkg/client/resource/injection/informers/factory/factory.go b/pkg/client/resource/injection/informers/factory/factory.go new file mode 100644 index 00000000000..ea517cdfd0e --- /dev/null +++ b/pkg/client/resource/injection/informers/factory/factory.go @@ -0,0 +1,56 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package factory + +import ( + context "context" + + externalversions "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions" + client "github.com/tektoncd/pipeline/pkg/client/resource/injection/client" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformerFactory(withInformerFactory) +} + +// Key is used as the key for associating information with a context.Context. +type Key struct{} + +func withInformerFactory(ctx context.Context) context.Context { + c := client.Get(ctx) + opts := make([]externalversions.SharedInformerOption, 0, 1) + if injection.HasNamespaceScope(ctx) { + opts = append(opts, externalversions.WithNamespace(injection.GetNamespaceScope(ctx))) + } + return context.WithValue(ctx, Key{}, + externalversions.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), opts...)) +} + +// Get extracts the InformerFactory from the context. +func Get(ctx context.Context) externalversions.SharedInformerFactory { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions.SharedInformerFactory from context.") + } + return untyped.(externalversions.SharedInformerFactory) +} diff --git a/pkg/client/resource/injection/informers/factory/fake/fake.go b/pkg/client/resource/injection/informers/factory/fake/fake.go new file mode 100644 index 00000000000..fdb9e625960 --- /dev/null +++ b/pkg/client/resource/injection/informers/factory/fake/fake.go @@ -0,0 +1,45 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + externalversions "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions" + fake "github.com/tektoncd/pipeline/pkg/client/resource/injection/client/fake" + factory "github.com/tektoncd/pipeline/pkg/client/resource/injection/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = factory.Get + +func init() { + injection.Fake.RegisterInformerFactory(withInformerFactory) +} + +func withInformerFactory(ctx context.Context) context.Context { + c := fake.Get(ctx) + opts := make([]externalversions.SharedInformerOption, 0, 1) + if injection.HasNamespaceScope(ctx) { + opts = append(opts, externalversions.WithNamespace(injection.GetNamespaceScope(ctx))) + } + return context.WithValue(ctx, factory.Key{}, + externalversions.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), opts...)) +} diff --git a/pkg/client/resource/injection/informers/factory/filtered/fake/fake_filtered_factory.go b/pkg/client/resource/injection/informers/factory/filtered/fake/fake_filtered_factory.go new file mode 100644 index 00000000000..6fdf67aee1b --- /dev/null +++ b/pkg/client/resource/injection/informers/factory/filtered/fake/fake_filtered_factory.go @@ -0,0 +1,59 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fakeFilteredFactory + +import ( + context "context" + + externalversions "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions" + fake "github.com/tektoncd/pipeline/pkg/client/resource/injection/client/fake" + filtered "github.com/tektoncd/pipeline/pkg/client/resource/injection/informers/factory/filtered" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterInformerFactory(withInformerFactory) +} + +func withInformerFactory(ctx context.Context) context.Context { + c := fake.Get(ctx) + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + for _, selector := range labelSelectors { + opts := []externalversions.SharedInformerOption{} + if injection.HasNamespaceScope(ctx) { + opts = append(opts, externalversions.WithNamespace(injection.GetNamespaceScope(ctx))) + } + opts = append(opts, externalversions.WithTweakListOptions(func(l *v1.ListOptions) { + l.LabelSelector = selector + })) + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, + externalversions.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), opts...)) + } + return ctx +} diff --git a/pkg/client/resource/injection/informers/factory/filtered/filtered_factory.go b/pkg/client/resource/injection/informers/factory/filtered/filtered_factory.go new file mode 100644 index 00000000000..560e97f91d2 --- /dev/null +++ b/pkg/client/resource/injection/informers/factory/filtered/filtered_factory.go @@ -0,0 +1,77 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filteredFactory + +import ( + context "context" + + externalversions "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions" + client "github.com/tektoncd/pipeline/pkg/client/resource/injection/client" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformerFactory(withInformerFactory) +} + +// Key is used as the key for associating information with a context.Context. +type Key struct { + Selector string +} + +type LabelKey struct{} + +func WithSelectors(ctx context.Context, selector ...string) context.Context { + return context.WithValue(ctx, LabelKey{}, selector) +} + +func withInformerFactory(ctx context.Context) context.Context { + c := client.Get(ctx) + untyped := ctx.Value(LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + for _, selector := range labelSelectors { + opts := []externalversions.SharedInformerOption{} + if injection.HasNamespaceScope(ctx) { + opts = append(opts, externalversions.WithNamespace(injection.GetNamespaceScope(ctx))) + } + opts = append(opts, externalversions.WithTweakListOptions(func(l *v1.ListOptions) { + l.LabelSelector = selector + })) + ctx = context.WithValue(ctx, Key{Selector: selector}, + externalversions.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), opts...)) + } + return ctx +} + +// Get extracts the InformerFactory from the context. +func Get(ctx context.Context, selector string) externalversions.SharedInformerFactory { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions.SharedInformerFactory with selector %s from context.", selector) + } + return untyped.(externalversions.SharedInformerFactory) +} diff --git a/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/fake/fake.go b/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/fake/fake.go new file mode 100644 index 00000000000..a3aee746b78 --- /dev/null +++ b/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/fake/fake.go @@ -0,0 +1,40 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "github.com/tektoncd/pipeline/pkg/client/resource/injection/informers/factory/fake" + pipelineresource "github.com/tektoncd/pipeline/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = pipelineresource.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Tekton().V1alpha1().PipelineResources() + return context.WithValue(ctx, pipelineresource.Key{}, inf), inf.Informer() +} diff --git a/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/filtered/fake/fake.go b/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/filtered/fake/fake.go new file mode 100644 index 00000000000..f6dbee6aea3 --- /dev/null +++ b/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/filtered/fake/fake.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + factoryfiltered "github.com/tektoncd/pipeline/pkg/client/resource/injection/informers/factory/filtered" + filtered "github.com/tektoncd/pipeline/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/filtered" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +var Get = filtered.Get + +func init() { + injection.Fake.RegisterFilteredInformers(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(factoryfiltered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := factoryfiltered.Get(ctx, selector) + inf := f.Tekton().V1alpha1().PipelineResources() + ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} diff --git a/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/filtered/pipelineresource.go b/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/filtered/pipelineresource.go new file mode 100644 index 00000000000..48883e46269 --- /dev/null +++ b/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/filtered/pipelineresource.go @@ -0,0 +1,136 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package filtered + +import ( + context "context" + + apisresourcev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + versioned "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned" + v1alpha1 "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions/resource/v1alpha1" + client "github.com/tektoncd/pipeline/pkg/client/resource/injection/client" + filtered "github.com/tektoncd/pipeline/pkg/client/resource/injection/informers/factory/filtered" + resourcev1alpha1 "github.com/tektoncd/pipeline/pkg/client/resource/listers/resource/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + cache "k8s.io/client-go/tools/cache" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterFilteredInformers(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct { + Selector string +} + +func withInformer(ctx context.Context) (context.Context, []controller.Informer) { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + infs := []controller.Informer{} + for _, selector := range labelSelectors { + f := filtered.Get(ctx, selector) + inf := f.Tekton().V1alpha1().PipelineResources() + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + infs = append(infs, inf.Informer()) + } + return ctx, infs +} + +func withDynamicInformer(ctx context.Context) context.Context { + untyped := ctx.Value(filtered.LabelKey{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch labelkey from context.") + } + labelSelectors := untyped.([]string) + for _, selector := range labelSelectors { + inf := &wrapper{client: client.Get(ctx), selector: selector} + ctx = context.WithValue(ctx, Key{Selector: selector}, inf) + } + return ctx +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context, selector string) v1alpha1.PipelineResourceInformer { + untyped := ctx.Value(Key{Selector: selector}) + if untyped == nil { + logging.FromContext(ctx).Panicf( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions/resource/v1alpha1.PipelineResourceInformer with selector %s from context.", selector) + } + return untyped.(v1alpha1.PipelineResourceInformer) +} + +type wrapper struct { + client versioned.Interface + + namespace string + + selector string +} + +var _ v1alpha1.PipelineResourceInformer = (*wrapper)(nil) +var _ resourcev1alpha1.PipelineResourceLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apisresourcev1alpha1.PipelineResource{}, 0, nil) +} + +func (w *wrapper) Lister() resourcev1alpha1.PipelineResourceLister { + return w +} + +func (w *wrapper) PipelineResources(namespace string) resourcev1alpha1.PipelineResourceNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, selector: w.selector} +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apisresourcev1alpha1.PipelineResource, err error) { + reqs, err := labels.ParseToRequirements(w.selector) + if err != nil { + return nil, err + } + selector = selector.Add(reqs...) + lo, err := w.client.TektonV1alpha1().PipelineResources(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apisresourcev1alpha1.PipelineResource, error) { + // TODO(mattmoor): Check that the fetched object matches the selector. + return w.client.TektonV1alpha1().PipelineResources(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. + }) +} diff --git a/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/pipelineresource.go b/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/pipelineresource.go new file mode 100644 index 00000000000..6dde6ad326b --- /dev/null +++ b/pkg/client/resource/injection/informers/resource/v1alpha1/pipelineresource/pipelineresource.go @@ -0,0 +1,116 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package pipelineresource + +import ( + context "context" + + apisresourcev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + versioned "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned" + v1alpha1 "github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions/resource/v1alpha1" + client "github.com/tektoncd/pipeline/pkg/client/resource/injection/client" + factory "github.com/tektoncd/pipeline/pkg/client/resource/injection/informers/factory" + resourcev1alpha1 "github.com/tektoncd/pipeline/pkg/client/resource/listers/resource/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + cache "k8s.io/client-go/tools/cache" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Tekton().V1alpha1().PipelineResources() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.PipelineResourceInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/resource/informers/externalversions/resource/v1alpha1.PipelineResourceInformer from context.") + } + return untyped.(v1alpha1.PipelineResourceInformer) +} + +type wrapper struct { + client versioned.Interface + + namespace string + + resourceVersion string +} + +var _ v1alpha1.PipelineResourceInformer = (*wrapper)(nil) +var _ resourcev1alpha1.PipelineResourceLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apisresourcev1alpha1.PipelineResource{}, 0, nil) +} + +func (w *wrapper) Lister() resourcev1alpha1.PipelineResourceLister { + return w +} + +func (w *wrapper) PipelineResources(namespace string) resourcev1alpha1.PipelineResourceNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, resourceVersion: w.resourceVersion} +} + +// SetResourceVersion allows consumers to adjust the minimum resourceVersion +// used by the underlying client. It is not accessible via the standard +// lister interface, but can be accessed through a user-defined interface and +// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) +func (w *wrapper) SetResourceVersion(resourceVersion string) { + w.resourceVersion = resourceVersion +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apisresourcev1alpha1.PipelineResource, err error) { + lo, err := w.client.TektonV1alpha1().PipelineResources(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + ResourceVersion: w.resourceVersion, + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apisresourcev1alpha1.PipelineResource, error) { + return w.client.TektonV1alpha1().PipelineResources(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + ResourceVersion: w.resourceVersion, + }) +} diff --git a/pkg/client/resource/listers/resource/v1alpha1/expansion_generated.go b/pkg/client/resource/listers/resource/v1alpha1/expansion_generated.go new file mode 100644 index 00000000000..ef6617f7bb5 --- /dev/null +++ b/pkg/client/resource/listers/resource/v1alpha1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// PipelineResourceListerExpansion allows custom methods to be added to +// PipelineResourceLister. +type PipelineResourceListerExpansion interface{} + +// PipelineResourceNamespaceListerExpansion allows custom methods to be added to +// PipelineResourceNamespaceLister. +type PipelineResourceNamespaceListerExpansion interface{} diff --git a/pkg/client/resource/listers/resource/v1alpha1/pipelineresource.go b/pkg/client/resource/listers/resource/v1alpha1/pipelineresource.go new file mode 100644 index 00000000000..9d698cb9431 --- /dev/null +++ b/pkg/client/resource/listers/resource/v1alpha1/pipelineresource.go @@ -0,0 +1,99 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PipelineResourceLister helps list PipelineResources. +// All objects returned here must be treated as read-only. +type PipelineResourceLister interface { + // List lists all PipelineResources in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.PipelineResource, err error) + // PipelineResources returns an object that can list and get PipelineResources. + PipelineResources(namespace string) PipelineResourceNamespaceLister + PipelineResourceListerExpansion +} + +// pipelineResourceLister implements the PipelineResourceLister interface. +type pipelineResourceLister struct { + indexer cache.Indexer +} + +// NewPipelineResourceLister returns a new PipelineResourceLister. +func NewPipelineResourceLister(indexer cache.Indexer) PipelineResourceLister { + return &pipelineResourceLister{indexer: indexer} +} + +// List lists all PipelineResources in the indexer. +func (s *pipelineResourceLister) List(selector labels.Selector) (ret []*v1alpha1.PipelineResource, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.PipelineResource)) + }) + return ret, err +} + +// PipelineResources returns an object that can list and get PipelineResources. +func (s *pipelineResourceLister) PipelineResources(namespace string) PipelineResourceNamespaceLister { + return pipelineResourceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PipelineResourceNamespaceLister helps list and get PipelineResources. +// All objects returned here must be treated as read-only. +type PipelineResourceNamespaceLister interface { + // List lists all PipelineResources in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.PipelineResource, err error) + // Get retrieves the PipelineResource from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.PipelineResource, error) + PipelineResourceNamespaceListerExpansion +} + +// pipelineResourceNamespaceLister implements the PipelineResourceNamespaceLister +// interface. +type pipelineResourceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PipelineResources in the indexer for a given namespace. +func (s pipelineResourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.PipelineResource, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.PipelineResource)) + }) + return ret, err +} + +// Get retrieves the PipelineResource from the indexer for a given namespace and name. +func (s pipelineResourceNamespaceLister) Get(name string) (*v1alpha1.PipelineResource, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("pipelineresource"), name) + } + return obj.(*v1alpha1.PipelineResource), nil +}