feat(zookeeper): support TLS-secured connections

This commit is contained in:
yimiaoxiehou authored and GitHub committed 2026-09-14 00:48:51 +08:00
1 parent 8cd5372e22
commit 56c0f8567d
14 files changed
+320 -33

No files matched your search

@@ -2546,10 +2546,6 @@ function applyProfile(val: string, preserveConnectionFields = false) {
if (profile.type === "zookeeper") {
form.value.database = undefined;
form.value.connection_string = "";
form.value.ssl = false;
form.value.ca_cert_path = "";
form.value.client_cert_path = "";
form.value.client_key_path = "";
}
if (profile.type === "nacos") {
resetNacosFields();
@@ -3173,6 +3169,7 @@ const tlsCapableDatabaseTypes = new Set<DatabaseType>([
"influxdb",
"victoriametrics",
"cassandra",
"zookeeper",
]);
const supportsTlsToggle = computed(() => tlsCapableDatabaseTypes.has(form.value.db_type));
const supportsCaCertificatePath = computed(() => form.value.db_type === "clickhouse" || form.value.db_type === "victoriametrics");
@@ -4385,7 +4382,12 @@ function connectionConfigForSubmit(id: string, generatedName = "", validatePlugi
config.port = firstEndpoint.port;
}
config.database = undefined;
config.ssl = false;
config.ca_cert_path = config.ca_cert_path?.trim() || "";
config.client_cert_path = config.client_cert_path?.trim() || "";
config.client_key_path = config.client_key_path?.trim() || "";
if ((config.client_cert_path && !config.client_key_path) || (!config.client_cert_path && config.client_key_path)) {
throw new Error(t("connection.etcdClientCertPairRequired"));
}
}
if (config.db_type === "etcd") {
config.etcd_endpoints = normalizeEndpointLines(config.etcd_endpoints || "");
@@ -4400,12 +4402,12 @@ function connectionConfigForSubmit(id: string, generatedName = "", validatePlugi
if ((config.client_cert_path && !config.client_key_path) || (!config.client_cert_path && config.client_key_path)) {
throw new Error(t("connection.etcdClientCertPairRequired"));
}
} else if (form.value.db_type !== "consul") {
} else if (form.value.db_type !== "consul" && config.db_type !== "zookeeper") {
config.etcd_endpoints = undefined;
config.client_cert_path = undefined;
config.client_key_path = undefined;
}
if (config.db_type !== "mysql" && config.db_type !== "clickhouse" && config.db_type !== "etcd" && config.db_type !== "consul" && config.db_type !== "starrocks" && config.db_type !== "mongodb" && config.db_type !== "victoriametrics") {
if (config.db_type !== "mysql" && config.db_type !== "clickhouse" && config.db_type !== "etcd" && config.db_type !== "consul" && config.db_type !== "starrocks" && config.db_type !== "mongodb" && config.db_type !== "victoriametrics" && config.db_type !== "zookeeper") {
config.ca_cert_path = undefined;
} else {
config.ca_cert_path = config.ca_cert_path?.trim() || "";
@@ -8342,7 +8344,7 @@ function openExternalUrl(url: string) {
</label>
</div>
<template v-if="form.db_type === 'etcd' || form.db_type === 'consul'">
<template v-if="form.db_type === 'etcd' || form.db_type === 'consul' || form.db_type === 'zookeeper'">
<div class="grid grid-cols-4 items-start gap-4">
<Label :class="connectionLabelSmallPaddedClass">
<span class="inline-flex items-center justify-end gap-1">
@@ -8396,7 +8398,7 @@ function openExternalUrl(url: string) {
</Tooltip>
</div>
<p class="text-[11px] leading-4 text-muted-foreground">
{{ t("connection.etcdClientCertHint") }}
{{ t("connection.clientCertHint") }}
</p>
</div>
</div>