From 8575da6356baa36722f33c81c30d8391cae0167b Mon Sep 17 00:00:00 2001 From: skudasov Date: Thu, 21 Sep 2023 14:39:41 +0200 Subject: [PATCH 1/9] pin stable geth --- charts/chainlink-cluster/README.md | 16 ++++++--- charts/chainlink-cluster/devspace.yaml | 1 + .../templates/geth-deployment.yaml | 1 - charts/chainlink-cluster/values-raw-helm.yaml | 36 +++++++++++++++---- 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/charts/chainlink-cluster/README.md b/charts/chainlink-cluster/README.md index 179e51f2fa8..2711499d405 100644 --- a/charts/chainlink-cluster/README.md +++ b/charts/chainlink-cluster/README.md @@ -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 ``` @@ -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 @@ -76,11 +78,15 @@ 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` +If you would like to use `helm` directly, please uncomment data in `values-raw-helm.yaml` ## Install ``` helm install -f values-raw-helm.yaml cl-cluster . ``` +Forward all apps (in another terminal) +``` +sudo kubefwd svc +``` ## Helm Test ``` diff --git a/charts/chainlink-cluster/devspace.yaml b/charts/chainlink-cluster/devspace.yaml index 63b6f112fec..54b5f9f01e9 100644 --- a/charts/chainlink-cluster/devspace.yaml +++ b/charts/chainlink-cluster/devspace.yaml @@ -43,6 +43,7 @@ deployments: image: ${DEVSPACE_IMAGE} stateful: false geth: + version: v1.12.0 wsrpc-port: 8546 httprpc-port: 8544 networkid: 1337 diff --git a/charts/chainlink-cluster/templates/geth-deployment.yaml b/charts/chainlink-cluster/templates/geth-deployment.yaml index 72c20892109..41c5a8685bc 100644 --- a/charts/chainlink-cluster/templates/geth-deployment.yaml +++ b/charts/chainlink-cluster/templates/geth-deployment.yaml @@ -4,7 +4,6 @@ kind: Deployment metadata: name: geth spec: - replicas: {{ .Values.replicas }} selector: matchLabels: app: geth diff --git a/charts/chainlink-cluster/values-raw-helm.yaml b/charts/chainlink-cluster/values-raw-helm.yaml index cd1bf8503eb..84998dd783f 100644 --- a/charts/chainlink-cluster/values-raw-helm.yaml +++ b/charts/chainlink-cluster/values-raw-helm.yaml @@ -15,12 +15,35 @@ chainlink: nodes: - name: node-1 # 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 +# 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 @@ -35,6 +58,7 @@ db: stateful: false # default cluster shipped with latest Geth ( dev mode by default ) geth: + version: v1.12.0 wsrpc-port: 8546 httprpc-port: 8544 networkid: 1337 From fdfd0ffb962ea6db903eb7787230a06bdab49ebe Mon Sep 17 00:00:00 2001 From: skudasov Date: Thu, 21 Sep 2023 15:22:29 +0200 Subject: [PATCH 2/9] try publish --- .github/workflows/helm-publish.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/helm-publish.yml diff --git a/.github/workflows/helm-publish.yml b/.github/workflows/helm-publish.yml new file mode 100644 index 00000000000..5f2d474b582 --- /dev/null +++ b/.github/workflows/helm-publish.yml @@ -0,0 +1,13 @@ +name: Helm Publish + +on: + push: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: J12934/helm-gh-pages-action@master + with: + access-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From d2c5c96b1ac7a44f14fcdbce66c22a68c1c7d40c Mon Sep 17 00:00:00 2001 From: skudasov Date: Thu, 21 Sep 2023 15:35:31 +0200 Subject: [PATCH 3/9] try publish --- .github/workflows/helm-publish.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/helm-publish.yml b/.github/workflows/helm-publish.yml index 5f2d474b582..0d7ecd939a9 100644 --- a/.github/workflows/helm-publish.yml +++ b/.github/workflows/helm-publish.yml @@ -8,6 +8,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - name: Create packages and repo index + run: | + git config user.name github-actions + git config user.email github-actions@github.com - uses: J12934/helm-gh-pages-action@master with: - access-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + charts-folder: charts + deploy-branch: helm-release + access-token: ${{ secrets.HELM_PUSH_TOKEN }} \ No newline at end of file From 73814eacfcddd814aa42323d9de53f6d3778faee Mon Sep 17 00:00:00 2001 From: skudasov Date: Thu, 21 Sep 2023 16:15:11 +0200 Subject: [PATCH 4/9] try release on tag --- .github/workflows/helm-publish.yml | 2 ++ charts/chainlink-cluster/Chart.yaml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/helm-publish.yml b/.github/workflows/helm-publish.yml index 0d7ecd939a9..77fe63fac3b 100644 --- a/.github/workflows/helm-publish.yml +++ b/.github/workflows/helm-publish.yml @@ -2,6 +2,8 @@ name: Helm Publish on: push: + tags: + - "helm-release-v**" jobs: build: diff --git a/charts/chainlink-cluster/Chart.yaml b/charts/chainlink-cluster/Chart.yaml index 6b64d718717..89079dc1046 100644 --- a/charts/chainlink-cluster/Chart.yaml +++ b/charts/chainlink-cluster/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 name: chainlink-cluster description: Chainlink nodes cluster -version: 0.1.0 -appVersion: '0.1.0' \ No newline at end of file +version: 0.1.1 +appVersion: '2.6.0' \ No newline at end of file From 3186f71e29f0118edf66a954dec6f46884db641e Mon Sep 17 00:00:00 2001 From: skudasov Date: Thu, 21 Sep 2023 17:11:59 +0200 Subject: [PATCH 5/9] try release on tag --- .github/workflows/helm-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/helm-publish.yml b/.github/workflows/helm-publish.yml index 77fe63fac3b..689677f6adc 100644 --- a/.github/workflows/helm-publish.yml +++ b/.github/workflows/helm-publish.yml @@ -3,7 +3,7 @@ name: Helm Publish on: push: tags: - - "helm-release-v**" + - helm-v** jobs: build: From 250fbe839f47a814f3be206d9a1220bc72d2b02d Mon Sep 17 00:00:00 2001 From: skudasov Date: Thu, 21 Sep 2023 17:20:59 +0200 Subject: [PATCH 6/9] try release on label --- .github/workflows/helm-publish.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/helm-publish.yml b/.github/workflows/helm-publish.yml index 689677f6adc..8a14ff1a7e6 100644 --- a/.github/workflows/helm-publish.yml +++ b/.github/workflows/helm-publish.yml @@ -1,20 +1,17 @@ name: Helm Publish on: - push: - tags: - - helm-v** + pull_request: + types: [ labeled ] jobs: - build: + helm_release: + if: ${{ github.event.label.name == 'helm_release' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - name: Create packages and repo index - run: | - git config user.name github-actions - git config user.email github-actions@github.com - - uses: J12934/helm-gh-pages-action@master + - name: Release helm chart + uses: J12934/helm-gh-pages-action@master with: charts-folder: charts deploy-branch: helm-release From 4ffff820b690d92410cfa5852b8cfd6abaf9051a Mon Sep 17 00:00:00 2001 From: skudasov Date: Thu, 21 Sep 2023 21:53:15 +0200 Subject: [PATCH 7/9] add resources, update README --- charts/chainlink-cluster/Chart.yaml | 2 +- charts/chainlink-cluster/README.md | 17 ++++++- .../templates/chainlink-deployment.yaml | 8 ++-- .../templates/geth-deployment.yaml | 4 +- .../templates/mockserver.yaml | 21 ++++----- .../templates/runner-deployment.yaml | 2 +- charts/chainlink-cluster/values-raw-helm.yaml | 47 +++++++++++++++++-- 7 files changed, 76 insertions(+), 25 deletions(-) diff --git a/charts/chainlink-cluster/Chart.yaml b/charts/chainlink-cluster/Chart.yaml index 89079dc1046..ddf8e5e8162 100644 --- a/charts/chainlink-cluster/Chart.yaml +++ b/charts/chainlink-cluster/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 name: chainlink-cluster description: Chainlink nodes cluster -version: 0.1.1 +version: 0.1.2 appVersion: '2.6.0' \ No newline at end of file diff --git a/charts/chainlink-cluster/README.md b/charts/chainlink-cluster/README.md index 2711499d405..ffb13f00b1b 100644 --- a/charts/chainlink-cluster/README.md +++ b/charts/chainlink-cluster/README.md @@ -79,7 +79,7 @@ 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-raw-helm.yaml` -## Install +## Install from local files ``` helm install -f values-raw-helm.yaml cl-cluster . ``` @@ -87,6 +87,21 @@ 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 +``` +Install +``` +helm install -f values-raw-helm.yaml cl-cluster chainlink-cluster/chainlink-cluster --version v0.1.1 +``` + +## 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 ``` diff --git a/charts/chainlink-cluster/templates/chainlink-deployment.yaml b/charts/chainlink-cluster/templates/chainlink-deployment.yaml index 3ab1edac602..16665916f59 100644 --- a/charts/chainlink-cluster/templates/chainlink-deployment.yaml +++ b/charts/chainlink-cluster/templates/chainlink-deployment.yaml @@ -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: @@ -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: diff --git a/charts/chainlink-cluster/templates/geth-deployment.yaml b/charts/chainlink-cluster/templates/geth-deployment.yaml index 41c5a8685bc..11fb0cbee22 100644 --- a/charts/chainlink-cluster/templates/geth-deployment.yaml +++ b/charts/chainlink-cluster/templates/geth-deployment.yaml @@ -101,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: diff --git a/charts/chainlink-cluster/templates/mockserver.yaml b/charts/chainlink-cluster/templates/mockserver.yaml index 998687790ba..96f9582435f 100755 --- a/charts/chainlink-cluster/templates/mockserver.yaml +++ b/charts/chainlink-cluster/templates/mockserver.yaml @@ -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 }} \ No newline at end of file + {{ toYaml . | indent 8 }} + {{- end }} +--- \ No newline at end of file diff --git a/charts/chainlink-cluster/templates/runner-deployment.yaml b/charts/chainlink-cluster/templates/runner-deployment.yaml index 41b24a770f5..5d9025b41c5 100644 --- a/charts/chainlink-cluster/templates/runner-deployment.yaml +++ b/charts/chainlink-cluster/templates/runner-deployment.yaml @@ -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 }} diff --git a/charts/chainlink-cluster/values-raw-helm.yaml b/charts/chainlink-cluster/values-raw-helm.yaml index 84998dd783f..006515f0a33 100644 --- a/charts/chainlink-cluster/values-raw-helm.yaml +++ b/charts/chainlink-cluster/values-raw-helm.yaml @@ -14,8 +14,9 @@ chainlink: p2p_port: 8090 nodes: - name: node-1 + image: "public.ecr.aws/chainlink/chainlink:latest" # override default config per node - # for example, use OCRv2 P2P setup + # for example, use OCRv2 P2P setup, the whole config # toml: | # RootDir = './clroot' # [Log] @@ -47,6 +48,14 @@ chainlink: - 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: # @@ -56,6 +65,13 @@ 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 @@ -63,18 +79,39 @@ geth: 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: From efeeb7b545d330c023b2284323d9f0290a81330f Mon Sep 17 00:00:00 2001 From: skudasov Date: Sun, 24 Sep 2023 16:17:34 +0200 Subject: [PATCH 8/9] update README --- charts/chainlink-cluster/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/charts/chainlink-cluster/README.md b/charts/chainlink-cluster/README.md index ffb13f00b1b..f7d4c45fa5f 100644 --- a/charts/chainlink-cluster/README.md +++ b/charts/chainlink-cluster/README.md @@ -95,9 +95,15 @@ 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.1 +helm install -f values-raw-helm.yaml cl-cluster chainlink-cluster/chainlink-cluster --version v0.1.2 ``` ## Create a new release From bd041834ccfca0f1dda82d1b3535d4bd0689fcea Mon Sep 17 00:00:00 2001 From: skudasov Date: Sun, 24 Sep 2023 16:18:21 +0200 Subject: [PATCH 9/9] bump and test release --- charts/chainlink-cluster/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/chainlink-cluster/Chart.yaml b/charts/chainlink-cluster/Chart.yaml index ddf8e5e8162..bfea29c82ec 100644 --- a/charts/chainlink-cluster/Chart.yaml +++ b/charts/chainlink-cluster/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 name: chainlink-cluster description: Chainlink nodes cluster -version: 0.1.2 +version: 0.1.3 appVersion: '2.6.0' \ No newline at end of file