Skip to content

Refactor route controller to pattern consistent with other controllers.#1444

Merged
google-prow-robot merged 2 commits intoknative:masterfrom
tcnghia:refactor
Jul 2, 2018
Merged

Refactor route controller to pattern consistent with other controllers.#1444
google-prow-robot merged 2 commits intoknative:masterfrom
tcnghia:refactor

Conversation

@tcnghia
Copy link
Copy Markdown
Contributor

@tcnghia tcnghia commented Jul 1, 2018

This PR move route controller to pattern similar to that of the rest of the controllers, that all resource changes impacting a route will go through the same function.

I am only updating the tests to compile with new code, and have not also refactored the tests. Will follow up in another PR to avoid over-complicating the code review.

Also removing some unused code. In particular, in #1228 I change the activator route to only depends on the Revision's Serving state (whether it is in Reserved or not) and not whether 1->0 is enabled (since we are only dealing with 0->1 activation here). Since then such code has been unused, so I am removing them as well.

@tcnghia tcnghia requested review from mattmoor and mdemirhan July 1, 2018 23:19
@google-prow-robot google-prow-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 1, 2018
@tcnghia tcnghia changed the title Refactor route controller to level-base. Refactor route controller to pattern consistent with other controllers. Jul 1, 2018
Copy link
Copy Markdown
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

This moves us a step closer, but I think has a ways to go to completely follow the same pattern I'd like. This seems like good incremental progress, so let's talk about what's next after this goes in.

Couple nits.

}

existing.Status = route.Status
// TODO: for CRD there's no updatestatus, so use normal update.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please undo this, we don't use UpdateStatus yet (yes, it is poorly worded).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

// If there's nothing to update, just return.
if reflect.DeepEqual(existing.Status, route.Status) {
return existing, nil
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand this change. I'd leave it for consistency with other updateStatus methods, or remove them all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

configName := config.Name
ns := config.Namespace

func (c *Controller) EnqueueReferringRoute(obj interface{}) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This depends on the Route label on Configurations, which is something we want to be able to relax.

You aren't introducing this, but we should fix this in a future change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ack

@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on pkg/. Say /test pull-knative-serving-go-coverage to run the coverage report again

File Old Coverage New Coverage Delta
pkg/controller/route/route.go 76.5% 95.0% 18.5

*TestCoverage feature is being tested, do not rely on any info here yet

Copy link
Copy Markdown
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 2, 2018
@google-prow-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor, tcnghia

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

The pull request process is described here

Details Needs approval from an approver in each of these files:

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

@google-prow-robot google-prow-robot merged commit e74cf23 into knative:master Jul 2, 2018
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. 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.

4 participants