浏览代码

Adds Handbrake (#2024)

* initial commit

* add chartfiles

* 2 more tempaltes

* add initial templates/values

* basic values

* add extra test values

* add readme

* fix storage

* add metadata

* add kill cap

* rofs false

* chown

* emptydirs

* hmm

* more caps

* more caps

* update meta

* 2 more

* fix dataset names
Stavros Kois 1 年之前
父节点
当前提交
df964fd77b

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

@@ -0,0 +1,6 @@
+dependencies:
+- name: common
+  repository: file://../../../common
+  version: 1.2.7
+digest: sha256:d69abe6772f86bc5c22cd95bf4505685ca88a1f5f99d78e2cf58cb66bb945e07
+generated: "2024-01-10T19:15:04.204944142+02:00"

+ 27 - 0
library/ix-dev/community/handbrake/Chart.yaml

@@ -0,0 +1,27 @@
+name: handbrake
+description: HandBrake is a tool for converting video from nearly any format to a selection of modern, widely supported codecs.
+annotations:
+  title: HandBrake
+type: application
+version: 1.0.0
+apiVersion: v2
+appVersion: 23.12.2
+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.2.7
+home: https://github.com/jlesage/docker-handbrake
+icon: https://media.sys.truenas.net/apps/handbrake/icons/icon.png
+sources:
+  - https://github.com/jlesage/docker-handbrake
+  - https://github.com/truenas/charts/tree/master/library/ix-dev/community/handbrake
+  - https://hub.docker.com/r/jlesage/handbrake
+keywords:
+  - media
+  - video
+  - transcoder

+ 3 - 0
library/ix-dev/community/handbrake/README.md

@@ -0,0 +1,3 @@
+# Handbrake
+
+[Handbrake](https://github.com/jlesage/docker-handbrake) is a tool for converting video from nearly any format to a selection of modern, widely supported codecs.

+ 3 - 0
library/ix-dev/community/handbrake/app-readme.md

@@ -0,0 +1,3 @@
+# Handbrake
+
+[Handbrake](https://github.com/jlesage/docker-handbrake) is a tool for converting video from nearly any format to a selection of modern, widely supported codecs.

二进制
library/ix-dev/community/handbrake/charts/common-1.2.7.tgz


+ 13 - 0
library/ix-dev/community/handbrake/ci/basic-values.yaml

@@ -0,0 +1,13 @@
+handbrakeID:
+  user: 1000
+  group: 1000
+
+handbrakeStorage:
+  config:
+    type: pvc
+  storage:
+    type: pvc
+  output:
+    type: pvc
+  watch:
+    type: pvc

+ 16 - 0
library/ix-dev/community/handbrake/ci/https-values.yaml

@@ -0,0 +1,16 @@
+handbrakeID:
+  user: 1000
+  group: 1000
+
+handbrakeConfig:
+  secureConnection: true
+
+handbrakeStorage:
+  config:
+    type: pvc
+  storage:
+    type: pvc
+  output:
+    type: pvc
+  watch:
+    type: pvc

+ 8 - 0
library/ix-dev/community/handbrake/item.yaml

@@ -0,0 +1,8 @@
+icon_url: https://media.sys.truenas.net/apps/handbrake/icons/icon.png
+categories:
+  - media
+screenshots: []
+tags:
+  - media
+  - video
+  - transcoder

+ 22 - 0
library/ix-dev/community/handbrake/metadata.yaml

@@ -0,0 +1,22 @@
+runAsContext:
+  - userName: root
+    groupName: root
+    gid: 0
+    uid: 0
+    description: Handbrake runs as root user.
+capabilities:
+  - name: CHOWN
+    description: Handbrake is able to change file ownership.
+  - name: DAC_OVERRIDE
+    description: Handbrake is able to bypass file read, write, and execute permission checks.
+  - name: FOWNER
+    description: Handbrake is able to bypass permission checks on operations that normally require the file system UID of the process to match the UID of the file.
+  - name: SETUID
+    description: Handbrake is able to set the setuid attribute on a file.
+  - name: SETGID
+    description: Handbrake is able to set the setgid attribute on a file.
+  - name: NET_BIND_SERVICE
+    description: Handbrake is able to bind a socket to internet domain privileged ports (port numbers less than 1024).
+  - name: KILL
+    description: Handbrake is able to kill processes.
+hostMounts: []

+ 648 - 0
library/ix-dev/community/handbrake/questions.yaml

@@ -0,0 +1,648 @@
+groups:
+  - name: Handbrake Configuration
+    description: Configure Handbrake
+  - name: User and Group Configuration
+    description: Configure User and Group for Handbrake
+  - name: Network Configuration
+    description: Configure Network for Handbrake
+  - name: Storage Configuration
+    description: Configure Storage for Handbrake
+  - name: Resources Configuration
+    description: Configure Resources for Handbrake
+
+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: TZ
+    group: Handbrake Configuration
+    label: Timezone
+    schema:
+      type: string
+      default: Etc/UTC
+      required: true
+      $ref:
+        - definitions/timezone
+
+  - variable: handbrakeConfig
+    label: ""
+    group: Handbrake Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: darkMode
+          label: Dark Mode
+          description: Enable dark mode for Handbrake.
+          schema:
+            type: boolean
+            default: false
+        - variable: vncPassword
+          label: VNC Password
+          description: The password for the VNC UI.
+          schema:
+            type: string
+            default: ""
+            private: true
+        - variable: secureConnection
+          label: Secure Connection
+          description: Enable secure connection for Handbrake.
+          schema:
+            type: boolean
+            default: false
+        - variable: additionalEnvs
+          label: Additional Environment Variables
+          description: Configure additional environment variables for Handbrake.
+          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: handbrakeID
+    label: ""
+    group: User and Group Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: user
+          label: User ID
+          description: The user id that Handbrake files will be owned by.
+          schema:
+            type: int
+            min: 568
+            default: 568
+            required: true
+        - variable: group
+          label: Group ID
+          description: The group id that Handbrake files will be owned by.
+          schema:
+            type: int
+            min: 568
+            default: 568
+            required: true
+
+  - variable: handbrakeNetwork
+    label: ""
+    group: Network Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: webPort
+          label: Web Port
+          description: The port for the Handbrake Web UI.
+          schema:
+            type: int
+            default: 31010
+            min: 9000
+            max: 65535
+            required: true
+        - variable: vncPort
+          label: VNC Port
+          description: The port for the Handbrake VNC UI.
+          schema:
+            type: int
+            default: 31011
+            min: 9000
+            max: 65535
+            required: true
+        - 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: handbrakeStorage
+    label: ""
+    group: Storage Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: config
+          label: Handbrake Config Storage
+          description: The path to store Handbrake 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
+                  immutable: 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: 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
+                        hidden: true
+                        default: "config"
+                    - variable: aclEntries
+                      label: ACL Configuration
+                      schema:
+                        type: dict
+                        show_if: [["aclEnable", "=", true]]
+                        attrs: []
+              - 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: storage
+          label: Handbrake Download Storage
+          description: The path to store Handbrake Storage.
+          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
+                  immutable: 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: readOnly
+                label: Read Only
+                description: Mount the volume as read only.
+                schema:
+                  type: boolean
+                  default: false
+              - 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
+                        hidden: true
+                        default: "storage"
+                    - variable: aclEntries
+                      label: ACL Configuration
+                      schema:
+                        type: dict
+                        show_if: [["aclEnable", "=", true]]
+                        attrs: []
+              - 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: output
+          label: Handbrake Output Storage
+          description: The path to store Handbrake Output.
+          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
+                  immutable: 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: 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
+                        hidden: true
+                        default: "output"
+                    - variable: aclEntries
+                      label: ACL Configuration
+                      schema:
+                        type: dict
+                        show_if: [["aclEnable", "=", true]]
+                        attrs: []
+              - 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: watch
+          label: Handbrake Watch Storage
+          description: The path to store Handbrake Watch.
+          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
+                  immutable: 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: 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
+                        hidden: true
+                        default: "watch"
+                    - variable: aclEntries
+                      label: ACL Configuration
+                      schema:
+                        type: dict
+                        show_if: [["aclEnable", "=", true]]
+                        attrs: []
+              - 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: additionalStorages
+          label: Additional Storage
+          description: Additional storage for Handbrake.
+          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: ""
+    schema:
+      type: dict
+      attrs:
+        - variable: limits
+          label: Limits
+          schema:
+            type: dict
+            attrs:
+              - variable: cpu
+                label: CPU
+                description: CPU limit for Handbrake.
+                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 Handbrake.
+                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/handbrake/templates/NOTES.txt

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

+ 60 - 0
library/ix-dev/community/handbrake/templates/_handbrake.tpl

@@ -0,0 +1,60 @@
+{{- define "handbrake.workload" -}}
+workload:
+  handbrake:
+    enabled: true
+    primary: true
+    type: Deployment
+    podSpec:
+      hostNetwork: {{ .Values.handbrakeNetwork.hostNetwork }}
+      securityContext:
+        fsGroup: {{ .Values.handbrakeID.group }}
+      containers:
+        handbrake:
+          enabled: true
+          primary: true
+          imageSelector: image
+          securityContext:
+            runAsUser: 0
+            runAsGroup: 0
+            runAsNonRoot: false
+            readOnlyRootFilesystem: false
+            capabilities:
+              add:
+                - CHOWN
+                - DAC_OVERRIDE
+                - FOWNER
+                - SETGID
+                - SETUID
+                - NET_BIND_SERVICE
+                - KILL
+          env:
+            AUTOMATED_CONVERSION_OUTPUT_DIR: /output
+            HANDBRAKE_GUI: "1"
+            WEB_LISTENING_PORT: {{ .Values.handbrakeNetwork.webPort }}
+            VNC_LISTENING_PORT: {{ .Values.handbrakeNetwork.vncPort }}
+            VNC_PASSWORD: {{ .Values.handbrakeConfig.vncPassword }}
+            DARK_MODE: {{ ternary "1" "0" .Values.handbrakeConfig.darkMode }}
+            SECURE_CONNECTION: {{ ternary "1" "0" .Values.handbrakeConfig.secureConnection }}
+          fixedEnv:
+            PUID: {{ .Values.handbrakeID.user }}
+          {{ with .Values.handbrakeConfig.additionalEnvs }}
+          envList:
+            {{ range $env := . }}
+            - name: {{ $env.name }}
+              value: {{ $env.value }}
+            {{ end }}
+          {{ end }}
+          probes:
+            liveness:
+              enabled: true
+              type: tcp
+              port: {{ .Values.handbrakeNetwork.vncPort }}
+            readiness:
+              enabled: true
+              type: tcp
+              port: {{ .Values.handbrakeNetwork.vncPort }}
+            startup:
+              enabled: true
+              type: tcp
+              port: {{ .Values.handbrakeNetwork.vncPort }}
+{{- end -}}

+ 54 - 0
library/ix-dev/community/handbrake/templates/_persistence.tpl

@@ -0,0 +1,54 @@
+{{- define "handbrake.persistence" -}}
+persistence:
+  config:
+    enabled: true
+    {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.handbrakeStorage.config) | nindent 4 }}
+    targetSelector:
+      handbrake:
+        handbrake:
+          mountPath: /config
+  storage:
+    enabled: true
+    {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.handbrakeStorage.storage) | nindent 4 }}
+    targetSelector:
+      handbrake:
+        handbrake:
+          mountPath: /storage
+  output:
+    enabled: true
+    {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.handbrakeStorage.output) | nindent 4 }}
+    targetSelector:
+      handbrake:
+        handbrake:
+          mountPath: /output
+  watch:
+    enabled: true
+    {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.handbrakeStorage.watch) | nindent 4 }}
+    targetSelector:
+      handbrake:
+        handbrake:
+          mountPath: /watch
+  varrun:
+    enabled: true
+    type: emptyDir
+    targetSelector:
+      handbrake:
+        handbrake:
+          mountPath: /var/run
+  tmp:
+    enabled: true
+    type: emptyDir
+    targetSelector:
+      handbrake:
+        handbrake:
+          mountPath: /tmp
+  {{- range $idx, $storage := .Values.handbrakeStorage.additionalStorages }}
+  {{ printf "handbrake-%v:" (int $idx) }}
+    enabled: true
+    {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }}
+    targetSelector:
+      handbrake:
+        handbrake:
+          mountPath: {{ $storage.mountPath }}
+  {{- end }}
+{{- end -}}

