From 5b5fe22a45ad84a7186d05db1ecf3a9e291c6ebf Mon Sep 17 00:00:00 2001 From: sonicaj Date: Sun, 24 Oct 2021 16:36:32 +0500 Subject: [PATCH] Add initial filecoin application template --- test/filecoin/1.0.0/.helmignore | 23 +++ test/filecoin/1.0.0/Chart.yaml | 18 ++ test/filecoin/1.0.0/README.md | 7 + test/filecoin/1.0.0/app-readme.md | 4 + .../filecoin/1.0.0/charts/common-2105.0.0.tgz | Bin 0 -> 4288 bytes test/filecoin/1.0.0/ix_values.yaml | 5 + test/filecoin/1.0.0/questions.yaml | 182 ++++++++++++++++++ test/filecoin/1.0.0/requirements.lock | 6 + test/filecoin/1.0.0/templates/deployment.yaml | 46 +++++ .../1.0.0/templates/generate-mnemonic.yaml | 30 +++ .../1.0.0/templates/mnemonic-configmap.yaml | 14 ++ test/filecoin/1.0.0/templates/networking.tpl | 21 ++ test/filecoin/1.0.0/templates/service.yaml | 13 ++ test/filecoin/1.0.0/test_values.yaml | 15 ++ test/filecoin/item.yaml | 4 + 15 files changed, 388 insertions(+) create mode 100644 test/filecoin/1.0.0/.helmignore create mode 100644 test/filecoin/1.0.0/Chart.yaml create mode 100755 test/filecoin/1.0.0/README.md create mode 100644 test/filecoin/1.0.0/app-readme.md create mode 100644 test/filecoin/1.0.0/charts/common-2105.0.0.tgz create mode 100644 test/filecoin/1.0.0/ix_values.yaml create mode 100644 test/filecoin/1.0.0/questions.yaml create mode 100644 test/filecoin/1.0.0/requirements.lock create mode 100644 test/filecoin/1.0.0/templates/deployment.yaml create mode 100644 test/filecoin/1.0.0/templates/generate-mnemonic.yaml create mode 100644 test/filecoin/1.0.0/templates/mnemonic-configmap.yaml create mode 100644 test/filecoin/1.0.0/templates/networking.tpl create mode 100644 test/filecoin/1.0.0/templates/service.yaml create mode 100644 test/filecoin/1.0.0/test_values.yaml create mode 100644 test/filecoin/item.yaml diff --git a/test/filecoin/1.0.0/.helmignore b/test/filecoin/1.0.0/.helmignore new file mode 100644 index 0000000000..a9fe727881 --- /dev/null +++ b/test/filecoin/1.0.0/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +# OWNERS file for Kubernetes +OWNERS \ No newline at end of file diff --git a/test/filecoin/1.0.0/Chart.yaml b/test/filecoin/1.0.0/Chart.yaml new file mode 100644 index 0000000000..9479b3adf1 --- /dev/null +++ b/test/filecoin/1.0.0/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +appVersion: v1.12.0 +dependencies: +- name: common + repository: file://../../../library/common/2105.0.0 + version: 2105.0.0 +description: Global, Versioned, peer-to-peer filesystem. +home: https://filecoin.io/ +icon: https://filecoin.io/images/filecoin-logo.svg +keywords: +- storage +- crypto +- blockchain +name: filecoin +sources: +- https://github.com/filecoin-project/lotus +- https://hub.docker.com/r/filecoin/lotus +version: 1.0.0 diff --git a/test/filecoin/1.0.0/README.md b/test/filecoin/1.0.0/README.md new file mode 100755 index 0000000000..09da0c62fa --- /dev/null +++ b/test/filecoin/1.0.0/README.md @@ -0,0 +1,7 @@ +Filecoin Network +===== + +Filecoin is a peer-to-peer network that stores files on the internet, with built-in economic incentives to ensure files are stored reliably over time. +------------ + +This chart bootstraps Filecoin Lotus deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. diff --git a/test/filecoin/1.0.0/app-readme.md b/test/filecoin/1.0.0/app-readme.md new file mode 100644 index 0000000000..6ab946dd9e --- /dev/null +++ b/test/filecoin/1.0.0/app-readme.md @@ -0,0 +1,4 @@ +Chia Network +===== + +[CHIA](https://www.chia.net/) is a new blockchain and smart transaction platform that is easier to use, more efficient, and secure. diff --git a/test/filecoin/1.0.0/charts/common-2105.0.0.tgz b/test/filecoin/1.0.0/charts/common-2105.0.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..ef6f820efb63f7b71b04a313be6b82dee84585b7 GIT binary patch literal 4288 zcmV;x5I^r9iwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PH<$Z`-(*{j6VcR_)-%-HH5&lPm%Zu-PPcCTJ%Onr!bKEEWMR z(KZ{IR7uLIx0C(t7ko*SEI-mTZaXzUv=&7k9+Ky!a}Jr9O(u-CPsWJLXoe=~voBvd zolfVV-`D?lI-UCeonEK&tlRJGclrm1{ocW|PPf-T=stta6W}seav>3a)_L?;^~rrF z1!d$N=7KPK1k+xCvaEdU1_>51Cz;gG$B>c%M|=jcq81o34&_J%1CC9 z7745Pzkk@R@&7@;zvcgpluw`9FM|_J1Yma_?A8Y_+xPdur%$_(;31(HLPIQ3l|n+; zy}u7Ca-=l}iQmj5?WH2+_Zi2z3eS`1(TNC1LC zn&XTUYP3B{Q^(W52Jdk!1;{ayfH;PjVq&+%M&cEo6{Ccz$yGial8*)jfVm-l zfgQabLkNGG?*23ltFJAnsD#wA0~UhAfSktHvrJ>`x+qHt{!~kY@>D{&TCO$=)CxYn z>^A$&vAS&1|tnt%i7ECHbz zTjW{BxWow%>R4KT0fdV-w?=htS5AF3>q z|JHT#=m5Yf`M! ztotxBCgJ)%yV7+ZnT(a=B3}WtvpkD#^8w}*ODrP7+C{>F`V5}y(qNc2LYW|nMmX6W z%&M_Q=Lo6xH*)sMBLApWom+z4M*LO;Q(fevu`i)QA{sC2&&_l%N-(Nv5k86D+3*Se zC^@>SVQgAkZ;YFc_V}1?QA01=sR*=)Blt;#W%uY7&%7t?9)dE;Qv0>_Vk{}k46g+76();!Z1(M8GOi5N`^#fge=pm9tHovW_r54RFhOYAYg!FlnV@kO)$JF zq_^3tA;D>40(B{w5Q!6z4CI&y*cr_9KAv7&skVfUKx8;>MZx(HtWY;VVn!t*RM^Zu zT}LF`ku-$?hFm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6s)4kT>w^~Bl1C6Zy(BjmAB3D)kU=pXD>7jjhQf*=!@mtiZ1?~ zTuf_X!?d-)jwvoIT|j1aTJqB{7m!~QMU@1#aN|u+#!d4{CTFLF!;9jlT{hF$RUW~o z%9Ww!7>L`Y;-*zYFOjQ1GsqOz;yJ3}_(M)OP9QAynKB6i%dpblzm~4JsI>Vu&qrnm zk&ljA>|Q=<95ihjBS8`goA+HC<;9exrwYc=FJNH#jrE#%6+XHJkrY)0;9|Mw=3tqH zThGI9cDet~*@XPlfC)>S8t(>Ne4c)d16IFcsqd7WT8!5VhdH!Snl^Fw7m?}~qvp)o zr9viJJD;|;2!#Z<%b_H*q@S@Ug*L6orl(jRQ}NJ6YS8-YFWT2Ohkm%S-2NvYEvG!` z{g3sToB|Kz#feUO2O$ zn%}1kB~SY~X_p9h^S{DyLFdxasQPmq z#!CL*+pququfxvv{+ErE=WvOn#GGnJpP>M_8)FKCoTLe%BgjyEi$+*P!E?}ufyqT9bo4WDoFYl4*vOHx9?>Lt4it|JKksB556MTIn7{P!Z>5!;wXqtuWqg+<2ZN@_O`NjCs&XVE`n%8WLy7h&<~=)|M9l|*Hw&1ZS{|P z6jRzR0S!=mn`ba2`nX>t?y}%zG(fk(%ScYtZ^p?ec=`Xqb9je1VYz_w(=!o78E5Zt zEQ5$77`07v&fW*nRKzU7?Qfj*b+P>a_U!od_p@k{JjEC*<3F7_{_kwh|7@l_hu8Lx z`kgHMqkgJRHwc24FaL4;_Tv2F*CV+8?feQ(emj194d+*I@#Y$SKRdp-hU+)*UuSTB zadmzC`t{iLeK?c#2b&0mXL?tz3tj^ajmsNy{k& iFxMjT=zEZJ+p;a&vMt+EE&mDt0RR8cdYzpBdH?`mlXJfS literal 0 HcmV?d00001 diff --git a/test/filecoin/1.0.0/ix_values.yaml b/test/filecoin/1.0.0/ix_values.yaml new file mode 100644 index 0000000000..e558f9ee82 --- /dev/null +++ b/test/filecoin/1.0.0/ix_values.yaml @@ -0,0 +1,5 @@ +image: + pullPolicy: IfNotPresent + repository: filecoin/lotus + tag: v1.12.0 +updateStrategy: Recreate diff --git a/test/filecoin/1.0.0/questions.yaml b/test/filecoin/1.0.0/questions.yaml new file mode 100644 index 0000000000..29ca90ccac --- /dev/null +++ b/test/filecoin/1.0.0/questions.yaml @@ -0,0 +1,182 @@ +groups: + - name: "Storage" + description: "Configure Storage for Chia" + - name: "Farmr.net Configuration" + description: "Configure farmr.net support" + - name: "Chia Environment Variables" + description: "Set the environment that will be visible to the container" + - name: "Networking" + description: "Configure networking for Chia container" + +portals: + web_portal: + protocols: + - "https" + host: + - "www.truepool.io" + ports: + - "443" + path: "/kb/truepool-docker-image/" + +questions: + - variable: farmr_env + label: "Enable 'farmr.net' support" + group: "Farmr.net Configuration" + description: "Configure 'farmr.net' support for chia" + schema: + type: string + default: "off" + enum: + - value: "off" + description: "OFF" + - value: "farmer" + description: "FARMER" + - value: "harvester" + description: "HARVESTER" + - variable: appVolumeMounts + label: "Chia Storage" + group: "Storage" + schema: + type: dict + attrs: + - variable: config + label: "Configuration Volume" + schema: + type: dict + attrs: + - variable: datasetName + label: "Configuration Volume Dataset Name" + schema: + type: string + hidden: true + $ref: + - "normalize/ixVolume" + show_if: [["hostPathEnabled", "=", false]] + default: "config" + editable: false + - variable: mountPath + label: "Configuration Mount Path" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + hidden: true + editable: true + default: "/data" + - variable: hostPathEnabled + label: "Enable Custom Host Path for Chia Configuration Volume" + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: hostPath + label: "Host Path for Chia Configuration Volume" + schema: + type: hostpath + required: true + - variable: plots + label: "Plot Volume" + schema: + type: dict + attrs: + - variable: datasetName + label: "Plots Volume Name" + schema: + type: string + hidden: true + $ref: + - "normalize/ixVolume" + show_if: [["hostPathEnabled", "=", false]] + default: "plots" + editable: false + - variable: mountPath + label: "Plots Mount Path" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + hidden: true + editable: false + default: "/plots" + - variable: hostPathEnabled + label: "Enable Custom Host Path for Chia Plots Volume" + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: hostPath + label: "Host Path for Chia Plots Volume" + schema: + type: hostpath + required: true + + - variable: extraAppVolumeMounts + label: "Chia Extra Host Path Volumes" + group: "Storage" + schema: + type: list + items: + - variable: extraAppVolume + label: "Chia Host Path Volume" + description: "Add an extra host path volume for chia application" + schema: + type: dict + attrs: + - variable: mountPath + label: "Mount Path in Pod" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + required: true + - variable: hostPath + label: "Host Path" + description: "Host path" + schema: + type: hostpath + required: true + + - variable: environmentVariables + label: "Environment Variables for Chia" + group: "Chia Environment Variables" + schema: + type: list + default: [] + items: + - variable: environmentVariable + label: "Environment Variable" + schema: + type: dict + attrs: + - variable: name + label: "Name" + schema: + type: string + - variable: value + label: "Value" + schema: + type: string + + - variable: service + description: "Networking Configuration" + label: "Networking Configuration" + group: "Networking" + schema: + type: dict + required: true + attrs: + - variable: nodePort + label: "Node Port to use for Chia" + schema: + type: int + min: 8000 + max: 65535 + default: 8444 + required: true + - variable: farmerPort + label: "Farmer Port to use for Chia" + schema: + type: int + min: 8000 + max: 65535 + default: 8447 + required: true diff --git a/test/filecoin/1.0.0/requirements.lock b/test/filecoin/1.0.0/requirements.lock new file mode 100644 index 0000000000..eba13d88bf --- /dev/null +++ b/test/filecoin/1.0.0/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../library/common/2105.0.0 + version: 2105.0.0 +digest: sha256:11522ab36487826700d7ad0f86f713a4bb5d35248014bcef690fe94acbc09ef6 +generated: "2021-05-17T18:26:46.201544+05:00" diff --git a/test/filecoin/1.0.0/templates/deployment.yaml b/test/filecoin/1.0.0/templates/deployment.yaml new file mode 100644 index 0000000000..c3ce22a445 --- /dev/null +++ b/test/filecoin/1.0.0/templates/deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "common.names.fullname" . }} + labels: {{ include "common.labels" . | nindent 4 }} + annotations: + rollme: {{ randAlphaNum 5 | quote }} +spec: + strategy: + type: {{ .Values.updateStrategy }} + selector: + matchLabels: {{ include "common.labels.selectorLabels" . | nindent 6 }} + template: + metadata: + name: {{ template "common.names.fullname" . }} + labels: {{ include "common.labels.selectorLabels" . | nindent 8 }} + spec: + # FIXME: Let's please remove hostnetwork when upstream hostport issue is sorted out with kube-router + hostNetwork: {{ include "hostNetworkingEnabled" . }} + containers: + - name: {{ .Chart.Name }} + {{ include "common.containers.imageConfig" .Values.image | nindent 10 }} + volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }} + {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }} + - name: extrappvolume-{{ $index }} + mountPath: {{ $hostPathConfiguration.mountPath }} + {{ end }} + ports: + - name: chia-network + protocol: TCP + containerPort: 8444 + hostPort: null + - name: chia-farmer + protocol: TCP + containerPort: 8447 + hostPort: null + {{ $envList := (default list .Values.environmentVariables) }} + {{ $envList = mustAppend $envList (dict "name" "keys" "value" "/plots/keyfile") }} + {{ $envList = mustAppend $envList (dict "name" "farmr" "value" $.Values.farmr_env) }} + {{ include "common.containers.allEnvironmentVariables" (dict "environmentVariables" $envList) | nindent 10 }} + volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }} + {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }} + - name: extrappvolume-{{ $index }} + hostPath: + path: {{ $hostPathConfiguration.hostPath }} + {{ end }} diff --git a/test/filecoin/1.0.0/templates/generate-mnemonic.yaml b/test/filecoin/1.0.0/templates/generate-mnemonic.yaml new file mode 100644 index 0000000000..1f3575ec84 --- /dev/null +++ b/test/filecoin/1.0.0/templates/generate-mnemonic.yaml @@ -0,0 +1,30 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: "pre-install" + annotations: + "helm.sh/hook": pre-install + "helm.sh/hook-weight": "1" + "helm.sh/hook-delete-policy": hook-succeeded +spec: + template: + metadata: + name: "pre-upgrade-hook2" + spec: + restartPolicy: Never + containers: + - name: {{ .Chart.Name }}-generate-mnemonic + {{ include "common.containers.imageConfig" .Values.image | nindent 8 }} + volumeMounts:{{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 10 }} + + - name: generate-mnemonic-configmap + mountPath: /generate_entrypoint.sh + readOnly: true + subPath: entrypoint.sh + command: + - "/generate_entrypoint.sh" + volumes: {{- include "common.storage.configureAppVolumes" .Values | nindent 8 -}} + - name: generate-mnemonic-configmap + configMap: + defaultMode: 0700 + name: "generate-mnemonic-config-map" diff --git a/test/filecoin/1.0.0/templates/mnemonic-configmap.yaml b/test/filecoin/1.0.0/templates/mnemonic-configmap.yaml new file mode 100644 index 0000000000..3158c85014 --- /dev/null +++ b/test/filecoin/1.0.0/templates/mnemonic-configmap.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: "generate-mnemonic-config-map" + annotations: + "helm.sh/hook": pre-install + "helm.sh/hook-weight": "-1" + "helm.sh/hook-delete-policy": hook-succeeded +data: + entrypoint.sh: |- + #!/bin/sh + if [ ! -e /plots/keyfile ]; then + /chia-blockchain/venv/bin/python3 -c "from chia.util.keychain import generate_mnemonic;print(generate_mnemonic())" > /plots/keyfile; + fi diff --git a/test/filecoin/1.0.0/templates/networking.tpl b/test/filecoin/1.0.0/templates/networking.tpl new file mode 100644 index 0000000000..280f7bdc9e --- /dev/null +++ b/test/filecoin/1.0.0/templates/networking.tpl @@ -0,0 +1,21 @@ +{{/* +Enable host networking +*/}} +{{- define "hostNetworkingEnabled" -}} +{{- if or (lt (.Values.service.nodePort | int) 9000) (lt (.Values.service.farmerPort | int) 9000) -}} +{{- print "true" -}} +{{- else -}} +{{- print "false" -}} +{{- end -}} +{{- end -}} + +{{/* +Enable Node Port Service +*/}} +{{- define "enableService" -}} +{{- if or (ge (.Values.service.nodePort | int) 9000) (ge (.Values.service.farmerPort | int) 9000) -}} +{{- print "true" -}} +{{- else -}} +{{- print "false" -}} +{{- end -}} +{{- end -}} diff --git a/test/filecoin/1.0.0/templates/service.yaml b/test/filecoin/1.0.0/templates/service.yaml new file mode 100644 index 0000000000..bf92e8d57b --- /dev/null +++ b/test/filecoin/1.0.0/templates/service.yaml @@ -0,0 +1,13 @@ +{{ if eq (include "enableService" .) "true" }} +{{ $svc := .Values.service }} +{{ $ports := list }} +{{ if ge ($svc.nodePort | int) 9000 }} +{{ $ports = mustAppend $ports (dict "name" "chia-network" "port" $svc.nodePort "nodePort" $svc.nodePort "targetPort" 8444) }} +{{ end }} +{{ if ge ($svc.farmerPort | int) 9000 }} +{{ $ports = mustAppend $ports (dict "name" "chia-farmer" "port" $svc.farmerPort "nodePort" $svc.farmerPort "targetPort" 8447) }} +{{ end }} +{{ $params := . }} +{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }} +{{ include "common.classes.service" $params }} +{{ end }} \ No newline at end of file diff --git a/test/filecoin/1.0.0/test_values.yaml b/test/filecoin/1.0.0/test_values.yaml new file mode 100644 index 0000000000..34292c026c --- /dev/null +++ b/test/filecoin/1.0.0/test_values.yaml @@ -0,0 +1,15 @@ +appVolumeMounts: + data: + emptyDir: true + mountPath: /data + staging: + emptyDir: true + mountPath: /plots +image: + pullPolicy: IfNotPresent + repository: filecoin/lotus + tag: v1.12.0 +service: + farmerPort: 31122 + nodePort: 31121 +updateStrategy: Recreate diff --git a/test/filecoin/item.yaml b/test/filecoin/item.yaml new file mode 100644 index 0000000000..62076aa7b2 --- /dev/null +++ b/test/filecoin/item.yaml @@ -0,0 +1,4 @@ +categories: + - storage + - crypto +icon_url: https://filecoin.io/images/filecoin-logo.svg