Skip to content

Commit

Permalink
Merge branch 'develop' into feature/re-1696-add-ci-lint-chaincli
Browse files Browse the repository at this point in the history
  • Loading branch information
momentmaker authored Sep 25, 2023
2 parents ce530aa + 661dd01 commit 5bb5966
Show file tree
Hide file tree
Showing 87 changed files with 1,463 additions and 866 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/helm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Helm Publish

on:
pull_request:
types: [ labeled ]

jobs:
helm_release:
if: ${{ github.event.label.name == 'helm_release' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Release helm chart
uses: J12934/helm-gh-pages-action@master
with:
charts-folder: charts
deploy-branch: helm-release
access-token: ${{ secrets.HELM_PUSH_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/lint-gh-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Check out Code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Run actionlint
uses: reviewdog/action-actionlint@67ec075cacebd361442f6e3ef7671f74c6548909 # v1.38.0
uses: reviewdog/action-actionlint@17ea0452ae2cd009a22ca629732a9ce7f49a55e6 # v1.39.0
- name: Collect Metrics
if: always()
id: collect-gha-metrics
Expand Down
4 changes: 2 additions & 2 deletions charts/chainlink-cluster/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
name: chainlink-cluster
description: Chainlink nodes cluster
version: 0.1.0
appVersion: '0.1.0'
version: 0.1.3
appVersion: '2.6.0'
39 changes: 33 additions & 6 deletions charts/chainlink-cluster/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Chainlink cluster
Example CL nodes cluster for system level tests

Enter the shell
Install `kubefwd` (no nixpkg for it yet, planned)
```
brew install txn2/tap/kubefwd
```

Enter the shell (from the root project dir)
```
nix develop
```
Expand All @@ -20,9 +25,6 @@ export DEVSPACE_IMAGE="${aws_account}.dkr.ecr.us-west-2.amazonaws.com/chainlink-
```
Enter the shell and deploy
```
nix develop
cd charts/chainlink-cluster
# set your unique namespace if it's a new cluster
devspace use namespace cl-cluster
devspace deploy
Expand Down Expand Up @@ -76,11 +78,36 @@ After that all the changes will be synced automatically
Check `.profiles` to understand what is uploaded in profiles `runner` and `node`

# Helm
If you would like to use `helm` directly, please uncomment data in `values.yaml`
## Install
If you would like to use `helm` directly, please uncomment data in `values-raw-helm.yaml`
## Install from local files
```
helm install -f values-raw-helm.yaml cl-cluster .
```
Forward all apps (in another terminal)
```
sudo kubefwd svc
```
Then you can connect and run your tests

## Install from release
Add the repository
```
helm repo add chainlink-cluster https://raw.githubusercontent.com/smartcontractkit/chainlink/helm-release/
helm repo update
```
Set default namespace
```
kubectl create ns cl-cluster
kubectl config set-context --current --namespace cl-cluster
```

Install
```
helm install -f values-raw-helm.yaml cl-cluster chainlink-cluster/chainlink-cluster --version v0.1.2
```

## Create a new release
Bump version in `Chart.yml` add your changes and add `helm_release` label to any PR to trigger a release

## Helm Test
```
Expand Down
1 change: 1 addition & 0 deletions charts/chainlink-cluster/devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ deployments:
image: ${DEVSPACE_IMAGE}
stateful: false
geth:
version: v1.12.0
wsrpc-port: 8546
httprpc-port: 8544
networkid: 1337
Expand Down
8 changes: 4 additions & 4 deletions charts/chainlink-cluster/templates/chainlink-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
name: {{ $.Release.Name }}-{{ $cfg.name }}-cm
containers:
- name: chainlink-db
image: {{ default "postgres" $.Values.db.image }}:{{ default "11.15" $.Values.db.version }}
image: {{ default "postgres:11.15" $.Values.db.image }}
command:
- docker-entrypoint.sh
args:
Expand Down Expand Up @@ -164,15 +164,15 @@ spec:
limits:
memory: {{ default "1024Mi" $.Values.chainlink.resources.limits.memory }}
cpu: {{ default "500m" $.Values.chainlink.resources.limits.cpu }}
{{- with $.Values.nodeSelector }}
{{ else }}
{{ end }}
{{- with $.Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- with $.Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- with $.Values.tolerations }}
tolerations:
Expand Down
5 changes: 2 additions & 3 deletions charts/chainlink-cluster/templates/geth-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ kind: Deployment
metadata:
name: geth
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
app: geth
Expand Down Expand Up @@ -102,11 +101,11 @@ spec:
{{ end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
Expand Down
21 changes: 10 additions & 11 deletions charts/chainlink-cluster/templates/mockserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,18 @@ spec:
limits:
memory: {{ default "1024Mi" $.Values.chainlink.resources.limits.memory }}
cpu: {{ default "500m" $.Values.chainlink.resources.limits.cpu }}
{{- with $.Values.nodeSelector }}
{{ else }}
{{ end }}
{{- with .Values.nodeSelector }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{ end }}
{{ toYaml . | indent 8 }}
{{- end }}
---
2 changes: 1 addition & 1 deletion charts/chainlink-cluster/templates/runner-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ spec:
limits:
memory: {{ default "1024Mi" $.Values.runner.resources.limits.memory }}
cpu: {{ default "500m" $.Values.runner.resources.limits.cpu }}
{{- with $.Values.nodeSelector }}
{{ else }}
{{ end }}
{{- with $.Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
Expand Down
81 changes: 71 additions & 10 deletions charts/chainlink-cluster/values-raw-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,48 @@ chainlink:
p2p_port: 8090
nodes:
- name: node-1
image: "public.ecr.aws/chainlink/chainlink:latest"
# override default config per node
#toml: |
# [Log]
# JSONConsole = true
# override image and a tag
# image: public.ecr.aws/chainlink/chainlink
# version: latest
# for example, use OCRv2 P2P setup, the whole config
# toml: |
# RootDir = './clroot'
# [Log]
# JSONConsole = true
# Level = 'debug'
# [WebServer]
# AllowOrigins = '*'
# SecureCookies = false
# SessionTimeout = '999h0m0s'
# [OCR2]
# Enabled = true
# [P2P]
# [P2P.V2]
# Enabled = false
# AnnounceAddresses = []
# DefaultBootstrappers = []
# DeltaDial = '15s'
# DeltaReconcile = '1m0s'
# ListenAddresses = []
# [[EVM]]
# ChainID = '1337'
# MinContractPayment = '0'
# [[EVM.Nodes]]
# Name = 'node-0'
# WSURL = 'ws://geth:8546'
# HTTPURL = 'http://geth:8544'
# [WebServer.TLS]
# HTTPSPort = 0
- name: node-2
- name: node-3
- name: node-4
resources:
requests:
cpu: 350m
memory: 1024Mi
limits:
cpu: 350m
memory: 1024Mi

# each CL node have a dedicated PostgreSQL 11.15
# use StatefulSet by setting:
#
Expand All @@ -33,24 +65,53 @@ chainlink:
# if you are running long tests
db:
stateful: false
resources:
requests:
cpu: 1
memory: 1024Mi
limits:
cpu: 1
memory: 1024Mi
# default cluster shipped with latest Geth ( dev mode by default )
geth:
version: v1.12.0
wsrpc-port: 8546
httprpc-port: 8544
networkid: 1337
blocktime: 1
resources:
requests:
cpu: 1
memory: 1024Mi
limits:
cpu: 1
memory: 1024Mi
# mockserver is https://www.mock-server.com/where/kubernetes.html
# used to stub External Adapters
mockserver:
port: 1080
resources:
requests:
cpu: 1
memory: 1024Mi
limits:
cpu: 1
memory: 1024Mi
runner:
stateful: false
resources:
requests:
cpu: 1
memory: 512Mi
limits:
cpu: 1
memory: 512Mi

# monitoring.coreos.com/v1 PodMonitor for each node
prometheusMonitor: false

# deployment placement, standard helm stuff
podAnnotations: { }
nodeSelector: { }
tolerations: [ ]
affinity: { }
podAnnotations:
nodeSelector:
tolerations:
affinity:
3 changes: 2 additions & 1 deletion core/chains/evm/config/toml/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ func (c *Chain) SetFrom(f *Chain) {
c.GasEstimator.setFrom(&f.GasEstimator)

if ks := f.KeySpecific; ks != nil {
for _, v := range ks {
for i := range ks {
v := ks[i]
if i := slices.IndexFunc(c.KeySpecific, func(k KeySpecific) bool { return k.Key == v.Key }); i == -1 {
c.KeySpecific = append(c.KeySpecific, v)
} else {
Expand Down
Loading

0 comments on commit 5bb5966

Please sign in to comment.