Apisix with multiple K8s clusters as a source for service discovery
Description
As a user, I need to use multiple K8s clusters as a source for service discovery.
In forum, Zeping Bai told me that at this time it's not possible to create a multiple similar service discovery.
It's possible develop that feature?
I plan to complete this feature, but The configuration form may be worth discussing.
1: Use a new discovery name such as multi-kubernetes, but only supports multi-cluster
2: The current kubernetes discovery supports both single and multiple clusters, but the compatibility cost may be high
3: Bread update kubernetes discovery, supports both single and multi-cluster
Maybe someone can suggest a new direction
@afbm08 @tao12345666333 @tokers @tzssangglass @spacewander @liangyawang
Maybe it's not just the needs of a specific module
Well, I don't see we need to add another service discovery module as its core capability is same to the existing one.
As for the compatibility, just adding another field: clusters, which is an array is enough. One can configure it via configuring a bunch of kubernetes clusters via the clusters array or using the existing one. Sub fields in the clusters are same to the flatten fields.
As for the compatibility, just adding another field:
clusters, which is an array is enough. One can configure it via configuring a bunch of kubernetes clusters via theclustersarray or using the existing one. Sub fields in theclustersare same to the flatten fields.
+1
Okay, Let's move on
Hello, every one:
This work is continuing, and I hope you can continue to discuss the configuration issue
At present, the demo I have completed supports the configuration in the following two modes:
Singleton Mode
compatible with current configuration, except for add shared_size field
config.yaml :
kubernets:
schema:
....
services:
....
client:
....
shared_size: 1m
and rendered out nginx.conf as follows
nginx.conf:
http {
...
lua_shared_dict kubernetes 1m;
....
}
Multiple Mode
configuration same as the singleton pattern except that they under an arrays
config.yaml
kubernets:
- services: ...
client: ...
id: "release"
shared_size: 2m
- services: ...
client: ...
id: "debug"
shared_size: 1m
the biggest difference from a singleton is that multiple lua_shared_dicts are rendered
nginx.conf
http {
...
lua_shared_dict kubernetes-release 2m;
lua_shared_dict kubernetes-debug 1m;
...
}
I think the configuration of these two mode is very easy to understand and has the same design as some another of the APISix configuration
If everyone thinks it's okay, I'll start the next step.
@spacewander @tokers @tzssangglass @afbm08 @liangyawang
LGTM
fixed by https://github.com/apache/apisix/pull/7895