Support set k8s namespace

This commit is contained in:
turtled 2018-04-17 11:39:03 +08:00
parent ad5ece8c33
commit f13654dbce
2 changed files with 12 additions and 1 deletions

View File

@ -135,6 +135,12 @@ cluster.autoclean = 5m
## Value: String ## Value: String
## cluster.k8s.app_name = emq ## cluster.k8s.app_name = emq
## Kubernates Namespace
##
## Value: String
## cluster.k8s.namespace = default
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## Node Args ## Node Args
##-------------------------------------------------------------------- ##--------------------------------------------------------------------

View File

@ -124,6 +124,10 @@
{datatype, string} {datatype, string}
]}. ]}.
{mapping, "cluster.k8s.namespace", "ekka.cluster_discovery", [
{datatype, string}
]}.
{translation, "ekka.cluster_discovery", fun(Conf) -> {translation, "ekka.cluster_discovery", fun(Conf) ->
Strategy = cuttlefish:conf_get("cluster.discovery", Conf), Strategy = cuttlefish:conf_get("cluster.discovery", Conf),
Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end, Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end,
@ -152,7 +156,8 @@
[{apiserver, cuttlefish:conf_get("cluster.k8s.apiserver", Conf)}, [{apiserver, cuttlefish:conf_get("cluster.k8s.apiserver", Conf)},
{service_name, cuttlefish:conf_get("cluster.k8s.service_name", Conf)}, {service_name, cuttlefish:conf_get("cluster.k8s.service_name", Conf)},
{address_type, cuttlefish:conf_get("cluster.k8s.address_type", Conf, ip)}, {address_type, cuttlefish:conf_get("cluster.k8s.address_type", Conf, ip)},
{app_name, cuttlefish:conf_get("cluster.k8s.app_name", Conf)}]; {app_name, cuttlefish:conf_get("cluster.k8s.app_name", Conf)},
{namespace, cuttlefish:conf_get("cluster.k8s.namespace", Conf)}];
(manual) -> (manual) ->
[ ] [ ]
end, end,