Skip to content

Commit

Permalink
Rename 'resources' to 'computeResources' in v1 taskRun
Browse files Browse the repository at this point in the history
This commit renames the `taskRunStepOverride` and `taskRunSidecarOverride` Golang structs to
`taskRunStepSpec` and `taskRunSidecarSpec`, renames `taskrun.spec.stepOverrides` and `taskrun.spec.sidecarOverrides`
to `taskrun.spec.stepSpecs` and `taskrun.spec.sidecarSpecs`, `pipelineRun.spec.taskRunSpecs.sidecarOverrides`
to `pipelineRun.spec.taskRunSpecs.sidecarSpecs`, `pipelineRun.spec.taskRunSpecs.stepOverrides` to
`pipelineRun.spec.taskRunSpecs.stepSpecs` and the fields related
to compute resources in v1 to a standardized term computeResources. This includes:
- task.spec.steps[].resources
- task.spec.stepTemplate.resources
- task.spec.sidecars[].resources
- taskRun.spec.stepOverrides[].resources
- taskrun.spec.sidecarOverrides[].resources
No functional changes.
  • Loading branch information
JeromeJu committed Sep 19, 2022
1 parent 34274fb commit 23d1006
Show file tree
Hide file tree
Showing 15 changed files with 301 additions and 294 deletions.
7 changes: 7 additions & 0 deletions dev/docs/migrating-v1beta1-to-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ In Tekton `v1`, the following fields have been changed:
| `pipelineRun.spec.resources` | removed from `PipelineRun` |
| `pipelineRun.spec.serviceAccountName` | [`pipelineRun.spec.taskRunTemplate.serviceAccountName`](#adding-taskruntemplate-to-pipelinerun.spec) |
| `pipelineRun.spec.podTemplate` | [`pipelineRun.spec.taskRunTemplate.podTemplate`](#adding-taskruntemplate-to-pipelinerun.spec) |
| `task.spec.steps[].resources` | `task.spec.steps[].computeResources` |
| `task.spec.stepTemplate.resources` | `task.spec.stepTemplate.computeResources` |
| `task.spec.sidecars[].resources` | `task.spec.sidecars[].computeResources` |
| `taskRun.spec.stepOverrides[].resources` | `taskRun.spec.stepOverrides[].computeResources` |
| `taskRun.spec.sidecarOverrides[].resources` | `taskRun.spec.sidecarOverrides[].computeResources` |
| `taskRun.spec.sidecarOverrides`| `taskRun.spec.sidecarSpecs` |
| `taskRun.spec.stepOverrides` | `taskRun.spec.stepSpecs` |

## Deprecating `resources` from Task, TaskRun, Pipeline and PipelineRun
`PipelineResources` are deprecated, and the `resources` fields of Task, TaskRun, Pipeline and PipelineRun has been removed. Please use `Tasks` instead. For more information, see [Replacing PipelineResources](https://github.com/tektoncd/pipeline/blob/main/docs/pipelineresources.md)
Expand Down
84 changes: 42 additions & 42 deletions docs/pipeline-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1163,35 +1163,35 @@ Template
</tr>
<tr>
<td>
<code>stepOverrides</code><br/>
<code>stepSpecs</code><br/>
<em>
<a href="#tekton.dev/v1.TaskRunStepOverride">
[]TaskRunStepOverride
<a href="#tekton.dev/v1.TaskRunStepSpec">
[]TaskRunStepSpec
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Overrides to apply to Steps in this TaskRun.
If a field is specified in both a Step and a StepOverride,
the value from the StepOverride will be used.
<p>Specs to apply to Steps in this TaskRun.
If a field is specified in both a Step and a StepSpec,
the value from the StepSpec will be used.
This field is only supported when the alpha feature gate is enabled.</p>
</td>
</tr>
<tr>
<td>
<code>sidecarOverrides</code><br/>
<code>sidecarSpecs</code><br/>
<em>
<a href="#tekton.dev/v1.TaskRunSidecarOverride">
[]TaskRunSidecarOverride
<a href="#tekton.dev/v1.TaskRunSidecarSpec">
[]TaskRunSidecarSpec
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Overrides to apply to Sidecars in this TaskRun.
If a field is specified in both a Sidecar and a SidecarOverride,
the value from the SidecarOverride will be used.
<p>Specs to apply to Sidecars in this TaskRun.
If a field is specified in both a Sidecar and a SidecarSpec,
the value from the SidecarSpec will be used.
This field is only supported when the alpha feature gate is enabled.</p>
</td>
</tr>
Expand Down Expand Up @@ -2685,10 +2685,10 @@ Template
</tr>
<tr>
<td>
<code>stepOverrides</code><br/>
<code>stepSpecs</code><br/>
<em>
<a href="#tekton.dev/v1.TaskRunStepOverride">
[]TaskRunStepOverride
<a href="#tekton.dev/v1.TaskRunStepSpec">
[]TaskRunStepSpec
</a>
</em>
</td>
Expand All @@ -2697,10 +2697,10 @@ Template
</tr>
<tr>
<td>
<code>sidecarOverrides</code><br/>
<code>sidecarSpecs</code><br/>
<em>
<a href="#tekton.dev/v1.TaskRunSidecarOverride">
[]TaskRunSidecarOverride
<a href="#tekton.dev/v1.TaskRunSidecarSpec">
[]TaskRunSidecarSpec
</a>
</em>
</td>
Expand Down Expand Up @@ -3160,7 +3160,7 @@ Cannot be updated.</p>
</tr>
<tr>
<td>
<code>resources</code><br/>
<code>computeResources</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#resourcerequirements-v1-core">
Kubernetes core/v1.ResourceRequirements
Expand All @@ -3169,7 +3169,7 @@ Kubernetes core/v1.ResourceRequirements
</td>
<td>
<em>(Optional)</em>
<p>Compute Resources required by this Sidecar.
<p>ComputeResources required by this Sidecar.
Cannot be updated.
More info: <a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/">https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/</a></p>
</td>
Expand Down Expand Up @@ -3721,7 +3721,7 @@ Cannot be updated.</p>
</tr>
<tr>
<td>
<code>resources</code><br/>
<code>computeResources</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#resourcerequirements-v1-core">
Kubernetes core/v1.ResourceRequirements
Expand All @@ -3730,7 +3730,7 @@ Kubernetes core/v1.ResourceRequirements
</td>
<td>
<em>(Optional)</em>
<p>Compute Resources required by this Step.
<p>ComputeResources required by this Step.
Cannot be updated.
More info: <a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/">https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/</a></p>
</td>
Expand Down Expand Up @@ -4102,7 +4102,7 @@ Cannot be updated.</p>
</tr>
<tr>
<td>
<code>resources</code><br/>
<code>computeResources</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#resourcerequirements-v1-core">
Kubernetes core/v1.ResourceRequirements
Expand All @@ -4111,7 +4111,7 @@ Kubernetes core/v1.ResourceRequirements
</td>
<td>
<em>(Optional)</em>
<p>Compute Resources required by this Step.
<p>ComputeResources required by this Step.
Cannot be updated.
More info: <a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/">https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/</a></p>
</td>
Expand Down Expand Up @@ -4492,13 +4492,13 @@ ParamValue
</tr>
</tbody>
</table>
<h3 id="tekton.dev/v1.TaskRunSidecarOverride">TaskRunSidecarOverride
<h3 id="tekton.dev/v1.TaskRunSidecarSpec">TaskRunSidecarSpec
</h3>
<p>
(<em>Appears on:</em><a href="#tekton.dev/v1.PipelineTaskRunSpec">PipelineTaskRunSpec</a>, <a href="#tekton.dev/v1.TaskRunSpec">TaskRunSpec</a>)
</p>
<div>
<p>TaskRunSidecarOverride is used to override the values of a Sidecar in the corresponding Task.</p>
<p>TaskRunSidecarSpec is used to override the values of a Sidecar in the corresponding Task.</p>
</div>
<table>
<thead>
Expand All @@ -4521,7 +4521,7 @@ string
</tr>
<tr>
<td>
<code>resources</code><br/>
<code>computeResources</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#resourcerequirements-v1-core">
Kubernetes core/v1.ResourceRequirements
Expand Down Expand Up @@ -4687,35 +4687,35 @@ Template
</tr>
<tr>
<td>
<code>stepOverrides</code><br/>
<code>stepSpecs</code><br/>
<em>
<a href="#tekton.dev/v1.TaskRunStepOverride">
[]TaskRunStepOverride
<a href="#tekton.dev/v1.TaskRunStepSpec">
[]TaskRunStepSpec
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Overrides to apply to Steps in this TaskRun.
If a field is specified in both a Step and a StepOverride,
the value from the StepOverride will be used.
<p>Specs to apply to Steps in this TaskRun.
If a field is specified in both a Step and a StepSpec,
the value from the StepSpec will be used.
This field is only supported when the alpha feature gate is enabled.</p>
</td>
</tr>
<tr>
<td>
<code>sidecarOverrides</code><br/>
<code>sidecarSpecs</code><br/>
<em>
<a href="#tekton.dev/v1.TaskRunSidecarOverride">
[]TaskRunSidecarOverride
<a href="#tekton.dev/v1.TaskRunSidecarSpec">
[]TaskRunSidecarSpec
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Overrides to apply to Sidecars in this TaskRun.
If a field is specified in both a Sidecar and a SidecarOverride,
the value from the SidecarOverride will be used.
<p>Specs to apply to Sidecars in this TaskRun.
If a field is specified in both a Sidecar and a SidecarSpec,
the value from the SidecarSpec will be used.
This field is only supported when the alpha feature gate is enabled.</p>
</td>
</tr>
Expand Down Expand Up @@ -4941,13 +4941,13 @@ TaskSpec
</tr>
</tbody>
</table>
<h3 id="tekton.dev/v1.TaskRunStepOverride">TaskRunStepOverride
<h3 id="tekton.dev/v1.TaskRunStepSpec">TaskRunStepSpec
</h3>
<p>
(<em>Appears on:</em><a href="#tekton.dev/v1.PipelineTaskRunSpec">PipelineTaskRunSpec</a>, <a href="#tekton.dev/v1.TaskRunSpec">TaskRunSpec</a>)
</p>
<div>
<p>TaskRunStepOverride is used to override the values of a Step in the corresponding Task.</p>
<p>TaskRunStepSpec is used to override the values of a Step in the corresponding Task.</p>
</div>
<table>
<thead>
Expand All @@ -4970,7 +4970,7 @@ string
</tr>
<tr>
<td>
<code>resources</code><br/>
<code>computeResources</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#resourcerequirements-v1-core">
Kubernetes core/v1.ResourceRequirements
Expand Down
24 changes: 12 additions & 12 deletions pkg/apis/pipeline/v1/container_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ type Step struct {
// +patchStrategy=merge
// +listType=atomic
Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,7,rep,name=env"`
// Compute Resources required by this Step.
// ComputeResources required by this Step.
// Cannot be updated.
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,8,opt,name=resources"`
ComputeResources corev1.ResourceRequirements `json:"computeResources,omitempty" protobuf:"bytes,8,opt,name=computeResources"`
// Volumes to mount into the Step's filesystem.
// Cannot be updated.
// +optional
Expand Down Expand Up @@ -165,7 +165,7 @@ func (s *Step) ToK8sContainer() *corev1.Container {
WorkingDir: s.WorkingDir,
EnvFrom: s.EnvFrom,
Env: s.Env,
Resources: s.Resources,
Resources: s.ComputeResources,
VolumeMounts: s.VolumeMounts,
VolumeDevices: s.VolumeDevices,
ImagePullPolicy: s.ImagePullPolicy,
Expand All @@ -182,7 +182,7 @@ func (s *Step) SetContainerFields(c corev1.Container) {
s.WorkingDir = c.WorkingDir
s.EnvFrom = c.EnvFrom
s.Env = c.Env
s.Resources = c.Resources
s.ComputeResources = c.Resources
s.VolumeMounts = c.VolumeMounts
s.VolumeDevices = c.VolumeDevices
s.ImagePullPolicy = c.ImagePullPolicy
Expand Down Expand Up @@ -242,11 +242,11 @@ type StepTemplate struct {
// +patchStrategy=merge
// +listType=atomic
Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,7,rep,name=env"`
// Compute Resources required by this Step.
// ComputeResources required by this Step.
// Cannot be updated.
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,8,opt,name=resources"`
ComputeResources corev1.ResourceRequirements `json:"computeResources,omitempty" protobuf:"bytes,8,opt,name=computeResources"`
// Volumes to mount into the Step's filesystem.
// Cannot be updated.
// +optional
Expand Down Expand Up @@ -282,7 +282,7 @@ func (s *StepTemplate) SetContainerFields(c corev1.Container) {
s.WorkingDir = c.WorkingDir
s.EnvFrom = c.EnvFrom
s.Env = c.Env
s.Resources = c.Resources
s.ComputeResources = c.Resources
s.VolumeMounts = c.VolumeMounts
s.VolumeDevices = c.VolumeDevices
s.ImagePullPolicy = c.ImagePullPolicy
Expand All @@ -298,7 +298,7 @@ func (s *StepTemplate) ToK8sContainer() *corev1.Container {
WorkingDir: s.WorkingDir,
EnvFrom: s.EnvFrom,
Env: s.Env,
Resources: s.Resources,
Resources: s.ComputeResources,
VolumeMounts: s.VolumeMounts,
VolumeDevices: s.VolumeDevices,
ImagePullPolicy: s.ImagePullPolicy,
Expand Down Expand Up @@ -377,11 +377,11 @@ type Sidecar struct {
// +patchStrategy=merge
// +listType=atomic
Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,7,rep,name=env"`
// Compute Resources required by this Sidecar.
// ComputeResources required by this Sidecar.
// Cannot be updated.
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,8,opt,name=resources"`
ComputeResources corev1.ResourceRequirements `json:"computeResources,omitempty" protobuf:"bytes,8,opt,name=computeResources"`
// Volumes to mount into the Sidecar's filesystem.
// Cannot be updated.
// +optional
Expand Down Expand Up @@ -502,7 +502,7 @@ func (s *Sidecar) ToK8sContainer() *corev1.Container {
Ports: s.Ports,
EnvFrom: s.EnvFrom,
Env: s.Env,
Resources: s.Resources,
Resources: s.ComputeResources,
VolumeMounts: s.VolumeMounts,
VolumeDevices: s.VolumeDevices,
LivenessProbe: s.LivenessProbe,
Expand All @@ -529,7 +529,7 @@ func (s *Sidecar) SetContainerFields(c corev1.Container) {
s.Ports = c.Ports
s.EnvFrom = c.EnvFrom
s.Env = c.Env
s.Resources = c.Resources
s.ComputeResources = c.Resources
s.VolumeMounts = c.VolumeMounts
s.VolumeDevices = c.VolumeDevices
s.LivenessProbe = c.LivenessProbe
Expand Down
Loading

0 comments on commit 23d1006

Please sign in to comment.