benchmark: add k8s helm charts and deployment scripts

This commit is contained in:
Alan Chen 2017-06-28 11:17:23 +08:00
parent 45dc130cbe
commit d8e11988a4
74 changed files with 1671 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#!/usr/bin/env python
from subprocess import call
for v in range(0, 22, 1):
call(["helm" ,"delete", "--purge", "validator-{}".format(v)])

View File

@ -0,0 +1,6 @@
#!/usr/bin/env python
from subprocess import call
for v in range(0, 22, 1):
call(["helm" ,"install", "-n", "validator-{}".format(v), "-f", "values.validator-{}.yaml".format(v), "validator"])

View File

@ -0,0 +1,21 @@
# 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

View File

@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart for eth-netstats
name: eth-netstats
version: 0.1.0

View File

@ -0,0 +1,15 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT/login
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }}
{{- end }}

View File

@ -0,0 +1,23 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 24 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s" $name | trunc 24 | trimSuffix "-" -}}
{{- end -}}
{{/*
Deployment environment
*/}}
{{- define "environment" -}}
{{- default .Release.Namespace -}}
{{- end -}}

View File

@ -0,0 +1,31 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ template "fullname" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.internalPort }}
name: websocket
env:
- name: WS_SECRET
value: {{ .Values.secret }}
resources:
{{ toYaml .Values.resources | indent 12 }}

View File

@ -0,0 +1,12 @@
kind: Secret
apiVersion: v1
metadata:
name: "{{ template "name" . }}-wssecret"
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
type: Opaque
data:
secret: {{ .Values.secret | b64enc }}

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: {{ .Values.service.internalPort }}
protocol: TCP
name: {{ .Values.service.name }}
selector:
app: {{ template "fullname" . }}

View File

@ -0,0 +1,15 @@
# Default values for eth-netstats.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: quay.io/maicoin/eth-netstats
tag: latest
pullPolicy: Always
service:
name: eth-netstats
type: LoadBalancer
externalPort: 3000
internalPort: 3000
secret: bb98a0b6442386d0cdf8a31b267892c1

View File

@ -0,0 +1,21 @@
# 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

View File

@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart for Ethereum genesis block
name: genesis-block
version: 0.1.0

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 AMIS Technologies
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,14 @@
# Installation
```shell
helm install \
-n development-genesis-block \
kubernetes/amis/development/genesis-block
```
# Upgrading a release
```shell
helm upgrade development-genesis-block \
kubernetes/amis/development/genesis-block
```

View File

@ -0,0 +1,40 @@
{
"config": {
"chainId": 2016,
"istanbul": {}
},
"nonce": "0x0000000000000000",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f90269f902229444add0ec310f115a0e603b2d7db9f067778eaf8a94294fc7e8f22b3bcdcf955dd7ff3ba2ed833f8212946beaaed781d2d2ab6350f5c4566a2c6eaac407a6948be76812f765c24641ec63dc2852b378aba2b440942d7c641c6262bdcf9865abeab65d2e84f9422737941e5606129f4f66e423521e2e8f7a91c446e6e57f94c532f7389fbb38d78da6b190a826b0c6472aefbf94b8138e4d5e227a84aaccf191f3d630ed28f3d3b094cf02a3ed043de0328bfea296d6473bdb7552ae11941010168c4238c67499d856cd106518ff5d07a107940dc89d887084868ad0226fd5d70303e4a290bcdf94b9330a665be281bd876470dbdc32af29ac7066be940037444eafd0d07c0875ae6d8c5c771d9ea7d9ad9455d6388e779d86ac4d337a8c14044e7b9b651de794d647363309491b88a660666e32cb265bc1fb22d594a0b190776c1250ac80f641e7becdd8675706947e9406decb8344fa751ee5727f9ced725d6a389b5b339405c870381cf8885356021d407c6f708b8db88d62947d33f0c170b2a265333c78e9d048b73d9261398f9463883b2b85d8572bcc7dd36e2faa26cbc7f467949443e55168e3f6a7690c2cd001d42b5ff1f7e0f9a79447704f9ded61edb89ea473d07889a1dd6b919e3e948b4d0062bc66754f01121a3e984c1dbde4320e62948d135f91276ee2405aa8de49177a28d7eb9f641c94176a43885dcc21f42205d6a1cc115c4abfb5bf83943349c7e0a53e8c80f12cb183cc779a22d4c6b68fb8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0",
"gasLimit": "0x1908b100",
"difficulty": "0x1",
"mixhash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"0x1a9afb711302c5f83b5902843d1c007a1a137632": {
"balance": "999900000000000000000000000000000000000000000"
},
"0x26c7ea56af25113f712befbf2077798fd7fbdb7c": {
"balance": "999900000000000000000000000000000000000000000"
},
"0xa4137d4ad166ae825f1b8dbb0c3d48f25f172e9e": {
"balance": "999900000000000000000000000000000000000000000"
},
"0xf5aee8f402a330bbdb5063080c31ff2df47dbb0a": {
"balance": "999900000000000000000000000000000000000000000"
},
"0xcce903202b149c677f91d30dddf83d05a741871a": {
"balance": "999900000000000000000000000000000000000000000"
},
"0xcc09b0634677b41668e6386844233528cee0a7d5": {
"balance": "999900000000000000000000000000000000000000000"
},
"0x3e28ea543417edafa7625e823d35e20b09115baa": {
"balance": "999900000000000000000000000000000000000000000"
},
"0x507a198251ed29f421bd6cf667596f750d9b14ec": {
"balance": "999900000000000000000000000000000000000000000"
}
}
}

View File

@ -0,0 +1 @@
Genesis block for {{ template "environment" . }} is deployed.

View File

@ -0,0 +1,23 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name | trunc 24 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name -}}
{{- printf "%s" $name | trunc 24 | trimSuffix "-" -}}
{{- end -}}
{{/*
Deployment environment
*/}}
{{- define "environment" -}}
{{- default .Release.Namespace -}}
{{- end -}}

View File

@ -0,0 +1,12 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: "{{ template "fullname" . }}"
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
data:
{{ $path := .Values.genesisFileName }}
{{ (.Files.Glob $path).AsConfig | indent 2 }}

View File

@ -0,0 +1,4 @@
# Default values for genesis-block.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
genesisFileName: genesis.json

View File

@ -0,0 +1,21 @@
# 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

View File

