diff --git a/benchmark/kubernetes/delete-validator b/benchmark/kubernetes/delete-validator index b7b06553..ccf612e4 100755 --- a/benchmark/kubernetes/delete-validator +++ b/benchmark/kubernetes/delete-validator @@ -3,4 +3,5 @@ from subprocess import call for v in range(0, 26, 1): + call(["helm" ,"delete", "--purge", "validator-svc-{}".format(v)]) call(["helm" ,"delete", "--purge", "validator-{}".format(v)]) diff --git a/benchmark/kubernetes/deploy-validator b/benchmark/kubernetes/deploy-validator index d5c6864f..2af99c21 100755 --- a/benchmark/kubernetes/deploy-validator +++ b/benchmark/kubernetes/deploy-validator @@ -3,4 +3,5 @@ from subprocess import call for v in range(0, 26, 1): + call(["helm" ,"install", "-n", "validator-svc-{}".format(v), "-f", "values.validator-{}.yaml".format(v), "validator-service"]) call(["helm" ,"install", "-n", "validator-{}".format(v), "-f", "values.validator-{}.yaml".format(v), "validator"]) diff --git a/benchmark/kubernetes/validator-service/.helmignore b/benchmark/kubernetes/validator-service/.helmignore new file mode 100755 index 00000000..f0c13194 --- /dev/null +++ b/benchmark/kubernetes/validator-service/.helmignore @@ -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 diff --git a/benchmark/kubernetes/validator-service/Chart.yaml b/benchmark/kubernetes/validator-service/Chart.yaml new file mode 100755 index 00000000..0e1c623f --- /dev/null +++ b/benchmark/kubernetes/validator-service/Chart.yaml @@ -0,0 +1,10 @@ +name: validator-service +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.0.1 +sources: + - https://github.com/maichain/mchain_service/kubernetes/amis/generic/validator diff --git a/benchmark/kubernetes/validator-service/LICENSE b/benchmark/kubernetes/validator-service/LICENSE new file mode 100644 index 00000000..bf43db95 --- /dev/null +++ b/benchmark/kubernetes/validator-service/LICENSE @@ -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. diff --git a/benchmark/kubernetes/validator-service/README.md b/benchmark/kubernetes/validator-service/README.md new file mode 100644 index 00000000..fbe1e368 --- /dev/null +++ b/benchmark/kubernetes/validator-service/README.md @@ -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) \ No newline at end of file diff --git a/benchmark/kubernetes/validator-service/templates/NOTES.txt b/benchmark/kubernetes/validator-service/templates/NOTES.txt new file mode 100755 index 00000000..8b137891 --- /dev/null +++ b/benchmark/kubernetes/validator-service/templates/NOTES.txt @@ -0,0 +1 @@ + diff --git a/benchmark/kubernetes/validator-service/templates/_helpers.tpl b/benchmark/kubernetes/validator-service/templates/_helpers.tpl new file mode 100755 index 00000000..54766765 --- /dev/null +++ b/benchmark/kubernetes/validator-service/templates/_helpers.tpl @@ -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-%v" .Chart.Name $name | trunc 60 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Deployment environment +*/}} +{{- define "environment" -}} +{{- default .Release.Namespace -}} +{{- end -}} diff --git a/benchmark/kubernetes/validator/templates/service.yaml b/benchmark/kubernetes/validator-service/templates/service.yaml similarity index 82% rename from benchmark/kubernetes/validator/templates/service.yaml rename to benchmark/kubernetes/validator-service/templates/service.yaml index 6bc61d4b..bcb46133 100755 --- a/benchmark/kubernetes/validator/templates/service.yaml +++ b/benchmark/kubernetes/validator-service/templates/service.yaml @@ -13,10 +13,6 @@ spec: 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 }} @@ -30,4 +26,4 @@ spec: name: ws {{- end }} selector: - app: {{ template "fullname" . }} + app: {{ .Values.app }} diff --git a/benchmark/kubernetes/validator-service/values.yaml b/benchmark/kubernetes/validator-service/values.yaml new file mode 100755 index 00000000..39096b97 --- /dev/null +++ b/benchmark/kubernetes/validator-service/values.yaml @@ -0,0 +1,21 @@ +# Default values for validator-service. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +nameOverride: + +# service.yaml +service: + type: ClusterIP + externalRPCPort: 8545 + externalWSPort: 8546 + +ethereum: + rpc: + enabled: false + port: 8545 + ws: + enabled: true + port: 8546 + +app: validator \ No newline at end of file