diff --git a/library/ix-dev/community/drawio/Chart.lock b/library/ix-dev/community/drawio/Chart.lock new file mode 100644 index 0000000000..4b6499659a --- /dev/null +++ b/library/ix-dev/community/drawio/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.1.1 +digest: sha256:a7dbe3e4d42dbcd4325776e5e01a1d630c7f185f79e7ebf22b1b9cc80f56eed7 +generated: "2023-10-09T17:13:08.326486318+03:00" diff --git a/library/ix-dev/community/drawio/Chart.yaml b/library/ix-dev/community/drawio/Chart.yaml new file mode 100644 index 0000000000..ad5a741cd0 --- /dev/null +++ b/library/ix-dev/community/drawio/Chart.yaml @@ -0,0 +1,26 @@ +name: drawio +description: Draw.io is a whiteboarding / diagramming software application. +annotations: + title: Draw.IO +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: 22.0.3 +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://www.drawio.com +icon: https://avatars.githubusercontent.com/u/1769238 +sources: + - https://hub.docker.com/r/jgraph/drawio + - https://github.com/truenas/charts/tree/master/library/ix-dev/community/drawio + - https://github.com/jgraph/drawio +keywords: + - diagram + - whiteboard diff --git a/library/ix-dev/community/drawio/README.md b/library/ix-dev/community/drawio/README.md new file mode 100644 index 0000000000..a6004edded --- /dev/null +++ b/library/ix-dev/community/drawio/README.md @@ -0,0 +1,3 @@ +# Draw.io + +[Draw.io](https://www.drawio.com) is a whiteboarding / diagramming software application. diff --git a/library/ix-dev/community/drawio/app-readme.md b/library/ix-dev/community/drawio/app-readme.md new file mode 100644 index 0000000000..a6004edded --- /dev/null +++ b/library/ix-dev/community/drawio/app-readme.md @@ -0,0 +1,3 @@ +# Draw.io + +[Draw.io](https://www.drawio.com) is a whiteboarding / diagramming software application. diff --git a/library/ix-dev/community/drawio/charts/common-1.1.1.tgz b/library/ix-dev/community/drawio/charts/common-1.1.1.tgz new file mode 100644 index 0000000000..8d3f9e686e Binary files /dev/null and b/library/ix-dev/community/drawio/charts/common-1.1.1.tgz differ diff --git a/library/ix-dev/community/drawio/ci/basic-values.yaml b/library/ix-dev/community/drawio/ci/basic-values.yaml new file mode 100644 index 0000000000..6dd6d3cbba --- /dev/null +++ b/library/ix-dev/community/drawio/ci/basic-values.yaml @@ -0,0 +1,3 @@ +drawioNetwork: + httpPort: 31000 + httpsPort: 31001 diff --git a/library/ix-dev/community/drawio/ci/extra-values.yaml b/library/ix-dev/community/drawio/ci/extra-values.yaml new file mode 100644 index 0000000000..a9145703d5 --- /dev/null +++ b/library/ix-dev/community/drawio/ci/extra-values.yaml @@ -0,0 +1,10 @@ +drawioNetwork: + httpPort: 31000 + httpsPort: 31001 + +drawioStorage: + additionalStorages: + - type: pvc + mountPath: /data1 + - type: pvc + mountPath: /data2 diff --git a/library/ix-dev/community/drawio/ci/hostNet-values.yaml b/library/ix-dev/community/drawio/ci/hostNet-values.yaml new file mode 100644 index 0000000000..48c444cb45 --- /dev/null +++ b/library/ix-dev/community/drawio/ci/hostNet-values.yaml @@ -0,0 +1,4 @@ +drawioNetwork: + httpPort: 31000 + httpsPort: 31001 + hostNetwork: true diff --git a/library/ix-dev/community/drawio/item.yaml b/library/ix-dev/community/drawio/item.yaml new file mode 100644 index 0000000000..03398421a8 --- /dev/null +++ b/library/ix-dev/community/drawio/item.yaml @@ -0,0 +1,10 @@ +icon_url: https://avatars.githubusercontent.com/u/1769238 +categories: + - productivity +screenshots: + - https://www.drawio.com/assets/img/blog/uml-association-class.gif + - https://www.drawio.com/assets/img/blog/export-as-editable-png.gif + - https://www.drawio.com/assets/img/blog/import-file.gif +tags: + - diagram + - whiteboard diff --git a/library/ix-dev/community/drawio/metadata.yaml b/library/ix-dev/community/drawio/metadata.yaml new file mode 100644 index 0000000000..1c05cb45e3 --- /dev/null +++ b/library/ix-dev/community/drawio/metadata.yaml @@ -0,0 +1,8 @@ +runAsContext: + - userName: drawio + groupName: drawio + gid: 1000 + uid: 999 + description: Draw.IO can run as a non-root user. +capabilities: [] +hostMounts: [] diff --git a/library/ix-dev/community/drawio/questions.yaml b/library/ix-dev/community/drawio/questions.yaml new file mode 100644 index 0000000000..9139b3e7a3 --- /dev/null +++ b/library/ix-dev/community/drawio/questions.yaml @@ -0,0 +1,185 @@ +groups: + - name: Draw.io Configuration + description: Configure Draw.io + - name: Network Configuration + description: Configure Network for Draw.io + - name: Storage Configuration + description: Configure Storage for Draw.io + - name: Resources Configuration + description: Configure Resources for Draw.io + +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: drawioConfig + label: "" + group: Draw.io Configuration + schema: + type: dict + attrs: + - variable: additionalEnvs + label: Additional Environment Variables + description: Configure additional environment variables for Draw.io. + 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: drawioNetwork + 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.
+ schema: + type: boolean + default: false + - variable: httpPort + label: HTTP Port + description: | + The HTTP port for the Draw.io Web UI. + You have to append [/?offline=1&https=0] to the URL + schema: + type: int + default: 30090 + show_if: [["hostNetwork", "=", false]] + min: 9000 + max: 65535 + required: true + - variable: httpsPort + label: HTTPS Port + description: | + The HTTPS port for the Draw.io Web UI. + You have to append [/?offline=1] to the URL + schema: + type: int + default: 30091 + show_if: [["hostNetwork", "=", false]] + min: 9000 + max: 65535 + required: true + + - variable: drawioStorage + label: "" + group: Storage Configuration + schema: + type: dict + attrs: + - variable: additionalStorages + label: Additional Storage + description: Additional storage for Draw.io. + 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.
+ 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 Draw.io. + 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
+ - Plain Integer - eg. 1
+ - Float - eg. 0.5
+ - Milicpu - eg. 500m + default: "4000m" + required: true + - variable: memory + label: Memory + description: Memory limit for Draw.io. + 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
+ - Suffixed with E/P/T/G/M/K - eg. 1G
+ - Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi
+ - Plain Integer in bytes - eg. 1024
+ - Exponent - eg. 134e6 + default: "8Gi" + required: true diff --git a/library/ix-dev/community/drawio/templates/NOTES.txt b/library/ix-dev/community/drawio/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/library/ix-dev/community/drawio/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/library/ix-dev/community/drawio/templates/_drawio.tpl b/library/ix-dev/community/drawio/templates/_drawio.tpl new file mode 100644 index 0000000000..d20e0c795c --- /dev/null +++ b/library/ix-dev/community/drawio/templates/_drawio.tpl @@ -0,0 +1,41 @@ +{{- define "drawio.workload" -}} +workload: + drawio: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: {{ .Values.drawioNetwork.hostNetwork }} + containers: + drawio: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: 1000 + runAsGroup: 999 + readOnlyRootFilesystem: false + {{ with .Values.drawioConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: true + type: http + port: 8080 + path: / + readiness: + enabled: true + type: http + port: 8080 + path: / + startup: + enabled: true + type: http + port: 8080 + path: / +{{- end -}} diff --git a/library/ix-dev/community/drawio/templates/_persistence.tpl b/library/ix-dev/community/drawio/templates/_persistence.tpl new file mode 100644 index 0000000000..a6dd93ecfc --- /dev/null +++ b/library/ix-dev/community/drawio/templates/_persistence.tpl @@ -0,0 +1,21 @@ +{{- define "drawio.persistence" -}} +persistence: + tmp: + enabled: true + type: emptyDir + targetSelector: + drawio: + drawio: + mountPath: /tmp + {{- range $idx, $storage := .Values.drawioStorage.additionalStorages }} + {{ printf "drawio-%v" (int $idx) }}: + enabled: true + type: {{ $storage.type }} + datasetName: {{ $storage.datasetName | default "" }} + hostPath: {{ $storage.hostPath | default "" }} + targetSelector: + drawio: + drawio: + mountPath: {{ $storage.mountPath }} + {{- end }} +{{- end -}} diff --git a/library/ix-dev/community/drawio/templates/_portal.tpl b/library/ix-dev/community/drawio/templates/_portal.tpl new file mode 100644 index 0000000000..a38d2598b9 --- /dev/null +++ b/library/ix-dev/community/drawio/templates/_portal.tpl @@ -0,0 +1,12 @@ +{{- define "drawio.portal" -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: portal +data: + path: "/?offline=1&https=0" + port: {{ .Values.drawioNetwork.httpPort | quote }} + protocol: http + host: $node_ip +{{- end -}} diff --git a/library/ix-dev/community/drawio/templates/_service.tpl b/library/ix-dev/community/drawio/templates/_service.tpl new file mode 100644 index 0000000000..4fbc5751d1 --- /dev/null +++ b/library/ix-dev/community/drawio/templates/_service.tpl @@ -0,0 +1,22 @@ +{{- define "drawio.service" -}} +service: + drawio: + enabled: true + primary: true + type: NodePort + targetSelector: drawio + ports: + http: + enabled: true + primary: true + port: {{ .Values.drawioNetwork.httpPort }} + nodePort: {{ .Values.drawioNetwork.httpPort }} + targetPort: 8080 + targetSelector: drawio + https: + enabled: true + port: {{ .Values.drawioNetwork.httpsPort }} + nodePort: {{ .Values.drawioNetwork.httpsPort }} + targetPort: 8443 + targetSelector: drawio +{{- end -}} diff --git a/library/ix-dev/community/drawio/templates/common.yaml b/library/ix-dev/community/drawio/templates/common.yaml new file mode 100644 index 0000000000..e8e1170701 --- /dev/null +++ b/library/ix-dev/community/drawio/templates/common.yaml @@ -0,0 +1,11 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "drawio.workload" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "drawio.service" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "drawio.persistence" $ | fromYaml) -}} + +{{/* Create the configmap for portal manually*/}} +{{- include "drawio.portal" $ -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/library/ix-dev/community/drawio/upgrade_info.json b/library/ix-dev/community/drawio/upgrade_info.json new file mode 100644 index 0000000000..767388094a --- /dev/null +++ b/library/ix-dev/community/drawio/upgrade_info.json @@ -0,0 +1 @@ +{"filename": "values.yaml", "keys": ["image"]} diff --git a/library/ix-dev/community/drawio/upgrade_strategy b/library/ix-dev/community/drawio/upgrade_strategy new file mode 100755 index 0000000000..af685230a1 --- /dev/null +++ b/library/ix-dev/community/drawio/upgrade_strategy @@ -0,0 +1,31 @@ +#!/usr/bin/python3 +import json +import re +import sys + +from catalog_update.upgrade_strategy import semantic_versioning + + +RE_STABLE_VERSION = re.compile(r'\d+\.\d+\.\d+') + + +def newer_mapping(image_tags): + key = list(image_tags.keys())[0] + tags = {t: t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)} + 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))) diff --git a/library/ix-dev/community/drawio/values.yaml b/library/ix-dev/community/drawio/values.yaml new file mode 100644 index 0000000000..116f78eef3 --- /dev/null +++ b/library/ix-dev/community/drawio/values.yaml @@ -0,0 +1,20 @@ +image: + repository: jgraph/drawio + pullPolicy: IfNotPresent + tag: 22.0.3 + +resources: + limits: + cpu: 4000m + memory: 8Gi + +drawioConfig: + additionalEnvs: [] + +drawioNetwork: + httpPort: 30090 + httpsPort: 30091 + hostNetwork: false + +drawioStorage: + additionalStorages: []