@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart for Ethereum static nodes
name: static-nodes
version: 0.1.0

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 AMIS Technologies
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,28 @@
[
"enode://52870b1bb7874e4ebffd708fbdea7add773912c000e54e5b504ea01ecd956ecb2b54ea4b2076fcfbd24121209dfe97ca8b6368926ce1956e53f63fd20c0e29d7@10.0.1.2:30303",
"enode://c8fa7bd31ac2bd271fbbc7c5503bff29a94b8301bac5fa5ab7e8787672febc0541926dcb5d8698ef36e66ccba84ef071ee1d29f9aebc9e6bbf4cfeb4e4dce8ad@10.0.1.3:30303",
"enode://a5a6c556e7ac360e8f2eee5d03c11f447c3d918d73692958695b429b9f0d67fbcb817aea2c169d7abd5a80bbae2adf6bf7e0237c8f78d93d6a82a27efe12ec57@10.0.1.4:30303",
"enode://5cd6270a6317e8bb1c8a70e5041260ae2864dc35103d27e129c6b0f9cf657cf3db866199a528b33d0ffb48f4e71b1ec8a01102e753cd527afa9c2ba3dfd4515d@10.0.1.5:30303",
"enode://d4812d13f650cc200203b3e1758dd17a51c38cefb0e68e1c366b9a4771a6e4dc51bd08920a6429fe0d5a889472643c8928a7cbe8fc846edf72b08d753d59a5f2@10.0.1.6:30303",
"enode://2554e0cff192cd5fe9809dee4e16eea1b69bd4cced1f55e239e882b6aa70b00c2b993eb05d4115539cdfe66af6628f4824fa7ade00eae45252febd08418c58ae@10.0.1.7:30303",
"enode://66e9928f4beb7ddd96884f9f524fc6c883f73cabb6cbc74513dee70e6849a7c0a0abf2eb213e99515f27ba3f748565ad1a53a14bf00c32c12df323cc59587256@10.0.1.8:30303",
"enode://4d2e3431085c468f0157d29d812f8924b9e04c67ba484f22935a0522f0a4791fdb8e52968c64069820edd168ae372b1fb5563cff402d36b25cecad9a5c921333@10.0.1.9:30303",
"enode://e94ed270c20a80ac459c57545f8aef1e08819d17586677c607ed224f25e5272ab42d32c3ca80eac7dd06559f5c1bb7c33db26916e207e883c99668736219c10d@10.0.1.10:30303",
"enode://90a4000e2578b7cf1326860a7ee142977e74ae21d0fa4f905e4e6c1efb76dc9bca2b707d9db5fec7002906cc99eec4d1a8cd7b9622da2e7043d1bb8bfb92e8b2@10.0.1.11:30303",
"enode://2c6bdf47b5ca1e79148ce495a11f3b3314ce9241c42f2db923bb089f1d39176da948eaec56000541a0f3d863f6cb1ff934717244fa90e9b371d5f9d6e9106508@10.0.1.12:30303",
"enode://29c4e19608ea6d739bff638c18f87be9bc73d5c5dbae6fd81890fba3b0abeb850c8bf3ce042e71f8f9cb11273fb09a818fddd011dc86d2fdddd799854f7ea9a2@10.0.1.13:30303",
"enode://65752b55e9eb3b84b9ca91e7000c9d194d2c9d2b9d1844e752b9f105666cba0e3358b4e2c97fd054e0a91377ca1c3369a5d51b205b30e0c1f87684364ce84fdc@10.0.1.14:30303",
"enode://58f14adbcf59a463dc0cec38d8dd74462d564c7213450322445a06935cb3edb97e8dc02a42fa22770845013d02f5e365765737dbd488802b350d5116ca8c4a6d@10.0.1.15:30303",
"enode://9d3ce64ca351d87796d9ae2c92745c0df018ccb0ef60071a55dec2d7a4a39e0ac8ce46c3a6ae4d01c5f71d05ef49be91081bfb9fbd2b5deeae5a539685b660aa@10.0.1.16:30303",
"enode://baeb3ad18957223a1ae649f571589a14bab93f4d81b4d6cd5068694ad309c0fb0113a974babc75a95c2a9e3248424bb5a760be6254c5ee8416735a71abb27c6a@10.0.1.17:30303",
"enode://f677bf74ddfc95d7ffa01efba3ca2b6bb854a33bcf99db7bd2a3822415af63b8da91905caa348d50d75ddabd7be591acd44c6e5e8de83d577ee3a38af35a2b47@10.0.1.18:30303",
"enode://d80fe433e36708cd50ad6f7643968360fcb5ea7ac7254562eb67cad498cc963a09149d96bc670fa978c122e7a6fc14bf327d31dcdbae46c784df6cef3566ec28@10.0.1.19:30303",
"enode://a8ae59ec25fa66f9daff25e5e9b561b8923716d21b350bc931e35b8e27414c39530de338f490f64a1e924c92a0cb221060e72bfd03a4fa6cb1cebb06e5a86f91@10.0.1.20:30303",
"enode://231497fb7f4570f1dd00f39e9d3a8cc9d54eb386f87ac670496a4fdc5f8fd4224d5d34277f96a252cfcf42e32a280d58d4fa46ba5da2ef044c3525d9dae726d3@10.0.1.21:30303",
"enode://38ac02bc42d5c9b97cbc13772fe4bb2e32e1ba2919a15c36a1f23ae79652fd479b0394b0936b7aa6589e4d2c85dcbc5d76ec52df417c899cfb83d5b53a3dc937@10.0.1.22:30303",
"enode://c4b8cb1c888aec3b3de5cd4e7287e292b14f54473e352650f852cee82a7796d70f6ddf4a51679b82d8c0a5c1d7347f81600cbdaec4048771b7043d2be2266ec5@10.0.1.23:30303",
"enode://4428b4ad8a35b87c9dd424e3485294d10e7934cc1faa102a6f84e696aba0956f86d76332c98e0b122dda332f28b2a54a67321fbb2624f3318fdd22e7c54aa7a0@10.0.1.24:30303",
"enode://25d7962a45382a337c5125bf36a655650358b047b09c85bc8d35e8707c45b329ac84a93ccae370d0f4f5f06c34b1549c9e49f9ca8e96ebe869f3f5c43b135d7b@10.0.1.25:30303",
"enode://795c9d0608d53b6e222797eff7806304b8156f552dadd349c81ad2fc72daeb98e44887b714c642685b0963cf48bf1b9e5d4a016c1dd5c0e3a66e55bb51418ef3@10.0.1.26:30303",
"enode://7053030ab8e4b57f56eef7bd4e2efd7d54e423fa07e4ccdc93ac4bd912d11ff680307dbe80e84aa6aec8574219b726b8655edc96fd314f703b71b6aeee096266@10.0.1.27:30303"
]

View File