+ 12 - 0
library/ix-dev/community/handbrake/templates/_portal.tpl

@@ -0,0 +1,12 @@
+{{- define "handbrake.portal" -}}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: portal
+data:
+  path: "/"
+  port: {{ .Values.handbrakeNetwork.webPort | quote }}
+  protocol: http
+  host: $node_ip
+{{- end -}}

+ 20 - 0
library/ix-dev/community/handbrake/templates/_service.tpl

@@ -0,0 +1,20 @@
+{{- define "handbrake.service" -}}
+service:
+  handbrake:
+    enabled: true
+    primary: true
+    type: NodePort
+    targetSelector: handbrake
+    ports:
+      webui:
+        enabled: true
+        primary: true
+        port: {{ .Values.handbrakeNetwork.webPort }}
+        nodePort: {{ .Values.handbrakeNetwork.webPort }}
+        targetSelector: handbrake
+      vnc:
+        enabled: true
+        port: {{ .Values.handbrakeNetwork.vncPort }}
+        nodePort: {{ .Values.handbrakeNetwork.vncPort }}
+        targetSelector: handbrake
+{{- end -}}

+ 11 - 0
library/ix-dev/community/handbrake/templates/common.yaml

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

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

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

+ 41 - 0
library/ix-dev/community/handbrake/upgrade_strategy

