From e1f67f57f61dc8a7d2a14aad09957c1240033b97 Mon Sep 17 00:00:00 2001 From: Arnob Kumar Saha Date: Tue, 30 Jun 2026 11:29:46 +0600 Subject: [PATCH 1/2] Split announce shard endpoints from comma-separated input in redis editor Signed-off-by: Arnob Kumar Saha Signed-off-by: Samiul --- .../ui/create-ui.yaml | 9 +++++++- .../ui/functions.js | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/charts/kubedbcom-redis-editor-options/ui/create-ui.yaml b/charts/kubedbcom-redis-editor-options/ui/create-ui.yaml index 2bbde2e30f..77688ad336 100644 --- a/charts/kubedbcom-redis-editor-options/ui/create-ui.yaml +++ b/charts/kubedbcom-redis-editor-options/ui/create-ui.yaml @@ -168,9 +168,16 @@ step: - element: label: Shard Endpoints (comma-separated, e.g. "endpoint1,endpoint2,endpoint3") type: input + init: + type: func + value: setAnnounceShards label: Shards - schema: schema/properties/spec/properties/cluster/properties/announce/properties/shards + schema: temp/announceShards type: array-item-form + watcher: + func: onAnnounceShardsChange + paths: + - temp/announceShards if: name: showAnnounce type: function diff --git a/charts/kubedbcom-redis-editor-options/ui/functions.js b/charts/kubedbcom-redis-editor-options/ui/functions.js index 4eed052c38..fcd9741431 100644 --- a/charts/kubedbcom-redis-editor-options/ui/functions.js +++ b/charts/kubedbcom-redis-editor-options/ui/functions.js @@ -1100,6 +1100,26 @@ export const useFunc = (model) => { }) } + function setAnnounceShards() { + const shards = getValue(model, '/spec/cluster/announce/shards') || [] + return shards.map((shard) => (shard?.endpoints || []).join(',')) + } + + function onAnnounceShardsChange() { + const shards = getValue(discriminator, '/announceShards') || [] + const transformed = shards.map((shard) => ({ + endpoints: (shard || '') + .split(',') + .map((endpoint) => endpoint.trim()) + .filter((endpoint) => endpoint), + })) + commit('wizard/model$update', { + path: '/spec/cluster/announce/shards', + value: transformed, + force: true, + }) + } + function setBackup() { const backup = getValue(model, '/spec/backup/tool') const val = getValue(model, '/spec/admin/backup/enable/default') @@ -1427,6 +1447,7 @@ export const useFunc = (model) => { isToggleOn, isVariantAvailable, notEqualToDatabaseMode, + onAnnounceShardsChange, onAuthChange, onBackupSwitch, onCreateSentinelChange, @@ -1434,6 +1455,7 @@ export const useFunc = (model) => { returnFalse, returnTrue, setAnnounce, + setAnnounceShards, setBackup, setLimits, setMachineToCustom, From c55b67926a3937363df7ab8911113954cd24af21 Mon Sep 17 00:00:00 2001 From: "Md. Samiul Haque" Date: Tue, 30 Jun 2026 15:21:31 +0600 Subject: [PATCH 2/2] add redis shard validation (#1076) * add redis shard validation Signed-off-by: Samiul * update validations Signed-off-by: Samiul * update validations Signed-off-by: Samiul * update validations Signed-off-by: Samiul --------- Signed-off-by: Samiul --- .../ui/create-ui.yaml | 3 +++ .../ui/functions.js | 21 +++++++++++++++++++ 2 files changed, 24 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..810e74ba42 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,25 @@ 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 `Each Shard should have ${replicas} comma-separated endpoints, but found ${endpoints.length}.` + } + } + } + function setBackup() { const backup = getValue(model, '/spec/backup/tool') const val = getValue(model, '/spec/admin/backup/enable/default') @@ -1448,6 +1468,7 @@ export const useFunc = (model) => { isVariantAvailable, notEqualToDatabaseMode, onAnnounceShardsChange, + validateAnnounceShards, onAuthChange, onBackupSwitch, onCreateSentinelChange,