diff --git a/catalog.json b/catalog.json index 46b1a9b434..cb66787603 100644 --- a/catalog.json +++ b/catalog.json @@ -682,5 +682,25 @@ } }, "enterprise": {}, - "community": {} + "community": { + "chia": { + "app_readme": "

Chia

\n

This container runs as root user.

\n

When a port is set to < 9000. Host Networking is enabled automatically.

\n
\n

Also NodePort services turn to ClusterIP services, to avoid attempts to bind ports twice.

\n
\n

Key file is stored in /plots/keyfile and is generated automatically, only if the file does not exist.\nIf you want to use your own keyfile, you can create a file called keyfile in the /plots directory and it will be used instead.

\n
\n

When set on harvester mode keys variable is set to none and no generation is performed.

\n
", + "categories": [ + "blockchain", + "chia" + ], + "description": "Chia is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure.", + "healthy": true, + "healthy_error": null, + "location": "/__w/charts/charts/community/chia", + "latest_version": "1.0.0", + "latest_app_version": "1.7.0", + "latest_human_version": "1.7.0_1.0.0", + "last_update": null, + "name": "chia", + "recommended": false, + "title": "Chia", + "icon_url": "https://www.chia.net/wp-content/uploads/2022/09/chia-logo.svg" + } + } } \ No newline at end of file diff --git a/community/chia/1.0.0/Chart.lock b/community/chia/1.0.0/Chart.lock new file mode 100644 index 0000000000..fabb017b0d --- /dev/null +++ b/community/chia/1.0.0/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.0.0 +digest: sha256:f90dc95623b075f1d9ec4c4ba12464e2e789176ce7282a3aede37222201763b6 +generated: "2023-03-14T17:45:19.72539268+02:00" diff --git a/community/chia/1.0.0/Chart.yaml b/community/chia/1.0.0/Chart.yaml new file mode 100644 index 0000000000..174e3026a3 --- /dev/null +++ b/community/chia/1.0.0/Chart.yaml @@ -0,0 +1,25 @@ +name: chia +description: Chia is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure. +annotations: + title: Chia +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: '1.7.0' +kubeVersion: '>=1.16.0-0' +maintainers: + - name: truenas + url: https://www.truenas.com/ +dependencies: +- name: common + repository: file://../../../common + version: 1.0.0 +home: https://www.chia.net/ +icon: https://www.chia.net/wp-content/uploads/2022/09/chia-logo.svg +sources: +- https://github.com/Chia-Network/chia-docker +- https://github.com/truenas/charts/tree/master/library/ix-dev/community/chia +- https://www.chia.net/ +keywords: +- blockchain +- chia diff --git a/community/chia/1.0.0/README.md b/community/chia/1.0.0/README.md new file mode 100644 index 0000000000..b23e94dac0 --- /dev/null +++ b/community/chia/1.0.0/README.md @@ -0,0 +1,10 @@ +# Chia + +This container runs as `root` user. + +When a port is set to < 9000. Host Networking is enabled automatically. +> Also NodePort services turn to ClusterIP services, to avoid attempts to bind ports twice. + +Key file is stored in `/plots/keyfile` and is generated automatically, **only** if the file does not exist. +If you want to use your own `keyfile`, you can create a file called `keyfile` in the `/plots` directory and it will be used instead. +> When set on `harvester` mode `keys` variable is set to `none` and no generation is performed. diff --git a/community/chia/1.0.0/app-readme.md b/community/chia/1.0.0/app-readme.md new file mode 100644 index 0000000000..b23e94dac0 --- /dev/null +++ b/community/chia/1.0.0/app-readme.md @@ -0,0 +1,10 @@ +# Chia + +This container runs as `root` user. + +When a port is set to < 9000. Host Networking is enabled automatically. +> Also NodePort services turn to ClusterIP services, to avoid attempts to bind ports twice. + +Key file is stored in `/plots/keyfile` and is generated automatically, **only** if the file does not exist. +If you want to use your own `keyfile`, you can create a file called `keyfile` in the `/plots` directory and it will be used instead. +> When set on `harvester` mode `keys` variable is set to `none` and no generation is performed. diff --git a/community/chia/1.0.0/charts/common-1.0.0.tgz b/community/chia/1.0.0/charts/common-1.0.0.tgz new file mode 100644 index 0000000000..2e108fa250 Binary files /dev/null and b/community/chia/1.0.0/charts/common-1.0.0.tgz differ diff --git a/community/chia/1.0.0/ci/additional-values.yaml b/community/chia/1.0.0/ci/additional-values.yaml new file mode 100644 index 0000000000..259c783e1a --- /dev/null +++ b/community/chia/1.0.0/ci/additional-values.yaml @@ -0,0 +1,21 @@ +chiaConfig: + additionalEnvs: + - name: testnet + value: true + +chiaStorage: + data: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/data + plots: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/plots + additionalVolumes: + - type: hostPath + hostPath: /mnt/{{ .Release.Name }}/plots1 + isPlotDir: true + mountPath: /plots1 + - type: hostPath + hostPath: /mnt/{{ .Release.Name }}/random_mount + isPlotDir: false + mountPath: /random_mount diff --git a/community/chia/1.0.0/ci/basic-values.yaml b/community/chia/1.0.0/ci/basic-values.yaml new file mode 100644 index 0000000000..0b7704e1ba --- /dev/null +++ b/community/chia/1.0.0/ci/basic-values.yaml @@ -0,0 +1,7 @@ +chiaStorage: + data: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/data + plots: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/plots diff --git a/community/chia/1.0.0/ci/farmer-values.yaml b/community/chia/1.0.0/ci/farmer-values.yaml new file mode 100644 index 0000000000..08c5a7f3ad --- /dev/null +++ b/community/chia/1.0.0/ci/farmer-values.yaml @@ -0,0 +1,10 @@ +chiaConfig: + service: farmer-only + +chiaStorage: + data: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/data + plots: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/plots diff --git a/community/chia/1.0.0/ix_values.yaml b/community/chia/1.0.0/ix_values.yaml new file mode 100644 index 0000000000..8b4b41cd46 --- /dev/null +++ b/community/chia/1.0.0/ix_values.yaml @@ -0,0 +1,34 @@ +image: + repository: ghcr.io/chia-network/chia + tag: "1.7.0" + pullPolicy: IfNotPresent + +resources: + limits: + cpu: 4000m + memory: 8Gi + +chiaNetwork: + chiaPort: 8444 + farmerPort: 8447 + +chiaConfig: + # farmer-only | harvester | "" + service: "" + # farmer_address, farmer_port and ca. Only if sevice == harvester + farmer_address: "" + farmer_port: "" + ca: "" + full_node_peer: "" + additionalEnvs: [] + +chiaStorage: + data: + type: ixVolume + hostPath: "" + datasetName: data + plots: + type: ixVolume + hostPath: "/" + datasetName: plots + additionalVolumes: [] diff --git a/community/chia/1.0.0/questions.yaml b/community/chia/1.0.0/questions.yaml new file mode 100644 index 0000000000..81d49321ca --- /dev/null +++ b/community/chia/1.0.0/questions.yaml @@ -0,0 +1,259 @@ +groups: + - name: Chia Configuration + description: Configure Chia + - name: Network Configuration + description: Configure Network for Chia + - name: Storage Configuration + description: Configure Storage for Chia + - name: Resources Configuration + description: Configure Resources for Chia + +questions: + + - variable: TZ + group: Chia Configuration + label: Timezone + schema: + type: string + default: Etc/UTC + required: true + $ref: + - definitions/timezone + + - variable: chiaNetwork + group: Network Configuration + label: "" + schema: + type: dict + attrs: + - variable: chiaPort + label: Chia Port + description: Ports below 9000 will enable Host Network automatically. + schema: + type: int + default: 38444 + required: true + - variable: farmerPort + label: Farmer Port + description: Ports below 9000 will enable Host Network automatically. + schema: + type: int + default: 38447 + required: true + + - variable: chiaConfig + group: Chia Configuration + label: "" + schema: + type: dict + attrs: + - variable: service + label: Chia Service Mode + description: Select the Chia Service Mode + schema: + type: string + default: "" + enum: + - value: "" + description: Full Node + - value: farmer-only + description: Farmer + - value: harvester + description: Harvester + - variable: farmer_address + label: Farmer Address + schema: + type: string + show_if: [["service", "=", "harvester"]] + required: true + default: "" + - variable: farmer_port + label: Farmer Port + schema: + type: int + show_if: [["service", "=", "harvester"]] + required: true + default: 8447 + - variable: ca + label: CA + schema: + type: string + show_if: [["service", "=", "harvester"]] + required: true + default: "" + - variable: full_node_peer + label: Full Node Peer + schema: + type: string + default: "" + - variable: additionalEnvs + label: Additional Environments + description: Additional Environments + schema: + type: list + default: [] + items: + - variable: env + label: Variable + schema: + type: dict + attrs: + - variable: name + label: Name + schema: + type: string + required: true + default: "" + - variable: value + label: Value + schema: + type: string + required: true + default: "" + + - variable: chiaStorage + group: Storage Configuration + label: "" + schema: + type: dict + attrs: + - variable: data + label: Data + schema: + type: dict + attrs: + - variable: type + label: Type + schema: + type: string + default: ixVolume + required: true + enum: + - value: ixVolume + description: ixVolume + - value: hostPath + description: hostPath + - variable: hostPath + label: Host Path + schema: + type: hostpath + show_if: [["type", "=", "hostPath"]] + default: "" + - variable: datasetName + label: Dataset Name + schema: + type: string + default: data + show_if: [["type", "=", "ixVolume"]] + hidden: true + $ref: + - "normalize/ixVolume" + - variable: plots + label: Plots + schema: + type: dict + attrs: + - variable: type + label: Type + schema: + type: string + default: ixVolume + required: true + enum: + - value: ixVolume + description: ixVolume + - value: hostPath + description: hostPath + - variable: hostPath + label: Host Path + schema: + type: hostpath + show_if: [["type", "=", "hostPath"]] + default: "" + - variable: datasetName + label: Dataset Name + schema: + type: string + default: plots + show_if: [["type", "=", "ixVolume"]] + hidden: true + $ref: + - "normalize/ixVolume" + - variable: additionalVolumes + label: Additional Volumes + schema: + type: list + default: [] + items: + - variable: volume + label: Volume + schema: + type: dict + attrs: + - variable: isPlotDir + label: Directory for Plots + description: | + If this is checked, it will append the directory to variable
+ Keep this unchecked if you want to mount a directory for anything else. + schema: + type: boolean + default: false + - variable: type + label: Type + schema: + type: string + default: ixVolume + required: true + enum: + - value: ixVolume + description: ixVolume + - value: hostPath + description: hostPath + - variable: hostPath + label: Host Path + schema: + type: hostpath + show_if: [["type", "=", "hostPath"]] + default: "" + - variable: datasetName + label: Dataset Name + schema: + type: string + default: "volume1" + required: true + show_if: [["type", "=", "ixVolume"]] + $ref: + - "normalize/ixVolume" + - variable: mountPath + label: Mount Path + description: Path to mount the volume inside the container + schema: + type: string + required: true + default: "" + + - variable: resources + label: "" + group: Resources Configuration + schema: + type: dict + attrs: + - variable: limits + label: Limits + schema: + type: dict + attrs: + - variable: cpu + label: CPU + description: CPU limit for qBittorrent. + schema: + type: string + default: 4000m + required: true + - variable: memory + label: Memory + description: Memory limit for qBittorrent. + schema: + type: string + default: 8Gi + required: true diff --git a/community/chia/1.0.0/templates/NOTES.txt b/community/chia/1.0.0/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/community/chia/1.0.0/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/community/chia/1.0.0/templates/_chia.tpl b/community/chia/1.0.0/templates/_chia.tpl new file mode 100644 index 0000000000..e272515bf7 --- /dev/null +++ b/community/chia/1.0.0/templates/_chia.tpl @@ -0,0 +1,161 @@ +{{- define "chia.workload" -}} +workload: + chia: + enabled: true + primary: true + type: Deployment + podSpec: + {{ if or (lt (int .Values.chiaNetwork.chiaPort) 9000) + (lt (int .Values.chiaNetwork.farmerPort) 9000) }} + hostNetwork: true + {{ else }} + hostNetwork: false + {{ end }} + containers: + chia: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: 0 + runAsGroup: 0 + runAsNonRoot: false + readOnlyRootFilesystem: false + env: + plots_dir: {{ include "chia.plotDirs" $ | quote }} + {{ with .Values.chiaConfig.full_node_peer }} + full_node_peer: {{ . | quote }} + {{ end }} + {{ with .Values.chiaConfig.service }} + service: {{ . }} + {{ end }} + {{ if eq .Values.chiaConfig.service "harvester" }} + farmer_address: {{ .Values.chiaConfig.farmer_address | quote }} + farmer_port: {{ .Values.chiaConfig.farmer_port | quote }} + ca: {{ .Values.chiaConfig.ca | quote }} + keys: "none" + {{ else }} + keys: {{ include "chia.keyfile" . | quote }} + {{ end }} + {{ with .Values.chiaConfig.additionalEnvs }} + {{ range $env := . }} + {{ $env.name }}: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: true + type: exec + command: + - /bin/sh + - -c + - | + chmod +x /usr/local/bin/docker-healthcheck.sh && \ + /usr/local/bin/docker-healthcheck.sh || exit 1 + readiness: + enabled: true + type: exec + command: + - /bin/sh + - -c + - | + chmod +x /usr/local/bin/docker-healthcheck.sh && \ + /usr/local/bin/docker-healthcheck.sh || exit 1 + startup: + enabled: true + type: exec + command: + - /bin/sh + - -c + - | + chmod +x /usr/local/bin/docker-healthcheck.sh && \ + /usr/local/bin/docker-healthcheck.sh || exit 1 + {{ if ne .Values.chiaConfig.service "harvester" }} + initContainers: + keygen: + enabled: true + type: init + imageSelector: image + securityContext: + runAsUser: 0 + runAsGroup: 0 + runAsNonRoot: false + command: /bin/sh + args: + - -c + - | + if [ ! -f {{ include "chia.keyfile" . | quote }} ]; then + echo "Generating keys..." + /chia-blockchain/venv/bin/python3 -c \ + "from chia.util.keychain import generate_mnemonic;print(generate_mnemonic())" > {{ include "chia.keyfile" . | quote }}; + + if [ ! -f {{ include "chia.keyfile" . | quote }} ]; then + echo "Failed to generate keys." && exit 1 + fi + + echo "Keys generated." + fi + {{ end }} +{{/* Service */}} +service: + chia: + enabled: true + primary: true + type: NodePort + targetSelector: chia + ports: + chia-net: + enabled: true + primary: true + port: {{ .Values.chiaNetwork.chiaPort }} + nodePort: {{ .Values.chiaNetwork.chiaPort }} + targePort: 8444 + targetSelector: chia + chia-farmer: + enabled: true + port: {{ .Values.chiaNetwork.farmerPort }} + nodePort: {{ .Values.chiaNetwork.farmerPort }} + targePort: 8447 + targetSelector: chia + +{{/* Persistence */}} +persistence: + data: + enabled: true + type: {{ .Values.chiaStorage.data.type }} + datasetName: {{ .Values.chiaStorage.data.datasetName | default "" }} + hostPath: {{ .Values.chiaStorage.data.hostPath | default "" }} + targetSelector: + chia: + chia: + mountPath: /root/.chia + plots: + enabled: true + type: {{ .Values.chiaStorage.plots.type }} + datasetName: {{ .Values.chiaStorage.plots.datasetName | default "" }} + hostPath: {{ .Values.chiaStorage.plots.hostPath | default "" }} + targetSelector: + chia: + chia: + mountPath: /plots + keygen: + mountPath: /plots + tmp: + enabled: true + type: emptyDir + targetSelector: + chia: + chia: + mountPath: /tmp + {{ range $idx, $vol := .Values.chiaStorage.additionalVolumes }} + {{ printf "volume-%s" (toString $idx) }}: + enabled: true + type: {{ $vol.type }} + datasetName: {{ $vol.datasetName | default "" }} + hostPath: {{ $vol.hostPath | default "" }} + targetSelector: + chia: + chia: + mountPath: {{ $vol.mountPath }} + {{ end }} +{{- end -}} diff --git a/community/chia/1.0.0/templates/_helper.tpl b/community/chia/1.0.0/templates/_helper.tpl new file mode 100644 index 0000000000..d4d7f9d202 --- /dev/null +++ b/community/chia/1.0.0/templates/_helper.tpl @@ -0,0 +1,14 @@ +{{- define "chia.plotDirs" -}} + {{- $plotDirs := list "/plots" -}} + {{- range $vol := .Values.chiaStorage.additionalVolumes -}} + {{- if $vol.isPlotDir -}} + {{- $plotDirs = mustAppend $plotDirs $vol.mountPath -}} + {{- end -}} + + {{- end -}} + {{- join ":" $plotDirs -}} +{{- end -}} + +{{- define "chia.keyfile" -}} + {{ print "/plots/keyfile" }} +{{- end -}} diff --git a/community/chia/1.0.0/templates/_validation.tpl b/community/chia/1.0.0/templates/_validation.tpl new file mode 100644 index 0000000000..6ace9abd60 --- /dev/null +++ b/community/chia/1.0.0/templates/_validation.tpl @@ -0,0 +1,22 @@ +{{- define "chia.validation" -}} + + {{- with $.Values.chiaConfig.service -}} + + {{- $allowedModes := list "farmer-only" "harvester" "\"\"" -}} + {{- if not (mustHas . $allowedModes) -}} + {{- fail (printf "Expected to be one of [%s], but got [%s]" (join ", " $allowedModes) .) -}} + {{- end -}} + + {{- end -}} + + {{- if eq $.Values.chiaConfig.service "harvester" -}} + {{- $reqs := list "farmer_address" "farmer_port" "ca" -}} + + {{- range $key := $reqs -}} + {{- if not (get $.Values.chiaConfig $key) -}} + {{- fail (printf "Expected non-empty <%s> when is set to " $key) -}} + {{- end -}} + {{- end -}} + + {{- end -}} +{{- end -}} diff --git a/community/chia/1.0.0/templates/common.yaml b/community/chia/1.0.0/templates/common.yaml new file mode 100644 index 0000000000..1dc3b6a415 --- /dev/null +++ b/community/chia/1.0.0/templates/common.yaml @@ -0,0 +1,8 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{- include "chia.validation" $ -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "chia.workload" $ | fromYaml) -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/community/chia/item.yaml b/community/chia/item.yaml new file mode 100644 index 0000000000..85bcbf0cbb --- /dev/null +++ b/community/chia/item.yaml @@ -0,0 +1,4 @@ +icon_url: https://www.chia.net/wp-content/uploads/2022/09/chia-logo.svg +categories: + - blockchain + - chia