pkg/route: Add a package with route helpers - #911
Conversation
|
Some potential consumers:
|
Miciah
left a comment
There was a problem hiding this comment.
It might make sense to add a test case with Admitted=False.
|
/lgtm |
|
I'm generally wary of "bucket of helpers", but I'm willing to see where it goes. The last three packages I saw like this took nearly six months to untangle enough to separate. I would like to see /approve holding for package update. Feel free to merge after. |
Constructing a usable URI for a route is non-trivial code that is useful in many route consumers. Save consumers a few lines by creating a helper in a shared location for centralized maintenance. Owners from [1], pruning the stale ironcladlou, pravisankar, and ramr entries, and alphabetizing each list. David requested the pkg/route/routeapihelpers package namespacing [2]. [1]: https://github.com/openshift/router/blob/189bd7fd5594e09e85b9af178738ae3550a39995/OWNERS [2]: openshift#911 (comment)
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, Miciah, wking The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold cancel |
Using the helper from [1] to centralize some route handling and error message generation. Generated with: $ emacs pkg/... # everything in the diff $ go get github.com/openshift/library-go@f360b9835cc8815eccc26cb52dafe05d3cbb3e93 go: github.com/openshift/library-go f360b9835cc8815eccc26cb52dafe05d3cbb3e93 => v0.0.0-20201006230840-f360b9835cc8 $ go mod tidy $ go mod vendor $ git add -A go.* vendor using: $ go version go version go1.15.2 linux/amd64 [1]: openshift/library-go#911
Using the helper from [1] to centralize some route handling and error message generation. Generated with: $ emacs pkg/... test/library/waits.go # everything in the diff $ go get github.com/openshift/library-go@f360b9835cc8815eccc26cb52dafe05d3cbb3e93 go: github.com/openshift/library-go f360b9835cc8815eccc26cb52dafe05d3cbb3e93 => v0.0.0-20201006230840-f360b9835cc8 $ go mod tidy $ go mod vendor $ git add -A go.* vendor using: $ go version go version go1.15.2 linux/amd64 [1]: openshift/library-go#911
Using the helper from [1], so we: * No longer hard-code https://. It's calculated based on the route's TLS config. * No longer assume that the available ingress host will match the route's spec.host. * No longer assume that the route is admitted. Now we check the ingress conditions to confirm Admitted=True. Generated with: $ emacs cmd/openshift-install/create.go # everything in the diff $ go mod tidy $ go mod vendor $ git add -A go.* vendor using: $ go version go version go1.15.2 linux/amd64 [1]: openshift/library-go#911
Constructing a usable URI for a route is non-trivial code that is useful in many route consumers. Save consumers a few lines by creating a helper in a shared location for centralized maintenance.
Owners from
router/OWNERS.CC @Miciah