From c21709d37c8a9567d98223a0c346fd11be8d6978 Mon Sep 17 00:00:00 2001 From: Samiul Date: Tue, 30 Jun 2026 12:43:15 +0600 Subject: [PATCH 1/4] add redis shard validation Signed-off-by: Samiul --- .../kubedbcom-redis-editor-options/ui/create-ui.yaml | 3 +++ charts/kubedbcom-redis-editor-options/ui/functions.js | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/charts/kubedbcom-redis-editor-options/ui/create-ui.yaml b/charts/kubedbcom-redis-editor-options/ui/create-ui.yaml index 77688ad336..7100d7d891 100644 --- a/charts/kubedbcom-redis-editor-options/ui/create-ui.yaml +++ b/charts/kubedbcom-redis-editor-options/ui/create-ui.yaml @@ -174,6 +174,9 @@ step: label: Shards schema: temp/announceShards type: array-item-form + validation: + type: custom + name: validateAnnounceShards watcher: func: onAnnounceShardsChange paths: diff --git a/charts/kubedbcom-redis-editor-options/ui/functions.js b/charts/kubedbcom-redis-editor-options/ui/functions.js index fcd9741431..9d98dd07c0 100644 --- a/charts/kubedbcom-redis-editor-options/ui/functions.js +++ b/charts/kubedbcom-redis-editor-options/ui/functions.js @@ -1113,6 +1113,7 @@ export const useFunc = (model) => { .map((endpoint) => endpoint.trim()) .filter((endpoint) => endpoint), })) + commit('wizard/model$update', { path: '/spec/cluster/announce/shards', value: transformed, @@ -1120,6 +1121,15 @@ export const useFunc = (model) => { }) } + function validateAnnounceShards() { + const shards = getValue(discriminator, '/announceShards') || [] + const master = getValue(model, '/spec/cluster/master') || 0 + + if (shards.length !== master) { + return `Shards Length should be equal to master(${master})` + } + } + function setBackup() { const backup = getValue(model, '/spec/backup/tool') const val = getValue(model, '/spec/admin/backup/enable/default') @@ -1448,6 +1458,7 @@ export const useFunc = (model) => { isVariantAvailable, notEqualToDatabaseMode, onAnnounceShardsChange, + validateAnnounceShards, onAuthChange, onBackupSwitch, onCreateSentinelChange, From de6114678fb3d44bc76e8a1180ea9135afc91799 Mon Sep 17 00:00:00 2001 From: Samiul Date: Tue, 30 Jun 2026 15:04:07 +0600 Subject: [PATCH 2/4] update validations Signed-off-by: Samiul --- .../kubedbcom-redis-editor-options/ui/functions.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/charts/kubedbcom-redis-editor-options/ui/functions.js b/charts/kubedbcom-redis-editor-options/ui/functions.js index 9d98dd07c0..a23fac978b 100644 --- a/charts/kubedbcom-redis-editor-options/ui/functions.js +++ b/charts/kubedbcom-redis-editor-options/ui/functions.js @@ -1124,10 +1124,20 @@ export const useFunc = (model) => { function validateAnnounceShards() { const shards = getValue(discriminator, '/announceShards') || [] const master = getValue(model, '/spec/cluster/master') || 0 - + const replicas = getValue(model, '/spec/cluster/replicas') || 0 if (shards.length !== master) { return `Shards Length should be equal to master(${master})` } + for (let i = 0; i < shards.length; i++) { + const shard = shards[i] + const endpoints = shard + .split(',') + .map((endpoint) => endpoint.trim()) + .filter((endpoint) => endpoint) + if (endpoints.length !== replicas) { + return `Shard ${i + 1} should have ${replicas} endpoints, but found ${endpoints.length}.` + } + } } function setBackup() { From 84f8cb1e72daa8854fceed661a8ec094425381cf Mon Sep 17 00:00:00 2001 From: Samiul Date: Tue, 30 Jun 2026 15:07:10 +0600 Subject: [PATCH 3/4] update validations Signed-off-by: Samiul --- charts/kubedbcom-redis-editor-options/ui/functions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/kubedbcom-redis-editor-options/ui/functions.js b/charts/kubedbcom-redis-editor-options/ui/functions.js index a23fac978b..d9e4fe32fa 100644 --- a/charts/kubedbcom-redis-editor-options/ui/functions.js +++ b/charts/kubedbcom-redis-editor-options/ui/functions.js @@ -1135,7 +1135,7 @@ export const useFunc = (model) => { .map((endpoint) => endpoint.trim()) .filter((endpoint) => endpoint) if (endpoints.length !== replicas) { - return `Shard ${i + 1} should have ${replicas} endpoints, but found ${endpoints.length}.` + return `Shard should have ${replicas} comma-separated endpoints, but found ${endpoints.length}.` } } } From 7070b0540dc5c82d48e11c03a4f1100630d74ef2 Mon Sep 17 00:00:00 2001 From: Samiul Date: Tue, 30 Jun 2026 15:10:16 +0600 Subject: [PATCH 4/4] update validations Signed-off-by: Samiul --- charts/kubedbcom-redis-editor-options/ui/functions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/kubedbcom-redis-editor-options/ui/functions.js b/charts/kubedbcom-redis-editor-options/ui/functions.js index d9e4fe32fa..810e74ba42 100644 --- a/charts/kubedbcom-redis-editor-options/ui/functions.js +++ b/charts/kubedbcom-redis-editor-options/ui/functions.js @@ -1135,7 +1135,7 @@ export const useFunc = (model) => { .map((endpoint) => endpoint.trim()) .filter((endpoint) => endpoint) if (endpoints.length !== replicas) { - return `Shard should have ${replicas} comma-separated endpoints, but found ${endpoints.length}.` + return `Each Shard should have ${replicas} comma-separated endpoints, but found ${endpoints.length}.` } } }