diff --git a/library/ix-dev/community/mineos/Chart.lock b/library/ix-dev/community/mineos/Chart.lock new file mode 100644 index 0000000000..0134b1624b --- /dev/null +++ b/library/ix-dev/community/mineos/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.0.8 +digest: sha256:254efaa1285f634b7a80b7baadeadbd20a680f7fee49d1d9d3c4618aa0d657ad +generated: "2023-06-02T19:17:47.930613813+03:00" diff --git a/library/ix-dev/community/mineos/Chart.yaml b/library/ix-dev/community/mineos/Chart.yaml new file mode 100644 index 0000000000..06689908b1 --- /dev/null +++ b/library/ix-dev/community/mineos/Chart.yaml @@ -0,0 +1,24 @@ +name: mineos +description: MineOS is a server front-end to ease managing Minecraft administrative tasks. +annotations: + title: MineOS +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: 'latest' +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.0.8 +home: https://github.com/hexparrot/mineos-node +icon: https://camo.githubusercontent.com/bfcc53b6de495c0f2d9d5699afea18b7319529933c5cd38f1e0cf55377df725f/68747470733a2f2f7669676e65747465322e77696b69612e6e6f636f6f6b69652e6e65742f6c6f74722d6d696e6563726166742d6d6f642d6578696c65732f696d616765732f662f66322f4d696e6563726166745f7365727665725f73657475702e706e672f7265766973696f6e2f6c61746573743f63623d3230313630393131313732353537 +sources: + - https://hub.docker.com/r/hexparrot/mineos/ + - https://github.com/hexparrot/mineos-node +keywords: + - minecraft diff --git a/library/ix-dev/community/mineos/README.md b/library/ix-dev/community/mineos/README.md new file mode 100644 index 0000000000..b1eb4a2a9a --- /dev/null +++ b/library/ix-dev/community/mineos/README.md @@ -0,0 +1,3 @@ +# MineOS + +[MineOS](https://github.com/hexparrot/mineos-node) is a server front-end to ease managing Minecraft administrative tasks. diff --git a/library/ix-dev/community/mineos/app-readme.md b/library/ix-dev/community/mineos/app-readme.md new file mode 100644 index 0000000000..b1eb4a2a9a --- /dev/null +++ b/library/ix-dev/community/mineos/app-readme.md @@ -0,0 +1,3 @@ +# MineOS + +[MineOS](https://github.com/hexparrot/mineos-node) is a server front-end to ease managing Minecraft administrative tasks. diff --git a/library/ix-dev/community/mineos/charts/common-1.0.8.tgz b/library/ix-dev/community/mineos/charts/common-1.0.8.tgz new file mode 100644 index 0000000000..2403a23d05 Binary files /dev/null and b/library/ix-dev/community/mineos/charts/common-1.0.8.tgz differ diff --git a/library/ix-dev/community/mineos/ci/basic-values.yaml b/library/ix-dev/community/mineos/ci/basic-values.yaml new file mode 100644 index 0000000000..d002e31d08 --- /dev/null +++ b/library/ix-dev/community/mineos/ci/basic-values.yaml @@ -0,0 +1,12 @@ +mineosConfig: + username: myuser + password: mypass + +mineosStorage: + data: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/data + +mineosNetwork: + mineosPortRangeStart: 30021 + mineosPortRangeEnd: 30025 diff --git a/library/ix-dev/community/mineos/ci/https-values.yaml b/library/ix-dev/community/mineos/ci/https-values.yaml new file mode 100644 index 0000000000..24888dc7ac --- /dev/null +++ b/library/ix-dev/community/mineos/ci/https-values.yaml @@ -0,0 +1,100 @@ +mineosConfig: + username: myuserhttps + password: mypasshttps + +mineosStorage: + data: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/data + +mineosNetwork: + useHTTPS: true + mineosPortRangeStart: 30021 + mineosPortRangeEnd: 30021 + certificateID: 1 + +ixCertificates: + "1": + certificate: | + -----BEGIN CERTIFICATE----- + MIIEdjCCA16gAwIBAgIDYFMYMA0GCSqGSIb3DQEBCwUAMGwxDDAKBgNVBAMMA2Fz + ZDELMAkGA1UEBhMCVVMxDTALBgNVBAgMBGFzZGYxCzAJBgNVBAcMAmFmMQ0wCwYD + VQQKDARhc2RmMQwwCgYDVQQLDANhc2QxFjAUBgkqhkiG9w0BCQEWB2FAYS5jb20w + HhcNMjEwODMwMjMyMzU0WhcNMjMxMjAzMjMyMzU0WjBuMQswCQYD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TCCASkwLQYDVR0RBCYwJIcEwKgABYcEwKgAA4cEwKgAkocEwKgAtYcE + 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 + 4vQCdYgW2g0KOvvNcZJCVq1OrhKiNiY1bWCp66DGg0ic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os3FxhUfcwJbM4b4VKeeHqzfu7pI6cU/3ydiHVitKcVe2bdw3qMPqI9Wc + nvi6e17Tbdq4OCsEJx1OiVwFD9YdO3cOTc6lw/3+hjypvZBRYo+/4jUthbu96E+S + dtOzehGZMmDvN0uSzupSi3ZOgkAAUFpyuIKickMCgYAId0PCRjonO2thn/R0rZ7P + //L852uyzYhXKw5/fjFGhQ6LbaLgIRFaCZ0L2809u0HFnNvJjHv4AKP6j+vFQYYY + qQ+66XnfsA9G/bu4MDS9AX83iahD9IdLXQAy8I19prAbpVumKegPbMnNYNB/TYEc + 3G15AKCXo7jjOUtHY01DCQ== + -----END PRIVATE KEY----- diff --git a/library/ix-dev/community/mineos/disable_upgrade_strategy b/library/ix-dev/community/mineos/disable_upgrade_strategy new file mode 100755 index 0000000000..fe8f0f89bb --- /dev/null +++ b/library/ix-dev/community/mineos/disable_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'latest') + + +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/mineos/item.yaml b/library/ix-dev/community/mineos/item.yaml new file mode 100644 index 0000000000..9ae274a041 --- /dev/null +++ b/library/ix-dev/community/mineos/item.yaml @@ -0,0 +1,7 @@ +icon_url: https://camo.githubusercontent.com/bfcc53b6de495c0f2d9d5699afea18b7319529933c5cd38f1e0cf55377df725f/68747470733a2f2f7669676e65747465322e77696b69612e6e6f636f6f6b69652e6e65742f6c6f74722d6d696e6563726166742d6d6f642d6578696c65732f696d616765732f662f66322f4d696e6563726166745f7365727665725f73657475702e706e672f7265766973696f6e2f6c61746573743f63623d3230313630393131313732353537 +screenshots: + - https://i.ytimg.com/vi/06XGie8SBnE/maxresdefault.jpg +categories: + - games +tags: + - minecraft diff --git a/library/ix-dev/community/mineos/metadata.yaml b/library/ix-dev/community/mineos/metadata.yaml new file mode 100644 index 0000000000..67a4ac10f6 --- /dev/null +++ b/library/ix-dev/community/mineos/metadata.yaml @@ -0,0 +1,18 @@ +runAsContext: + - userName: root + groupName: root + gid: 0 + uid: 0 + description: MineOS runs as root user +capabilities: + - name: CHOWN + description: MineOS requires this ability to change ownership of files. + - name: DAC_OVERRIDE + description: MineOS requires this ability to bypass file permissions. + - name: FOWNER + description: MineOS requires this ability to bypass file permissions for it's sub-processes. + - name: SETGID + description: MineOS requires this ability to switch group for sub-processes. + - name: SETUID + description: MineOS requires this ability to switch user for sub-processes. +hostMounts: [] diff --git a/library/ix-dev/community/mineos/questions.yaml b/library/ix-dev/community/mineos/questions.yaml new file mode 100644 index 0000000000..e8a705aa1c --- /dev/null +++ b/library/ix-dev/community/mineos/questions.yaml @@ -0,0 +1,231 @@ +groups: + - name: MineOS Configuration + description: Configure MineOS + - name: User and Group Configuration + description: Configure User and Group for MineOS + - name: Network Configuration + description: Configure Network for MineOS + - name: Storage Configuration + description: Configure Storage for MineOS + - name: Resources Configuration + description: Configure Resources for MineOS + +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: mineosConfig + label: "" + group: MineOS Configuration + schema: + type: dict + attrs: + - variable: username + label: Username + description: The username for MineOS WebUI. + schema: + type: string + empty: false + required: true + valid_chars: '^[a-zA-Z0-9]+$' + valid_chars_error: | + Username can only contain alphanumeric characters [0-9, a-z, A-Z]. + - variable: password + label: Password + description: The password for MineOS WebUI. + schema: + type: string + empty: false + required: true + private: true + - variable: terminationGracePeriodSeconds + label: Stop Grace Period + description: | + The time in seconds given to MineOS to stop before it is killed. + Killing a MineOS server without a grace period can cause data corruption. + schema: + type: int + empty: false + min: 30 + required: true + default: 600 + - variable: additionalEnvs + label: Additional Environment Variables + description: Configure additional environment variables for MineOS. + 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: mineosID + label: "" + group: User and Group Configuration + schema: + type: dict + attrs: + - variable: user + label: User ID + description: The user id that MineOS files will be owned by. + schema: + type: int + min: 568 + default: 568 + required: true + - variable: group + label: Group ID + description: The group id that MineOS files will be owned by. + schema: + type: int + min: 568 + default: 568 + required: true + + - variable: mineosNetwork + label: "" + group: Network Configuration + schema: + type: dict + attrs: + - variable: webPort + label: WebUI Port + description: The port for MineOS WebUI + schema: + type: int + default: 30000 + min: 9000 + max: 65535 + required: true + - variable: mineosPortRangeStart + label: Port Range Start + description: | + The start of the port range for MineOS servers.
+ It will open both TCP and UDP ports. + schema: + type: int + default: 30001 + min: 9000 + max: 65535 + required: true + - variable: mineosPortRangeEnd + label: Port Range End + description: | + The end of the port range for MineOS servers.
+ It will open both TCP and UDP ports.
+ Keep in mind that the port range can be at max 10 ports. + schema: + type: int + default: 30002 + min: 9000 + max: 65535 + required: true + - variable: useHTTPS + label: Use HTTPS + description: | + Enable HTTPS for MineOS WebUI.
+ If enabled, and you don't specify a certificate,
+ a self-signed certificate will be generated. + schema: + type: boolean + default: false + - variable: certificateID + label: Certificate + description: The certificate to use for MineOS WebUI + schema: + show_if: [["useHTTPS", "=", true]] + type: int + "null": true + $ref: + - "definitions/certificate" + + - variable: mineosStorage + label: "" + group: Storage Configuration + schema: + type: dict + attrs: + - variable: data + label: MineOS Data Storage + description: The path to store MineOS Data. + 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: 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: resources + label: Resources Configuration + group: Resources Configuration + schema: + type: dict + attrs: + - variable: limits + label: Limits + schema: + type: dict + attrs: + - variable: cpu + label: CPU + description: CPU limit for MineOS. + schema: + type: string + default: 4000m + required: true + - variable: memory + label: Memory + description: Memory limit for MineOS. + schema: + type: string + default: 8Gi + required: true diff --git a/library/ix-dev/community/mineos/templates/NOTES.txt b/library/ix-dev/community/mineos/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/library/ix-dev/community/mineos/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/library/ix-dev/community/mineos/templates/_mineos.tpl b/library/ix-dev/community/mineos/templates/_mineos.tpl new file mode 100644 index 0000000000..531e97ce4f --- /dev/null +++ b/library/ix-dev/community/mineos/templates/_mineos.tpl @@ -0,0 +1,134 @@ +{{- define "mineos.workload" -}} +workload: + mineos: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: false + # Upstream recommends a large termination grace period + terminationGracePeriodSeconds: {{ .Values.mineosConfig.terminationGracePeriodSeconds }} + securityContext: + fsGroup: {{ .Values.mineosID.group }} + containers: + mineos: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: 0 + runAsGroup: 0 + runAsNonRoot: false + readOnlyRootFilesystem: false + capabilities: + add: + - CHOWN + - DAC_OVERRIDE + - FOWNER + - SETGID + - SETUID + env: + SERVER_PORT: {{ .Values.mineosNetwork.webPort }} + USER_UID: {{ .Values.mineosID.user }} + GROUP_GID: {{ .Values.mineosID.group }} + USER_NAME: {{ .Values.mineosConfig.username }} + USER_PASSWORD: {{ .Values.mineosConfig.password }} + # Creates a group with the same name as the user + GROUP_NAME: {{ .Values.mineosConfig.username }} + USE_HTTPS: {{ .Values.mineosNetwork.useHTTPS }} + fixedEnv: + PUID: {{ .Values.mineosID.user }} + {{ with .Values.mineosConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: true + type: tcp + port: {{ .Values.mineosNetwork.webPort }} + readiness: + enabled: true + type: tcp + port: {{ .Values.mineosNetwork.webPort }} + startup: + enabled: true + type: tcp + port: {{ .Values.mineosNetwork.webPort }} + +{{/* Service */}} +service: + mineos: + enabled: true + primary: true + type: NodePort + targetSelector: mineos + ports: + webui: + enabled: true + primary: true + port: {{ .Values.mineosNetwork.webPort }} + nodePort: {{ .Values.mineosNetwork.webPort }} + targetSelector: mineos + game: + enabled: true + type: NodePort + targetSelector: mineos + ports: + {{- $start := (.Values.mineosNetwork.mineosPortRangeStart | int) -}} + {{- $end := (.Values.mineosNetwork.mineosPortRangeEnd | int) -}} + {{- $ports := (untilStep $start ($end | add1 | int) 1) -}} + {{- range $idx := $ports }} + port-{{ $idx }}-tcp: + enabled: true + primary: {{ eq $idx $start }} + port: {{ $idx }} + nodePort: {{ $idx }} + targetSelector: mineos + port-{{ $idx }}-udp: + enabled: true + primary: false + port: {{ $idx }} + nodePort: {{ $idx }} + protocol: udp + targetSelector: mineos + {{- end }} + +{{/* Persistence */}} +persistence: + data: + enabled: true + type: {{ .Values.mineosStorage.data.type }} + datasetName: {{ .Values.mineosStorage.data.datasetName | default "" }} + hostPath: {{ .Values.mineosStorage.data.hostPath | default "" }} + targetSelector: + mineos: + mineos: + mountPath: /var/games/minecraft + + {{- if and .Values.mineosNetwork.useHTTPS .Values.mineosNetwork.certificateID }} + cert: + enabled: true + type: secret + objectName: mineos-cert + defaultMode: "0600" + items: + - key: tls.key + path: mineos.key + - key: tls.crt + path: mineos.crt + targetSelector: + mineos: + mineos: + mountPath: /etc/ssl/certs + readOnly: true + +scaleCertificate: + mineos-cert: + enabled: true + id: {{ .Values.mineosNetwork.certificateID }} + {{- end -}} +{{- end -}} diff --git a/library/ix-dev/community/mineos/templates/_portal.tpl b/library/ix-dev/community/mineos/templates/_portal.tpl new file mode 100644 index 0000000000..6c5c76e67f --- /dev/null +++ b/library/ix-dev/community/mineos/templates/_portal.tpl @@ -0,0 +1,12 @@ +{{- define "mineos.portal" -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: portal +data: + path: "/" + port: {{ .Values.mineosNetwork.webPort | quote }} + protocol: {{ ternary "https" "http" .Values.mineosNetwork.useHTTPS }} + host: $node_ip +{{- end -}} diff --git a/library/ix-dev/community/mineos/templates/_validation.tpl b/library/ix-dev/community/mineos/templates/_validation.tpl new file mode 100644 index 0000000000..76f26a4183 --- /dev/null +++ b/library/ix-dev/community/mineos/templates/_validation.tpl @@ -0,0 +1,17 @@ +{{- define "mineos.validation" -}} + {{- $start := (.Values.mineosNetwork.mineosPortRangeStart | int) -}} + {{- $end := (.Values.mineosNetwork.mineosPortRangeEnd | int) -}} + + {{- if gt $start $end -}} + {{- fail "MineOS - Port range start cannot be greater than port range end." -}} + {{- end -}} + + {{- if gt (sub $end $start) 10 -}} + {{- fail "MineOS - Port range is too large. Max 10 ports are allowed." -}} + {{- end -}} + + {{- if not (mustRegexMatch "^[a-zA-Z0-9]+$" .Values.mineosConfig.username) -}} + {{- fail "MineOS - Username can only contain alphanumeric characters [0-9, a-z, A-Z]." -}} + {{- end -}} + +{{- end -}} diff --git a/library/ix-dev/community/mineos/templates/common.yaml b/library/ix-dev/community/mineos/templates/common.yaml new file mode 100644 index 0000000000..1539a83117 --- /dev/null +++ b/library/ix-dev/community/mineos/templates/common.yaml @@ -0,0 +1,10 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- include "mineos.validation" $ -}} +{{- $_ := mustMergeOverwrite .Values (include "mineos.workload" $ | fromYaml) -}} + +{{/* Create the configmap for portal manually*/}} +{{- include "mineos.portal" $ -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/library/ix-dev/community/mineos/upgrade_info.json b/library/ix-dev/community/mineos/upgrade_info.json new file mode 100644 index 0000000000..767388094a --- /dev/null +++ b/library/ix-dev/community/mineos/upgrade_info.json @@ -0,0 +1 @@ +{"filename": "values.yaml", "keys": ["image"]} diff --git a/library/ix-dev/community/mineos/values.yaml b/library/ix-dev/community/mineos/values.yaml new file mode 100644 index 0000000000..3c265ea968 --- /dev/null +++ b/library/ix-dev/community/mineos/values.yaml @@ -0,0 +1,28 @@ +image: + repository: hexparrot/mineos + pullPolicy: IfNotPresent + tag: latest + +resources: + limits: + cpu: 4000m + memory: 8Gi + +mineosConfig: + username: '' + password: '' + terminationGracePeriodSeconds: 240 + additionalEnvs: [] +mineosID: + user: 568 + group: 568 +mineosNetwork: + webPort: 30000 + mineosPortRangeStart: 30021 + mineosPortRangeEnd: 30022 + useHTTPS: false + certificateID: 0 +mineosStorage: + data: + type: ixVolume + datasetName: data