@ -0,0 +1,28 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name | trunc 24 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := .Chart.Name -}}
{{- printf "%s" $name | trunc 24 | trimSuffix "-" -}}
{{- end -}}
{{/*
Deployment environment
*/}}
{{- define "environment" -}}
{{- default .Release.Namespace -}}
{{- end -}}
{{- define "staticNodes" -}}
{{- $path := .Values.fileName -}}
{{- (.Files.Glob $path).AsConfig | indent 2 -}}
{{- end -}}

View File

@ -0,0 +1,13 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: "{{ template "fullname" . }}"
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
data:
{{- if .Values.fileName }}
{{ template "staticNodes" . }}
{{- end }}

View File

@ -0,0 +1,4 @@
# Default values for genesis-block.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
fileName: "static-nodes.json"

View File

@ -0,0 +1,21 @@
# 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

View File

@ -0,0 +1,10 @@
name: transactor
home: https://github.com/maichain/mchain_service
apiVersion: v1
description: A reference Helm chart for Ethereum transactor
maintainers:
- name: Alan Chen
email: alan@am.is
version: 0.2.3
sources:
- https://github.com/maichain/mchain_service/kubernetes/amis/generic/transactor

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 AMIS Technologies
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,74 @@
# Validator Helm Chart
A validator is an Ethereum client to validate transactions and generate blocks.
## Prerequisites
* [StatefulSets](https://kubernetes.io/docs/concepts/abstractions/controllers/statefulsets/) support
* Dynamically provisioned persistent volumes
## Installing the Chart
To install the chart:
```bash
helm install \
--name ${DEPLOYMENT_ENVIRONMENT}-transactor-${NAME} \
kubernetes/amis/generic/validator
```
## Configuration
The following tables lists the configurable parameters of the transactor chart and their default values.
| Parameter | Description | Default |
| ------------------------------- | ------------------------------------------------- | ---------------------------------------------------------- |
| `service.type` | The Kubernetes service type | `ClusterIP` |
| `service.externalPeerPort` | Exposed Ethereum P2P port | `30303` |
| `service.ExternalRPCPort` | Exposed Ethereum RPC port | `8545` |
| `service.ExternalWSPort` | Exposed Ethereum WebSocket port | `8546` |
| `replicaCount` | Kubernetes statefulset replicas | `1` |
| `image.repository` | Docker image repository | `ethereum/client-go` |
| `image.tag` | Docker image tag | `alpine` |
| `image.pullPolicy` | Docker image pulling policy | `Always` |
| `ethereum.identity` | Custom node name | `$POD_NAME` |
| `ethereum.port` | Network listening port | `30303` |
| `ethereum.networkID` | Network identifier | `12345` |
| `ethereum.cache` | Megabytes of memory allocated to internal caching | `512` |
| `ethereum.rpc.enabled` | Enable the HTTP-RPC server | `false` |
| `ethereum.rpc.addr` | HTTP-RPC server listening interface | `localhost` |
| `ethereum.rpc.port` | HTTP-RPC server listening port | `8545` |
| `ethereum.rpc.api` | API's offered over the HTTP-RPC interface | `"eth,net,web3,personal"` |
| `ethereum.rpc.corsdomain` | Comma separated list of domains from which to accept cross origin requests | `*` |
| `ethereum.ws.enabled` | Enable the WS-RPC server | `false` |
| `ethereum.ws.addr` | WS-RPC server listening interface | `localhost` |
| `ethereum.ws.port` | WS-RPC server listening port | `8546` |
| `ethereum.ws.api` | API's offered over the WS-RPC interface | `"eth,net,web3,personal"` |
| `ethereum.ws.origins` | Origins from which to accept websockets requests | `*` |
| `ethereum.mining.enabled` | Enable mining | `true` |
| `ethereum.mining.threads` | Number of CPU threads to use for mining | `2` |
| `ethereum.mining.etherbase` | Public address for block mining rewards | `"1a9afb711302c5f83b5902843d1c007a1a137632"` |
| `ethereum.ethstats.enabled` | Enable ethstats reporting | `true` |
| `ethereum.ethstats.addr` | Ethstats service address | `ws://eth-netstats` |
| `ethereum.ethstats.port` | Ethstats service port | `3000` |
| `ethereum.ethstats.secret` | Ethstats service websocket secret | `bb98a0b6442386d0cdf8a31b267892c1` |
| `ethereum.nodekey.hex` | P2P node key as hex | `aaaaaaaaaaaaaa5302ccdd5b6ffa092e148ba497e352c2824f366ec399072068` |
| `ethereum.account.address` | Account address assigned to the validator | `1a9afb711302c5f83b5902843d1c007a1a137632` |
| `ethereum.account.data` | Full account data file as JSON string | `{"address":"1a9afb711302c5f83b5902843d1c007a1a137632","Crypto":{"cipher":"aes-128-ctr","ciphertext":"132b50d7c8944a115824de7c00911c40a90f84f27c614b7a3ef05ee8fd414312","cipherparams":{"iv":"0f745599d1b3303988ce210fb82b8c7f"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"bce940bac232b4a9c5a2d50e5be51fde5cecfa7da9d49d8f650f91167bebf0de"},"mac":"36d515070b797aec58a574a3e04ea109498ee7674b15d7f952322cda7dcb68e3"},"id":"5d212b4c-3dd0-4c52-a32f-e42bf1b41133","version":3}` |
| `volumes.chaindir.size` | The maximum size usage of Ethereum data directory | `10Gi` |
| `volumes.chaindir.storageClass` | The Kubernetes storage class of Ethereum data | `$NAMESPACE-chaindata` |
| `global.computingSpec` | The computing spec level of node to schedule | `low` |
| `global.nodeType` | The type of node to schedule | `generic` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```bash
helm install \
--name ${DEPLOYMENT_ENVIRONMENT}-validator-${NAME} \
-f values.yaml \
kubernetes/amis/generic/validator
```
> **Tip**: You can use the default [values.yaml](values.yaml)

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,23 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name | trunc 60 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 60 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := .Values.nameOverride -}}
{{- printf "%s-%s" .Chart.Name $name | trunc 60 | trimSuffix "-" -}}
{{- end -}}
{{/*
Deployment environment
*/}}
{{- define "environment" -}}
{{- default .Release.Namespace -}}
{{- end -}}

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Secret
metadata:
name: "{{ template "fullname" . }}-secret"
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
type: Opaque
data:
azurestorageaccountname: {{ .Values.volumes.keystore.azureStorageAccountName | b64enc }}
azurestorageaccountkey: {{ .Values.volumes.keystore.azureStorageAccountKey | b64enc }}

View File

