diff --git a/charts/kubedbcom-oracle-editor-options/templates/kubestash/backupconfiguration.yaml b/charts/kubedbcom-oracle-editor-options/templates/kubestash/backupconfiguration.yaml new file mode 100644 index 0000000000..a4694b2bb1 --- /dev/null +++ b/charts/kubedbcom-oracle-editor-options/templates/kubestash/backupconfiguration.yaml @@ -0,0 +1,56 @@ +{{- if and (eq .Values.spec.backup.tool "KubeStash") (.Values.spec.admin.backup.enable.default) (eq .Values.spec.admin.backup.by "BackupConfiguration") -}} + +apiVersion: core.kubestash.com/v1alpha1 +kind: BackupConfiguration +metadata: + name: {{ include "kubedbcom-oracle-editor-options.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "kubedbcom-oracle-editor-options.labels" . | nindent 4 }} +spec: + target: + apiGroup: kubedb.com + kind: Oracle + name: {{ include "kubedbcom-oracle-editor-options.fullname" . }} + namespace: {{ .Release.Namespace }} + backends: + - name: default-backend + storageRef: + name: {{ .Values.spec.backup.kubestash.storageRef.name }} + namespace: {{ .Values.spec.backup.kubestash.storageRef.namespace }} + retentionPolicy: + name: {{ .Values.spec.backup.kubestash.retentionPolicy.name }} + namespace: {{ .Values.spec.backup.kubestash.retentionPolicy.namespace }} + sessions: + - name: full-backup + sessionHistoryLimit: 3 + scheduler: + schedule: {{ .Values.spec.backup.kubestash.schedule | quote }} + jobTemplate: + template: + spec: + containerSecurityContext: + {{- include "container.securityContext" . | nindent 16 }} + nodeSelector: + kubernetes.io/os: linux + backoffLimit: 2 + successfulJobsHistoryLimit: 2 + failedJobsHistoryLimit: 4 + repositories: + - name: {{ include "kubedbcom-oracle-editor-options.fullname" . }} + backend: default-backend + directory: {{ .Release.Namespace }}/{{ include "kubedbcom-oracle-editor-options.fullname" . }} + encryptionSecret: + name: {{ .Values.spec.backup.kubestash.encryptionSecret.name }} + namespace: {{ .Values.spec.backup.kubestash.encryptionSecret.namespace }} + addon: + name: oracle-addon + tasks: + - name: logical-backup + jobTemplate: + spec: + containerSecurityContext: + {{- include "container.securityContext" . | nindent 14 }} + nodeSelector: + kubernetes.io/os: linux +{{- end }} diff --git a/charts/kubedbcom-solr-editor-options/README.md b/charts/kubedbcom-solr-editor-options/README.md index 10073b8af7..b91da8a9fd 100644 --- a/charts/kubedbcom-solr-editor-options/README.md +++ b/charts/kubedbcom-solr-editor-options/README.md @@ -129,8 +129,8 @@ The following table lists the configurable parameters of the `kubedbcom-solr-edi | spec.admin.customConfiguration | | true | | spec.admin.deletionPolicy.default | | WipeOut | | spec.admin.deletionPolicy.toggle | | true | -| spec.admin.backup.enable.default | | false | -| spec.admin.backup.enable.toggle | | false | +| spec.admin.backup.enable.default | | true | +| spec.admin.backup.enable.toggle | | true | | spec.admin.backup.by | | BackupConfiguration | | spec.admin.backup.via | | Restic | | spec.admin.archiver.enable.default | | false | diff --git a/charts/kubedbcom-solr-editor-options/ui/create-ui.yaml b/charts/kubedbcom-solr-editor-options/ui/create-ui.yaml index 77705b24aa..77b860a283 100644 --- a/charts/kubedbcom-solr-editor-options/ui/create-ui.yaml +++ b/charts/kubedbcom-solr-editor-options/ui/create-ui.yaml @@ -491,6 +491,19 @@ step: name: isToggleOn|monitoring type: function type: block-layout + - if: + name: isToggleOn|backup + type: function + init: + type: func + value: setBackup + label: Enable Backup? + schema: temp/backup + type: switch + watcher: + func: onBackupSwitch + paths: + - temp/backup - elements: - if: name: isToggleOn|tls diff --git a/charts/kubedbcom-solr-editor-options/ui/functions.js b/charts/kubedbcom-solr-editor-options/ui/functions.js index a51cb02b2d..caabfc735d 100644 --- a/charts/kubedbcom-solr-editor-options/ui/functions.js +++ b/charts/kubedbcom-solr-editor-options/ui/functions.js @@ -850,6 +850,21 @@ export const useFunc = (model) => { return !!agent } + function onBackupSwitch() { + const isBackupOn = getValue(discriminator, '/backup') + commit('wizard/model$update', { + path: '/spec/backup/tool', + value: isBackupOn ? 'KubeStash' : '', + force: true, + }) + } + + function setBackup() { + const backup = getValue(model, '/spec/backup/tool') + const val = getValue(model, '/spec/admin/backup/enable/default') + return backup === 'KubeStash' && features.includes('backup') && val + } + function setRequests(resource, type) { const modelPath = type ? `/spec/${type}/podResources/resources/requests/${resource}` @@ -1178,8 +1193,10 @@ export const useFunc = (model) => { isRancherManaged, isVariantAvailable, onAuthChange, + onBackupSwitch, onReferSecretChange, returnFalse, + setBackup, setLimits, setMachineToCustom, setMonitoring, diff --git a/charts/kubedbcom-solr-editor-options/values.yaml b/charts/kubedbcom-solr-editor-options/values.yaml index de32b73881..1c1c811097 100644 --- a/charts/kubedbcom-solr-editor-options/values.yaml +++ b/charts/kubedbcom-solr-editor-options/values.yaml @@ -171,8 +171,8 @@ spec: toggle: true backup: enable: - default: false - toggle: false + default: true + toggle: true by: BackupConfiguration via: Restic archiver: