-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat(db) upstreams and targets to new dao (replaces #3622 and #3660) #3689
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bungle
changed the title
(feat) upstreams and targets to new dao (replaces #3622)
(feat) upstreams and targets to new dao (replaces #3622 and #3660)
Aug 10, 2018
bungle
force-pushed
the
feat/targets-to-new-dao-rebased
branch
from
August 10, 2018 16:02
644cd01
to
ef5b630
Compare
hishamhm
reviewed
Aug 10, 2018
kong/runloop/balancer.lua
Outdated
@@ -270,20 +264,24 @@ do | |||
healthcheckers[balancer] = hc | |||
|
|||
balancer.report_http_status = function(ip, port, status) | |||
log(DEBUG, "HC ", tostring(hc), " FOR BALANCER ", tostring(balancer), " REPORTING HTTP STATUS ", ip, ":", port, " ", status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all these lines containing uppercase DEBUG logs (plus the print
below) should be removed
bungle
force-pushed
the
feat/targets-to-new-dao-rebased
branch
from
August 10, 2018 17:49
ef5b630
to
7a7bbf5
Compare
hishamhm
reviewed
Aug 10, 2018
kong/runloop/balancer.lua
Outdated
@@ -12,6 +12,7 @@ local log = ngx.log | |||
local sleep = ngx.sleep | |||
local min = math.min | |||
local max = math.max | |||
local inspect = require("inspect") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is also a leftover
bungle
force-pushed
the
feat/targets-to-new-dao-rebased
branch
from
August 10, 2018 17:53
7a7bbf5
to
2eebcc6
Compare
hishamhm
approved these changes
Aug 10, 2018
hishamhm
changed the title
(feat) upstreams and targets to new dao (replaces #3622 and #3660)
feat(db) upstreams and targets to new dao (replaces #3622 and #3660)
Aug 10, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new admin API is fairly similar to the previously existing one, but there are some breaking changes:
GET /upstreams
orGET /upstreams/{upstream}/targets
) don't accept query-attributes for filtering any moretotal
attribute is gonePUT
actions now are applied to entities instead of to collections. (PUT /upstreams/foo
instead ofPUT /upstreams
Attempting to use an invalid name name (such an IP address) when updating an upstream has become a500
error instead of a400
.PUT
actions return a200
on creation instead of201
.created_at
) can be presented and stored either with seconds or milliseconds resolutionNew features:
next
on paginated admin API results.db.targets:for_upstream(u)
, the list only includes active targets, and is reverse-sorted bycreated_at+id
. This is the method used in/upstreams/{upstream}/targets
db.targets:for_upstreams_raw(u)
which returns all targets, including those withweight=0
, associated with the upstream. That's what used in/upstreams/{upstream}/targets/all
db.targets:for_upstream_with_health(u)
is the same list asdb.targets:for_upstream(u)
but also includes health information (so it is slower to call). It is used in/upstreams/{upstream}/health
.db.targets:for_upstream_sorted(u)
which returns the targets sorted bycreated_at+id
. It is used internally in a couple places for things like cleaning up and building the cache.db.targets:delete
method creates a new target withweight = 0
. The only way to really delete a target from the database is by inserting targets (this will eventually trigger aclean_history
call).db.targets:post_health
is the one-place for changing health status of a target. It deals with balancer changes and sending events to the cluster. It is used inPOST /upstreams/{upstream}/targets/{target}/healthy|unhealthy
.Prerequisites:
hash_on_header
is not equal tohash_fallback_header
target.target
attribute is an endpoint key but it is not unique. Had to remove that restriction from the system.This PR replaces #3622 and #3660.