@ -0,0 +1,33 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
spec:
type: {{ .Values.service.type }}
{{- if .Values.service.staticIP }}
clusterIP: {{ .Values.service.staticIP | quote }}
{{- end }}
ports:
- port: {{ .Values.service.externalPeerPort }}
targetPort: {{ .Values.ethereum.port }}
protocol: TCP
name: peer
{{- if .Values.ethereum.rpc.enabled }}
- port: {{ .Values.service.externalRPCPort }}
targetPort: {{ .Values.ethereum.rpc.port }}
protocol: TCP
name: rpc
{{- end }}
{{- if .Values.ethereum.ws.enabled }}
- port: {{ .Values.service.externalWSPort }}
targetPort: {{ .Values.ethereum.ws.port }}
protocol: TCP
name: ws
{{- end }}
selector:
app: {{ template "fullname" . }}

View File

@ -0,0 +1,240 @@
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: {{ template "fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
spec:
serviceName: {{ template "fullname" . }}
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "init-genesis",
"image": "{{ .Values.image.repository }}:{{ .Values.image.tag }}",
"imagePullPolicy": "{{ .Values.image.pullPolicy }}",
"command": [
"geth",
"--datadir",
"{{ .Values.volumes.chaindir.mountPath }}",
"init",
"{{ .Values.genesis.mountPath }}/{{ .Values.genesis.fileName }}"
],
"volumeMounts": [
{
"name": "data",
"mountPath": "{{ .Values.volumes.chaindir.mountPath }}"
},
{
"name": "genesis",
"mountPath": "{{ .Values.genesis.mountPath }}"
}
]
},
{
"name": "copy-files",
"image": "library/busybox",
"imagePullPolicy": "IfNotPresent",
"command": [
"sh",
"-c",
"cp {{ .Values.ethereum.staticNodes.mountPath }}/static-nodes.json {{ .Values.volumes.chaindir.mountPath }}/"
],
"volumeMounts": [
{
"name": "data",
"mountPath": "{{ .Values.volumes.chaindir.mountPath }}"
},
{
"name": "static-nodes",
"mountPath": "{{ .Values.ethereum.staticNodes.mountPath }}"
}
]
}
]'
spec:
terminationGracePeriodSeconds: 10
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["geth"]
args:
- --datadir
- "{{ .Values.volumes.chaindir.mountPath }}"
- --keystore
- "{{ .Values.volumes.keystore.mountPath }}"
- --port
- "{{ .Values.ethereum.port }}"
- --nat
- any
- --fast
- --nodiscover
- --identity
- "{{ default "$(POD_NAME)" .Values.ethereum.identity }}"
{{- if .Values.ethereum.networkID }}
- --networkid
- "{{ .Values.ethereum.networkID }}"
{{- end }}
{{- if .Values.ethereum.useTestNet }}
- --testnet
{{- end }}
{{- if .Values.ethereum.useDeveloperMode }}
- --dev
{{- end }}
{{- if .Values.ethereum.cache }}
- --cache
- "{{ .Values.ethereum.cache }}"
{{- end }}
{{- if .Values.ethereum.rpc.enabled }}
- --rpc
- --rpcaddr
- "{{ .Values.ethereum.rpc.addr }}"
- --rpcport
- "{{ .Values.ethereum.rpc.port }}"
- --rpcapi
- "{{ .Values.ethereum.rpc.api }}"
- --rpccorsdomain
- "{{ .Values.ethereum.rpc.corsdomain }}"
{{- end }}
{{- if .Values.ethereum.ws.enabled }}
- --ws
- --wsaddr
- "{{ .Values.ethereum.ws.addr }}"
- --wsport
- "{{ .Values.ethereum.ws.port }}"
- --wsapi
- "{{ .Values.ethereum.ws.api }}"
- --wsorigins
- "{{ .Values.ethereum.ws.origins }}"
{{- end }}
{{- if .Values.ethereum.mining.etherbase }}
- --etherbase
- "{{ .Values.ethereum.mining.etherbase }}"
{{- end }}
{{- if .Values.ethereum.mining.enabled }}
- --mine
- --minerthreads
- "{{ .Values.ethereum.mining.threads }}"
{{- end }}
{{- if .Values.ethereum.ethstats.enabled }}
- --ethstats
- "$(POD_NAME):{{ .Values.ethereum.ethstats.secret }}@{{ .Values.ethereum.ethstats.addr }}.{{ template "environment" . }}:{{ .Values.ethereum.ethstats.port }}"
{{- end }}
{{- if .Values.benchmark.gasprice }}
- --gasprice
- {{ .Values.benchmark.gasprice | quote }}
- --txpool.pricelimit
- {{ .Values.benchmark.gasprice | quote }}
{{- end }}
{{- if .Values.benchmark.targetgaslimit }}
- --targetgaslimit
- {{ .Values.benchmark.targetgaslimit | quote }}
{{- end }}
{{- if .Values.benchmark.txpool.globalslots }}
- --txpool.globalslots
- {{ .Values.benchmark.txpool.globalslots | quote }}
{{- end }}
{{- if .Values.benchmark.txpool.accountslots }}
- --txpool.accountslots
- {{ .Values.benchmark.txpool.accountslots | quote }}
{{- end }}
{{- if .Values.benchmark.txpool.globalqueue }}
- --txpool.globalqueue
- {{ .Values.benchmark.txpool.globalqueue | quote }}
{{- end }}
{{- if .Values.benchmark.txpool.accountqueue }}
- --txpool.accountqueue
- {{ .Values.benchmark.txpool.accountqueue | quote }}
{{- end }}
- --metrics
{{- if .Values.benchmark.prometheus.url }}
- --promaddr
- {{ .Values.benchmark.prometheus.url }}
{{- end }}
- --debug
- --maxpeers
- "100"
ports:
- containerPort: {{ .Values.ethereum.port }}
name: peer
{{- if .Values.ethereum.rpc.enabled }}
- containerPort: {{ .Values.ethereum.rpc.port }}
name: rpc
{{- end }}
{{- if .Values.ethereum.ws.enabled }}
- containerPort: {{ .Values.ethereum.ws.port }}
name: ws
{{- end }}
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
livenessProbe:
exec:
command:
- "geth"
- "--exec"
- "eth.blockNumber"
- "attach"
{{- if .Values.ethereum.ipc.path }}
- {{ .Values.ethereum.ipc.path | quote }}
{{- else }}
- "{{ .Values.volumes.chaindir.mountPath }}/geth.ipc"
{{- end }}
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
readinessProbe:
exec:
command:
- "geth"
- "--exec"
- "eth.blockNumber"
- "attach"
{{- if .Values.ethereum.ipc.path }}
- {{ .Values.ethereum.ipc.path | quote }}
{{- else }}
- "{{ .Values.volumes.chaindir.mountPath }}/geth.ipc"
{{- end }}
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
volumeMounts:
- name: data
mountPath: "{{ .Values.volumes.chaindir.mountPath }}"
- name: keystore
mountPath: "{{ .Values.volumes.keystore.mountPath }}"
volumes:
- name: genesis
configMap:
name: {{ .Values.genesis.config }}
- name: keystore
azureFile:
secretName: "{{ template "fullname" . }}-secret"
shareName: "keystore"
readOnly: {{ .Values.volumes.keystore.readOnly }}
- name: static-nodes
configMap:
name: {{ .Values.ethereum.staticNodes.config }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: {{ .Values.volumes.chaindir.size }}

View File

@ -0,0 +1,85 @@
# Default values for validator.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
nameOverride: "istanbul"
# service.yaml
service:
type: LoadBalancer
externalPeerPort: 30303
externalRPCPort: 8545
externalWSPort: 8546
# statefulset.yaml
replicaCount: 1
image:
repository: quay.io/maicoin/ottoman_geth
tag: prometheus
pullPolicy: Always
ethereum:
identity: ""
port: 30303
useTestNet: false
useDeveloperMode: false
networkID: 12345 # 0=Olympic (disused), 1=Frontier, 2=Morden (disused), 3=Ropsten) (default: 1)
cache: 512
ipc:
enabled: true
path: ""
rpc:
enabled: true
addr: 0.0.0.0
port: 8545
api: "eth,net,web3,personal"
corsdomain: "*"
ws:
enabled: true
addr: 0.0.0.0
port: 8546
api: "eth,net,web3,personal"
origins: "*"
mining:
enabled: false
threads: 1
etherbase: "1a9afb711302c5f83b5902843d1c007a1a137632"
staticNodes:
config: static-nodes
mountPath: "/staticNodes"
ethstats:
enabled: true
addr: ws://eth-netstats
port: 3000
secret: bb98a0b6442386d0cdf8a31b267892c1
volumes:
chaindir:
name: chaindir
size: 1000Gi
mountPath: "/data"
storageClass: ""
keystore:
name: azureFile
size: 10Gi
mountPath: "/keystore"
readOnly: false
azureStorageAccountName: "00tfesixb6x7pioagnt0"
azureStorageAccountKey: "wbZvXCskwCaSVuyo56svXCse3hL/kgN8ZrCx3KCp0X2g8Nhd7XwpyMfueE0VMqX0cdwXh4ILX2KpLgjMa7nzPg=="
genesis:
config: genesis-block
mountPath: "/genesis"
fileName: "genesis.json"
# Geth parameters for benchmark
benchmark:
gasprice: "0"
targetgaslimit: "500000000"
txpool:
globalslots: "4096"
accountslots: "4096"
globalqueue: "2048"
accountqueue: "2048"
prometheus:
url: http://52.163.252.208:9091

View File

@ -0,0 +1,21 @@
# 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

View File

@ -0,0 +1,10 @@
name: validator
home: https://github.com/maichain/mchain_service
apiVersion: v1
description: A reference Helm chart for Ethereum validator
maintainers:
- name: Alan Chen
email: alan@am.is
version: 0.2.3
sources:
- https://github.com/maichain/mchain_service/kubernetes/amis/generic/validator

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 AMIS Technologies
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,74 @@
# Validator Helm Chart
A validator is an Ethereum client to validate transactions and generate blocks.
## Prerequisites
* [StatefulSets](https://kubernetes.io/docs/concepts/abstractions/controllers/statefulsets/) support
* Dynamically provisioned persistent volumes
## Installing the Chart
To install the chart:
```bash
helm install \
--name ${DEPLOYMENT_ENVIRONMENT}-transactor-${NAME} \
kubernetes/amis/generic/validator
```
## Configuration
The following tables lists the configurable parameters of the transactor chart and their default values.
| Parameter | Description | Default |
| ------------------------------- | ------------------------------------------------- | ---------------------------------------------------------- |
| `service.type` | The Kubernetes service type | `ClusterIP` |
| `service.externalPeerPort` | Exposed Ethereum P2P port | `30303` |
| `service.ExternalRPCPort` | Exposed Ethereum RPC port | `8545` |
| `service.ExternalWSPort` | Exposed Ethereum WebSocket port | `8546` |
| `replicaCount` | Kubernetes statefulset replicas | `1` |
| `image.repository` | Docker image repository | `ethereum/client-go` |
| `image.tag` | Docker image tag | `alpine` |
| `image.pullPolicy` | Docker image pulling policy | `Always` |
| `ethereum.identity` | Custom node name | `$POD_NAME` |
| `ethereum.port` | Network listening port | `30303` |
| `ethereum.networkID` | Network identifier | `12345` |
| `ethereum.cache` | Megabytes of memory allocated to internal caching | `512` |
| `ethereum.rpc.enabled` | Enable the HTTP-RPC server | `false` |
| `ethereum.rpc.addr` | HTTP-RPC server listening interface | `localhost` |
| `ethereum.rpc.port` | HTTP-RPC server listening port | `8545` |
| `ethereum.rpc.api` | API's offered over the HTTP-RPC interface | `"eth,net,web3,personal"` |
| `ethereum.rpc.corsdomain` | Comma separated list of domains from which to accept cross origin requests | `*` |
| `ethereum.ws.enabled` | Enable the WS-RPC server | `false` |
| `ethereum.ws.addr` | WS-RPC server listening interface | `localhost` |
| `ethereum.ws.port` | WS-RPC server listening port | `8546` |
| `ethereum.ws.api` | API's offered over the WS-RPC interface | `"eth,net,web3,personal"` |
| `ethereum.ws.origins` | Origins from which to accept websockets requests | `*` |
| `ethereum.mining.enabled` | Enable mining | `true` |
| `ethereum.mining.threads` | Number of CPU threads to use for mining | `2` |
| `ethereum.mining.etherbase` | Public address for block mining rewards | `"1a9afb711302c5f83b5902843d1c007a1a137632"` |
| `ethereum.ethstats.enabled` | Enable ethstats reporting | `true` |
| `ethereum.ethstats.addr` | Ethstats service address | `ws://eth-netstats` |
| `ethereum.ethstats.port` | Ethstats service port | `3000` |
| `ethereum.ethstats.secret` | Ethstats service websocket secret | `bb98a0b6442386d0cdf8a31b267892c1` |
| `ethereum.nodekey.hex` | P2P node key as hex | `aaaaaaaaaaaaaa5302ccdd5b6ffa092e148ba497e352c2824f366ec399072068` |
| `ethereum.account.address` | Account address assigned to the validator | `1a9afb711302c5f83b5902843d1c007a1a137632` |
| `ethereum.account.data` | Full account data file as JSON string | `{"address":"1a9afb711302c5f83b5902843d1c007a1a137632","Crypto":{"cipher":"aes-128-ctr","ciphertext":"132b50d7c8944a115824de7c00911c40a90f84f27c614b7a3ef05ee8fd414312","cipherparams":{"iv":"0f745599d1b3303988ce210fb82b8c7f"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"bce940bac232b4a9c5a2d50e5be51fde5cecfa7da9d49d8f650f91167bebf0de"},"mac":"36d515070b797aec58a574a3e04ea109498ee7674b15d7f952322cda7dcb68e3"},"id":"5d212b4c-3dd0-4c52-a32f-e42bf1b41133","version":3}` |
| `volumes.chaindir.size` | The maximum size usage of Ethereum data directory | `10Gi` |
| `volumes.chaindir.storageClass` | The Kubernetes storage class of Ethereum data | `$NAMESPACE-chaindata` |
| `global.computingSpec` | The computing spec level of node to schedule | `low` |
| `global.nodeType` | The type of node to schedule | `generic` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```bash
helm install \
--name ${DEPLOYMENT_ENVIRONMENT}-validator-${NAME} \
-f values.yaml \
kubernetes/amis/generic/validator
```
> **Tip**: You can use the default [values.yaml](values.yaml)

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,23 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.ethereum.nodekey.hex | trunc 60 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 60 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := .Values.nameOverride -}}
{{- printf "%s-%s" .Chart.Name $name | trunc 60 | trimSuffix "-" -}}
{{- end -}}
{{/*
Deployment environment
*/}}
{{- define "environment" -}}
{{- default .Release.Namespace -}}
{{- end -}}

