Browse Source

add migration flag for smb (#2029)

* add migration flag for smb

* dont clear default mountOpts
Stavros Kois 1 year ago
parent
commit
212e34496a

+ 1 - 1
library/common/Chart.yaml

@@ -2,7 +2,7 @@ apiVersion: v2
 name: common
 description: A library chart for iX Official Catalog
 type: library
-version: 1.2.7
+version: 1.2.8
 appVersion: v1
 annotations:
   title: Common Library Chart

+ 7 - 2
library/common/templates/app_functions/_storageEntry.tpl

@@ -18,6 +18,9 @@
   {{- $username := "" -}}
   {{- $password := "" -}}
   {{- $medium := "" -}}
+  {{- $mountOpts := (list
+      (dict "key" "noperm")
+  ) -}}
 
   {{- if $storage.readOnly -}}
     {{- $readOnly = true -}}
@@ -56,6 +59,9 @@
     {{- $domain = $storage.smbConfig.domain | quote -}}
     {{- $username = $storage.smbConfig.username | quote -}}
     {{- $password = $storage.smbConfig.password | quote -}}
+    {{- if $storage.smbConfig.mountOptions -}}
+      {{- $mountOpts = $storage.smbConfig.mountOptions -}}
+    {{- end -}}
     {{- if $storage.smbConfig.size -}}
       {{- $size = (printf "%vGi" $storage.smbConfig.size) -}}
     {{- end -}}
@@ -88,7 +94,6 @@ domain: {{ $domain }}
 username: {{ $username }}
 password: {{ $password }}
 {{- if eq $storage.type "smb-pv-pvc" }}
-mountOptions:
-  - key: noperm
+mountOptions: {{ $mountOpts | toYaml | nindent 2 }}
 {{- end }}
 {{- end -}}

+ 3 - 3
library/ix-dev/test/syncthing/Chart.lock

@@ -1,6 +1,6 @@
 dependencies:
 - name: common
   repository: file://../../../common
-  version: 1.2.7
-digest: sha256:d69abe6772f86bc5c22cd95bf4505685ca88a1f5f99d78e2cf58cb66bb945e07
-generated: "2024-01-09T19:51:36.548222782+02:00"
+  version: 1.2.8
+digest: sha256:6798e8f5a66aa1f06247a6b75c10b03b6d7777b129251995e2e4249c89b0eaef
+generated: "2024-01-11T19:04:53.665949067+02:00"

+ 2 - 2
library/ix-dev/test/syncthing/Chart.yaml

@@ -3,7 +3,7 @@ description: Syncthing is a continuous file synchronization program.
 annotations:
   title: Syncthing
 type: application
-version: 1.2.1
+version: 1.2.2
 apiVersion: v2
 appVersion: '1.27.0'
 kubeVersion: '>=1.16.0-0'
@@ -14,7 +14,7 @@ maintainers:
 dependencies:
   - name: common
     repository: file://../../../common
-    version: 1.2.7
+    version: 1.2.8
 home: https://syncthing.net/
 icon: https://media.sys.truenas.net/apps/syncthing/icons/icon.svg
 sources:

BIN
library/ix-dev/test/syncthing/charts/common-1.2.7.tgz


BIN
library/ix-dev/test/syncthing/charts/common-1.2.8.tgz


+ 16 - 0
library/ix-dev/test/syncthing/questions.yaml

@@ -346,6 +346,22 @@ questions:
                         type: dict
                         show_if: [["type", "=", "smb-pv-pvc"]]
                         attrs:
+                          - variable: migrationMode
+                            label: Migration Mode
+                            description: |
+                              Enabling this will force the following:</br>
+                              - Read Only Mount, regardless of the value of the Read Only checkbox.</br>
+                              - SMB Mount Options will be set to "vers=3.0", "cifsacl", "noperm" </br>
+
+                              This option is used to migrate data from third party </br>
+                              NAS platforms onto TrueNAS SCALE.</br>
+
+                              Keep in mind that the ACL preservation is not guaranteed when:</br>
+                              - Non-AD environment</br>
+                              - ACL or remote server contains local users</br>
+                            schema:
+                              type: boolean
+                              default: false
                           - variable: server
                             label: Server
                             description: The server for the SMB share.

+ 10 - 12
library/ix-dev/test/syncthing/templates/_persistence.tpl

@@ -2,7 +2,6 @@
 persistence:
   home:
     enabled: true
-    {{- include "syncthing.storage.ci.migration" (dict "storage" .Values.syncthingStorage.home) }}
     {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.syncthingStorage.home) | nindent 4 }}
     targetSelector:
       syncthing:
@@ -36,9 +35,18 @@ persistence:
   {{- end -}}
 
   {{- range $idx, $storage := .Values.syncthingStorage.additionalStorages }}
+  {{- if eq $storage.type "smb-pv-pvc" -}}
+    {{- if $storage.smbConfig.migrationMode -}}
+      {{- $_ := set $storage "readOnly" true -}}
+      {{- $_ := set $storage.smbConfig "mountOptions" (list
+        (dict "key" "noperm")
+        (dict "key" "cifsacl")
+        (dict "key" "vers" "value" "3.0")
+      ) -}}
+    {{- end -}}
+  {{- end }}
   {{ printf "sync-%v" (int $idx) }}:
     enabled: true
-    {{- include "syncthing.storage.ci.migration" (dict "storage" $storage) }}
     {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }}
     targetSelector:
       syncthing:
@@ -69,13 +77,3 @@ scaleCertificate:
     id: {{ .Values.syncthingNetwork.certificateID }}
     {{- end -}}
 {{- end -}}
-
-{{/* TODO: Remove on the next version bump, eg 1.2.0+ */}}
-{{- define "syncthing.storage.ci.migration" -}}
-  {{- $storage := .storage -}}
-
-  {{- if $storage.hostPath -}}
-    {{- $_ := set $storage "hostPathConfig" dict -}}
-    {{- $_ := set $storage.hostPathConfig "hostPath" $storage.hostPath -}}
-  {{- end -}}
-{{- end -}}