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 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 d8d70e9
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 95 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
16 changes: 8 additions & 8 deletions docs/pipeline-api.md
Original file line number Diff line number Diff line change
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 @@ -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
20 changes: 10 additions & 10 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.

16 changes: 8 additions & 8 deletions pkg/apis/pipeline/v1/pipelinerun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ func TestPipelineRun_Validate(t *testing.T) {
PipelineTaskName: "bar",
StepOverrides: []v1.TaskRunStepOverride{{
Name: "task-1",
Resources: corev1.ResourceRequirements{
ComputeResources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")},
}},
},
SidecarOverrides: []v1.TaskRunSidecarOverride{{
Name: "task-1",
Resources: corev1.ResourceRequirements{
ComputeResources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")},
}},
},
Expand Down Expand Up @@ -374,7 +374,7 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
PipelineTaskName: "bar",
StepOverrides: []v1.TaskRunStepOverride{{
Name: "task-1",
Resources: corev1.ResourceRequirements{
ComputeResources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")},
}},
},
Expand All @@ -391,7 +391,7 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
PipelineTaskName: "bar",
SidecarOverrides: []v1.TaskRunSidecarOverride{{
Name: "task-1",
Resources: corev1.ResourceRequirements{
ComputeResources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")},
}},
},
Expand All @@ -407,7 +407,7 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
{
PipelineTaskName: "bar",
StepOverrides: []v1.TaskRunStepOverride{{
Resources: corev1.ResourceRequirements{
ComputeResources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")},
}},
},
Expand Down Expand Up @@ -439,7 +439,7 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
{
PipelineTaskName: "bar",
SidecarOverrides: []v1.TaskRunSidecarOverride{{
Resources: corev1.ResourceRequirements{
ComputeResources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")},
}},
},
Expand All @@ -457,7 +457,7 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
PipelineTaskName: "pipelineTask",
StepOverrides: []v1.TaskRunStepOverride{{
Name: "stepOverride",
Resources: corev1.ResourceRequirements{
ComputeResources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")},
}},
},
Expand Down Expand Up @@ -548,7 +548,7 @@ func TestPipelineRunSpec_Validate(t *testing.T) {
},
SidecarOverrides: []v1.TaskRunSidecarOverride{{
Name: "sidecar",
Resources: corev1.ResourceRequirements{
ComputeResources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceMemory: corev1resources.MustParse("4Gi"),
},
Expand Down
Loading

0 comments on commit d8d70e9

Please sign in to comment.