Просмотр исходного кода

Add `sftpgo` to `community` train (#1601)

* initial commit

* add metadata

* add readme

* add common

* extend upgrade_strategy

* add initial templates

* add qs

* fix path

* fix typo

* quote nums

* add some integrations

* try dobule underscore

* add service lists and test variable

* update quetsions

* double is the one

* add passive port range on ftpd

* fix webdav

* formatting

* https

* test plugin too

* services

* remove todo

* add data storage

* fix portal, ui and services

* only if there are defined
Stavros Kois 1 год назад
Родитель
Сommit
b1ec000492
24 измененных файлов с 1075 добавлено и 0 удалено
  1. 6 0
      library/ix-dev/community/sftpgo/Chart.lock
  2. 25 0
      library/ix-dev/community/sftpgo/Chart.yaml
  3. 8 0
      library/ix-dev/community/sftpgo/README.md
  4. 8 0
      library/ix-dev/community/sftpgo/app-readme.md
  5. BIN
      library/ix-dev/community/sftpgo/charts/common-1.1.1.tgz
  6. 14 0
      library/ix-dev/community/sftpgo/ci/basic-values.yaml
  7. 97 0
      library/ix-dev/community/sftpgo/ci/https-values.yaml
  8. 28 0
      library/ix-dev/community/sftpgo/ci/integrations-values.yaml
  9. 31 0
      library/ix-dev/community/sftpgo/ci/plugin-values.yaml
  10. 6 0
      library/ix-dev/community/sftpgo/item.yaml
  11. 8 0
      library/ix-dev/community/sftpgo/metadata.yaml
  12. 443 0
      library/ix-dev/community/sftpgo/questions.yaml
  13. 1 0
      library/ix-dev/community/sftpgo/templates/NOTES.txt
  14. 40 0
      library/ix-dev/community/sftpgo/templates/_configuration.tpl
  15. 78 0
      library/ix-dev/community/sftpgo/templates/_persistence.tpl
  16. 16 0
      library/ix-dev/community/sftpgo/templates/_portal.tpl
  17. 18 0
      library/ix-dev/community/sftpgo/templates/_service.tpl
  18. 54 0
      library/ix-dev/community/sftpgo/templates/_sftpgo.tpl
  19. 53 0
      library/ix-dev/community/sftpgo/templates/_svcGen.tpl
  20. 34 0
      library/ix-dev/community/sftpgo/templates/_validation.tpl
  21. 13 0
      library/ix-dev/community/sftpgo/templates/common.yaml
  22. 1 0
      library/ix-dev/community/sftpgo/upgrade_info.json
  23. 48 0
      library/ix-dev/community/sftpgo/upgrade_strategy
  24. 45 0
      library/ix-dev/community/sftpgo/values.yaml

+ 6 - 0
library/ix-dev/community/sftpgo/Chart.lock

@@ -0,0 +1,6 @@
+dependencies:
+- name: common
+  repository: file://../../../common
+  version: 1.1.1
+digest: sha256:a7dbe3e4d42dbcd4325776e5e01a1d630c7f185f79e7ebf22b1b9cc80f56eed7
+generated: "2023-10-03T18:09:23.669495026+03:00"

+ 25 - 0
library/ix-dev/community/sftpgo/Chart.yaml

@@ -0,0 +1,25 @@
+name: sftpgo
+description: SFTPGo is a fully featured and highly configurable SFTP server with optional HTTP/S, FTP/S and WebDAV support - S3, Google Cloud Storage, Azure Blob
+annotations:
+  title: SFTPGo
+type: application
+version: 1.0.0
+apiVersion: v2
+appVersion: v2.5.4
+kubeVersion: '>=1.16.0-0'
+maintainers:
+  - name: truenas
+    url: https://www.truenas.com/
+    email: dev@ixsystems.com
+dependencies:
+  - name: common
+    repository: file://../../../common
+    version: 1.1.1
+home: https://github.com/drakkan/sftpgo
+icon: https://github.com/drakkan/sftpgo/blob/main/img/logo.png?raw=true
+sources:
+  - https://hub.docker.com/r/drakkan/sftpgo
+  - https://github.com/truenas/charts/tree/master/library/ix-dev/community/sftpgo
+  - https://github.com/drakkan/sftpgo
+keywords:
+  - sftpgo

+ 8 - 0
library/ix-dev/community/sftpgo/README.md

@@ -0,0 +1,8 @@
+# SFTPGo
+
+[SFTPGo](https://github.com/drakkan/sftpgo) is a fully featured and highly configurable SFTP server with optional HTTP/S, FTP/S and WebDAV support - S3, Google Cloud Storage, Azure Blob
+
+> When application is installed, a container will be launched with **root** privileges.
+> This is required in order to apply the correct permissions to the `SFTPGo` directories.
+> Afterward, the `SFTPGo` container will run as a **non**-root user (Default: `568`).
+> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user.

+ 8 - 0
library/ix-dev/community/sftpgo/app-readme.md

@@ -0,0 +1,8 @@
+# SFTPGo
+
+[SFTPGo](https://github.com/drakkan/sftpgo) is a fully featured and highly configurable SFTP server with optional HTTP/S, FTP/S and WebDAV support - S3, Google Cloud Storage, Azure Blob
+
+> When application is installed, a container will be launched with **root** privileges.
+> This is required in order to apply the correct permissions to the `SFTPGo` directories.
+> Afterward, the `SFTPGo` container will run as a **non**-root user (Default: `568`).
+> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user.

BIN
library/ix-dev/community/sftpgo/charts/common-1.1.1.tgz


+ 14 - 0
library/ix-dev/community/sftpgo/ci/basic-values.yaml

@@ -0,0 +1,14 @@
+sftpgoNetwork:
+  webPort: 31000
+
+sftpgoRunAs:
+  user: 1100
+  group: 1100
+
+sftpgoStorage:
+  config:
+    type: pvc
+  data:
+    type: pvc
+  backups:
+    type: pvc

+ 97 - 0
library/ix-dev/community/sftpgo/ci/https-values.yaml

@@ -0,0 +1,97 @@
+sftpgoNetwork:
+  certificateID: 1
+  webPort: 31000
+
+sftpgoStorage:
+  config:
+    type: pvc
+  data:
+    type: pvc
+  backups:
+    type: pvc
+
+ixCertificates:
+  "1":
+    certificate: |
+      -----BEGIN CERTIFICATE-----
+      MIIEdjCCA16gAwIBAgIDYFMYMA0GCSqGSIb3DQEBCwUAMGwxDDAKBgNVBAMMA2Fz
+      ZDELMAkGA1UEBhMCVVMxDTALBgNVBAgMBGFzZGYxCzAJBgNVBAcMAmFmMQ0wCwYD
+      VQQKDARhc2RmMQwwCgYDVQQLDANhc2QxFjAUBgkqhkiG9w0BCQEWB2FAYS5jb20w
+      HhcNMjEwODMwMjMyMzU0WhcNMjMxMjAzMjMyMzU0WjBuMQswCQYDVQQDDAJhZDEL
+      MAkGA1UEBhMCVVMxDTALBgNVBAgMBGFzZGYxDTALBgNVBAcMBGFzZGYxDTALBgNV
+      BAoMBGFkc2YxDTALBgNVBAsMBGFzZGYxFjAUBgkqhkiG9w0BCQEWB2FAYS5jb20w
+      ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC7+1xOHRQyOnQTHFcrdasX
+      Zl0gzutVlA890a1wiQpdD5dOtCLo7+eqVYjqVKo9W8RUIArXWmBu/AbkH7oVFWC1
+      P973W1+ArF5sA70f7BZgqRKJTIisuIFIlRETgfnP2pfQmHRZtGaIJRZI4vQCdYgW
+      2g0KOvvNcZJCVq1OrhKiNiY1bWCp66DGg0ic6OEkZFHTm745zUNQaf2dNgsxKU0H
+      PGjVLJI//yrRFAOSBUqgD4c50krnMF7fU/Fqh+UyOu8t6Y/HsySh3urB+Zie331t
+      AzV6QV39KKxRflNx/yuWrtIEslGTm+xHKoCYJEk/nZ3mX8Y5hG6wWAb7A/FuDVg3
+      AgMBAAGjggEdMIIBGTAnBgNVHREEIDAehwTAqAADhwTAqAAFhwTAqAC2hwTAqACB
+      hwTAqACSMB0GA1UdDgQWBBQ4G2ff4tgZl4vmo4xCfqmJhdqShzAMBgNVHRMBAf8E
+      AjAAMIGYBgNVHSMEgZAwgY2AFLlYf9L99nxJDcpCM/LT3V5hQ/a3oXCkbjBsMQww
+      CgYDVQQDDANhc2QxCzAJBgNVBAYTAlVTMQ0wCwYDVQQIDARhc2RmMQswCQYDVQQH
+      DAJhZjENMAsGA1UECgwEYXNkZjEMMAoGA1UECwwDYXNkMRYwFAYJKoZIhvcNAQkB
+      FgdhQGEuY29tggNgUxcwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwEwDgYDVR0PAQH/
+      BAQDAgWgMA0GCSqGSIb3DQEBCwUAA4IBAQA6FpOInEHB5iVk3FP67GybJ29vHZTD
+      KQHbQgmg8s4L7qIsA1HQ+DMCbdylpA11x+t/eL/n48BvGw2FNXpN6uykhLHJjbKR
+      h8yITa2KeD3LjLYhScwIigXmTVYSP3km6s8jRL6UKT9zttnIHyXVpBDya6Q4WTMx
+      fmfC6O7t1PjQ5ZyVtzizIUP8ah9n4TKdXU4A3QIM6WsJXpHb+vqp1WDWJ7mKFtgj
+      x5TKv3wcPnktx0zMPfLb5BTSE9rc9djcBG0eIAsPT4FgiatCUChe7VhuMnqskxEz
+      MymJLoq8+mzucRwFkOkR2EIt1x+Irl2mJVMeBow63rVZfUQBD8h++LqB
+      -----END CERTIFICATE-----
+      -----BEGIN CERTIFICATE-----
+      MIIEhDCCA2ygAwIBAgIDYFMXMA0GCSqGSIb3DQEBCwUAMGwxDDAKBgNVBAMMA2Fz
+      ZDELMAkGA1UEBhMCVVMxDTALBgNVBAgMBGFzZGYxCzAJBgNVBAcMAmFmMQ0wCwYD
+      VQQKDARhc2RmMQwwCgYDVQQLDANhc2QxFjAUBgkqhkiG9w0BCQEWB2FAYS5jb20w
+      HhcNMjEwODMwMjMyMDQ1WhcNMzEwODI4MjMyMDQ1WjBsMQwwCgYDVQQDDANhc2Qx
+      CzAJBgNVBAYTAlVTMQ0wCwYDVQQIDARhc2RmMQswCQYDVQQHDAJhZjENMAsGA1UE
+      CgwEYXNkZjEMMAoGA1UECwwDYXNkMRYwFAYJKoZIhvcNAQkBFgdhQGEuY29tMIIB
+      IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq//c0hEEr83CS1pMgsHX50jt
+      2MqIbcf63UUNJTiYpUUvUQSFJFc7m/dr+RTZvu97eDCnD5K2qkHHvTPaPZwY+Djf
+      iy7N641Sz6u/y3Yo3xxs1Aermsfedh48vusJpjbkT2XS44VjbkrpKcWDNVpp3Evd
+      M7oJotXeUsZ+imiyVCfr4YhoY5gbGh/r+KN9Wf9YKoUyfLLZGwdZkhtX2zIbidsL
+      Thqi9YTaUHttGinjiBBum234u/CfvKXsfG3yP2gvBGnlvZnM9ktv+lVffYNqlf7H
+      VmB1bKKk84HtzuW5X76SGAgOG8eHX4x5ZLI1WQUuoQOVRl1I0UCjBtbz8XhwvQID
+      AQABo4IBLTCCASkwLQYDVR0RBCYwJIcEwKgABYcEwKgAA4cEwKgAkocEwKgAtYcE
+      wKgAgYcEwKgAtjAdBgNVHQ4EFgQUuVh/0v32fEkNykIz8tPdXmFD9rcwDwYDVR0T
+      AQH/BAUwAwEB/zCBmAYDVR0jBIGQMIGNgBS5WH/S/fZ8SQ3KQjPy091eYUP2t6Fw
+      pG4wbDEMMAoGA1UEAwwDYXNkMQswCQYDVQQGEwJVUzENMAsGA1UECAwEYXNkZjEL
+      MAkGA1UEBwwCYWYxDTALBgNVBAoMBGFzZGYxDDAKBgNVBAsMA2FzZDEWMBQGCSqG
+      SIb3DQEJARYHYUBhLmNvbYIDYFMXMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEF
+      BQcDAjAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggEBAKEocOmVuWlr
+      zegtKYMe8NhHIkFY9oVn5ym6RHNOJpPH4QF8XYC3Z5+iC5yGh4P/jVe/4I4SF6Ql
+      PtofU0jNq5vzapt/y+m008eXqPQFmoUOvu+JavoRVcRx2LIP5AgBA1mF56CSREsX
+      TkuJAA9IUQ8EjnmAoAeKINuPaKxGDuU8BGCMqr/qd564MKNf9XYL+Fb2rlkA0O2d
+      2No34DQLgqSmST/LAvPM7Cbp6knYgnKmGr1nETCXasg1cueHLnWWTvps2HiPp2D/
+      +Fq0uqcZLu4Mdo0CPs4e5sHRyldEnRSKh0DVLprq9zr/GMipmPLJUsT5Jed3sj0w
+      M7Y3vwxshpo=
+      -----END CERTIFICATE-----
+    privatekey: |
+      -----BEGIN PRIVATE KEY-----
+      MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC7+1xOHRQyOnQT
+      HFcrdasXZl0gzutVlA890a1wiQpdD5dOtCLo7+eqVYjqVKo9W8RUIArXWmBu/Abk
+      H7oVFWC1P973W1+ArF5sA70f7BZgqRKJTIisuIFIlRETgfnP2pfQmHRZtGaIJRZI
+      4vQCdYgW2g0KOvvNcZJCVq1OrhKiNiY1bWCp66DGg0ic6OEkZFHTm745zUNQaf2d
+      NgsxKU0HPGjVLJI//yrRFAOSBUqgD4c50krnMF7fU/Fqh+UyOu8t6Y/HsySh3urB
+      +Zie331tAzV6QV39KKxRflNx/yuWrtIEslGTm+xHKoCYJEk/nZ3mX8Y5hG6wWAb7
+      A/FuDVg3AgMBAAECggEAapt30rj9DitGTtxAt13pJMEhyYxvvD3WkvmJwguF/Bbu
+      eW0Ba1c668fMeRCA54FWi1sMqusPS4HUqqUvk+tmyAOsAF4qgD/A4MMSC7uJSVI5
+      N/JWhJWyhCY94/FPakiO1nbPbVw41bcqtzU2qvparpME2CtxSCbDiqm7aaag3Kqe
+      EF0fGSUdZ+TYl9JM05+eIyiX+UY19Fg0OjTHMn8nGpxcNTfDBdQ68TKvdo/dtIKL
+      PLKzJUNNdM8odC4CvQtfGMqaslwZwXkiOl5VJcW21ncj/Y0ngEMKeD/i65ZoqGdR
+      0FKCQYEAGtM2FvJcZQ92Wsw7yj2bK2MSegVUyLK32QKBgQDe8syVCepPzRsfjfxA
+      6TZlWcGuTZLhwIx97Ktw3VcQ1f4rLoEYlv0xC2VWBORpzIsJo4I/OLmgp8a+Ga8z
+      FkVRnq90dV3t4NP9uJlHgcODHnOardC2UUka4olBSCG6zmK4Jxi34lOxhGRkshOo
+      L4IBeOIB5g+ZrEEXkzfYJHESRQKBgQDX2YhFhGIrT8BAnC5BbXbhm8h6Bhjz8DYL
+      d+qhVJjef7L/aJxViU0hX9Ba2O8CLK3FZeREFE3hJPiJ4TZSlN4evxs5p+bbNDcA
+      0mhRI/o3X4ac6IxdRebyYnCOB/Cu94/MzppcZcotlCekKNike7eorCcX4Qavm7Pu
+      MUuQ+ifmSwKBgEnchoqZzlbBzMqXb4rRuIO7SL9GU/MWp3TQg7vQmJerTZlgvsQ2
+      wYsOC3SECmhCq4117iCj2luvOdihCboTFsQDnn0mpQe6BIF6Ns3J38wAuqv0CcFd
+      DKsrge1uyD3rQilgSoAhKzkUc24o0PpXQurZ8YZPgbuXpbj5vPaOnCdBAoGACYc7
+      wb3XS4wos3FxhUfcwJbM4b4VKeeHqzfu7pI6cU/3ydiHVitKcVe2bdw3qMPqI9Wc
+      nvi6e17Tbdq4OCsEJx1OiVwFD9YdO3cOTc6lw/3+hjypvZBRYo+/4jUthbu96E+S
+      dtOzehGZMmDvN0uSzupSi3ZOgkAAUFpyuIKickMCgYAId0PCRjonO2thn/R0rZ7P
+      //L852uyzYhXKw5/fjFGhQ6LbaLgIRFaCZ0L2809u0HFnNvJjHv4AKP6j+vFQYYY
+      qQ+66XnfsA9G/bu4MDS9AX83iahD9IdLXQAy8I19prAbpVumKegPbMnNYNB/TYEc
+      3G15AKCXo7jjOUtHY01DCQ==
+      -----END PRIVATE KEY-----

+ 28 - 0
library/ix-dev/community/sftpgo/ci/integrations-values.yaml

@@ -0,0 +1,28 @@
+sftpgoNetwork:
+  webPort: 31000
+  sftpdServices:
+    - enabled: true
+      port: 31001
+    - enabled: true
+      port: 31002
+  ftpdServices:
+    - enabled: true
+      port: 31003
+    - enabled: true
+      port: 31004
+  ftpdPassivePortRange:
+    start: 31100
+    end: 31101
+  webdavServices:
+    - enabled: true
+      port: 31005
+    - enabled: true
+      port: 31006
+
+sftpgoStorage:
+  config:
+    type: pvc
+  data:
+    type: pvc
+  backups:
+    type: pvc

+ 31 - 0
library/ix-dev/community/sftpgo/ci/plugin-values.yaml

@@ -0,0 +1,31 @@
+sftpgoNetwork:
+  webPort: 31000
+  sftpdServices:
+    - enabled: true
+      port: 31001
+    - enabled: true
+      port: 31002
+  ftpdServices:
+    - enabled: true
+      port: 31003
+    - enabled: true
+      port: 31004
+  ftpdPassivePortRange:
+    start: 31100
+    end: 31101
+  webdavServices:
+    - enabled: true
+      port: 31005
+    - enabled: true
+      port: 31006
+
+sftpgoConfig:
+  imageSelector: pluginsImage
+
+sftpgoStorage:
+  config:
+    type: pvc
+  data:
+    type: pvc
+  backups:
+    type: pvc

+ 6 - 0
library/ix-dev/community/sftpgo/item.yaml

@@ -0,0 +1,6 @@
+icon_url: https://github.com/drakkan/sftpgo/blob/main/img/logo.png?raw=true
+categories:
+  - storage
+screenshots: []
+tags:
+  - sftp

+ 8 - 0
library/ix-dev/community/sftpgo/metadata.yaml

@@ -0,0 +1,8 @@
+runAsContext:
+  - userName: sftpgo
+    groupName: sftpgo
+    gid: 568
+    uid: 568
+    description: SFTPGo can run as any non-root user.
+capabilities: []
+hostMounts: []

+ 443 - 0
library/ix-dev/community/sftpgo/questions.yaml

@@ -0,0 +1,443 @@
+groups:
+  - name: SFTPGo Configuration
+    description: Configure SFTPGo
+  - name: User and Group Configuration
+    description: Configure User and Group for SFTPGo
+  - name: Network Configuration
+    description: Configure Network for SFTPGo
+  - name: Storage Configuration
+    description: Configure Storage for SFTPGo
+  - name: Resources Configuration
+    description: Configure Resources for SFTPGo
+
+portals:
+  web_portal:
+    protocols:
+      - "$kubernetes-resource_configmap_portal_protocol"
+    host:
+      - "$kubernetes-resource_configmap_portal_host"
+    ports:
+      - "$kubernetes-resource_configmap_portal_port"
+    path: "$kubernetes-resource_configmap_portal_path"
+
+questions:
+  - variable: sftpgoConfig
+    label: ""
+    group: SFTPGo Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: imageSelector
+          label: Image Selector
+          description: The image to use for SFTPGo.
+          schema:
+            type: string
+            default: "image"
+            required: true
+            enum:
+              - value: "image"
+                description: Default Image
+              - value: "pluginsImage"
+                description: Plugins Image
+        - variable: graceTime
+          label: Grace Time
+          description: The time in seconds to wait for connections to close before shutting down.
+          schema:
+            type: int
+            default: 60
+            min: 1
+            required: true
+        - variable: additionalEnvs
+          label: Additional Environment Variables
+          description: Configure additional environment variables for SFTPGo.
+          schema:
+            type: list
+            default: []
+            items:
+              - variable: env
+                label: Environment Variable
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: name
+                      label: Name
+                      schema:
+                        type: string
+                        required: true
+                    - variable: value
+                      label: Value
+                      schema:
+                        type: string
+                        required: true
+
+  - variable: sftpgoRunAs
+    label: ""
+    group: User and Group Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: user
+          label: User ID
+          description: The user id that SFTPGo will run as.
+          schema:
+            type: int
+            min: 2
+            default: 568
+            required: true
+        - variable: group
+          label: Group ID
+          description: The group id that SFTPGo will run as.
+          schema:
+            type: int
+            min: 2
+            default: 568
+            required: true
+
+  - variable: sftpgoNetwork
+    label: ""
+    group: Network Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: hostNetwork
+          label: Host Network
+          description: |
+            Bind to the host network. It's recommended to keep this disabled.</br>
+          schema:
+            type: boolean
+            default: false
+        - variable: certificateID
+          label: Certificate
+          description: The certificate to use for SFTPGo WebUI
+          schema:
+            type: int
+            "null": true
+            $ref:
+              - "definitions/certificate"
+        - variable: webPort
+          label: Web Port
+          description: The port for the SFTPGo Web UI.
+          schema:
+            type: int
+            default: 30086
+            min: 9000
+            max: 65535
+            required: true
+        - variable: webdavdServices
+          label: WebDAVd Services
+          description: Enable one or more WebDAVd services.
+          schema:
+            type: list
+            default: []
+            items:
+              - variable: webdavdServiceEntry
+                label: WebDAVd Service Entry
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: enabled
+                      label: Enabled
+                      description: Enable this WebDAVd service.
+                      schema:
+                        type: boolean
+                        default: false
+                    - variable: port
+                      label: Port
+                      description: The port for WebDAVd.
+                      schema:
+                        type: int
+                        default: 30089
+                        min: 9000
+                        max: 65535
+                        required: true
+        - variable: sftpdServices
+          label: SFTPd Services
+          description: Enable one or more SFTPd services.
+          schema:
+            type: list
+            default: []
+            items:
+              - variable: sftpdServiceEntry
+                label: SFTPd Service Entry
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: enabled
+                      label: Enabled
+                      description: Enable this SFTPd service.
+                      schema:
+                        type: boolean
+                        default: false
+                    - variable: port
+                      label: Port
+                      description: The port for SFTPd.
+                      schema:
+                        type: int
+                        default: 30087
+                        min: 9000
+                        max: 65535
+                        required: true
+        - variable: ftpdServices
+          label: FTPd Services
+          description: Enable one or more FTPd services.
+          schema:
+            type: list
+            default: []
+            items:
+              - variable: ftpdServiceEntry
+                label: FTPd Service Entry
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: enabled
+                      label: Enabled
+                      description: Enable this FTPd service.
+                      schema:
+                        type: boolean
+                        default: false
+                    - variable: port
+                      label: Port
+                      description: The port for FTPd.
+                      schema:
+                        type: int
+                        default: 30088
+                        min: 9000
+                        max: 65535
+                        required: true
+        - variable: ftpdPassivePortRange
+          label: FTPd Passive Port Range
+          description: The port range for FTPd passive connections.
+          schema:
+            type: dict
+            show_if: [["ftpdServices", "!=", []]]
+            attrs:
+              - variable: start
+                label: Start
+                description: The start of the port range.
+                schema:
+                  type: int
+                  default: 50000
+                  min: 9000
+                  max: 65535
+                  required: true
+              - variable: end
+                label: End
+                description: The end of the port range.
+                schema:
+                  type: int
+                  default: 50001
+                  min: 9000
+                  max: 65535
+                  required: true
+
+  - variable: sftpgoStorage
+    label: ""
+    group: Storage Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: config
+          label: SFTPGo Config Storage
+          description: The path to store SFTPGo Configuration.
+          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.
+                schema:
+                  type: string
+                  required: true
+                  default: "ixVolume"
+                  enum:
+                    - value: "hostPath"
+                      description: Host Path (Path that already exists on the system)
+                    - value: "ixVolume"
+                      description: ixVolume (Dataset created automatically by the system)
+              - variable: datasetName
+                label: Dataset Name
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: "config"
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: data
+          label: SFTPGo Data Storage
+          description: The path to store SFTPGo Data.
+          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.
+                schema:
+                  type: string
+                  required: true
+                  default: "ixVolume"
+                  enum:
+                    - value: "hostPath"
+                      description: Host Path (Path that already exists on the system)
+                    - value: "ixVolume"
+                      description: ixVolume (Dataset created automatically by the system)
+              - variable: datasetName
+                label: Dataset Name
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: "data"
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: backups
+          label: SFTPGo Backups Storage
+          description: The path to store SFTPGo Backups.
+          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.
+                schema:
+                  type: string
+                  required: true
+                  default: "ixVolume"
+                  enum:
+                    - value: "hostPath"
+                      description: Host Path (Path that already exists on the system)
+                    - value: "ixVolume"
+                      description: ixVolume (Dataset created automatically by the system)
+              - variable: datasetName
+                label: Dataset Name
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: "backups"
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: additionalStorages
+          label: Additional Storage
+          description: Additional storage for SFTPGo.
+          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.
+                      schema:
+                        type: string
+                        required: true
+                        default: "ixVolume"
+                        enum:
+                          - value: "hostPath"
+                            description: Host Path (Path that already exists on the system)
+                          - value: "ixVolume"
+                            description: ixVolume (Dataset created automatically by the system)
+                    - variable: mountPath
+                      label: Mount Path
+                      description: The path inside the container to mount the storage.
+                      schema:
+                        type: path
+                        required: true
+                    - variable: hostPath
+                      label: Host Path
+                      description: The host path to use for storage.
+                      schema:
+                        type: hostpath
+                        show_if: [["type", "=", "hostPath"]]
+                        required: true
+                    - variable: datasetName
+                      label: Dataset Name
+                      description: The name of the dataset to use for storage.
+                      schema:
+                        type: string
+                        show_if: [["type", "=", "ixVolume"]]
+                        required: true
+                        immutable: true
+                        default: "storage_entry"
+                        $ref:
+                          - "normalize/ixVolume"
+
+  - variable: resources
+    group: Resources Configuration
+    label: ""
+    schema:
+      type: dict
+      attrs:
+        - variable: limits
+          label: Limits
+          schema:
+            type: dict
+            attrs:
+              - variable: cpu
+                label: CPU
+                description: CPU limit for SFTPGo.
+                schema:
+                  type: string
+                  max_length: 6
+                  valid_chars: '^(0\.[1-9]|[1-9][0-9]*)(\.[0-9]|m?)$'
+                  valid_chars_error: |
+                    Valid CPU limit formats are</br>
+                    - Plain Integer - eg. 1</br>
+                    - Float - eg. 0.5</br>
+                    - Milicpu - eg. 500m
+                  default: "4000m"
+                  required: true
+              - variable: memory
+                label: Memory
+                description: Memory limit for SFTPGo.
+                schema:
+                  type: string
+                  max_length: 12
+                  valid_chars: '^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$'
+                  valid_chars_error: |
+                    Valid Memory limit formats are</br>
+                    - Suffixed with E/P/T/G/M/K - eg. 1G</br>
+                    - Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi</br>
+                    - Plain Integer in bytes - eg. 1024</br>
+                    - Exponent - eg. 134e6
+                  default: "8Gi"
+                  required: true

+ 1 - 0
library/ix-dev/community/sftpgo/templates/NOTES.txt

@@ -0,0 +1 @@
+{{ include "ix.v1.common.lib.chart.notes" $ }}

+ 40 - 0
library/ix-dev/community/sftpgo/templates/_configuration.tpl

@@ -0,0 +1,40 @@
+{{- define "sftpgo.configuration" -}}
+configmap:
+  sftpgo-config:
+    enabled: true
+    data:
+      SFTPGO_CONFIG_DIR: /var/lib/sftpgo
+      SFTPGO_DATA_PROVIDER__USERS_BASE_DIR: /srv/sftpgo/data
+      SFTPGO_DATA_PROVIDER__BACKUPS_PATH: /srv/sftpgo/backups
+      SFTPGO_GRACE_TIME: {{ .Values.sftpgoConfig.graceTime | quote }}
+      SFTPGO_HTTPD__BINDINGS__0__PORT: {{ .Values.sftpgoNetwork.webPort | quote }}
+      SFTPGO_HTTPD__BINDINGS__0__ADDRESS: ''
+      SFTPGO_HTTPD__BINDINGS__0__ENABLE_WEB_ADMIN: "true"
+  {{- if .Values.sftpgoNetwork.certificateID }}
+      SFTPGO_HTTPD__BINDINGS__0__ENABLE_HTTPS: "true"
+      SFTPGO_HTTPD__BINDINGS__0__CERTIFICATE_FILE: /srv/sftpgo/certs/public.crt
+      SFTPGO_HTTPD__BINDINGS__0__CERTIFICATE_KEY_FILE: /srv/sftpgo/certs/private.key
+  {{- end -}}
+  {{/* SFTPD */}}
+  {{- $enabledServices := (include "sftpgo.svc.enabled" (dict "rootCtx" $ "type" "sftpd") | fromJsonArray) -}}
+  {{- range $idx, $svc := $enabledServices }}
+      SFTPGO_SFTPD__BINDINGS__{{ $idx }}__PORT: {{ $svc.port | quote }}
+      SFTPGO_SFTPD__BINDINGS__{{ $idx }}__ADDRESS: ''
+  {{- end -}}
+  {{/* FTPD */}}
+  {{- $enabledServices := (include "sftpgo.svc.enabled" (dict "rootCtx" $ "type" "ftpd") | fromJsonArray) -}}
+  {{- range $idx, $svc := $enabledServices }}
+      SFTPGO_FTPD__BINDINGS__{{ $idx }}__PORT: {{ $svc.port | quote }}
+      SFTPGO_FTPD__BINDINGS__{{ $idx }}__ADDRESS: ''
+  {{- end -}}
+  {{- if $enabledServices }}
+      SFTPGO_FTPD__PASSIVE_PORT_RANGE__START: {{ .Values.sftpgoNetwork.ftpdPassivePortRange.start | quote }}
+      SFTPGO_FTPD__PASSIVE_PORT_RANGE__END: {{ .Values.sftpgoNetwork.ftpdPassivePortRange.end | quote }}
+  {{- end -}}
+  {{/* WEBDAV */}}
+  {{- $enabledServices := (include "sftpgo.svc.enabled" (dict "rootCtx" $ "type" "webdavd") | fromJsonArray) -}}
+  {{- range $idx, $svc := $enabledServices }}
+      SFTPGO_WEBDAVD__BINDINGS__{{ $idx }}__PORT: {{ $svc.port | quote }}
+      SFTPGO_WEBDAVD__BINDINGS__{{ $idx }}__ADDRESS: ''
+  {{- end -}}
+{{- end -}}

+ 78 - 0
library/ix-dev/community/sftpgo/templates/_persistence.tpl

@@ -0,0 +1,78 @@
+{{- define "sftpgo.persistence" -}}
+persistence:
+  config:
+    enabled: true
+    type: {{ .Values.sftpgoStorage.config.type }}
+    datasetName: {{ .Values.sftpgoStorage.config.datasetName | default "" }}
+    hostPath: {{ .Values.sftpgoStorage.config.hostPath | default "" }}
+    targetSelector:
+      sftpgo:
+        sftpgo:
+          mountPath: /var/lib/sftpgo
+        01-permissions:
+          mountPath: /mnt/directories/config
+  data:
+    enabled: true
+    type: {{ .Values.sftpgoStorage.data.type }}
+    datasetName: {{ .Values.sftpgoStorage.data.datasetName | default "" }}
+    hostPath: {{ .Values.sftpgoStorage.data.hostPath | default "" }}
+    targetSelector:
+      sftpgo:
+        sftpgo:
+          mountPath: /srv/sftpgo/data
+        01-permissions:
+          mountPath: /mnt/directories/data
+  backups:
+    enabled: true
+    type: {{ .Values.sftpgoStorage.backups.type }}
+    datasetName: {{ .Values.sftpgoStorage.backups.datasetName | default "" }}
+    hostPath: {{ .Values.sftpgoStorage.backups.hostPath | default "" }}
+    targetSelector:
+      sftpgo:
+        sftpgo:
+          mountPath: /srv/sftpgo/backups
+        01-permissions:
+          mountPath: /mnt/directories/backups
+  tmp:
+    enabled: true
+    type: emptyDir
+    targetSelector:
+      sftpgo:
+        sftpgo:
+          mountPath: /tmp
+  {{- range $idx, $storage := .Values.sftpgoStorage.additionalStorages }}
+  {{ printf "sftpgo-%v" (int $idx) }}:
+    enabled: true
+    type: {{ $storage.type }}
+    datasetName: {{ $storage.datasetName | default "" }}
+    hostPath: {{ $storage.hostPath | default "" }}
+    targetSelector:
+      sftpgo:
+        sftpgo:
+          mountPath: {{ $storage.mountPath }}
+        01-permissions:
+          mountPath: /mnt/directories{{ $storage.mountPath }}
+  {{- end -}}
+  {{- if .Values.sftpgoNetwork.certificateID }}
+  cert:
+    enabled: true
+    type: secret
+    objectName: sftpgo-cert
+    defaultMode: "0600"
+    items:
+      - key: tls.key
+        path: private.key
+      - key: tls.crt
+        path: public.crt
+    targetSelector:
+      sftpgo:
+        sftpgo:
+          mountPath: /srv/sftpgo/certs
+          readOnly: true
+
+scaleCertificate:
+  sftpgo-cert:
+    enabled: true
+    id: {{ .Values.sftpgoNetwork.certificateID }}
+    {{- end -}}
+{{- end -}}

+ 16 - 0
library/ix-dev/community/sftpgo/templates/_portal.tpl

@@ -0,0 +1,16 @@
+{{- define "sftpgo.portal" -}}
+{{- $protocol := "http" -}}
+{{- if .Values.sftpgoNetwork.certificateID -}}
+  {{- $protocol = "https" -}}
+{{- end }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: portal
+data:
+  path: "/web/admin"
+  port: {{ .Values.sftpgoNetwork.webPort | quote }}
+  protocol: {{ $protocol | quote }}
+  host: $node_ip
+{{- end -}}

+ 18 - 0
library/ix-dev/community/sftpgo/templates/_service.tpl

@@ -0,0 +1,18 @@
+{{- define "sftpgo.service" -}}
+service:
+  sftpgo:
+    enabled: true
+    primary: true
+    type: NodePort
+    targetSelector: sftpgo
+    ports:
+      webui:
+        enabled: true
+        primary: true
+        port: {{ .Values.sftpgoNetwork.webPort }}
+        nodePort: {{ .Values.sftpgoNetwork.webPort }}
+        targetSelector: sftpgo
+  {{- include "sftpgo.svc.gen" (dict "rootCtx" $ "type" "sftpd") | nindent 2 }}
+  {{- include "sftpgo.svc.gen" (dict "rootCtx" $ "type" "ftpd") | nindent 2 }}
+  {{- include "sftpgo.svc.gen" (dict "rootCtx" $ "type" "webdavd") | nindent 2 }}
+{{- end -}}

+ 54 - 0
library/ix-dev/community/sftpgo/templates/_sftpgo.tpl

@@ -0,0 +1,54 @@
+{{- define "sftpgo.workload" -}}
+workload:
+  sftpgo:
+    enabled: true
+    primary: true
+    type: Deployment
+    podSpec:
+      hostNetwork: {{ .Values.sftpgoNetwork.hostNetwork }}
+      terminationGracePeriodSeconds: {{ .Values.sftpgoConfig.graceTime }}
+      containers:
+        sftpgo:
+          enabled: true
+          primary: true
+          imageSelector: image
+          securityContext:
+            runAsUser: {{ .Values.sftpgoRunAs.user }}
+            runAsGroup: {{ .Values.sftpgoRunAs.group }}
+          envFrom:
+            - configMapRef:
+                name: sftpgo-config
+          {{ with .Values.sftpgoConfig.additionalEnvs }}
+          envList:
+            {{ range $env := . }}
+            - name: {{ $env.name }}
+              value: {{ $env.value }}
+            {{ end }}
+          {{ end }}
+          probes:
+            {{- $protocol := "http" -}}
+            {{- if .Values.sftpgoNetwork.certificateID -}}
+              {{- $protocol = "https" -}}
+            {{- end }}
+            liveness:
+              enabled: true
+              type: {{ $protocol }}
+              port: {{ .Values.sftpgoNetwork.webPort }}
+              path: /healthz
+            readiness:
+              enabled: true
+              type: {{ $protocol }}
+              port: {{ .Values.sftpgoNetwork.webPort }}
+              path: /healthz
+            startup:
+              enabled: true
+              type: {{ $protocol }}
+              port: {{ .Values.sftpgoNetwork.webPort }}
+              path: /healthz
+      initContainers:
+      {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
+                                                        "UID" .Values.sftpgoRunAs.user
+                                                        "GID" .Values.sftpgoRunAs.group
+                                                        "mode" "check"
+                                                        "type" "init") | nindent 8 }}
+{{- end -}}

+ 53 - 0
library/ix-dev/community/sftpgo/templates/_svcGen.tpl

@@ -0,0 +1,53 @@
+{{- define "sftpgo.svc.gen" -}}
+  {{- $rootCtx := .rootCtx -}}
+  {{- $type := .type -}}
+
+  {{- $enabledServices := (include "sftpgo.svc.enabled" (dict "rootCtx" $rootCtx "type" $type) | fromJsonArray) -}}
+
+{{- with $enabledServices }}
+{{ printf "sftpgo-%s" $type }}:
+  enabled: true
+  type: NodePort
+  targetSelector: sftpgo
+  ports:
+{{- end -}}
+  {{- range $idx, $svc := $enabledServices }}
+    {{ printf "%s-%d" $type $idx }}:
+      enabled: true
+      primary: {{ eq ($idx | int) 0 }}
+      port: {{ $svc.port }}
+      nodePort: {{ $svc.port }}
+      targetSelector: sftpgo
+  {{- end -}}
+  {{- if and $enabledServices (eq $type "ftpd") -}}
+    {{- $start := int $rootCtx.Values.sftpgoNetwork.ftpdPassivePortRange.start -}}
+    {{- $end := int $rootCtx.Values.sftpgoNetwork.ftpdPassivePortRange.end -}}
+    {{- $end = int (add1 $end) -}}
+
+    {{- range $idx := untilStep $start $end 1 }}
+    {{ printf "ftpd-pasv-%d" $idx }}:
+      enabled: true
+      port: {{ $idx }}
+      nodePort: {{ $idx }}
+      targetSelector: sftpgo
+    {{- end -}}
+  {{- end -}}
+{{- end -}}
+
+{{- define "sftpgo.svc.enabled" -}}
+  {{- $rootCtx := .rootCtx -}}
+  {{- $type := .type -}}
+
+  {{- $services := (get $rootCtx.Values.sftpgoNetwork (printf "%sServices" $type)) -}}
+
+  {{- $enabledServices := list -}}
+  {{- if $services -}}
+    {{- range $idx, $svc := $services -}}
+      {{- if $svc.enabled -}}
+        {{- $enabledServices = append $enabledServices $svc -}}
+      {{- end -}}
+    {{- end -}}
+  {{- end -}}
+
+  {{- $enabledServices | toJson -}}
+{{- end -}}

+ 34 - 0
library/ix-dev/community/sftpgo/templates/_validation.tpl

@@ -0,0 +1,34 @@
+{{- define "sftgo.validation" -}}
+  {{- $ports := list -}}
+  {{- $ports = append $ports .Values.sftpgoNetwork.webPort -}}
+
+  {{- range $k, $v := .Values.sftpgoNetwork -}}
+    {{- if (hasSuffix "Services" $k) -}}
+      {{- range $idx, $svc := $v -}}
+        {{- if $svc.enabled -}}
+          {{- $ports = append $ports $svc.port -}}
+        {{- end -}}
+      {{- end -}}
+    {{- end -}}
+  {{- end -}}
+
+  {{- if gt (len $ports) 20 -}} {{/* Arbitrary limit, to avoid overallocating ports */}}
+    {{- fail (printf "SFTPGo - Too many ports defined, max 20 ports can be defined [%s]" (join ", " $ports)) -}}
+  {{- end -}}
+
+  {{- if not (deepEqual ($ports | uniq) $ports) -}}
+    {{- fail (printf "SFTPGo - Expected ports to be unique for all services, ports defined [%s]" (join ", " $ports)) -}}
+  {{- end -}}
+
+  {{- if .Values.sftpgoNetwork.ftpdServices -}}
+    {{- with .Values.sftpgoNetwork.ftpdPassivePortRange -}}
+      {{- if ge (int .start) (int .end) -}}
+        {{- fail (printf "SFTPGo - ftpd passive port range start [%d] must be less than end [%d]" (int .start) (int .end)) -}}
+      {{- end -}}
+
+      {{- if ge (sub (int .end) (int .start)) 20 -}} {{/* Arbitrary limit, to avoid overallocating ports */}}
+        {{- fail (printf "SFTPGo - ftpd passive port range must be less than 20 ports, start [%d] end [%d]" (int .start) (int .end)) -}}
+      {{- end -}}
+    {{- end -}}
+  {{- end -}}
+{{- end -}}

+ 13 - 0
library/ix-dev/community/sftpgo/templates/common.yaml

@@ -0,0 +1,13 @@
+{{- include "ix.v1.common.loader.init" . -}}
+
+{{- include "sftgo.validation" $ -}}
+{{/* Merge the templates with Values */}}
+{{- $_ := mustMergeOverwrite .Values (include "sftpgo.configuration" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "sftpgo.service" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "sftpgo.persistence" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "sftpgo.workload" $ | fromYaml) -}}
+
+{{/* Create the configmap for portal manually*/}}
+{{- include "sftpgo.portal" $ -}}
+
+{{- include "ix.v1.common.loader.apply" . -}}

+ 1 - 0
library/ix-dev/community/sftpgo/upgrade_info.json

@@ -0,0 +1 @@
+{"filename": "values.yaml", "keys": ["image"]}

+ 48 - 0
library/ix-dev/community/sftpgo/upgrade_strategy

@@ -0,0 +1,48 @@
+#!/usr/bin/python3
+import json
+import re
+import sys
+
+from catalog_update.upgrade_strategy import semantic_versioning
+
+RE_STABLE_VERSION_BASE = r'v\d+\.\d+\.\d+'
+ENUMS = {
+    'image': {
+        'RE_STABLE_VERSION': re.compile(rf'{RE_STABLE_VERSION_BASE}'),
+    },
+    'pluginsImage': {
+        'RE_STABLE_VERSION': re.compile(rf'{RE_STABLE_VERSION_BASE}-plugins'),
+    },
+}
+
+
+def newer_mapping(image_tags):
+    output = {
+        "tags": {},
+        "app_version": ""
+    }
+
+    for key in image_tags.keys():
+        RE_STABLE_VERSION = ENUMS[key].get('RE_STABLE_VERSION', None) if key in ENUMS else None
+
+        tags = {t.strip('v').strip('-plugins'): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
+        version = semantic_versioning(list(tags))
+
+        if not version:
+            continue
+
+        if key == 'image':
+            output['app_version'] = version
+
+        output['tags'][key] = tags[version]
+
+    return output
+
+
+if __name__ == '__main__':
+    try:
+        versions_json = json.loads(sys.stdin.read())
+    except ValueError:
+        raise ValueError('Invalid json specified')
+
+    print(json.dumps(newer_mapping(versions_json)))

+ 45 - 0
library/ix-dev/community/sftpgo/values.yaml

@@ -0,0 +1,45 @@
+image:
+  repository: drakkan/sftpgo
+  pullPolicy: IfNotPresent
+  tag: v2.5.4
+pluginsImage:
+  repository: drakkan/sftpgo
+  pullPolicy: IfNotPresent
+  tag: v2.5.4-plugins
+
+resources:
+  limits:
+    cpu: 4000m
+    memory: 8Gi
+
+sftpgoConfig:
+  imageSelector: image
+  graceTime: 60
+  additionalEnvs: []
+
+sftpgoNetwork:
+  hostNetwork: false
+  certificateID:
+  webPort: 30086
+  webdavdServices: []
+  sftpdServices: []
+  ftpdServices: []
+  ftpdPassivePortRange:
+    start: 50000
+    end: 50001
+
+sftpgoRunAs:
+  user: 568
+  group: 568
+
+sftpgoStorage:
+  config:
+    type: ixVolume
+    datasetName: config
+  data:
+    type: ixVolume
+    datasetName: data
+  backups:
+    type: ixVolume
+    datasetName: backups
+  additionalStorages: []