mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-23 03:59:22 +00:00
Cluster Orchestration with Kubernetes (#121)
* add file * builds + caching fixed * bitcoin orchestration * remove default entrypoint * eth image and cleanup * working monero * remove signature file * cleanup on aisle eth * cleanup on aisle btc * eth working * remove docker ignore * remove bitcoin image readme * fix serai builds * serai clusters * added readme for docker * formatting * share the image * newlines at EOF * add multi profile example * coin order * coin order * profile order * fix grammar * fix whitespace * reduce trusted signature set, require at least 3 signatures. * remove echo * update comment to ref trusted keys * comment fix * use 16 keys, check for laanwj, name compose * don't use bash * monero fingerprints & eth fixes * eth fixes * remove extra eth keys * kubernetes deployment implemented with helm charts * deleted helmignores & added new lines at the end of the file * deleted duplications & delete unnecessary comments & deactivated service accounts * deleted generators files * added a new line to monero/values.yaml * deleted support for old kubernetes version - ingress.yaml * added new like to serai/values.yaml * serai's port name changed * serai's port name changed * release name limit was changed to 253 * README.md updated * fixed Makefile * deleted platform dependant instructions * deleted appVersion from .yamls * added -i parameter for deleting process * added \ for Makefile Co-authored-by: TheArchitect108 <75815740+TheArchitect108@users.noreply.github.com> Co-authored-by: TheArchitect <TheArchitect108@protonmail.com>
This commit is contained in:
parent
26cbcfb78c
commit
f9310a9968
32 changed files with 1312 additions and 13 deletions
|
@ -13,8 +13,8 @@ bitcoind -regtest -txindex -fallbackfee=0.000001 -rpcuser=$RPC_USER -rpcpassword
|
|||
# give time to bitcoind to start
|
||||
while true
|
||||
do
|
||||
bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS generatetoaddress 100 $MINER && break
|
||||
sleep 5
|
||||
bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS generatetoaddress 100 $MINER && break
|
||||
sleep 5
|
||||
done
|
||||
|
||||
bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS createwallet "miner" false false $RPC_PASS false false true &&
|
||||
|
@ -24,6 +24,6 @@ bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS importprivkey $PR
|
|||
# mine a new block every BLOCK_TIME
|
||||
while true
|
||||
do
|
||||
bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS generatetoaddress 1 $MINER
|
||||
sleep $BLOCK_TIME
|
||||
bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS generatetoaddress 1 $MINER
|
||||
sleep $BLOCK_TIME
|
||||
done
|
||||
|
|
|
@ -8,7 +8,7 @@ name: serai-dev
|
|||
# coins - node clients for coins only (BTC, ETH, XMR)
|
||||
# cluster-sm - Alice, Bob, Charlie
|
||||
# cluster-coins-sm - cluster-sm with coins
|
||||
# cluter-lg - Alice, Bob, Charlie, Dave, Eve, Ferdie
|
||||
# cluster-lg - Alice, Bob, Charlie, Dave, Eve, Ferdie
|
||||
# cluster-coins-lg - cluster-lg with coins
|
||||
# monero - full node monero only
|
||||
# bitcoin - full node bitcoin only
|
||||
|
@ -42,7 +42,6 @@ services:
|
|||
- "./serai/scripts:/scripts"
|
||||
|
||||
serai-base:
|
||||
&serai
|
||||
<<: *serai_defaults
|
||||
hostname: serai-base
|
||||
profiles:
|
||||
|
@ -52,7 +51,6 @@ services:
|
|||
NAME: base
|
||||
|
||||
serai-alice:
|
||||
&serai
|
||||
<<: *serai_defaults
|
||||
hostname: serai-alice
|
||||
profiles:
|
||||
|
@ -67,7 +65,6 @@ services:
|
|||
VALIDATOR: true
|
||||
|
||||
serai-bob:
|
||||
&serai
|
||||
<<: *serai_defaults
|
||||
hostname: serai-bob
|
||||
profiles:
|
||||
|
@ -81,7 +78,6 @@ services:
|
|||
NAME: Bob
|
||||
|
||||
serai-charlie:
|
||||
&serai
|
||||
<<: *serai_defaults
|
||||
hostname: serai-charlie
|
||||
profiles:
|
||||
|
@ -95,7 +91,6 @@ services:
|
|||
NAME: Charlie
|
||||
|
||||
serai-dave:
|
||||
&serai
|
||||
<<: *serai_defaults
|
||||
hostname: serai-dave
|
||||
profiles:
|
||||
|
@ -107,7 +102,6 @@ services:
|
|||
NAME: Dave
|
||||
|
||||
serai-eve:
|
||||
&serai
|
||||
<<: *serai_defaults
|
||||
hostname: serai-eve
|
||||
profiles:
|
||||
|
@ -119,7 +113,6 @@ services:
|
|||
NAME: Eve
|
||||
|
||||
serai-ferdie:
|
||||
&serai
|
||||
<<: *serai_defaults
|
||||
hostname: serai-ferdie
|
||||
profiles:
|
||||
|
@ -171,6 +164,5 @@ services:
|
|||
context: ./coins/monero/
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- "./coins/monero/temp:/temp"
|
||||
- "./coins/monero/scripts:/scripts"
|
||||
entrypoint: /scripts/entry-dev.sh
|
||||
|
|
103
deploy/kubernetes/Makefile
Normal file
103
deploy/kubernetes/Makefile
Normal file
|
@ -0,0 +1,103 @@
|
|||
SHELL := /bin/bash
|
||||
|
||||
check-helm:
|
||||
@helm version || $(MAKE) install-helm
|
||||
|
||||
check-kubectl:
|
||||
@kubectl version || $(MAKE) install-kubectl
|
||||
|
||||
install-helm:
|
||||
@curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
|
||||
@chmod 700 get_helm.sh
|
||||
@./get_helm.sh
|
||||
@rm get_helm.sh
|
||||
|
||||
install-kubectl:
|
||||
@curl -LO 'https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl'
|
||||
@sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
|
||||
@rm kubectl
|
||||
|
||||
deploy-base:
|
||||
@docker compose -f ../docker-compose.yml --profile base build --quiet
|
||||
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-base charts/serai/\
|
||||
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-base,nameOverride=serai-base,\
|
||||
image.envVariables[1].value=base,configMapFile=%
|
||||
|
||||
deploy-bitcoin:
|
||||
@docker compose -f ../docker-compose.yml --profile bitcoin build --quiet
|
||||
@(cat ../coins/bitcoin/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install bitcoin-daemon\
|
||||
charts/bitcoin/ --values charts/bitcoin/values.yaml --set configMapFile=%
|
||||
|
||||
deploy-ethereum:
|
||||
@docker compose -f ../docker-compose.yml --profile ethereum build --quiet
|
||||
@(cat ../coins/ethereum/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install ethereum-daemon\
|
||||
charts/ethereum/ --values charts/ethereum/values.yaml --set configMapFile=%
|
||||
|
||||
deploy-monero:
|
||||
@docker compose -f ../docker-compose.yml --profile monero build --quiet
|
||||
@(cat ../coins/monero/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install monero-daemon\
|
||||
charts/monero/ --values charts/monero/values.yaml --set configMapFile=%
|
||||
|
||||
deploy-cluster-sm:
|
||||
@docker compose -f ../docker-compose.yml --profile cluster-sm build --quiet
|
||||
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-alice charts/serai/\
|
||||
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-alice,nameOverride=serai-alice,\
|
||||
image.envVariables[1].value=Alice,image.envVariables[2].value="'1'",configMapFile=%
|
||||
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-charlie charts/serai/\
|
||||
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-charlie,nameOverride=serai-charlie,\
|
||||
image.envVariables[1].value=Charlie,configMapFile=%
|
||||
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-bob charts/serai/\
|
||||
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-bob,nameOverride=serai-bob,\
|
||||
image.envVariables[1].value=Bob,configMapFile=%
|
||||
|
||||
deploy-cluster-lg: deploy-cluster-sm
|
||||
@docker compose -f ../docker-compose.yml --profile cluster-lg build --quiet
|
||||
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-dave charts/serai/\
|
||||
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-dave,nameOverride=serai-dave,\
|
||||
image.envVariables[1].value=Dave,configMapFile=%
|
||||
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-eve charts/serai/\
|
||||
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-eve,nameOverride=serai-eve,\
|
||||
image.envVariables[1].value=Eve,configMapFile=%
|
||||
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-ferdie charts/serai/\
|
||||
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-ferdie,nameOverride=serai-ferdie,\
|
||||
image.envVariables[1].value=Ferdie,configMapFile=%
|
||||
|
||||
deploy-coins: deploy-bitcoin deploy-ethereum deploy-monero
|
||||
|
||||
deploy-cluster-coins-sm: deploy-cluster-sm deploy-coins
|
||||
|
||||
deploy-cluster-coins-lg: deploy-cluster-lg deploy-coins
|
||||
|
||||
deploy-all: deploy-cluster-coins-lg
|
||||
|
||||
delete-base:
|
||||
@helm delete serai-base
|
||||
|
||||
delete-bitcoin:
|
||||
@helm delete bitcoin-daemon
|
||||
|
||||
delete-ethereum:
|
||||
@helm delete ethereum-daemon
|
||||
|
||||
delete-monero:
|
||||
@helm delete monero-daemon
|
||||
|
||||
delete-cluster-lg: delete-cluster-sm
|
||||
@helm delete serai-dave
|
||||
@helm delete serai-eve
|
||||
@helm delete serai-ferdie
|
||||
|
||||
delete-cluster-sm:
|
||||
@helm delete serai-alice
|
||||
@helm delete serai-charlie
|
||||
@helm delete serai-bob
|
||||
|
||||
delete-coins: delete-bitcoin delete-ethereum delete-monero
|
||||
|
||||
delete-cluster-coins-sm: delete-cluster-sm delete-coins
|
||||
|
||||
delete-cluster-coins-lg: delete-cluster-lg delete-coins
|
||||
|
||||
delete-all: delete-cluster-coins-lg
|
||||
|
||||
check-dependencies: check-helm check-kubectl
|
41
deploy/kubernetes/README.md
Normal file
41
deploy/kubernetes/README.md
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Kubernetes
|
||||
## Run with Kubernetes
|
||||
Running the Serai infrastructure is easy with Kubernetes.
|
||||
|
||||
We utilize Makefile to easily orchestrate various pieces of the infrastructure on kubernetes.
|
||||
|
||||
**Example to deploy:** `make deploy-<Profile_Name>`
|
||||
```bash
|
||||
make deploy-cluster-sm
|
||||
```
|
||||
**Example to delete:** `make -i delete-<Profile_Name>`
|
||||
```bash
|
||||
make delete-cluster-sm
|
||||
```
|
||||
|
||||
All commands are assumed to be ran from the kubernetes folder, not the serai root folder.
|
||||
|
||||
### Profiles:
|
||||
* deploy-base - single node, named base
|
||||
* deploy-coins - node clients for coins only (BTC, ETH, XMR)
|
||||
* deploy-cluster-sm - Alice (Validator), Bob, Charlie
|
||||
* deploy-cluster-coins-sm - cluster-sm with coins
|
||||
* deploy-cluster-lg - Alice (Validator), Bob, Charlie, Dave, Eve, Ferdie
|
||||
* deploy-cluster-coins-lg - cluster-lg with coins
|
||||
* deploy-monero - full node monero only
|
||||
* deploy-bitcoin - full node bitcoin only
|
||||
* deploy-ethereum - full node ethereum only
|
||||
|
||||
## Requirements for Linux
|
||||
* Local built images of serai and coins, please follow the Instructions [here](../README.md)
|
||||
* Running kubernetes cluster (version >= 1.19)
|
||||
* Curl tool
|
||||
* Make tool
|
||||
* Kubectl, check if not installed
|
||||
```bash
|
||||
make check-kubectl
|
||||
```
|
||||
* Helm, check if not installed
|
||||
```bash
|
||||
make check-helm
|
||||
```
|
5
deploy/kubernetes/charts/bitcoin/Chart.yaml
Normal file
5
deploy/kubernetes/charts/bitcoin/Chart.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
apiVersion: v2
|
||||
name: bitcoin
|
||||
description: A Helm chart for bitcoin-daemon
|
||||
type: application
|
||||
version: 0.1.0
|
42
deploy/kubernetes/charts/bitcoin/templates/_helpers.tpl
Normal file
42
deploy/kubernetes/charts/bitcoin/templates/_helpers.tpl
Normal file
|
@ -0,0 +1,42 @@
|
|||
{{- define "bitcoin.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "bitcoin.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 253 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "bitcoin.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "bitcoin.labels" -}}
|
||||
helm.sh/chart: {{ include "bitcoin.chart" . }}
|
||||
{{ include "bitcoin.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "bitcoin.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "bitcoin.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "bitcoin.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "bitcoin.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,7 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-configmap
|
||||
data:
|
||||
entry-dev.sh: |
|
||||
{{ .Values.configMapFile | b64dec | indent 4}}
|
88
deploy/kubernetes/charts/bitcoin/templates/deployment.yaml
Normal file
88
deploy/kubernetes/charts/bitcoin/templates/deployment.yaml
Normal file
|
@ -0,0 +1,88 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "bitcoin.fullname" . }}
|
||||
labels:
|
||||
{{- include "bitcoin.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "bitcoin.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "bitcoin.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "bitcoin.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if hasKey .Values.image "ports" }}
|
||||
ports:
|
||||
{{- range .Values.image.ports }}
|
||||
- name: {{ .name }}
|
||||
containerPort: {{ .containerPort }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "command" }}
|
||||
command:
|
||||
{{- toYaml .Values.image.command | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "args" }}
|
||||
args:
|
||||
{{- toYaml .Values.image.args | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "envVariables" }}
|
||||
env:
|
||||
{{- toYaml .Values.image.envVariables | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "volumeMounts" }}
|
||||
volumeMounts:
|
||||
{{- range .Values.image.volumeMounts }}
|
||||
- mountPath: {{ .mountPath }}
|
||||
name: {{ $.Release.Name}}-{{ .name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if hasKey .Values "volumes" }}
|
||||
volumes:
|
||||
{{- range .Values.volumes }}
|
||||
- configMap:
|
||||
defaultMode: {{ .configMap.defaultMode }}
|
||||
name: {{ $.Release.Name}}-{{ .configMap.name }}
|
||||
name: {{ $.Release.Name}}-{{ .name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
50
deploy/kubernetes/charts/bitcoin/templates/ingress.yaml
Normal file
50
deploy/kubernetes/charts/bitcoin/templates/ingress.yaml
Normal file
|
@ -0,0 +1,50 @@
|
|||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "bitcoin.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "bitcoin.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
{{- if .pathType }}
|
||||
pathType: {{ .pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
24
deploy/kubernetes/charts/bitcoin/templates/service.yaml
Normal file
24
deploy/kubernetes/charts/bitcoin/templates/service.yaml
Normal file
|
@ -0,0 +1,24 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "bitcoin.fullname" . }}
|
||||
labels:
|
||||
{{- include "bitcoin.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
{{- if hasKey .Values.service "ports" }}
|
||||
{{- range .Values.service.ports }}
|
||||
- port: {{ .port }}
|
||||
name: {{ .name }}
|
||||
targetPort: {{ .targetPort }}
|
||||
protocol: {{ .protocol }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "bitcoin.selectorLabels" . | nindent 4 }}
|
74
deploy/kubernetes/charts/bitcoin/values.yaml
Normal file
74
deploy/kubernetes/charts/bitcoin/values.yaml
Normal file
|
@ -0,0 +1,74 @@
|
|||
replicaCount: 1
|
||||
|
||||
net: mainnet
|
||||
|
||||
image:
|
||||
repository: serai-dev-bitcoin
|
||||
pullPolicy: IfNotPresent
|
||||
tag: "latest"
|
||||
ports:
|
||||
- name: p2p
|
||||
containerPort: 18444
|
||||
protocol: TCP
|
||||
- name: rpc
|
||||
containerPort: 18443
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- mountPath: /scripts
|
||||
name: configmap-volume
|
||||
args:
|
||||
- bash
|
||||
- /scripts/entry-dev.sh
|
||||
|
||||
volumes:
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: configmap
|
||||
name: configmap-volume
|
||||
|
||||
configMapFile: "entry-dev.sh"
|
||||
|
||||
imagePullSecrets: []
|
||||
|
||||
serviceAccount:
|
||||
create: false
|
||||
name: ""
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podSecurityContext: {}
|
||||
|
||||
securityContext: {}
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: p2p
|
||||
port: 18444
|
||||
targetPort: p2p
|
||||
protocol: TCP
|
||||
- name: rpc
|
||||
port: 18443
|
||||
targetPort: rpc
|
||||
protocol: TCP
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
hosts: []
|
||||
tls: []
|
||||
|
||||
resources: {}
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 100
|
||||
targetCPUUtilizationPercentage: 80
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
5
deploy/kubernetes/charts/ethereum/Chart.yaml
Normal file
5
deploy/kubernetes/charts/ethereum/Chart.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
apiVersion: v2
|
||||
name: ethereum
|
||||
description: A Helm chart for ethereum-daemon
|
||||
type: application
|
||||
version: 0.1.0
|
42
deploy/kubernetes/charts/ethereum/templates/_helpers.tpl
Normal file
42
deploy/kubernetes/charts/ethereum/templates/_helpers.tpl
Normal file
|
@ -0,0 +1,42 @@
|
|||
{{- define "ethereum.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "ethereum.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 253 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "ethereum.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "ethereum.labels" -}}
|
||||
helm.sh/chart: {{ include "ethereum.chart" . }}
|
||||
{{ include "ethereum.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "ethereum.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "ethereum.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "ethereum.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "ethereum.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,7 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-configmap
|
||||
data:
|
||||
entry-dev.sh: |
|
||||
{{ .Values.configMapFile | b64dec | indent 4}}
|
89
deploy/kubernetes/charts/ethereum/templates/deployment.yaml
Normal file
89
deploy/kubernetes/charts/ethereum/templates/deployment.yaml
Normal file
|
@ -0,0 +1,89 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "ethereum.fullname" . }}
|
||||
labels:
|
||||
{{- include "ethereum.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "ethereum.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "ethereum.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "ethereum.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if hasKey .Values.image "ports" }}
|
||||
ports:
|
||||
{{- range .Values.image.ports }}
|
||||
- name: {{ .name }}
|
||||
containerPort: {{ .containerPort }}
|
||||
protocol: {{ .protocol }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "command" }}
|
||||
command:
|
||||
{{- toYaml .Values.image.command | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "args" }}
|
||||
args:
|
||||
{{- toYaml .Values.image.args | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "envVariables" }}
|
||||
env:
|
||||
{{- toYaml .Values.image.envVariables | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "volumeMounts" }}
|
||||
volumeMounts:
|
||||
{{- range .Values.image.volumeMounts }}
|
||||
- mountPath: {{ .mountPath }}
|
||||
name: {{ $.Release.Name}}-{{ .name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if hasKey .Values "volumes" }}
|
||||
volumes:
|
||||
{{- range .Values.volumes }}
|
||||
- configMap:
|
||||
defaultMode: {{ .configMap.defaultMode }}
|
||||
name: {{ $.Release.Name}}-{{ .configMap.name }}
|
||||
name: {{ $.Release.Name}}-{{ .name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
50
deploy/kubernetes/charts/ethereum/templates/ingress.yaml
Normal file
50
deploy/kubernetes/charts/ethereum/templates/ingress.yaml
Normal file
|
@ -0,0 +1,50 @@
|
|||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "ethereum.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "ethereum.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
{{- if .pathType }}
|
||||
pathType: {{ .pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
24
deploy/kubernetes/charts/ethereum/templates/service.yaml
Normal file
24
deploy/kubernetes/charts/ethereum/templates/service.yaml
Normal file
|
@ -0,0 +1,24 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "ethereum.fullname" . }}
|
||||
labels:
|
||||
{{- include "ethereum.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
{{- if hasKey .Values.service "ports" }}
|
||||
{{- range .Values.service.ports }}
|
||||
- port: {{ .port }}
|
||||
name: {{ .name }}
|
||||
targetPort: {{ .targetPort }}
|
||||
protocol: {{ .protocol }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "ethereum.selectorLabels" . | nindent 4 }}
|
60
deploy/kubernetes/charts/ethereum/values.yaml
Normal file
60
deploy/kubernetes/charts/ethereum/values.yaml
Normal file
|
@ -0,0 +1,60 @@
|
|||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: serai-dev-ethereum
|
||||
pullPolicy: IfNotPresent
|
||||
tag: "latest"
|
||||
|
||||
ports:
|
||||
- name: rpc
|
||||
containerPort: 8545
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- mountPath: /scripts
|
||||
name: configmap-volume
|
||||
args:
|
||||
- bash
|
||||
- /scripts/entry-dev.sh
|
||||
|
||||
volumes:
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: configmap
|
||||
name: configmap-volume
|
||||
|
||||
configMapFile: "entry-dev.sh"
|
||||
|
||||
imagePullSecrets: []
|
||||
|
||||
serviceAccount:
|
||||
create: false
|
||||
name: ""
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podSecurityContext: {}
|
||||
|
||||
securityContext: {}
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8545
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
hosts: []
|
||||
tls: []
|
||||
|
||||
resources: {}
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 100
|
||||
targetCPUUtilizationPercentage: 80
|
||||
|
||||
nodeSelector: {}
|
||||
tolerations: []
|
||||
affinity: {}
|
5
deploy/kubernetes/charts/monero/Chart.yaml
Normal file
5
deploy/kubernetes/charts/monero/Chart.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
apiVersion: v2
|
||||
name: monero
|
||||
description: A Helm chart for monero-daemon
|
||||
type: application
|
||||
version: 0.1.0
|
42
deploy/kubernetes/charts/monero/templates/_helpers.tpl
Normal file
42
deploy/kubernetes/charts/monero/templates/_helpers.tpl
Normal file
|
@ -0,0 +1,42 @@
|
|||
{{- define "monero.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "monero.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 253 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "monero.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "monero.labels" -}}
|
||||
helm.sh/chart: {{ include "monero.chart" . }}
|
||||
{{ include "monero.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "monero.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "monero.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "monero.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "monero.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
7
deploy/kubernetes/charts/monero/templates/configmap.yaml
Normal file
7
deploy/kubernetes/charts/monero/templates/configmap.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-configmap
|
||||
data:
|
||||
entry-dev.sh: |
|
||||
{{ .Values.configMapFile | b64dec | indent 4}}
|
88
deploy/kubernetes/charts/monero/templates/deployment.yaml
Normal file
88
deploy/kubernetes/charts/monero/templates/deployment.yaml
Normal file
|
@ -0,0 +1,88 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "monero.fullname" . }}
|
||||
labels:
|
||||
{{- include "monero.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "monero.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "monero.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "monero.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if hasKey .Values.image "ports" }}
|
||||
ports:
|
||||
{{- range .Values.image.ports }}
|
||||
- name: {{ .name }}
|
||||
containerPort: {{ .containerPort }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "command" }}
|
||||
command:
|
||||
{{- toYaml .Values.image.command | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "args" }}
|
||||
args:
|
||||
{{- toYaml .Values.image.args | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "envVariables" }}
|
||||
env:
|
||||
{{- toYaml .Values.image.envVariables | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "volumeMounts" }}
|
||||
volumeMounts:
|
||||
{{- range .Values.image.volumeMounts }}
|
||||
- mountPath: {{ .mountPath }}
|
||||
name: {{ $.Release.Name}}-{{ .name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if hasKey .Values "volumes" }}
|
||||
volumes:
|
||||
{{- range .Values.volumes }}
|
||||
- configMap:
|
||||
defaultMode: {{ .configMap.defaultMode }}
|
||||
name: {{ $.Release.Name}}-{{ .configMap.name }}
|
||||
name: {{ $.Release.Name}}-{{ .name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
50
deploy/kubernetes/charts/monero/templates/ingress.yaml
Normal file
50
deploy/kubernetes/charts/monero/templates/ingress.yaml
Normal file
|
@ -0,0 +1,50 @@
|
|||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "monero.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "monero.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
{{- if .pathType }}
|
||||
pathType: {{ .pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
24
deploy/kubernetes/charts/monero/templates/service.yaml
Normal file
24
deploy/kubernetes/charts/monero/templates/service.yaml
Normal file
|
@ -0,0 +1,24 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "monero.fullname" . }}
|
||||
labels:
|
||||
{{- include "monero.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
{{- if hasKey .Values.service "ports" }}
|
||||
{{- range .Values.service.ports }}
|
||||
- port: {{ .port }}
|
||||
name: {{ .name }}
|
||||
targetPort: {{ .targetPort }}
|
||||
protocol: {{ .protocol }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "monero.selectorLabels" . | nindent 4 }}
|
72
deploy/kubernetes/charts/monero/values.yaml
Normal file
72
deploy/kubernetes/charts/monero/values.yaml
Normal file
|
@ -0,0 +1,72 @@
|
|||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: serai-dev-monero
|
||||
pullPolicy: IfNotPresent
|
||||
tag: "latest"
|
||||
ports:
|
||||
- name: p2p
|
||||
containerPort: 18080
|
||||
protocol: TCP
|
||||
- name: rpc
|
||||
containerPort: 18081
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- mountPath: /scripts
|
||||
name: configmap-volume
|
||||
args:
|
||||
- bash
|
||||
- /scripts/entry-dev.sh
|
||||
|
||||
volumes:
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: configmap
|
||||
name: configmap-volume
|
||||
|
||||
configMapFile: "entry-dev.sh"
|
||||
|
||||
imagePullSecrets: []
|
||||
|
||||
serviceAccount:
|
||||
create: false
|
||||
name: ""
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podSecurityContext: {}
|
||||
|
||||
securityContext: {}
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: p2p
|
||||
port: 18080
|
||||
targetPort: p2p
|
||||
protocol: TCP
|
||||
- name: rpc
|
||||
port: 18081
|
||||
targetPort: rpc
|
||||
protocol: TCP
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
hosts: []
|
||||
tls: []
|
||||
|
||||
resources: {}
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 100
|
||||
targetCPUUtilizationPercentage: 80
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
5
deploy/kubernetes/charts/serai/Chart.yaml
Normal file
5
deploy/kubernetes/charts/serai/Chart.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
apiVersion: v2
|
||||
name: serai
|
||||
description: A Helm chart for serai
|
||||
type: application
|
||||
version: 0.1.0
|
42
deploy/kubernetes/charts/serai/templates/_helpers.tpl
Normal file
42
deploy/kubernetes/charts/serai/templates/_helpers.tpl
Normal file
|
@ -0,0 +1,42 @@
|
|||
{{- define "serai-base.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "serai-base.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 253 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "serai-base.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "serai-base.labels" -}}
|
||||
helm.sh/chart: {{ include "serai-base.chart" . }}
|
||||
{{ include "serai-base.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "serai-base.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "serai-base.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "serai-base.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "serai-base.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
7
deploy/kubernetes/charts/serai/templates/configmap.yaml
Normal file
7
deploy/kubernetes/charts/serai/templates/configmap.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-configmap
|
||||
data:
|
||||
entry-dev.sh: |
|
||||
{{ .Values.configMapFile | b64dec | indent 4}}
|
88
deploy/kubernetes/charts/serai/templates/deployment.yaml
Normal file
88
deploy/kubernetes/charts/serai/templates/deployment.yaml
Normal file
|
@ -0,0 +1,88 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "serai-base.fullname" . }}
|
||||
labels:
|
||||
{{- include "serai-base.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "serai-base.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "serai-base.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "serai-base.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if hasKey .Values.image "ports" }}
|
||||
ports:
|
||||
{{- range .Values.image.ports }}
|
||||
- name: {{ .name }}
|
||||
containerPort: {{ .containerPort }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "command" }}
|
||||
command:
|
||||
{{- toYaml .Values.image.command | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "args" }}
|
||||
args:
|
||||
{{- toYaml .Values.image.args | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "envVariables" }}
|
||||
env:
|
||||
{{- toYaml .Values.image.envVariables | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.image "volumeMounts" }}
|
||||
volumeMounts:
|
||||
{{- range .Values.image.volumeMounts }}
|
||||
- mountPath: {{ .mountPath }}
|
||||
name: {{ $.Release.Name}}-{{ .name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if hasKey .Values "volumes" }}
|
||||
volumes:
|
||||
{{- range .Values.volumes }}
|
||||
- configMap:
|
||||
defaultMode: {{ .configMap.defaultMode }}
|
||||
name: {{ $.Release.Name}}-{{ .configMap.name }}
|
||||
name: {{ $.Release.Name}}-{{ .name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
50
deploy/kubernetes/charts/serai/templates/ingress.yaml
Normal file
50
deploy/kubernetes/charts/serai/templates/ingress.yaml
Normal file
|
@ -0,0 +1,50 @@
|
|||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "serai-base.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "serai-base.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
{{- if .pathType }}
|
||||
pathType: {{ .pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
24
deploy/kubernetes/charts/serai/templates/service.yaml
Normal file
24
deploy/kubernetes/charts/serai/templates/service.yaml
Normal file
|
@ -0,0 +1,24 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "serai-base.fullname" . }}
|
||||
labels:
|
||||
{{- include "serai-base.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
{{- if hasKey .Values.service "ports" }}
|
||||
{{- range .Values.service.ports }}
|
||||
- port: {{ .port }}
|
||||
name: {{ .name }}
|
||||
targetPort: {{ .targetPort }}
|
||||
protocol: {{ .protocol }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "serai-base.selectorLabels" . | nindent 4 }}
|
92
deploy/kubernetes/charts/serai/values.yaml
Normal file
92
deploy/kubernetes/charts/serai/values.yaml
Normal file
|
@ -0,0 +1,92 @@
|
|||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: serai
|
||||
pullPolicy: IfNotPresent
|
||||
tag: "dev"
|
||||
ports:
|
||||
- name: p2p
|
||||
containerPort: 30333
|
||||
protocol: TCP
|
||||
- name: prometheus
|
||||
containerPort: 9615
|
||||
protocol: TCP
|
||||
- name: rpc
|
||||
containerPort: 9933
|
||||
protocol: TCP
|
||||
- name: ws
|
||||
containerPort: 9944
|
||||
protocol: TCP
|
||||
|
||||
volumeMounts:
|
||||
- mountPath: /scripts
|
||||
name: configmap-volume
|
||||
envVariables:
|
||||
- name: CHAIN
|
||||
value: dev
|
||||
- name: NAME
|
||||
value: base
|
||||
- name: VALIDATOR
|
||||
value:
|
||||
args:
|
||||
- bash
|
||||
- /scripts/entry-dev.sh
|
||||
|
||||
volumes:
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: configmap
|
||||
name: configmap-volume
|
||||
|
||||
configMapFile: "entry-dev.sh"
|
||||
|
||||
imagePullSecrets: []
|
||||
|
||||
serviceAccount:
|
||||
create: false
|
||||
name: ""
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podSecurityContext: {}
|
||||
|
||||
securityContext: {}
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: p2p
|
||||
port: 30333
|
||||
targetPort: p2p
|
||||
protocol: TCP
|
||||
- name: prometheus
|
||||
port: 9615
|
||||
targetPort: prometheus
|
||||
protocol: TCP
|
||||
- name: rpc
|
||||
port: 9933
|
||||
targetPort: rpc
|
||||
protocol: TCP
|
||||
- name: ws
|
||||
port: 9944
|
||||
targetPort: ws
|
||||
protocol: TCP
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
hosts: []
|
||||
tls: []
|
||||
|
||||
resources: {}
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 100
|
||||
targetCPUUtilizationPercentage: 80
|
||||
|
||||
nodeSelector: {}
|
||||
tolerations: []
|
||||
affinity: {}
|
Loading…
Reference in a new issue