add drawio to community train (#1629)

* add `drawio` to `community` train

* http/https

* other user

* cleanup

* update questions

* typo
This commit is contained in:
Stavros Kois
2023-10-10 16:14:10 +03:00
committed by GitHub
parent 8da2ee1bf0
commit df6aa84c17
20 changed files with 418 additions and 0 deletions

View File

@@ -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"

View File

@@ -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

View File

@@ -0,0 +1,3 @@
# Draw.io
[Draw.io](https://www.drawio.com) is a whiteboarding / diagramming software application.

View File

@@ -0,0 +1,3 @@
# Draw.io
[Draw.io](https://www.drawio.com) is a whiteboarding / diagramming software application.

View File

@@ -0,0 +1,3 @@
drawioNetwork:
httpPort: 31000
httpsPort: 31001

View File

@@ -0,0 +1,10 @@
drawioNetwork:
httpPort: 31000
httpsPort: 31001
drawioStorage:
additionalStorages:
- type: pvc
mountPath: /data1
- type: pvc
mountPath: /data2

View File

@@ -0,0 +1,4 @@
drawioNetwork:
httpPort: 31000
httpsPort: 31001
hostNetwork: true

View File

@@ -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

View File

@@ -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: []

View File

@@ -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.</br>
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.</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 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</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 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</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

View File

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

View File

@@ -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 -}}

View File

@@ -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 -}}

View File

@@ -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 -}}

View File

@@ -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 -}}

View File

@@ -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" . -}}

View File

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

View File

@@ -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)))

View File

@@ -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: []