View File

@ -0,0 +1,12 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: "{{ template "name" . }}-account"
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
data:
{{ .Values.ethereum.account.address | indent 2 }}: |-
{{ .Values.ethereum.account.data | indent 4 }}

View File

@ -0,0 +1,12 @@
kind: Secret
apiVersion: v1
metadata:
name: "{{ template "name" . }}-nodekey"
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
type: Opaque
data:
{{ .Values.ethereum.nodekey.fileName }}: {{ .Values.ethereum.nodekey.hex | b64enc }}

View File

@ -0,0 +1,33 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
spec:
type: {{ .Values.service.type }}
{{- if .Values.service.staticIP }}
clusterIP: {{ .Values.service.staticIP | quote }}
{{- end }}
ports:
- port: {{ .Values.service.externalPeerPort }}
targetPort: {{ .Values.ethereum.port }}
protocol: TCP
name: peer
{{- if .Values.ethereum.rpc.enabled }}
- port: {{ .Values.service.externalRPCPort }}
targetPort: {{ .Values.ethereum.rpc.port }}
protocol: TCP
name: rpc
{{- end }}
{{- if .Values.ethereum.ws.enabled }}
- port: {{ .Values.service.externalWSPort }}
targetPort: {{ .Values.ethereum.ws.port }}
protocol: TCP
name: ws
{{- end }}
selector:
app: {{ template "fullname" . }}

