mirror of
https://github.com/truenas/charts.git
synced 2026-10-26 07:58:40 +00:00
NAS-121031 / None / Add chia to community train (#1031)
* add chia to community train * dummy commit * add update_strategy
This commit is contained in:
@@ -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"
|
||||
@@ -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
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
Binary file not shown.
@@ -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
|
||||
@@ -0,0 +1,7 @@
|
||||
chiaStorage:
|
||||
data:
|
||||
type: hostPath
|
||||
hostPath: /mnt/{{ .Release.Name }}/data
|
||||
plots:
|
||||
type: hostPath
|
||||
hostPath: /mnt/{{ .Release.Name }}/plots
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
icon_url: https://www.chia.net/wp-content/uploads/2022/09/chia-logo.svg
|
||||
categories:
|
||||
- blockchain
|
||||
- chia
|
||||
@@ -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 <plots_dir> variable <br>
|
||||
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
|
||||
@@ -0,0 +1 @@
|
||||
{{ include "ix.v1.common.lib.chart.notes" $ }}
|
||||
@@ -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 -}}
|
||||
@@ -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 -}}
|
||||
@@ -0,0 +1,22 @@
|
||||
{{- define "chia.validation" -}}
|
||||
|
||||
{{- with $.Values.chiaConfig.service -}}
|
||||
|
||||
{{- $allowedModes := list "farmer-only" "harvester" "\"\"" -}}
|
||||
{{- if not (mustHas . $allowedModes) -}}
|
||||
{{- fail (printf "Expected <service> 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 <node_mode> is set to <harvester>" $key) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -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" . -}}
|
||||
+31
@@ -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'[0-9]\.[0-9]\.[0-9]')
|
||||
|
||||
|
||||
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)))
|
||||
@@ -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: []
|
||||
Reference in New Issue
Block a user