From 496ed82f0717fa17a500e4abad28a4cf66255515 Mon Sep 17 00:00:00 2001 From: "Md. Samiul Haque" Date: Wed, 15 Jul 2026 10:58:08 +0600 Subject: [PATCH 1/3] fix backup default values (#1086) Signed-off-by: Samiul --- .../ui/functions.js | 122 +++++++++++++--- .../ui/functions.js | 122 +++++++++++++--- .../ui/functions.js | 122 +++++++++++++--- charts/kubedbcom-druid-editor/ui/functions.js | 122 +++++++++++++--- .../ui/functions.js | 122 +++++++++++++--- .../ui/functions.js | 122 +++++++++++++--- .../kubedbcom-ignite-editor/ui/functions.js | 122 +++++++++++++--- .../kubedbcom-mariadb-editor/ui/functions.js | 122 +++++++++++++--- .../kubedbcom-mongodb-editor/ui/functions.js | 122 +++++++++++++--- .../ui/functions.js | 122 +++++++++++++--- charts/kubedbcom-mysql-editor/ui/functions.js | 122 +++++++++++++--- charts/kubedbcom-neo4j-editor/ui/functions.js | 122 +++++++++++++--- .../kubedbcom-oracle-editor/ui/functions.js | 122 +++++++++++++--- .../kubedbcom-postgres-editor/ui/functions.js | 132 ++++++++++++++---- charts/kubedbcom-redis-editor/ui/functions.js | 124 +++++++++++++--- .../ui/functions.js | 122 +++++++++++++--- charts/kubedbcom-solr-editor/ui/functions.js | 124 ++++++++++++---- .../ui/functions.js | 122 +++++++++++++--- 18 files changed, 1809 insertions(+), 401 deletions(-) diff --git a/charts/kubedbcom-cassandra-editor/ui/functions.js b/charts/kubedbcom-cassandra-editor/ui/functions.js index 799dccbe94..c737a84b25 100644 --- a/charts/kubedbcom-cassandra-editor/ui/functions.js +++ b/charts/kubedbcom-cassandra-editor/ui/functions.js @@ -160,7 +160,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'cassandra', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'cassandra-backend', + retentionPolicy: { + name: 'cassandra-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'cassandra-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'cassandra-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'cassandra-frequent-backup', + repositories: [ + { + backend: 'cassandra-backend', + directory: '/cassandra-repo', + encryptionSecret: { + name: 'cassandra-encryption-secret', + namespace: 'demo', + }, + name: 'cassandra-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'Cassandra', + name: 'cassandra', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -181,27 +280,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-clickhouse-editor/ui/functions.js b/charts/kubedbcom-clickhouse-editor/ui/functions.js index da1b3e4505..8b348ac382 100644 --- a/charts/kubedbcom-clickhouse-editor/ui/functions.js +++ b/charts/kubedbcom-clickhouse-editor/ui/functions.js @@ -160,7 +160,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'clickhouse', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'clickhouse-backend', + retentionPolicy: { + name: 'clickhouse-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'clickhouse-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'clickhouse-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'clickhouse-frequent-backup', + repositories: [ + { + backend: 'clickhouse-backend', + directory: '/clickhouse-repo', + encryptionSecret: { + name: 'clickhouse-encryption-secret', + namespace: 'demo', + }, + name: 'clickhouse-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'ClickHouse', + name: 'clickhouse', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -181,27 +280,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-documentdb-editor/ui/functions.js b/charts/kubedbcom-documentdb-editor/ui/functions.js index 3812039bd3..2b9e260eb1 100644 --- a/charts/kubedbcom-documentdb-editor/ui/functions.js +++ b/charts/kubedbcom-documentdb-editor/ui/functions.js @@ -160,7 +160,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'documentdb', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'documentdb-backend', + retentionPolicy: { + name: 'documentdb-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'documentdb-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'documentdb-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'documentdb-frequent-backup', + repositories: [ + { + backend: 'documentdb-backend', + directory: '/documentdb-repo', + encryptionSecret: { + name: 'documentdb-encryption-secret', + namespace: 'demo', + }, + name: 'documentdb-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'DocumentDB', + name: 'documentdb', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -181,27 +280,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-druid-editor/ui/functions.js b/charts/kubedbcom-druid-editor/ui/functions.js index 02223778d6..d13293e242 100644 --- a/charts/kubedbcom-druid-editor/ui/functions.js +++ b/charts/kubedbcom-druid-editor/ui/functions.js @@ -738,7 +738,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'druid', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'druid-backend', + retentionPolicy: { + name: 'druid-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'druid-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'druid-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'druid-frequent-backup', + repositories: [ + { + backend: 'druid-backend', + directory: '/druid-repo', + encryptionSecret: { + name: 'druid-encryption-secret', + namespace: 'demo', + }, + name: 'druid-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'Druid', + name: 'druid', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -759,27 +858,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-elasticsearch-editor/ui/functions.js b/charts/kubedbcom-elasticsearch-editor/ui/functions.js index 24cc1f9659..199e471a77 100644 --- a/charts/kubedbcom-elasticsearch-editor/ui/functions.js +++ b/charts/kubedbcom-elasticsearch-editor/ui/functions.js @@ -241,7 +241,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'elasticsearch', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'elasticsearch-backend', + retentionPolicy: { + name: 'elasticsearch-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'elasticsearch-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'elasticsearch-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'elasticsearch-frequent-backup', + repositories: [ + { + backend: 'elasticsearch-backend', + directory: '/elasticsearch-repo', + encryptionSecret: { + name: 'elasticsearch-encryption-secret', + namespace: 'demo', + }, + name: 'elasticsearch-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'Elasticsearch', + name: 'elasticsearch', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -262,27 +361,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-hazelcast-editor/ui/functions.js b/charts/kubedbcom-hazelcast-editor/ui/functions.js index 08593f1013..8e1be38f24 100644 --- a/charts/kubedbcom-hazelcast-editor/ui/functions.js +++ b/charts/kubedbcom-hazelcast-editor/ui/functions.js @@ -152,7 +152,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'hazelcast', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'hazelcast-backend', + retentionPolicy: { + name: 'hazelcast-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'hazelcast-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'hazelcast-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'hazelcast-frequent-backup', + repositories: [ + { + backend: 'hazelcast-backend', + directory: '/hazelcast-repo', + encryptionSecret: { + name: 'hazelcast-encryption-secret', + namespace: 'demo', + }, + name: 'hazelcast-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'Hazelcast', + name: 'hazelcast', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -173,27 +272,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-ignite-editor/ui/functions.js b/charts/kubedbcom-ignite-editor/ui/functions.js index c79e0ef6e3..17bdd02e0d 100644 --- a/charts/kubedbcom-ignite-editor/ui/functions.js +++ b/charts/kubedbcom-ignite-editor/ui/functions.js @@ -148,7 +148,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'ignite', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'ignite-backend', + retentionPolicy: { + name: 'ignite-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'ignite-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'ignite-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'ignite-frequent-backup', + repositories: [ + { + backend: 'ignite-backend', + directory: '/ignite-repo', + encryptionSecret: { + name: 'ignite-encryption-secret', + namespace: 'demo', + }, + name: 'ignite-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'Ignite', + name: 'ignite', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -169,27 +268,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-mariadb-editor/ui/functions.js b/charts/kubedbcom-mariadb-editor/ui/functions.js index e4c5202e39..fc648c3f89 100644 --- a/charts/kubedbcom-mariadb-editor/ui/functions.js +++ b/charts/kubedbcom-mariadb-editor/ui/functions.js @@ -161,7 +161,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'mariadb', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'mariadb-backend', + retentionPolicy: { + name: 'mariadb-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'mariadb-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'mariadb-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'mariadb-frequent-backup', + repositories: [ + { + backend: 'mariadb-backend', + directory: '/mariadb-repo', + encryptionSecret: { + name: 'mariadb-encryption-secret', + namespace: 'demo', + }, + name: 'mariadb-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'MariaDB', + name: 'mariadb', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -182,27 +281,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-mongodb-editor/ui/functions.js b/charts/kubedbcom-mongodb-editor/ui/functions.js index e96f5e5684..6f34f7cae1 100644 --- a/charts/kubedbcom-mongodb-editor/ui/functions.js +++ b/charts/kubedbcom-mongodb-editor/ui/functions.js @@ -1648,7 +1648,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'mongodb', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'mongodb-backend', + retentionPolicy: { + name: 'mongodb-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'mongodb-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'mongodb-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'mongodb-frequent-backup', + repositories: [ + { + backend: 'mongodb-backend', + directory: '/mongodb-repo', + encryptionSecret: { + name: 'mongodb-encryption-secret', + namespace: 'demo', + }, + name: 'mongodb-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'MongoDB', + name: 'mongodb', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -1669,27 +1768,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-mssqlserver-editor/ui/functions.js b/charts/kubedbcom-mssqlserver-editor/ui/functions.js index 267ba31475..b4b0870f04 100644 --- a/charts/kubedbcom-mssqlserver-editor/ui/functions.js +++ b/charts/kubedbcom-mssqlserver-editor/ui/functions.js @@ -173,7 +173,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'mssqlserver', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'mssqlserver-backend', + retentionPolicy: { + name: 'mssqlserver-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'mssqlserver-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'mssqlserver-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'mssqlserver-frequent-backup', + repositories: [ + { + backend: 'mssqlserver-backend', + directory: '/mssqlserver-repo', + encryptionSecret: { + name: 'mssqlserver-encryption-secret', + namespace: 'demo', + }, + name: 'mssqlserver-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'MSSQLServer', + name: 'mssqlserver', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -194,27 +293,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-mysql-editor/ui/functions.js b/charts/kubedbcom-mysql-editor/ui/functions.js index ec977e6b73..e03d0e6035 100644 --- a/charts/kubedbcom-mysql-editor/ui/functions.js +++ b/charts/kubedbcom-mysql-editor/ui/functions.js @@ -160,7 +160,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'mysql', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'mysql-backend', + retentionPolicy: { + name: 'mysql-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'mysql-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'mysql-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'mysql-frequent-backup', + repositories: [ + { + backend: 'mysql-backend', + directory: '/mysql-repo', + encryptionSecret: { + name: 'mysql-encryption-secret', + namespace: 'demo', + }, + name: 'mysql-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'MySQL', + name: 'mysql', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -181,27 +280,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-neo4j-editor/ui/functions.js b/charts/kubedbcom-neo4j-editor/ui/functions.js index e07625166f..1969b4a16d 100644 --- a/charts/kubedbcom-neo4j-editor/ui/functions.js +++ b/charts/kubedbcom-neo4j-editor/ui/functions.js @@ -160,7 +160,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'neo4j', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'neo4j-backend', + retentionPolicy: { + name: 'neo4j-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'neo4j-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'neo4j-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'neo4j-frequent-backup', + repositories: [ + { + backend: 'neo4j-backend', + directory: '/neo4j-repo', + encryptionSecret: { + name: 'neo4j-encryption-secret', + namespace: 'demo', + }, + name: 'neo4j-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'Neo4j', + name: 'neo4j', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -181,27 +280,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-oracle-editor/ui/functions.js b/charts/kubedbcom-oracle-editor/ui/functions.js index 436c5e7c1a..7ec4434a75 100644 --- a/charts/kubedbcom-oracle-editor/ui/functions.js +++ b/charts/kubedbcom-oracle-editor/ui/functions.js @@ -160,7 +160,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'oracle', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'oracle-backend', + retentionPolicy: { + name: 'oracle-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'oracle-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'oracle-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'oracle-frequent-backup', + repositories: [ + { + backend: 'oracle-backend', + directory: '/oracle-repo', + encryptionSecret: { + name: 'oracle-encryption-secret', + namespace: 'demo', + }, + name: 'oracle-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'Oracle', + name: 'oracle', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -181,27 +280,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-postgres-editor/ui/functions.js b/charts/kubedbcom-postgres-editor/ui/functions.js index de023a6bc9..aae7379203 100644 --- a/charts/kubedbcom-postgres-editor/ui/functions.js +++ b/charts/kubedbcom-postgres-editor/ui/functions.js @@ -160,7 +160,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'postgres', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'postgres-backend', + retentionPolicy: { + name: 'postgres-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'postgres-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'postgres-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'postgres-frequent-backup', + repositories: [ + { + backend: 'postgres-backend', + directory: '/postgres-repo', + encryptionSecret: { + name: 'postgres-encryption-secret', + namespace: 'demo', + }, + name: 'postgres-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'Postgres', + name: 'postgres', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -182,27 +281,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { @@ -256,13 +334,17 @@ export const useFunc = (model) => { if (stashPreset) { const { retentionPolicy, encryptionSecret, schedule, storageRef } = stashPreset - const tempBackends = valuesFromWizard.spec?.backends + const tempBackends = valuesFromWizard.spec?.backends || [] + console.log(tempBackends) + tempBackends[0]['storageRef'] = storageRef tempBackends[0]['retentionPolicy'] = retentionPolicy valuesFromWizard.spec['backends'] = tempBackends - const tempSessions = valuesFromWizard.spec?.sessions - const tempRepositories = valuesFromWizard.spec?.sessions[0]?.repositories + const tempSessions = valuesFromWizard.spec?.sessions || [] + console.log(tempSessions) + + const tempRepositories = valuesFromWizard.spec?.sessions[0]?.repositories || [] tempRepositories[0]['encryptionSecret'] = encryptionSecret tempRepositories[0].name = name tempRepositories[0]['directory'] = `${namespace}/${name}` diff --git a/charts/kubedbcom-redis-editor/ui/functions.js b/charts/kubedbcom-redis-editor/ui/functions.js index 13d3a2cc50..ad60db71c9 100644 --- a/charts/kubedbcom-redis-editor/ui/functions.js +++ b/charts/kubedbcom-redis-editor/ui/functions.js @@ -159,7 +159,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'redis', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'redis-backend', + retentionPolicy: { + name: 'redis-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'redis-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'redis-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'redis-frequent-backup', + repositories: [ + { + backend: 'redis-backend', + directory: '/redis-repo', + encryptionSecret: { + name: 'redis-encryption-secret', + namespace: 'demo', + }, + name: 'redis-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'Redis', + name: 'redis', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -180,27 +279,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { @@ -257,6 +335,8 @@ export const useFunc = (model) => { const tempBackends = valuesFromWizard.spec?.backends tempBackends[0]['storageRef'] = storageRef tempBackends[0]['retentionPolicy'] = retentionPolicy + console.log(tempBackends) + valuesFromWizard.spec['backends'] = tempBackends const tempSessions = valuesFromWizard.spec?.sessions diff --git a/charts/kubedbcom-singlestore-editor/ui/functions.js b/charts/kubedbcom-singlestore-editor/ui/functions.js index e0bab91c69..0b61e8d304 100644 --- a/charts/kubedbcom-singlestore-editor/ui/functions.js +++ b/charts/kubedbcom-singlestore-editor/ui/functions.js @@ -178,7 +178,106 @@ export const useFunc = (model) => { let initialDbMetadata = {} let namespaceList = [] let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'singlestore', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'singlestore-backend', + retentionPolicy: { + name: 'singlestore-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'singlestore-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'singlestore-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'singlestore-frequent-backup', + repositories: [ + { + backend: 'singlestore-backend', + directory: '/singlestore-repo', + encryptionSecret: { + name: 'singlestore-encryption-secret', + namespace: 'demo', + }, + name: 'singlestore-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'Singlestore', + name: 'singlestore', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -200,27 +299,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { diff --git a/charts/kubedbcom-solr-editor/ui/functions.js b/charts/kubedbcom-solr-editor/ui/functions.js index 72c3a8fd19..cfd0fa4bcc 100644 --- a/charts/kubedbcom-solr-editor/ui/functions.js +++ b/charts/kubedbcom-solr-editor/ui/functions.js @@ -157,7 +157,106 @@ export const useFunc = (model) => { let dbResource = {} let initialDbMetadata = {} let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'solr', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'solr-backend', + retentionPolicy: { + name: 'solr-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'solr-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'solr-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'solr-frequent-backup', + repositories: [ + { + backend: 'solr-backend', + directory: '/solr-repo', + encryptionSecret: { + name: 'solr-encryption-secret', + namespace: 'demo', + }, + name: 'solr-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'Solr', + name: 'solr', + namespace: 'demo', + }, + }, + } async function initBackupData() { initialModel = getValue(model, '/resources/coreKubestashComBackupConfiguration') @@ -171,29 +270,6 @@ export const useFunc = (model) => { dbResource = getValue(model, '/resources/kubedbComSolr') initialDbMetadata = objectCopy(dbResource.metadata) - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - valuesFromWizard.spec = valuesFromWizard.spec || {} - } catch (e) { - console.log(e) - } - let config = configs?.find( (item) => item.metadata?.name === name && diff --git a/charts/kubedbcom-zookeeper-editor/ui/functions.js b/charts/kubedbcom-zookeeper-editor/ui/functions.js index 484caa1a84..dd30ceb7f2 100644 --- a/charts/kubedbcom-zookeeper-editor/ui/functions.js +++ b/charts/kubedbcom-zookeeper-editor/ui/functions.js @@ -69,7 +69,106 @@ export const useFunc = (model) => { let dbResource = {} let initialDbMetadata = {} let backupConfigurationsFromStore = {} - let valuesFromWizard = {} + let valuesFromWizard = { + apiVersion: 'core.kubestash.com/v1alpha1', + kind: 'BackupConfiguration', + metadata: { + name: 'zookeeper', + namespace: 'demo', + }, + spec: { + backends: [ + { + name: 'zookeeper-backend', + retentionPolicy: { + name: 'zookeeper-retention-policy', + namespace: 'demo', + }, + storageRef: { + name: 'zookeeper-storage', + namespace: 'demo', + }, + }, + ], + sessions: [ + { + addon: { + jobTemplate: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + name: 'zookeeper-addon', + tasks: [ + { + name: 'logical-backup', + }, + ], + }, + name: 'zookeeper-frequent-backup', + repositories: [ + { + backend: 'zookeeper-backend', + directory: '/zookeeper-repo', + encryptionSecret: { + name: 'zookeeper-encryption-secret', + namespace: 'demo', + }, + name: 'zookeeper-repo', + }, + ], + scheduler: { + failedJobsHistoryLimit: 4, + jobTemplate: { + backoffLimit: 2, + template: { + spec: { + containerSecurityContext: { + allowPrivilegeEscalation: false, + capabilities: { + drop: ['ALL'], + }, + runAsGroup: 0, + runAsNonRoot: true, + runAsUser: 999, + seccompProfile: { + type: 'RuntimeDefault', + }, + }, + nodeSelector: { + 'kubernetes.io/os': 'linux', + }, + }, + }, + }, + schedule: '0 */2 * * *', + successfulJobsHistoryLimit: 2, + }, + sessionHistoryLimit: 3, + }, + ], + target: { + apiGroup: 'kubedb.com', + kind: 'ZooKeeper', + name: 'zookeeper', + namespace: 'demo', + }, + }, + } let initialArchiver = {} let isArchiverAvailable = false let archiverObjectToCommit = {} @@ -91,27 +190,6 @@ export const useFunc = (model) => { initialArchiver = dbResource.spec?.archiver ? objectCopy(dbResource.spec?.archiver) : undefined // get values.yaml to populate data when backup-config is being created - try { - const actionArray = storeGet('/resource/actions/result') - const editorDetails = actionArray[0]?.items[0]?.editor - const chartName = editorDetails?.name - const sourceApiGroup = editorDetails?.sourceRef?.apiGroup - const sourceKind = editorDetails?.sourceRef?.kind - const sourceNamespace = editorDetails?.sourceRef?.namespace - const sourceName = editorDetails?.sourceRef?.name - const chartVersion = editorDetails?.version - - let url = `/clusters/${user}/${cluster}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - if (spoke) - url = `/clusters/${user}/${spoke}/helm/packageview/values?name=${chartName}&sourceApiGroup=${sourceApiGroup}&sourceKind=${sourceKind}&sourceNamespace=${sourceNamespace}&sourceName=${sourceName}&version=${chartVersion}&format=json` - - const resp = await axios.get(url) - - valuesFromWizard = objectCopy(resp.data?.resources?.coreKubestashComBackupConfiguration) || {} - } catch (e) { - console.log(e) - } // check storageclass archiver annotation if (initialArchiver) { From 8103e6a47a94172ba6774aa2e22b48d7b595ba4e Mon Sep 17 00:00:00 2001 From: "Md. Samiul Haque" Date: Wed, 15 Jul 2026 11:19:16 +0600 Subject: [PATCH 2/3] add archiver fields to clickhouse (#1084) Signed-off-by: samiul --- .../ui/create-ui.yaml | 73 +++++++++++ .../ui/functions.js | 118 ++++++++++++++++++ 2 files changed, 191 insertions(+) diff --git a/charts/kubedbcom-clickhouse-editor-options/ui/create-ui.yaml b/charts/kubedbcom-clickhouse-editor-options/ui/create-ui.yaml index 0249137ff4..906a70164f 100644 --- a/charts/kubedbcom-clickhouse-editor-options/ui/create-ui.yaml +++ b/charts/kubedbcom-clickhouse-editor-options/ui/create-ui.yaml @@ -301,6 +301,57 @@ step: label: Configuration schema: schema/properties/spec/properties/configuration type: textarea + - if: + name: isToggleOn|pointInTimeRecovery + type: function + init: + type: func + value: getDefault|pointInTimeRecovery + label: Point in-time Recovery? + schema: temp/recovery + type: switch + - elements: + - label: "" + subtitle: Configure point-in-time recovery to restore your database to a specific + moment. Specify the source database namespace, name, and the exact timestamp + for recovery. + type: label-element + - elements: + - forceRequired: true + label: Namespace + schema: temp/refNamespace + type: input + validation: + type: required + watcher: + func: setPointInTimeRecovery + paths: + - temp/refNamespace + - label: Name + schema: temp/refDBName + type: input + validation: + type: required + watcher: + func: setPointInTimeRecovery + paths: + - temp/refDBName + showLabels: true + type: horizontal-layout + - customClass: mt-10 + label: Recovery Timestamp + schema: schema/properties/spec/properties/init/properties/archiver/properties/recoveryTimestamp + type: date-time + watcher: + func: onTimestampChange + paths: + - schema/properties/spec/properties/init/properties/archiver/properties/recoveryTimestamp + if: + name: showRecovery + type: function + label: Point in-time Recovery + showLabels: true + type: block-layout - if: name: isToggleOn|deployment type: function @@ -377,6 +428,28 @@ step: func: onBackupSwitch paths: - temp/backup + - elements: + - disable: + name: showArchiverAlert + watchPaths: + - schema/spec/admin/storageClasses/default + - schema/spec/mode + label: Enable Archiver? + schema: schema/properties/spec/properties/admin/properties/archiver/properties/enable/properties/default + type: switch + watcher: + func: onArchiverChange + paths: + - schema/properties/spec/properties/admin/properties/archiver/properties/enable/properties/default + - if: + name: showArchiverAlert + type: function + label: The selected StorageClass does not support Archiver + type: warning + if: + name: showArchiver + type: function + type: block-layout - elements: - if: name: isToggleOn|tls diff --git a/charts/kubedbcom-clickhouse-editor-options/ui/functions.js b/charts/kubedbcom-clickhouse-editor-options/ui/functions.js index 948b72f14c..122d4649b3 100644 --- a/charts/kubedbcom-clickhouse-editor-options/ui/functions.js +++ b/charts/kubedbcom-clickhouse-editor-options/ui/functions.js @@ -1308,6 +1308,121 @@ export const useFunc = (model) => { return (val && expected === 'true') || (!val && expected === 'false') } + function showRecovery() { + // watchDependency('discriminator#/recovery') + const isRecoveryOn = getValue(discriminator, '/recovery') || '' + return isRecoveryOn + } + + async function setPointInTimeRecovery() { + const owner = storeGet('/route/params/user') + const cluster = storeGet('/route/params/cluster') + const refNamespace = getValue(discriminator, '/refNamespace') + const refDBName = getValue(discriminator, '/refDBName') + + try { + const repositoriesUrl = `clusters/${owner}/${cluster}/proxy/storage.kubestash.com/v1alpha1/namespaces/${refNamespace}/repositories/${refDBName}-full` + const snapshotsUrl = `clusters/${owner}/${cluster}/proxy/storage.kubestash.com/v1alpha1/namespaces/${refNamespace}/snapshots/${refDBName}-incremental-snapshot` + const repositoriesResp = await axios.get(repositoriesUrl) + const snapshotsResp = await axios.get(snapshotsUrl) + + commit('wizard/model$update', { + path: `/spec/init/archiver/encryptionSecret/name`, + value: repositoriesResp.data?.spec.encryptionSecret.name, + force: true, + }) + commit('wizard/model$update', { + path: `/spec/init/archiver/encryptionSecret/namespace`, + value: repositoriesResp.data?.spec.encryptionSecret.namespace, + force: true, + }) + commit('wizard/model$update', { + path: `/spec/init/archiver/fullDBRepository/name`, + value: `${refDBName}-full`, + force: true, + }) + commit('wizard/model$update', { + path: `/spec/init/archiver/fullDBRepository/namespace`, + value: `${refNamespace}`, + force: true, + }) + commit('wizard/model$update', { + path: `/spec/init/archiver/manifestRepository/name`, + value: `${refDBName}-manifest`, + force: true, + }) + commit('wizard/model$update', { + path: `/spec/init/archiver/manifestRepository/namespace`, + value: `${refNamespace}`, + force: true, + }) + + const resp = getComponentLogStats(snapshotsResp.data) + + commit('wizard/model$update', { + path: `/spec/init/archiver/recoveryTimestamp`, + value: convertToUTC(resp?.end), + force: true, + }) + commit('wizard/model$update', { + path: `/minDate`, + value: convertToUTC(resp?.start), + force: true, + }) + commit('wizard/model$update', { + path: `/maxDate`, + value: convertToUTC(resp?.end), + force: true, + }) + } catch (e) { + pointIntimeError = + e.response?.data?.message || 'Invalid name / namespace for recovery timestamp' + commit('wizard/model$update', { + path: `/spec/init/archiver/recoveryTimestamp`, + value: '', + force: true, + }) + commit('wizard/model$update', { + path: `/minDate`, + value: '', + force: true, + }) + commit('wizard/model$update', { + path: `/maxDate`, + value: '', + force: true, + }) + commit('wizard/model$delete', '/spec/init/archiver/encryptionSecret') + commit('wizard/model$delete', '/spec/init/archiver/fullDBRepository') + commit('wizard/model$delete', '/spec/init/archiver/manifestRepository') + console.log(e) + } + } + + function convertToUTC(localTime) { + const date = new Date(localTime) + if (isNaN(date.getTime())) return + + const utcString = date.toISOString() + return utcString + } + + function onTimestampChange() { + const localTime = getValue(model, '/spec/init/archiver/recoveryTimestamp') + if (!localTime) return + + const utcString = convertToUTC(localTime) + + // Only update if the value is valid & not already in UTC format + if (utcString && localTime !== utcString) { + commit('wizard/model$update', { + path: '/spec/init/archiver/recoveryTimestamp', + value: utcString, + force: true, + }) + } + } + return { isExternallyManaged, showReferSecretSwitch, @@ -1367,5 +1482,8 @@ export const useFunc = (model) => { onModeChange, setBackup, getDefault, + setPointInTimeRecovery, + onTimestampChange, + showRecovery, } } From 635183e8caeb04ea786f4551cbd743fb300714b1 Mon Sep 17 00:00:00 2001 From: "Md. Samiul Haque" Date: Wed, 15 Jul 2026 11:40:00 +0600 Subject: [PATCH 3/3] add expose binding support to milvus, qdrant, weaviate (#1085) * add expose binding support to milvus, qdrant, weaviate Signed-off-by: Samiul * typo Signed-off-by: Samiul * typo Signed-off-by: Samiul * binding template Signed-off-by: Samiul --------- Signed-off-by: Samiul --- .../templates/binding.yaml | 16 ++++++ .../ui/create-ui.yaml | 6 +++ .../kubedbcom-milvus-editor/ui/edit-ui.yaml | 14 +++++ .../kubedbcom-milvus-editor/ui/functions.js | 53 ++++++++++++++++--- .../templates/binding.yaml | 16 ++++++ .../ui/create-ui.yaml | 6 +++ .../templates/binding.yaml | 16 ++++++ .../ui/create-ui.yaml | 9 ++-- .../kubedbcom-weaviate-editor/ui/edit-ui.yaml | 14 +++++ .../kubedbcom-weaviate-editor/ui/functions.js | 41 ++++++++++++++ 10 files changed, 180 insertions(+), 11 deletions(-) create mode 100644 charts/kubedbcom-milvus-editor-options/templates/binding.yaml create mode 100644 charts/kubedbcom-qdrant-editor-options/templates/binding.yaml create mode 100644 charts/kubedbcom-weaviate-editor-options/templates/binding.yaml diff --git a/charts/kubedbcom-milvus-editor-options/templates/binding.yaml b/charts/kubedbcom-milvus-editor-options/templates/binding.yaml new file mode 100644 index 0000000000..fd8f5c8321 --- /dev/null +++ b/charts/kubedbcom-milvus-editor-options/templates/binding.yaml @@ -0,0 +1,16 @@ +{{- if .Values.spec.admin.expose.enable.default }} +apiVersion: catalog.appscode.com/v1alpha1 +kind: MilvusBinding +metadata: + name: {{ include "kubedbcom-milvus-editor-options.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "kubedbcom-milvus-editor-options.labels" . | nindent 4 }} +spec: + sourceRef: + name: {{ include "kubedbcom-milvus-editor-options.fullname" . }} + namespace: {{ .Release.Namespace }} + uiExposure: + disableUI: {{ .Values.spec.admin.expose.uiExposure.disableUI }} + disableCostEfficiency: {{ .Values.spec.admin.expose.uiExposure.disableCostEfficiency }} +{{- end }} \ No newline at end of file diff --git a/charts/kubedbcom-milvus-editor-options/ui/create-ui.yaml b/charts/kubedbcom-milvus-editor-options/ui/create-ui.yaml index c3d5b6688f..1907e3713b 100644 --- a/charts/kubedbcom-milvus-editor-options/ui/create-ui.yaml +++ b/charts/kubedbcom-milvus-editor-options/ui/create-ui.yaml @@ -604,6 +604,12 @@ step: name: isToggleOn|tls type: function type: block-layout + - if: + name: isToggleOn|expose + type: function + label: Expose via Gateway? + schema: schema/properties/spec/properties/admin/properties/expose/properties/enable/properties/default + type: switch if: name: showAdditionalSettings type: function diff --git a/charts/kubedbcom-milvus-editor/ui/edit-ui.yaml b/charts/kubedbcom-milvus-editor/ui/edit-ui.yaml index 58329a0105..16011a830d 100644 --- a/charts/kubedbcom-milvus-editor/ui/edit-ui.yaml +++ b/charts/kubedbcom-milvus-editor/ui/edit-ui.yaml @@ -1024,4 +1024,18 @@ step: id: monitoring loader: initMonitoring type: single-step-form +- elements: + - fullwidth: true + init: + type: func + value: isBindingAlreadyOn + label: Expose Database + schema: temp/properties/binding + type: switch + watcher: + func: addOrRemoveBinding + paths: + - temp/properties/binding + id: binding + type: single-step-form type: multi-step-form diff --git a/charts/kubedbcom-milvus-editor/ui/functions.js b/charts/kubedbcom-milvus-editor/ui/functions.js index 09ed811475..2139a1b64d 100644 --- a/charts/kubedbcom-milvus-editor/ui/functions.js +++ b/charts/kubedbcom-milvus-editor/ui/functions.js @@ -116,10 +116,7 @@ export const useFunc = (model) => { async function getIssuerRefsName() { const owner = storeGet('/route/params/user') const cluster = storeGet('/route/params/cluster') - const kind = getValue( - model, - '/resources/kubedbComMilvus/spec/tls/issuerRef/kind', - ) + const kind = getValue(model, '/resources/kubedbComMilvus/spec/tls/issuerRef/kind') const namespace = getValue(model, '/metadata/release/namespace') if (kind === 'Issuer') { @@ -672,10 +669,8 @@ export const useFunc = (model) => { function showOpsRequestOptions() { if (isKubedb()) return true return ( - !!getValue( - model, - '/resources/autoscalingKubedbComMilvusAutoscaler/spec/databaseRef/name', - ) && !!getValue(discriminator, '/autoscalingType') + !!getValue(model, '/resources/autoscalingKubedbComMilvusAutoscaler/spec/databaseRef/name') && + !!getValue(discriminator, '/autoscalingType') ) } @@ -771,6 +766,45 @@ export const useFunc = (model) => { } } + function isBindingAlreadyOn() { + const value = getValue(model, '/resources') + const keys = Object.keys(value) + const isExposeBinding = !!keys.find((str) => str === 'catalogAppscodeComMilvusBinding') + return isExposeBinding + } + + function addOrRemoveBinding() { + const value = getValue(discriminator, `/binding`) + const dbName = getValue(model, '/metadata/release/name') + const dbNamespace = getValue(model, '/metadata/release/namespace') + const labels = getValue(model, '/resources/kubedbComMilvus/metadata/labels') + const bindingValues = { + apiVersion: 'catalog.appscode.com/v1alpha1', + kind: 'MilvusBinding', + metadata: { + labels, + name: dbName, + namespace: dbNamespace, + }, + spec: { + sourceRef: { + name: dbName, + namespace: dbNamespace, + }, + }, + } + + if (value) { + commit('wizard/model$update', { + path: '/resources/catalogAppscodeComMilvusBinding', + value: bindingValues, + force: true, + }) + } else { + commit('wizard/model$delete', '/resources/catalogAppscodeComMilvusBinding') + } + } + return { returnFalse, returnTrue, @@ -837,5 +871,8 @@ export const useFunc = (model) => { setApplyToIfReady, handleUnit, setValueFromDbDetails, + + addOrRemoveBinding, + isBindingAlreadyOn, } } diff --git a/charts/kubedbcom-qdrant-editor-options/templates/binding.yaml b/charts/kubedbcom-qdrant-editor-options/templates/binding.yaml new file mode 100644 index 0000000000..1883e76f14 --- /dev/null +++ b/charts/kubedbcom-qdrant-editor-options/templates/binding.yaml @@ -0,0 +1,16 @@ +{{- if .Values.spec.admin.expose.enable.default }} +apiVersion: catalog.appscode.com/v1alpha1 +kind: QdrantBinding +metadata: + name: {{ include "kubedbcom-qdrant-editor.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "kubedbcom-qdrant-editor.labels" . | nindent 4 }} +spec: + sourceRef: + name: {{ include "kubedbcom-qdrant-editor.fullname" . }} + namespace: {{ .Release.Namespace }} + uiExposure: + disableUI: {{ .Values.spec.admin.expose.uiExposure.disableUI }} + disableCostEfficiency: {{ .Values.spec.admin.expose.uiExposure.disableCostEfficiency }} +{{- end }} \ No newline at end of file diff --git a/charts/kubedbcom-qdrant-editor-options/ui/create-ui.yaml b/charts/kubedbcom-qdrant-editor-options/ui/create-ui.yaml index 573a3def62..654870e11d 100644 --- a/charts/kubedbcom-qdrant-editor-options/ui/create-ui.yaml +++ b/charts/kubedbcom-qdrant-editor-options/ui/create-ui.yaml @@ -327,6 +327,12 @@ step: name: isToggleOn|tls type: function type: block-layout + - if: + name: isToggleOn|expose + type: function + label: Expose via Gateway? + schema: schema/properties/spec/properties/admin/properties/expose/properties/enable/properties/default + type: switch if: name: showAdditionalSettings type: function diff --git a/charts/kubedbcom-weaviate-editor-options/templates/binding.yaml b/charts/kubedbcom-weaviate-editor-options/templates/binding.yaml new file mode 100644 index 0000000000..8eb93701ae --- /dev/null +++ b/charts/kubedbcom-weaviate-editor-options/templates/binding.yaml @@ -0,0 +1,16 @@ +{{- if .Values.spec.admin.expose.enable.default }} +apiVersion: catalog.appscode.com/v1alpha1 +kind: WeaviateBinding +metadata: + name: {{ include "kubedbcom-weaviate-editor-options.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "kubedbcom-weaviate-editor-options.labels" . | nindent 4 }} +spec: + sourceRef: + name: {{ include "kubedbcom-weaviate-editor-options.fullname" . }} + namespace: {{ .Release.Namespace }} + uiExposure: + disableUI: {{ .Values.spec.admin.expose.uiExposure.disableUI }} + disableCostEfficiency: {{ .Values.spec.admin.expose.uiExposure.disableCostEfficiency }} +{{- end }} \ No newline at end of file diff --git a/charts/kubedbcom-weaviate-editor-options/ui/create-ui.yaml b/charts/kubedbcom-weaviate-editor-options/ui/create-ui.yaml index 2b2e6e35de..6751320069 100644 --- a/charts/kubedbcom-weaviate-editor-options/ui/create-ui.yaml +++ b/charts/kubedbcom-weaviate-editor-options/ui/create-ui.yaml @@ -303,9 +303,12 @@ step: validation: type: required type: block-layout - if: - name: returnFalse - type: function + - if: + name: isToggleOn|expose + type: function + label: Expose via Gateway? + schema: schema/properties/spec/properties/admin/properties/expose/properties/enable/properties/default + type: switch label: Additional Options showLabels: true type: block-layout diff --git a/charts/kubedbcom-weaviate-editor/ui/edit-ui.yaml b/charts/kubedbcom-weaviate-editor/ui/edit-ui.yaml index 5404d69b7b..747ff2943e 100644 --- a/charts/kubedbcom-weaviate-editor/ui/edit-ui.yaml +++ b/charts/kubedbcom-weaviate-editor/ui/edit-ui.yaml @@ -302,4 +302,18 @@ step: type: block-layout id: storage-autoscaler type: single-step-form +- elements: + - fullwidth: true + init: + type: func + value: isBindingAlreadyOn + label: Expose Database + schema: temp/properties/binding + type: switch + watcher: + func: addOrRemoveBinding + paths: + - temp/properties/binding + id: binding + type: single-step-form type: multi-step-form diff --git a/charts/kubedbcom-weaviate-editor/ui/functions.js b/charts/kubedbcom-weaviate-editor/ui/functions.js index 0e871c63b8..ff1e3ca91e 100644 --- a/charts/kubedbcom-weaviate-editor/ui/functions.js +++ b/charts/kubedbcom-weaviate-editor/ui/functions.js @@ -554,6 +554,45 @@ export const useFunc = (model) => { return showStoragememory } + function isBindingAlreadyOn() { + const value = getValue(model, '/resources') + const keys = Object.keys(value) + const isExposeBinding = !!keys.find((str) => str === 'catalogAppscodeComWeaviateBinding') + return isExposeBinding + } + + function addOrRemoveBinding() { + const value = getValue(discriminator, `/binding`) + const dbName = getValue(model, '/metadata/release/name') + const dbNamespace = getValue(model, '/metadata/release/namespace') + const labels = getValue(model, '/resources/kubedbComWeaviate/metadata/labels') + const bindingValues = { + apiVersion: 'catalog.appscode.com/v1alpha1', + kind: 'WeaviateBinding', + metadata: { + labels, + name: dbName, + namespace: dbNamespace, + }, + spec: { + sourceRef: { + name: dbName, + namespace: dbNamespace, + }, + }, + } + + if (value) { + commit('wizard/model$update', { + path: '/resources/catalogAppscodeComWeaviateBinding', + value: bindingValues, + force: true, + }) + } else { + commit('wizard/model$delete', '/resources/catalogAppscodeComWeaviateBinding') + } + } + return { isKubedb, isConsole, @@ -584,5 +623,7 @@ export const useFunc = (model) => { returnFalse, setValueFromDbDetails, showStorageMemoryOption, + isBindingAlreadyOn, + addOrRemoveBinding, } }