Răsfoiți Sursa

zerotier: allow additional storage (#2581)

* zerotier: allow additional storage

* update valeus

* lint
Stavros Kois 1 an în urmă
părinte
comite
bd615231e4

+ 1 - 1
library/ix-dev/community/zerotier/Chart.yaml

@@ -3,7 +3,7 @@ description: Securely connect any device, anywhere.
 annotations:
   title: Zerotier
 type: application
-version: 1.0.21
+version: 1.0.22
 apiVersion: v2
 appVersion: 1.14.0
 kubeVersion: '>=1.16.0-0'

+ 151 - 0
library/ix-dev/community/zerotier/questions.yaml

@@ -3,6 +3,8 @@ groups:
     description: Configure Zerotier
   - name: Network Configuration
     description: Configure Network for Zerotier
+  - name: Storage Configuration
+    description: Configure Storage for Zerotier
   - name: Resources Configuration
     description: Configure Resources for Zerotier
 
@@ -92,6 +94,155 @@ questions:
             type: boolean
             default: false
 
+  - variable: zerotierStorage
+    label: ""
+    group: Storage Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: additionalStorages
+          label: Additional Storage
+          description: Additional storage for Zerotier.
+          schema:
+            type: list
+            default: []
+            items:
+              - variable: storageEntry
+                label: Storage Entry
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: type
+                      label: Type
+                      description: |
+                        ixVolume: Is dataset created automatically by the system.</br>
+                        Host Path: Is a path that already exists on the system.</br>
+                        SMB Share: Is a SMB share that is mounted to a persistent volume claim.
+                      schema:
+                        type: string
+                        required: true
+                        default: "ixVolume"
+                        immutable: true
+                        enum:
+                          - value: "hostPath"
+                            description: Host Path (Path that already exists on the system)
+                          - value: "ixVolume"
+                            description: ixVolume (Dataset created automatically by the system)
+                          - value: "smb-pv-pvc"
+                            description: SMB Share (Mounts a persistent volume claim to a SMB share)
+                    - variable: readOnly
+                      label: Read Only
+                      description: Mount the volume as read only.
+                      schema:
+                        type: boolean
+                        default: false
+                    - variable: mountPath
+                      label: Mount Path
+                      description: The path inside the container to mount the storage.
+                      schema:
+                        type: path
+                        required: true
+                    - variable: hostPathConfig
+                      label: Host Path Configuration
+                      schema:
+                        type: dict
+                        show_if: [["type", "=", "hostPath"]]
+                        attrs:
+                          - variable: aclEnable
+                            label: Enable ACL
+                            description: Enable ACL for the dataset.
+                            schema:
+                              type: boolean
+                              default: false
+                          - variable: acl
+                            label: ACL Configuration
+                            schema:
+                              type: dict
+                              show_if: [["aclEnable", "=", true]]
+                              attrs: []
+                              $ref:
+                                - "normalize/acl"
+                          - variable: hostPath
+                            label: Host Path
+                            description: The host path to use for storage.
+                            schema:
+                              type: hostpath
+                              show_if: [["aclEnable", "=", false]]
+                              required: true
+                    - variable: ixVolumeConfig
+                      label: ixVolume Configuration
+                      description: The configuration for the ixVolume dataset.
+                      schema:
+                        type: dict
+                        show_if: [["type", "=", "ixVolume"]]
+                        $ref:
+                          - "normalize/ixVolume"
+                        attrs:
+                          - variable: aclEnable
+                            label: Enable ACL
+                            description: Enable ACL for the dataset.
+                            schema:
+                              type: boolean
+                              default: false
+                          - variable: datasetName
+                            label: Dataset Name
+                            description: The name of the dataset to use for storage.
+                            schema:
+                              type: string
+                              required: true
+                              immutable: true
+                              default: "storage_entry"
+                          - variable: aclEntries
+                            label: ACL Configuration
+                            schema:
+                              type: dict
+                              show_if: [["aclEnable", "=", true]]
+                              attrs: []
+                    - variable: smbConfig
+                      label: SMB Share Configuration
+                      description: The configuration for the SMB Share.
+                      schema:
+                        type: dict
+                        show_if: [["type", "=", "smb-pv-pvc"]]
+                        attrs:
+                          - variable: server
+                            label: Server
+                            description: The server for the SMB share.
+                            schema:
+                              type: string
+                              required: true
+                          - variable: share
+                            label: Share
+                            description: The share name for the SMB share.
+                            schema:
+                              type: string
+                              required: true
+                          - variable: domain
+                            label: Domain (Optional)
+                            description: The domain for the SMB share.
+                            schema:
+                              type: string
+                          - variable: username
+                            label: Username
+                            description: The username for the SMB share.
+                            schema:
+                              type: string
+                              required: true
+                          - variable: password
+                            label: Password
+                            description: The password for the SMB share.
+                            schema:
+                              type: string
+                              required: true
+                              private: true
+                          - variable: size
+                            label: Size (in Gi)
+                            description: The size of the volume quota.
+                            schema:
+                              type: int
+                              required: true
+                              min: 1
+                              default: 1
   - variable: resources
     group: Resources Configuration
     label: ""

+ 9 - 0
library/ix-dev/community/zerotier/templates/_zerotier.tpl

@@ -86,4 +86,13 @@ persistence:
       zerotier:
         zerotier:
           mountPath: /dev/net/tun
+  {{- range $idx, $storage := .Values.zerotierStorage.additionalStorages }}
+  {{ printf "zerotier-%v:" (int $idx) }}
+    enabled: true
+    {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }}
+    targetSelector:
+      zerotier:
+        zerotier:
+          mountPath: {{ $storage.mountPath }}
+  {{- end }}
 {{- end -}}

+ 3 - 0
library/ix-dev/community/zerotier/values.yaml

@@ -17,3 +17,6 @@ zerotierConfig:
 
 zerotierNetwork:
   hostNetwork: false
+
+zerotierStorage:
+  additionalStorages: []