@@ -0,0 +1,41 @@
+#!/usr/bin/python3
+import json
+import re
+import sys
+
+from catalog_update.upgrade_strategy import semantic_versioning
+
+
+RE_STABLE_VERSION = re.compile(r'v\d+\.\d+\.\d+')
+
+
+def newer_mapping(image_tags):
+    key = list(image_tags.keys())[0]
+    temp_tags = {t.strip('v'): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
+
+    # Strip leading zeros
+    tags = {}
+    for tag in temp_tags:
+        tag = tag.split('.')
+        for i in range(len(tag)):
+            # Remove leading zeros
+            tag[i] = tag[i].lstrip('0')
+        tags[tag] = '.'.join(tag)
+
+    version = semantic_versioning(list(tags))
+    if not version:
+        return {}
+
+    return {
+        'tags': {key: tags[version]},
+        'app_version': version,
+    }
+
+
+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)))

+ 43 - 0
library/ix-dev/community/handbrake/values.yaml

@@ -0,0 +1,43 @@
+image:
+  repository: jlesage/handbrake
+  pullPolicy: IfNotPresent
+  tag: v23.12.2
+
+resources:
+  limits:
+    cpu: 4000m
+    memory: 8Gi
+
+handbrakeConfig:
+  darkMode: false
+  vncPassword: ""
+  secureConnection: false
+  additionalEnvs: []
+
+handbrakeID:
+  user: 568
+  group: 568
+
+handbrakeNetwork:
+  webPort: 31010
+  vncPort: 31011
+  hostNetwork: false
+
+handbrakeStorage:
+  config:
+    type: ixVolume
+    ixVolumeConfig:
+      datasetName: config
+  storage:
+    type: ixVolume
+    ixVolumeConfig:
+      datasetName: storage
+  output:
+    type: ixVolume
+    ixVolumeConfig:
+      datasetName: output
+  watch:
+    type: ixVolume
+    ixVolumeConfig:
+      datasetName: watch
+  additionalStorages: []