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 `taskrun.spec.stepOverrides` and `taskrun.spec.sidecarOverrides`
to `taskrun.spec.stepSpecs` and `taskrun.spec.sidecarSpecs` 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 16, 2022
1 parent 34274fb commit 5a3b8ef
Show file tree
Hide file tree
Showing 13 changed files with 157 additions and 152 deletions.
5 changes: 5 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,11 @@ 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` |

## 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
24 changes: 12 additions & 12 deletions docs/pipeline-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ Template
</tr>
<tr>
<td>
<code>stepOverrides</code><br/>
<code>stepSpecs</code><br/>
<em>
<a href="#tekton.dev/v1.TaskRunStepOverride">
[]TaskRunStepOverride
Expand All @@ -1180,7 +1180,7 @@ This field is only supported when the alpha feature gate is enabled.</p>
</tr>
<tr>
<td>
<code>sidecarOverrides</code><br/>
<code>sidecarSpecs</code><br/>
<em>
<a href="#tekton.dev/v1.TaskRunSidecarOverride">
[]TaskRunSidecarOverride
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 @@ -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,7 +4687,7 @@ Template
</tr>
<tr>
<td>
<code>stepOverrides</code><br/>
<code>stepSpecs</code><br/>
<em>
<a href="#tekton.dev/v1.TaskRunStepOverride">
[]TaskRunStepOverride
Expand All @@ -4704,7 +4704,7 @@ This field is only supported when the alpha feature gate is enabled.</p>
</tr>
<tr>
<td>
<code>sidecarOverrides</code><br/>
<code>sidecarSpecs</code><br/>
<em>
<a href="#tekton.dev/v1.TaskRunSidecarOverride">
[]TaskRunSidecarOverride
Expand Down Expand Up @@ -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
24 changes: 12 additions & 12 deletions pkg/apis/pipeline/v1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1/pipelinerun_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ func (ps *PipelineRunSpec) validatePipelineTimeout(timeout time.Duration, errorM
func validateTaskRunSpec(ctx context.Context, trs PipelineTaskRunSpec) (errs *apis.FieldError) {
if trs.StepOverrides != nil {
errs = errs.Also(version.ValidateEnabledAPIFields(ctx, "stepOverrides", config.AlphaAPIFields).ViaField("stepOverrides"))
errs = errs.Also(validateStepOverrides(trs.StepOverrides).ViaField("stepOverrides"))
errs = errs.Also(validateStepSpecs(trs.StepOverrides).ViaField("stepOverrides"))
}
if trs.SidecarOverrides != nil {
errs = errs.Also(version.ValidateEnabledAPIFields(ctx, "sidecarOverrides", config.AlphaAPIFields).ViaField("sidecarOverrides"))
errs = errs.Also(validateSidecarOverrides(trs.SidecarOverrides).ViaField("sidecarOverrides"))
errs = errs.Also(validateSidecarSpecs(trs.SidecarOverrides).ViaField("sidecarOverrides"))
}
if trs.ComputeResources != nil {
errs = errs.Also(version.ValidateEnabledAPIFields(ctx, "computeResources", config.AlphaAPIFields).ViaField("computeResources"))
Expand Down
Loading

0 comments on commit 5a3b8ef

Please sign in to comment.