Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate the TaskRun controller to genreconciler. #2771

Merged
merged 1 commit into from
Jun 9, 2020

Conversation

mattmoor
Copy link
Member

@mattmoor mattmoor commented Jun 6, 2020

There are effectively two pieces to this change:

  1. Generate and consume the base reconciler (dropping boilerplate)
  2. Update tests to plumb certain things differently (the existing tests followed our bad example and used unsafe type cases to root around in the controller.Reconciler.(*Reconciler))

The changes in the pipeline run files are mostly for symmetry, or because a common utility changed.

This is WIP until #2760 lands.

@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 6, 2020
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 6, 2020
@tekton-robot
Copy link
Collaborator

This PR cannot be merged: expecting exactly one kind/ label

Available kind/ labels are:

kind/bug: Categorizes issue or PR as related to a bug.
kind/flake: Categorizes issue or PR as related to a flakey test
kind/cleanup: Categorizes issue or PR as related to cleaning up code, process, or technical debt.
kind/design: Categorizes issue or PR as related to design.
kind/documentation: Categorizes issue or PR as related to documentation.
kind/feature: Categorizes issue or PR as related to a new feature.
kind/misc: Categorizes issue or PR as a miscellaneuous one.

2 similar comments
@tekton-robot
Copy link
Collaborator

This PR cannot be merged: expecting exactly one kind/ label

Available kind/ labels are:

kind/bug: Categorizes issue or PR as related to a bug.
kind/flake: Categorizes issue or PR as related to a flakey test
kind/cleanup: Categorizes issue or PR as related to cleaning up code, process, or technical debt.
kind/design: Categorizes issue or PR as related to design.
kind/documentation: Categorizes issue or PR as related to documentation.
kind/feature: Categorizes issue or PR as related to a new feature.
kind/misc: Categorizes issue or PR as a miscellaneuous one.

@tekton-robot
Copy link
Collaborator

This PR cannot be merged: expecting exactly one kind/ label

Available kind/ labels are:

kind/bug: Categorizes issue or PR as related to a bug.
kind/flake: Categorizes issue or PR as related to a flakey test
kind/cleanup: Categorizes issue or PR as related to cleaning up code, process, or technical debt.
kind/design: Categorizes issue or PR as related to design.
kind/documentation: Categorizes issue or PR as related to documentation.
kind/feature: Categorizes issue or PR as related to a new feature.
kind/misc: Categorizes issue or PR as a miscellaneuous one.

@mattmoor
Copy link
Member Author

mattmoor commented Jun 6, 2020

/kind cleanup

@tekton-robot tekton-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jun 6, 2020
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/metrics.go 86.8% 84.7% -2.0
pkg/reconciler/pipelinerun/pipelinerun.go 80.2% 80.3% 0.1
pkg/reconciler/taskrun/controller.go 96.2% 96.4% 0.3
pkg/reconciler/taskrun/metrics.go 86.7% 85.4% -1.2
pkg/reconciler/taskrun/taskrun.go 76.0% 74.7% -1.3
test/controller.go 0.0% 28.9% 28.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/metrics.go 86.8% 84.7% -2.0
pkg/reconciler/pipelinerun/pipelinerun.go 80.2% 80.3% 0.1
pkg/reconciler/taskrun/controller.go 96.2% 96.4% 0.3
pkg/reconciler/taskrun/metrics.go 86.7% 85.4% -1.2
pkg/reconciler/taskrun/taskrun.go 76.0% 74.7% -1.3
test/controller.go 0.0% 28.9% 28.9

@mattmoor
Copy link
Member Author

mattmoor commented Jun 6, 2020

oh boy, my favorite. dependency cycles!

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/metrics.go 86.8% 84.7% -2.0
pkg/reconciler/pipelinerun/pipelinerun.go 80.2% 80.3% 0.1
pkg/reconciler/taskrun/controller.go 96.2% 96.4% 0.3
pkg/reconciler/taskrun/metrics.go 86.7% 85.4% -1.2
pkg/reconciler/taskrun/taskrun.go 76.0% 74.7% -1.3
test/controller.go 0.0% 28.9% 28.9

@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 8, 2020
@mattmoor mattmoor changed the title [WIP] Migrate the TaskRun controller to genreconciler. Migrate the TaskRun controller to genreconciler. Jun 8, 2020
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 8, 2020
@mattmoor
Copy link
Member Author

mattmoor commented Jun 8, 2020

/assign @afrittoli @vdemeester @imjasonh

Alright, this should be RFAL. There's some cruft to cleanup after this, but this has already started to creep a bit in the cleanup department. 😬

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/controller.go 96.6% 96.7% 0.1
pkg/reconciler/taskrun/taskrun.go 75.5% 74.7% -0.8

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@@ -14,38 +14,39 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package config
package config_test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😻

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 8, 2020
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jun 8, 2020
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/controller.go 96.6% 96.7% 0.1
pkg/reconciler/taskrun/taskrun.go 75.5% 77.0% 1.5

There are effectively two pieces to this change:
1. Generate and consume the base reconciler (dropping boilerplate)
2. Update tests to plumb certain things differently (the existing tests followed our bad example and used unsafe type cases to root around in the `controller.Reconciler.(*Reconciler)`)

The changes in the pipeline run files are mostly for symmetry, or because a common utility changed.
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/controller.go 96.6% 96.7% 0.1
pkg/reconciler/taskrun/taskrun.go 75.5% 77.0% 1.5

@@ -727,8 +662,7 @@ func updateStoppedSidecarStatus(pod *corev1.Pod, tr *v1beta1.TaskRun, c *Reconci
})
}
}
_, err := c.updateStatus(tr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making a note here in case this comes into question, but checked this out and seems to be fine without the call to updateStatus. Thanks for noticing and correcting.

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thank you!
/approve

@@ -1328,7 +1307,7 @@ func TestReconcile(t *testing.T) {
t.Fatalf("Expected actions to be logged in the kubeclient, got none")
}

err = checkEvents(fr, tc.name, tc.wantEvents)
err = checkEvents(testAssets.Recorder, tc.name, tc.wantEvents)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! 🤩

Pipeline *fakepipelineclientset.Clientset
Resource *fakeresourceclientset.Clientset
Kube *fakekubeclientset.Clientset
CloudEvents cloudeventclient.CEClient
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I knew there was a better place to store this client :D only at the time I had no idea :P

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 9, 2020
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/meow

@tekton-robot
Copy link
Collaborator

@vdemeester: cat image

In response to this:

/lgtm
/meow

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 9, 2020
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afrittoli, vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [afrittoli,vdemeester]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mattmoor
Copy link
Member Author

mattmoor commented Jun 9, 2020

/retest

@tekton-robot tekton-robot merged commit 9e8c654 into tektoncd:master Jun 9, 2020
@mattmoor mattmoor deleted the taskrun branch June 9, 2020 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants