diff --git a/charts/chainlink-cluster/connect.toml b/charts/chainlink-cluster/connect.toml index 1f49b5a6e37..9560be53adc 100644 --- a/charts/chainlink-cluster/connect.toml +++ b/charts/chainlink-cluster/connect.toml @@ -2,7 +2,7 @@ namespace = "cl-cluster" network_name = "geth" network_chain_id = 1337 network_private_key = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" -network_ws_url = "ws://geth:8546" +network_ws_url = "ws://geth-1337:8546" network_http_url = "http://geth:8544" cl_nodes_num = 6 cl_node_url_template = "http://app-node-%d:6688" diff --git a/charts/chainlink-cluster/devspace.yaml b/charts/chainlink-cluster/devspace.yaml index 7148f271516..f7808085505 100644 --- a/charts/chainlink-cluster/devspace.yaml +++ b/charts/chainlink-cluster/devspace.yaml @@ -77,7 +77,7 @@ pipelines: echo "############################################" echo "Ingress Domains" echo "############################################" - ingress_names="node1 node2 node3 node4 node5 node6 geth-http geth-ws" + ingress_names="node1 node2 node3 node4 node5 node6 geth-1337-http geth-1337-ws geth-2337-http geth-2337-ws" for ingress in ${ingress_names}; do echo "https://${DEVSPACE_NAMESPACE}-${ingress}.${DEVSPACE_INGRESS_BASE_DOMAIN}" done @@ -230,7 +230,9 @@ deployments: version: v1.12.0 wsrpc-port: 8546 httprpc-port: 8544 - networkid: 1337 + chains: + - networkId: 1337 + - networkId: 2337 blocktime: 1 resources: requests: @@ -364,22 +366,40 @@ deployments: name: app-node-6 port: number: 6688 - - host: ${DEVSPACE_NAMESPACE}-geth-http.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-geth-1337-http.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: geth + name: geth-1337 port: number: 8544 - - host: ${DEVSPACE_NAMESPACE}-geth-ws.${DEVSPACE_INGRESS_BASE_DOMAIN} + - host: ${DEVSPACE_NAMESPACE}-geth-1337-ws.${DEVSPACE_INGRESS_BASE_DOMAIN} http: paths: - path: / backend: service: - name: geth + name: geth-1337 + port: + number: 8546 + - host: ${DEVSPACE_NAMESPACE}-geth-2337-http.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: geth-2337 + port: + number: 8544 + - host: ${DEVSPACE_NAMESPACE}-geth-2337-ws.${DEVSPACE_INGRESS_BASE_DOMAIN} + http: + paths: + - path: / + backend: + service: + name: geth-2337 port: number: 8546 - host: ${DEVSPACE_NAMESPACE}-mockserver.${DEVSPACE_INGRESS_BASE_DOMAIN} diff --git a/charts/chainlink-cluster/templates/chainlink-cm.yaml b/charts/chainlink-cluster/templates/chainlink-cm.yaml index b33e29df4b5..25deb475af2 100644 --- a/charts/chainlink-cluster/templates/chainlink-cm.yaml +++ b/charts/chainlink-cluster/templates/chainlink-cm.yaml @@ -40,15 +40,20 @@ data: AnnounceAddresses = ['0.0.0.0:6690'] DeltaDial = '500ms' DeltaReconcile = '5s' + {{- range $chainCfg := $.Values.geth.chains }} [[EVM]] - ChainID = '1337' + ChainID = {{ $chainCfg.networkId | quote }} MinContractPayment = '0' AutoCreateKey = true FinalityDepth = 1 + {{- if (hasKey $chainCfg "customEVMConfigToml") }} + {{- $chainCfg.customEVMConfigToml | nindent 4 }} + {{- end }} [[EVM.Nodes]] - Name = 'node-0' - WSURL = 'ws://geth:8546' - HTTPURL = 'http://geth:8544' + Name = 'node-{{ $chainCfg.networkId }}' + WSURL = 'ws://geth-{{ $chainCfg.networkId }}:8546' + HTTPURL = 'http://geth-{{ $chainCfg.networkId }}:8544' + {{- end }} [WebServer.TLS] HTTPSPort = 0 {{ end }} diff --git a/charts/chainlink-cluster/templates/geth-config-map.yaml b/charts/chainlink-cluster/templates/geth-config-map.yaml index 022d9f2ea61..0d9abb042e3 100644 --- a/charts/chainlink-cluster/templates/geth-config-map.yaml +++ b/charts/chainlink-cluster/templates/geth-config-map.yaml @@ -1,11 +1,12 @@ {{ if (hasKey .Values "geth") }} +{{- range $cfg := .Values.geth.chains }} apiVersion: v1 kind: ConfigMap metadata: labels: - app: geth-cm - release: {{ .Release.Name }} - name: geth-cm + app: geth-{{ $cfg.networkId }}-cm + release: {{ $.Release.Name }} + name: geth-{{ $cfg.networkId }}-cm data: key1: | {"address":"f39fd6e51aad88f6f4ce6ab8827279cfffb92266","crypto":{"cipher":"aes-128-ctr","ciphertext":"c36afd6e60b82d6844530bd6ab44dbc3b85a53e826c3a7f6fc6a75ce38c1e4c6","cipherparams":{"iv":"f69d2bb8cd0cb6274535656553b61806"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"80d5f5e38ba175b6b89acfc8ea62a6f163970504af301292377ff7baafedab53"},"mac":"f2ecec2c4d05aacc10eba5235354c2fcc3776824f81ec6de98022f704efbf065"},"id":"e5c124e9-e280-4b10-a27b-d7f3e516b408","version":3} @@ -50,17 +51,18 @@ data: password.txt: | init.sh: | #!/bin/bash - if [ ! -d /app/.ethereum/keystore ]; then - echo "/app/.ethereum/keystore not found, running 'geth init'..." - geth init /app/ethconfig/genesis.json + if [ ! -d /chain/chain-data/keystore ]; then + echo "/chain/chain-data/keystore not found, running 'geth init'..." + geth init --datadir /chain/chain-data/ /chain/genesis.json echo "...done!" + cp /chain/config/key* /chain/chain-data/keystore fi - geth "$@" + cd /chain/chain-data && geth "$@" genesis.json: | { "config": { - "chainId": {{ .Values.geth.networkId }}, + "chainId": {{ $cfg.networkId }}, "homesteadBlock": 0, "eip150Block": 0, "eip155Block": 0, @@ -72,14 +74,18 @@ data: "istanbulBlock": 0, "muirGlacierBlock": 0, "berlinBlock": 0, - "londonBlock": 0 + "londonBlock": 0, + "clique": { + "period": 2, + "epoch": 30000 + } }, "nonce": "0x0000000000000042", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "difficulty": "1", "coinbase": "0x3333333333333333333333333333333333333333", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "0x", + "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "gasLimit": "8000000000", "alloc": { "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266": { @@ -144,4 +150,6 @@ data: } } } - {{ end }} \ No newline at end of file +--- +{{- end }} +{{ end }} \ No newline at end of file diff --git a/charts/chainlink-cluster/templates/geth-deployment.yaml b/charts/chainlink-cluster/templates/geth-deployment.yaml index abc7853d978..c78f0851038 100644 --- a/charts/chainlink-cluster/templates/geth-deployment.yaml +++ b/charts/chainlink-cluster/templates/geth-deployment.yaml @@ -1,35 +1,38 @@ {{ if (hasKey .Values "geth") }} +{{- range $cfg := .Values.geth.chains }} apiVersion: apps/v1 kind: Deployment metadata: - name: geth + name: geth-{{ $cfg.networkId }} spec: selector: matchLabels: app: geth + release: {{ $.Release.Name }} + instance: geth-{{ $cfg.networkId }} # Used for testing. # havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool havoc-component-group: "blockchain" havoc-network-group: "blockchain" - release: {{ .Release.Name }} template: metadata: labels: app: geth + instance: geth-{{ $cfg.networkId }} + release: {{ $.Release.Name }} # Used for testing. # havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool havoc-component-group: "blockchain" havoc-network-group: "blockchain" - release: {{ .Release.Name }} annotations: - {{- range $key, $value := .Values.podAnnotations }} + {{- range $key, $value := $.Values.podAnnotations }} {{ $key }}: {{ $value | quote }} {{- end }} spec: volumes: - name: configmap-volume configMap: - name: geth-cm + name: geth-{{ $cfg.networkId }}-cm - name: devchain-volume emptyDir: {} securityContext: @@ -38,43 +41,32 @@ spec: - name: geth-network securityContext: {{- toYaml $.Values.geth.securityContext | nindent 12 }} - image: "{{ default "ethereum/client-go" .Values.geth.image }}:{{ default "stable" .Values.geth.version }}" - command: [ "sh", "/app/init.sh" ] + image: "{{ default "ethereum/client-go" $.Values.geth.image }}:{{ default "stable" $.Values.geth.version }}" + command: [ "sh", "/chain/init.sh" ] volumeMounts: - name: devchain-volume - mountPath: /app/.ethereum/devchain + mountPath: /chain/chain-data - name : configmap-volume - mountPath: /app/init.sh + mountPath: /chain/genesis.json + subPath: genesis.json + - name : configmap-volume + mountPath: /chain/init.sh subPath: init.sh - name: configmap-volume - mountPath: /app/config - - name: configmap-volume - mountPath: /app/.ethereum/devchain/keystore/key1 - subPath: key1 - - name: configmap-volume - mountPath: /app/.ethereum/devchain/keystore/key2 - subPath: key2 - - name: configmap-volume - mountPath: /app/.ethereum/devchain/keystore/key3 - subPath: key3 + mountPath: /chain/config args: - - '--dev' - '--password' - - '/app/config/password.txt' + - '/chain/config/password.txt' - '--datadir' - - '/app/.ethereum/devchain' + - '/chain/chain-data/' - '--unlock' - '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266' - - '--unlock' - - '0x70997970C51812dc3A010C7d01b50e0d17dc79C8' - - '--unlock' - - '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC' - '--mine' - '--miner.etherbase' - '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266' - '--ipcdisable' - '--http.api' - - 'admin,debug,web3,eth,txpool,personal,miner,net' + - 'admin,debug,clique,eth,miner,net,personal,txpool,web3' - '--http' - '--http.vhosts' - '*' @@ -95,11 +87,11 @@ spec: - '--http.corsdomain' - '*' - '--vmdebug' - - '--networkid={{ .Values.geth.networkid }}' + - '--networkid={{ $cfg.networkId }}' - '--rpc.txfeecap' - '0' - '--dev.period' - - '{{ .Values.geth.blocktime }}' + - '{{ $.Values.geth.blocktime }}' - '--miner.gasprice' - '10000000000' ports: @@ -107,26 +99,28 @@ spec: containerPort: 8544 - name: ws-rpc containerPort: 8546 - {{ if (hasKey .Values.geth "resources") }} + {{ if (hasKey $.Values.geth "resources") }} resources: requests: - memory: {{ default "1024Mi" .Values.geth.resources.requests.memory }} - cpu: {{ default "1000m" .Values.geth.resources.requests.cpu }} + memory: {{ default "1024Mi" $.Values.geth.resources.requests.memory }} + cpu: {{ default "1000m" $.Values.geth.resources.requests.cpu }} limits: - memory: {{ default "1024Mi" .Values.geth.resources.limits.memory }} - cpu: {{ default "1000m" .Values.geth.resources.limits.cpu }} + memory: {{ default "1024Mi" $.Values.geth.resources.limits.memory }} + cpu: {{ default "1000m" $.Values.geth.resources.limits.cpu }} {{ else }} {{ end }} -{{- with .Values.nodeSelector }} +{{- with $.Values.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} {{- end }} -{{- with .Values.affinity }} +{{- with $.Values.affinity }} affinity: {{ toYaml . | indent 8 }} {{- end }} -{{- with .Values.tolerations }} +{{- with $.Values.tolerations }} tolerations: {{ toYaml . | indent 8 }} {{- end }} -{{ end }} +--- +{{- end }} +{{ end }} \ No newline at end of file diff --git a/charts/chainlink-cluster/templates/geth-service.yaml b/charts/chainlink-cluster/templates/geth-service.yaml index cdae0c4bdf0..3016c53048f 100644 --- a/charts/chainlink-cluster/templates/geth-service.yaml +++ b/charts/chainlink-cluster/templates/geth-service.yaml @@ -1,12 +1,13 @@ {{ if (hasKey .Values "geth") }} +{{- range $cfg := .Values.geth.chains }} apiVersion: v1 kind: Service metadata: - name: geth + name: geth-{{ $cfg.networkId }} spec: selector: - app: geth - release: {{ .Release.Name }} + instance: geth-{{ $cfg.networkId }} + release: {{ $.Release.Name }} ports: - name: ws-rpc port: {{ default "8546" $.Values.geth.wsrpc_port}} @@ -15,4 +16,6 @@ spec: port: {{ default "8544" $.Values.geth.httprpc_port}} targetPort: http-rpc type: ClusterIP +--- +{{- end }} {{ end }} \ No newline at end of file diff --git a/charts/chainlink-cluster/values.yaml b/charts/chainlink-cluster/values.yaml index 3e58cbaea24..fefb819cf2f 100644 --- a/charts/chainlink-cluster/values.yaml +++ b/charts/chainlink-cluster/values.yaml @@ -121,8 +121,19 @@ geth: version: v1.12.0 wsrpc-port: 8546 httprpc-port: 8544 - networkid: 1337 blocktime: 1 + chains: + - networkId: 1337 + # use to inject custom configuration for each chain, e.g. GasEstimator + # - customEVMConfigToml: | + # [EVM.GasEstimator] + # PriceMax = '200 gwei' + # LimitDefault = 6000000 + # FeeCapDefault = '200 gwei' + # [EVM.GasEstimator.BlockHistory] + # BlockHistorySize = 200 + # EIP1559FeeCapBufferBlocks = 0 + - networkId: 2337 resources: requests: cpu: 1