feat: Add labels for upstream object#2279
Conversation
labels can be used to specify additional attributes. Signed-off-by: imjoey <[email protected]>
c8550b7 to
508cd8c
Compare
membphis
left a comment
There was a problem hiding this comment.
need a test case, I think it should be invalid.
{
... ...
lables: {
key: {
sub_key: ["a", "b", "c"]
}
}
}| }, | ||
| labels = { | ||
| description = "key/value pairs to specify attributes", | ||
| type = "table" |
There was a problem hiding this comment.
I think it should be object here.
There was a problem hiding this comment.
@membphis agreed, nice catch, thanks. I would make changes as the your suggestions and add one more failure test case after I find the lua way. 😄
There was a problem hiding this comment.
@membphis PR is updated and labels are limited to string key/value pairs, so fix the depth problem. 😄
|
@imjoey One thing confuses me that the labels field is attached on the whole |
|
This is a very interesting topic. |
Hi @tokers , thanks for your feedback. I guess labels could be very useful for every single object in APISIX. While currently |
Your idea is great,
|
@gxthrj yep, glad to hear your thoughts. Yesterday I was about to migrate the functionality of RouteGroup from MySQL to etcd. But it seemed still under discussions in community. So I deliberated on the whole design, I guess labels could make the relationships of objects in APISIX much more loosely coupled, and also make the extensibility more easily. |
I think we don't need to separate nodes from upstream, just redefine the data structure of nodes. |
@nic-chen Just FYI, we could make use of the existing |
|
Signed-off-by: imjoey <[email protected]>
980e048 to
07ae2c7
Compare
| |checks |可选|配置健康检查的参数,详细可参考[health-check](../health-check.md)| | ||
| |retries |可选|使用底层的 Nginx 重试机制将请求传递给下一个上游,默认 APISIX 会启用重试机制,根据配置的后端节点个数设置重试次数,如果此参数显式被设置将会覆盖系统默认设置的重试次数。| | ||
| |enable_websocket|可选| 是否启用 `websocket`(布尔值),默认不启用| | ||
| |labels |可选| 用于标识属性的键值对。 | |
There was a problem hiding this comment.
need more doc, we need an example about how to use this field.
There was a problem hiding this comment.
@membphis thanks for reviewing. I will add more guidance docs about labels usage and best practice in APISIX after labels are added in all objects.
membphis
left a comment
There was a problem hiding this comment.
Some minor document issues need to be fixed, LGTM
|
@imjoey many thx, merged |
Signed-off-by: imjoey [email protected]
What this PR does / why we need it:
Hi fellows, we could use
labels(as it in Kubernetes) to specify attributes that attached an object. This is a kind of extensibility mechanism for developers. Once I had a short discussion with @moonming at apache/apisix-dashboard#431 (comment) , so this PR is going to takeupstreamas the starting point and add a newlabelsproperty, via a rather simple implementation.Looking forward to the feedback. Thanks.
Pre-submission checklist: