diff --git a/.github/workflows/helm-publish.yml b/.github/workflows/helm-publish.yml new file mode 100644 index 00000000000..8a14ff1a7e6 --- /dev/null +++ b/.github/workflows/helm-publish.yml @@ -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 }} \ No newline at end of file diff --git a/charts/chainlink-cluster/Chart.yaml b/charts/chainlink-cluster/Chart.yaml index 6b64d718717..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.0 -appVersion: '0.1.0' \ No newline at end of file +version: 0.1.3 +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 179e51f2fa8..f7d4c45fa5f 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,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 ``` 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/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 72c20892109..11fb0cbee22 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 @@ -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: 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 cd1bf8503eb..006515f0a33 100644 --- a/charts/chainlink-cluster/values-raw-helm.yaml +++ b/charts/chainlink-cluster/values-raw-helm.yaml @@ -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: # @@ -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: