diff --git a/library/ix-dev/community/netbootxyz/Chart.lock b/library/ix-dev/community/netbootxyz/Chart.lock new file mode 100644 index 0000000000..17f0402d36 --- /dev/null +++ b/library/ix-dev/community/netbootxyz/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.2.9 +digest: sha256:af1a9a1f87e3e48453c9f25f909f5ebcd7fa6e25162b7b425448ba752bcdbc5c +generated: "2024-01-23T17:10:13.3434522-05:00" diff --git a/library/ix-dev/community/netbootxyz/Chart.yaml b/library/ix-dev/community/netbootxyz/Chart.yaml new file mode 100644 index 0000000000..aec38bd43f --- /dev/null +++ b/library/ix-dev/community/netbootxyz/Chart.yaml @@ -0,0 +1,30 @@ +name: netbootxyz +description: netboot.xyz lets you PXE boot various operating system installers or utilities from a single tool over the network. +annotations: + title: netbootxyz +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: 2.0.76 +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.9 +home: https://github.com/truenas/charts/tree/master/community/netbootxyz +icon: https://media.sys.truenas.net/apps/netbootxyz/icons/icon.svg +sources: + - https://github.com/truenas/charts/tree/master/community/netbootxyz + - https://github.com/netbootxyz/docker-netbootxyz + - https://netboot.xyz +keywords: + - tftp + - network + - pxe + - netboot + - netbootxyz + - netboot.xyz diff --git a/library/ix-dev/community/netbootxyz/README.md b/library/ix-dev/community/netbootxyz/README.md new file mode 100644 index 0000000000..8811ed20a1 --- /dev/null +++ b/library/ix-dev/community/netbootxyz/README.md @@ -0,0 +1,3 @@ +# netboot.xyz + +[netboot.xyz](https://netboot.xyz) lets you PXE boot various operating system installers or utilities from a single tool over the network. diff --git a/library/ix-dev/community/netbootxyz/app-readme.md b/library/ix-dev/community/netbootxyz/app-readme.md new file mode 100644 index 0000000000..8811ed20a1 --- /dev/null +++ b/library/ix-dev/community/netbootxyz/app-readme.md @@ -0,0 +1,3 @@ +# netboot.xyz + +[netboot.xyz](https://netboot.xyz) lets you PXE boot various operating system installers or utilities from a single tool over the network. diff --git a/library/ix-dev/community/netbootxyz/charts/common-1.2.9.tgz b/library/ix-dev/community/netbootxyz/charts/common-1.2.9.tgz new file mode 100644 index 0000000000..c4d2a1d1c2 Binary files /dev/null and b/library/ix-dev/community/netbootxyz/charts/common-1.2.9.tgz differ diff --git a/library/ix-dev/community/netbootxyz/ci/basic-values.yaml b/library/ix-dev/community/netbootxyz/ci/basic-values.yaml new file mode 100644 index 0000000000..28bc16c903 --- /dev/null +++ b/library/ix-dev/community/netbootxyz/ci/basic-values.yaml @@ -0,0 +1,10 @@ +netbootStorage: + config: + type: pvc + assets: + type: pvc +netbootNetwork: + hostNetwork: true + tftpPort: 69 + webHttpPort: 3000 + webAssetsPort: 8080 diff --git a/library/ix-dev/community/netbootxyz/item.yaml b/library/ix-dev/community/netbootxyz/item.yaml new file mode 100644 index 0000000000..6a79cdd5ad --- /dev/null +++ b/library/ix-dev/community/netbootxyz/item.yaml @@ -0,0 +1,10 @@ +icon_url: https://media.sys.truenas.net/apps/netbootxyz/icons/icon.svg +categories: + - network +screenshots: + - https://media.sys.truenas.net/apps/netbootxyz/screenshots/screenshot1.jpg +tags: + - tftp + - pxe + - netboot + - netboot.xyz diff --git a/library/ix-dev/community/netbootxyz/metadata.yaml b/library/ix-dev/community/netbootxyz/metadata.yaml new file mode 100644 index 0000000000..9006156fd3 --- /dev/null +++ b/library/ix-dev/community/netbootxyz/metadata.yaml @@ -0,0 +1,22 @@ +runAsContext: + - userName: root + groupName: root + gid: 0 + uid: 0 + description: The container starts as root, then NGINX and TFTP spawn under normal user accounts. +capabilities: + - name: CHOWN + description: TFTP requires this ability to set permissions for sub-processes. + - name: DAC_OVERRIDE + description: TFTP requires this ability to set permissions for sub-processes. + - name: FOWNER + description: TFTP requires this ability to set permissions for sub-processes. + - name: SETUID + description: TFTP requires this ability to switch user for sub-processes. + - name: SETGID + description: TFTP requires this ability to switch group for sub-processes. + - name: NET_BIND_SERVICE + description: TFTP requires this ability to bind to port 69 for TFTP. + - name: KILL + description: TFTP requires this ability to kill sub-processes. +hostMounts: [] diff --git a/library/ix-dev/community/netbootxyz/questions.yaml b/library/ix-dev/community/netbootxyz/questions.yaml new file mode 100644 index 0000000000..89a2cbb623 --- /dev/null +++ b/library/ix-dev/community/netbootxyz/questions.yaml @@ -0,0 +1,321 @@ +groups: + - name: netboot.xyz Configuration + description: Configure netboot.xyz. + - name: Network Configuration + description: Configure Network for netboot.xyz. + - name: Storage Configuration + description: Configure Storage for netboot.xyz + - name: Resources Configuration + description: Configure Resources for netboot.xyz + +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: netboot.xyz Configuration + label: Timezone + schema: + type: string + default: Etc/UTC + required: true + $ref: + - definitions/timezone + + - variable: netbootConfig + label: "" + group: netboot.xyz Configuration + schema: + type: dict + attrs: + - variable: tftpdOpts + label: TFTPD Options + description: | + Additional TFTPD options. + schema: + type: list + default: [] + items: + - variable: option + label: Option + schema: + type: string + required: true + - variable: additionalEnvs + label: Additional Environment Variables + description: Configure additional environment variables for netboot.xyz. + 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: netbootNetwork + label: "" + group: Network Configuration + schema: + type: dict + attrs: + - variable: hostNetwork + label: Host Network + description: | + Bind to the host network.
+ Required for TFTP. + schema: + type: boolean + default: true + - variable: tftpPort + label: TFTP Port + description: The TFTP port for netboot.xyz. + schema: + show_if: [["hostNetwork", "=", false]] + type: int + default: 31009 + min: 9000 + max: 65535 + required: true + - variable: webHttpPort + label: Portal HTTP Port + description: The HTTP port for the netboot.xyz Portal. + schema: + show_if: [["hostNetwork", "=", false]] + type: int + default: 31010 + min: 9000 + max: 65535 + required: true + - variable: webAssetsPort + label: Assets Port + description: The Assets port for the netboot.xyz, configures the NGINX_PORT variable on the container. + schema: + type: int + default: 31011 + min: 9000 + max: 65535 + required: true + + - variable: netbootStorage + label: "" + group: Storage Configuration + schema: + type: dict + attrs: + - variable: config + label: netboot.xyz Config Storage + description: The path to store netboot.xyz configuration. + 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 + 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: assets + label: netboot.xyz Assets Storage + description: The path to store netboot.xyz assets. + 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 + 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: "assets" + - 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: 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 netboot.xyz. + 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 netboot.xyz. + 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/netbootxyz/templates/NOTES.txt b/library/ix-dev/community/netbootxyz/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/library/ix-dev/community/netbootxyz/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/library/ix-dev/community/netbootxyz/templates/_netboot.tpl b/library/ix-dev/community/netbootxyz/templates/_netboot.tpl new file mode 100644 index 0000000000..d1ef92f474 --- /dev/null +++ b/library/ix-dev/community/netbootxyz/templates/_netboot.tpl @@ -0,0 +1,63 @@ +{{- define "netboot.workload" -}} +workload: + netboot: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: {{ .Values.netbootNetwork.hostNetwork }} + containers: + netboot: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsNonRoot: false + runAsUser: 0 + runAsGroup: 0 + readOnlyRootFilesystem: false + capabilities: + add: + - CHOWN + - DAC_OVERRIDE + - FOWNER + - SETGID + - SETUID + - NET_BIND_SERVICE + - KILL + env: + NGINX_PORT: {{ .Values.netbootNetwork.webAssetsPort }} + TFTPD_OPTS: {{ join " " .Values.netbootConfig.tftpdOpts }} + {{ with .Values.netbootConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: true + type: exec + command: + - /bin/sh + - -c + - | + pgrep in.tftpd + readiness: + enabled: true + type: exec + command: + - /bin/sh + - -c + - | + pgrep in.tftpd + startup: + enabled: true + type: exec + command: + - /bin/sh + - -c + - | + pgrep in.tftpd +{{- end -}} diff --git a/library/ix-dev/community/netbootxyz/templates/_persistence.tpl b/library/ix-dev/community/netbootxyz/templates/_persistence.tpl new file mode 100644 index 0000000000..91708c2dc8 --- /dev/null +++ b/library/ix-dev/community/netbootxyz/templates/_persistence.tpl @@ -0,0 +1,47 @@ +{{- define "netboot.persistence" -}} +persistence: + config: + enabled: true + {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.netbootStorage.config) | nindent 4 }} + targetSelector: + netboot: + netboot: + mountPath: /config + assets: + enabled: true + {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.netbootStorage.assets) | nindent 4 }} + targetSelector: + netboot: + netboot: + mountPath: /assets + tmp: + enabled: true + type: emptyDir + targetSelector: + netboot: + netboot: + mountPath: /tmp + varlognginx: + enabled: true + type: emptyDir + targetSelector: + netboot: + netboot: + mountPath: /var/log/nginx + vartmpnginx: + enabled: true + type: emptyDir + targetSelector: + netboot: + netboot: + mountPath: /var/tmp/nginx + {{- range $idx, $storage := .Values.netbootStorage.additionalStorages }} + {{ printf "netboot-%v" (int $idx) }}: + enabled: true + {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }} + targetSelector: + netboot: + netboot: + mountPath: {{ $storage.mountPath }} + {{- end -}} +{{- end -}} diff --git a/library/ix-dev/community/netbootxyz/templates/_portal.tpl b/library/ix-dev/community/netbootxyz/templates/_portal.tpl new file mode 100644 index 0000000000..a6a056a93b --- /dev/null +++ b/library/ix-dev/community/netbootxyz/templates/_portal.tpl @@ -0,0 +1,12 @@ +{{- define "netboot.portal" -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: portal +data: + path: "/" + port: {{ .Values.netbootNetwork.webHttpPort | quote }} + protocol: http + host: $node_ip +{{- end -}} diff --git a/library/ix-dev/community/netbootxyz/templates/_service.tpl b/library/ix-dev/community/netbootxyz/templates/_service.tpl new file mode 100644 index 0000000000..ac61fd1e2c --- /dev/null +++ b/library/ix-dev/community/netbootxyz/templates/_service.tpl @@ -0,0 +1,34 @@ +{{- define "netboot.service" -}} +service: + netboot: + enabled: true + primary: true + type: NodePort + targetSelector: netboot + ports: + tftp: + enabled: true + primary: true + port: {{ .Values.netbootNetwork.tftpPort }} + nodePort: {{ .Values.netbootNetwork.tftpPort }} + targetPort: 69 + protocol: udp + targetSelector: netboot + assets: + enabled: true + port: {{ .Values.netbootNetwork.webAssetsPort }} + nodePort: {{ .Values.netbootNetwork.webAssetsPort }} + targetSelector: netboot + netboot-portal: + enabled: true + type: NodePort + targetSelector: netboot + ports: + portal-http: + enabled: true + primary: true + port: {{ .Values.netbootNetwork.webHttpPort }} + nodePort: {{ .Values.netbootNetwork.webHttpPort }} + targetPort: 3000 + targetSelector: netboot +{{- end -}} diff --git a/library/ix-dev/community/netbootxyz/templates/common.yaml b/library/ix-dev/community/netbootxyz/templates/common.yaml new file mode 100644 index 0000000000..18606a4fe8 --- /dev/null +++ b/library/ix-dev/community/netbootxyz/templates/common.yaml @@ -0,0 +1,11 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "netboot.workload" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "netboot.service" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "netboot.persistence" $ | fromYaml) -}} + +{{/* Create the configmap for portal manually*/}} +{{- include "netboot.portal" $ -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/library/ix-dev/community/netbootxyz/upgrade_info.json b/library/ix-dev/community/netbootxyz/upgrade_info.json new file mode 100644 index 0000000000..767388094a --- /dev/null +++ b/library/ix-dev/community/netbootxyz/upgrade_info.json @@ -0,0 +1 @@ +{"filename": "values.yaml", "keys": ["image"]} diff --git a/library/ix-dev/community/netbootxyz/upgrade_strategy b/library/ix-dev/community/netbootxyz/upgrade_strategy new file mode 100644 index 0000000000..e7c7ee22f8 --- /dev/null +++ b/library/ix-dev/community/netbootxyz/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+-nbxyz2') + + +def newer_mapping(image_tags): + key = list(image_tags.keys())[0] + tags = {t.strip('-nbxyz2'): 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/netbootxyz/values.yaml b/library/ix-dev/community/netbootxyz/values.yaml new file mode 100644 index 0000000000..041fa44854 --- /dev/null +++ b/library/ix-dev/community/netbootxyz/values.yaml @@ -0,0 +1,31 @@ +image: + repository: netbootxyz/netbootxyz + pullPolicy: IfNotPresent + tag: 0.7.0-nbxyz2 + +resources: + limits: + cpu: 4000m + memory: 8Gi + +netbootConfig: + tftpdOpts: [] + additionalEnvs: [] + +netbootNetwork: + # TFTP only works with hostNetwork: true + hostNetwork: true + tftpPort: 69 + webHttpPort: 3000 + webAssetsPort: 8080 + +netbootStorage: + config: + type: ixVolume + ixVolumeConfig: + datasetName: config + assets: + type: ixVolume + ixVolumeConfig: + datasetName: assets + additionalStorages: []