View File

@ -0,0 +1,251 @@
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: {{ template "fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
spec:
serviceName: {{ template "fullname" . }}
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
environment: {{ template "environment" . }}
annotations:
nodekey: "{{ .Values.ethereum.nodekey.hex }}"
account: "{{ .Values.ethereum.account.address }}"
pod.beta.kubernetes.io/init-containers: '[
{
"name": "init-genesis",
"image": "{{ .Values.image.repository }}:{{ .Values.image.tag }}",
"imagePullPolicy": "{{ .Values.image.pullPolicy }}",
"command": [
"geth",
"--datadir",
"{{ .Values.volumes.chaindir.mountPath }}",
"init",
"{{ .Values.genesis.mountPath }}/{{ .Values.genesis.fileName }}"
],
"volumeMounts": [
{
"name": "data",
"mountPath": "{{ .Values.volumes.chaindir.mountPath }}"
},
{
"name": "genesis",
"mountPath": "{{ .Values.genesis.mountPath }}"
}
]
},
{
"name": "copy-files",
"image": "library/busybox",
"imagePullPolicy": "IfNotPresent",
"command": [
"sh",
"-c",
"cp {{ .Values.ethereum.staticNodes.mountPath }}/static-nodes.json {{ .Values.volumes.chaindir.mountPath }}/ &&
mkdir -p {{ .Values.volumes.chaindir.mountPath }}/keystore &&
cp {{ .Values.ethereum.account.mountPath }}/{{ .Values.ethereum.account.address }} {{ .Values.volumes.chaindir.mountPath }}/keystore/"
],
"volumeMounts": [
{
"name": "data",
"mountPath": "{{ .Values.volumes.chaindir.mountPath }}"
},
{
"name": "static-nodes",
"mountPath": "{{ .Values.ethereum.staticNodes.mountPath }}"
},
{
"name": "account",
"mountPath": "{{ .Values.ethereum.account.mountPath }}"
}
]
}
]'
spec:
terminationGracePeriodSeconds: 10
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["geth"]
args:
- --datadir
- "{{ .Values.volumes.chaindir.mountPath }}"
- --keystore
- "{{ .Values.volumes.chaindir.mountPath }}/keystore"
- --nodekey
- "{{ .Values.ethereum.nodekey.mountPath }}/{{ .Values.ethereum.nodekey.fileName }}"
- --port
- "{{ .Values.ethereum.port }}"
- --nat
- any
- --fast
- --nodiscover
- --identity
- "{{ default "$(POD_NAME)" .Values.ethereum.identity }}"
{{- if .Values.ethereum.networkID }}
- --networkid
- "{{ .Values.ethereum.networkID }}"
{{- end }}
{{- if .Values.ethereum.useTestNet }}
- --testnet
{{- end }}
{{- if .Values.ethereum.useDeveloperMode }}
- --dev
{{- end }}
{{- if .Values.ethereum.cache }}
- --cache
- "{{ .Values.ethereum.cache }}"
{{- end }}
{{- if .Values.ethereum.rpc.enabled }}
- --rpc
- --rpcaddr
- "{{ .Values.ethereum.rpc.addr }}"
- --rpcport
- "{{ .Values.ethereum.rpc.port }}"
- --rpcapi
- "{{ .Values.ethereum.rpc.api }}"
- --rpccorsdomain
- "{{ .Values.ethereum.rpc.corsdomain }}"
{{- end }}
{{- if .Values.ethereum.ws.enabled }}
- --ws
- --wsaddr
- "{{ .Values.ethereum.ws.addr }}"
- --wsport
- "{{ .Values.ethereum.ws.port }}"
- --wsapi
- "{{ .Values.ethereum.ws.api }}"
- --wsorigins
- "{{ .Values.ethereum.ws.origins }}"
{{- end }}
{{- if .Values.ethereum.mining.etherbase }}
- --etherbase
- "{{ .Values.ethereum.mining.etherbase }}"
{{- end }}
{{- if .Values.ethereum.mining.enabled }}
- --mine
- --minerthreads
- "{{ .Values.ethereum.mining.threads }}"
{{- end }}
{{- if .Values.ethereum.ethstats.enabled }}
- --ethstats
- "$(POD_NAME):{{ .Values.ethereum.ethstats.secret }}@{{ .Values.ethereum.ethstats.addr }}.{{ template "environment" . }}:{{ .Values.ethereum.ethstats.port }}"
{{- end }}
{{- if .Values.benchmark.gasprice }}
- --gasprice
- {{ .Values.benchmark.gasprice | quote }}
- --txpool.pricelimit
- {{ .Values.benchmark.gasprice | quote }}
{{- end }}
{{- if .Values.benchmark.targetgaslimit }}
- --targetgaslimit
- {{ .Values.benchmark.targetgaslimit | quote }}
{{- end }}
{{- if .Values.benchmark.txpool.globalslots }}
- --txpool.globalslots
- {{ .Values.benchmark.txpool.globalslots | quote }}
{{- end }}
{{- if .Values.benchmark.txpool.accountslots }}
- --txpool.accountslots
- {{ .Values.benchmark.txpool.accountslots | quote }}
{{- end }}
{{- if .Values.benchmark.txpool.globalqueue }}
- --txpool.globalqueue
- {{ .Values.benchmark.txpool.globalqueue | quote }}
{{- end }}
{{- if .Values.benchmark.txpool.accountqueue }}
- --txpool.accountqueue
- {{ .Values.benchmark.txpool.accountqueue | quote }}
{{- end }}
- --metrics
{{- if .Values.benchmark.prometheus.url }}
- --promaddr
- {{ .Values.benchmark.prometheus.url }}
{{- end }}
- --debug
- --maxpeers
- "100"
ports:
- containerPort: {{ .Values.ethereum.port }}
name: peer
{{- if .Values.ethereum.rpc.enabled }}
- containerPort: {{ .Values.ethereum.rpc.port }}
name: rpc
{{- end }}
{{- if .Values.ethereum.ws.enabled }}
- containerPort: {{ .Values.ethereum.ws.port }}
name: ws
{{- end }}
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
livenessProbe:
exec:
command:
- "geth"
- "--exec"
- "eth.blockNumber"
- "attach"
{{- if .Values.ethereum.ipc.path }}
- {{ .Values.ethereum.ipc.path | quote }}
{{- else }}
- "{{ .Values.volumes.chaindir.mountPath }}/geth.ipc"
{{- end }}
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
readinessProbe:
exec:
command:
- "geth"
- "--exec"
- "eth.blockNumber"
- "attach"
{{- if .Values.ethereum.ipc.path }}
- {{ .Values.ethereum.ipc.path | quote }}
{{- else }}
- "{{ .Values.volumes.chaindir.mountPath }}/geth.ipc"
{{- end }}
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
volumeMounts:
- name: data
mountPath: "{{ .Values.volumes.chaindir.mountPath }}"
- name: nodekey
mountPath: "{{ .Values.ethereum.nodekey.mountPath }}"
volumes:
- name: genesis
configMap:
name: {{ .Values.genesis.config }}
- name: nodekey
secret:
secretName: "{{ template "name" . }}-nodekey"
- name: account
configMap:
name: "{{ template "name" . }}-account"
- name: static-nodes
configMap:
name: {{ .Values.ethereum.staticNodes.config }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: {{ .Values.volumes.chaindir.size }}

View File

@ -0,0 +1,84 @@
# Default values for validator.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
# service.yaml
service:
type: ClusterIP
externalPeerPort: 30303
externalRPCPort: 8545
externalWSPort: 8546
# statefulset.yaml
replicaCount: 1
image:
repository: quay.io/maicoin/ottoman_geth
tag: prometheus
pullPolicy: Always
ethereum:
identity: ""
port: 30303
useTestNet: false
useDeveloperMode: false
networkID: 12345 # 0=Olympic (disused), 1=Frontier, 2=Morden (disused), 3=Ropsten) (default: 1)
cache: 512
ipc:
enabled: true
path: ""
rpc:
enabled: true
addr: 0.0.0.0
port: 8545
api: "eth,net,web3,personal"
corsdomain: "*"
ws:
enabled: false
addr: 0.0.0.0
port: 8546
api: "eth,net,web3,personal"
origins: "*"
mining:
enabled: true
threads: 1
etherbase: "1a9afb711302c5f83b5902843d1c007a1a137632"
staticNodes:
config: static-nodes
mountPath: "/staticNodes"
ethstats:
enabled: true
addr: ws://eth-netstats
port: 3000
secret: bb98a0b6442386d0cdf8a31b267892c1
nodekey:
hex: aaaaaaaaaaaaaa5302ccdd5b6ffa092e148ba497e352c2824f366ec399072068
mountPath: "/nodekey"
fileName: nodekey
account:
address: "1a9afb711302c5f83b5902843d1c007a1a137632"
data: '{"address":"1a9afb711302c5f83b5902843d1c007a1a137632","Crypto":{"cipher":"aes-128-ctr","ciphertext":"132b50d7c8944a115824de7c00911c40a90f84f27c614b7a3ef05ee8fd414312","cipherparams":{"iv":"0f745599d1b3303988ce210fb82b8c7f"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"bce940bac232b4a9c5a2d50e5be51fde5cecfa7da9d49d8f650f91167bebf0de"},"mac":"36d515070b797aec58a574a3e04ea109498ee7674b15d7f952322cda7dcb68e3"},"id":"5d212b4c-3dd0-4c52-a32f-e42bf1b41133","version":3}'
mountPath: "/keystore"
volumes:
chaindir:
name: chaindir
size: 1000Gi
mountPath: "/data"
storageClass: ""
genesis:
config: genesis-block
mountPath: "/genesis"
fileName: "genesis.json"
# Geth parameters for benchmark
benchmark:
gasprice: "0"
targetgaslimit: "500000000"
txpool:
globalslots: "4096"
accountslots: "4096"
globalqueue: "2048"
accountqueue: "2048"
prometheus:
url: http://52.163.252.208:9091

View File

@ -0,0 +1,7 @@
nameOverride: "0"
service:
name: validator-0
staticIP: "10.0.1.2"
ethereum:
nodekey:
hex: 1862cf0b92e8da1c92521006f29a5a9cca33ee7537a23112719c41bf816832f2

View File

@ -0,0 +1,8 @@
nameOverride: "1"
service:
name: validator-1
staticIP: "10.0.1.3"
ethereum:
nodekey:
hex: 72fa6fc77e8ea98a5adc168c0ceed63205d9580dcbb969df794248dee5a00ea5

View File

@ -0,0 +1,7 @@
nameOverride: "10"
service:
name: validator-10
staticIP: "10.0.1.12"
ethereum:
nodekey:
hex: 89441386c9f3c3e180c79b894fa045608d29e63712bf121d921efd60f38bfd91

View File

@ -0,0 +1,7 @@
nameOverride: "11"
service:
name: validator-11
staticIP: "10.0.1.13"
ethereum:
nodekey:
hex: a4a8c2aca140a1f18d0ba60c0897c4361ea27d2a07ac154652fab03245870538

View File

@ -0,0 +1,7 @@
nameOverride: "12"
service:
name: validator-12
staticIP: "10.0.1.14"
ethereum:
nodekey:
hex: 0107fdbe8207a98106f60e646375e46670a8343bbe3dac8d5bd4dd358fee9be7

View File

@ -0,0 +1,7 @@
nameOverride: "13"
service:
name: validator-13
staticIP: "10.0.1.15"
ethereum:
nodekey:
hex: 46b95787b86a41d61ec8d4491f762a7949cbdf3eaf75052660eb4684d1572e8a

View File

@ -0,0 +1,8 @@
nameOverride: "14"
service:
name: validator-14
staticIP: "10.0.1.16"
ethereum:
nodekey:
hex: 132d05afb9c7fd8e1b1392ad35d883164e422784950e0afd2db7eee56893880d

View File

@ -0,0 +1,7 @@
nameOverride: "15"
service:
name: validator-15
staticIP: "10.0.1.17"
ethereum:
nodekey:
hex: 8e2916f4237b03817f0d8537e1c687c756f3270ebdbb6d9939b650aaaf0bf735

View File

@ -0,0 +1,7 @@
nameOverride: "16"
service:
name: validator-16
staticIP: "10.0.1.18"
ethereum:
nodekey:
hex: 6a4f6487716a01ea75d38dc89da3e4dc6cb69a8d350862dcf13b3d19c971ddb5

View File

@ -0,0 +1,8 @@
nameOverride: "17"
service:
name: validator-17
staticIP: "10.0.1.19"
ethereum:
nodekey:
hex: 77fb4f684c0965854da7c9a478314afcc8147eb82d2037f75f8d1bf2f91810c6

View File

@ -0,0 +1,8 @@
nameOverride: "18"
service:
name: validator-18
staticIP: "10.0.1.20"
ethereum:
nodekey:
hex: 05ee8404840229b59a57fb36ab77d5d78bedb471951596bce58a84454245b4cf

View File

@ -0,0 +1,8 @@
nameOverride: "19"
service:
name: validator-19
staticIP: "10.0.1.21"
ethereum:
nodekey:
hex: 7bd1df3fe65b8864592030e5f9e3490255d4ac700a5bc94a26d02a0893ccc904

View File

@ -0,0 +1,7 @@
nameOverride: "2"
service:
name: validator-2
staticIP: "10.0.1.4"
ethereum:
nodekey:
hex: 31f07e972131b6449296d519a99b0b6a4b58426f3a56093174601475efd5c944

View File

@ -0,0 +1,8 @@
nameOverride: "20"
service:
name: validator-20
staticIP: "10.0.1.22"
ethereum:
nodekey:
hex: 0566596beee2e79289fc3b85f315ef549d4de543e253244d0db7c467d446c1ce

View File

@ -0,0 +1,8 @@
nameOverride: "21"
service:
name: validator-21
staticIP: "10.0.1.23"
ethereum:
nodekey:
hex: 3b67ecd07acd4da6cfd3b69d831fbb71955b8cbf6c832652304a738947caf857

View File

@ -0,0 +1,7 @@
nameOverride: "22"
service:
name: validator-22
staticIP: "10.0.1.24"
ethereum:
nodekey:
hex: 13deee5916dc38ba7bdc779a452ab0879151db4a6165b4c2d24e50b867075837

View File

@ -0,0 +1,8 @@
nameOverride: "23"
service:
name: validator-23
staticIP: "10.0.1.25"
ethereum:
nodekey:
hex: 97c28cf516124ed4b8d2a2f2e52222e211a50716139667cbb063f82e6414ea77

View File

@ -0,0 +1,8 @@
nameOverride: "24"
service:
name: validator-24
staticIP: "10.0.1.26"
ethereum:
nodekey:
hex: 1023eb680551b7a58d75aa334a30d03cc7d0b9722164356e3193c5cfcbcf8971

View File

@ -0,0 +1,8 @@
nameOverride: "25"
service:
name: validator-25
staticIP: "10.0.1.27"
ethereum:
nodekey:
hex: ff6584aea5b07ea6090eaeb7b91dfeec448a1d241c6ec33dc92dd2ba68266b6d

View File

@ -0,0 +1,7 @@
nameOverride: "3"
service:
name: validator-3
staticIP: "10.0.1.5"
ethereum:
nodekey:
hex: 4b67c5a38c067a477088b2d2607dbec6ce2b2febcba9fe64bc27ee81e4f34532

View File

@ -0,0 +1,8 @@
nameOverride: "4"
service:
name: validator-4
staticIP: "10.0.1.6"
ethereum:
nodekey:
hex: 1a65c4a249a5b671d6f88bcee35f8b07acc41cd7e91b230faad92dcb36f9c2cd

View File

@ -0,0 +1,8 @@
nameOverride: "5"
service:
name: validator-5
staticIP: "10.0.1.7"
ethereum:
nodekey:
hex: 9c471e1981a1a2d35cc35431677745d0c6e06dee2870b766e113ee46064e1cf4

View File

@ -0,0 +1,8 @@
nameOverride: "6"
service:
name: validator-6
staticIP: "10.0.1.8"
ethereum:
nodekey:
hex: 3b966389b7e7247c2ac188e46222999cd52511795840884414991900033d13b8

View File

@ -0,0 +1,8 @@
nameOverride: "7"
service:
name: validator-7
staticIP: "10.0.1.9"
ethereum:
nodekey:
hex: cd3f319b2ef5b696560da1b40646c17c6516e93ccfb0cd15acd5c4bcb761f27c

View File

@ -0,0 +1,8 @@
nameOverride: "8"
service:
name: validator-8
staticIP: "10.0.1.10"
ethereum:
nodekey:
hex: fe37f6d6dd2c8f669d8b468811e516b2b4bdf07ab5ff66c810803729cc7a0040

View File

@ -0,0 +1,8 @@
nameOverride: "9"
service:
name: validator-9
staticIP: "10.0.1.11"
ethereum:
nodekey:
hex: 44fad729e6c2008387c0e4f027e2d54ce43cf539a097e7428009f59b44cb8bc0