From 38b52670fb509e4530768bea3083f8bf541582ee Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Mon, 11 Dec 2023 09:59:33 -0500 Subject: [PATCH 01/14] Create empty ingress for helm chart --- charts/chainlink-cluster/templates/ingress.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 charts/chainlink-cluster/templates/ingress.yaml diff --git a/charts/chainlink-cluster/templates/ingress.yaml b/charts/chainlink-cluster/templates/ingress.yaml new file mode 100644 index 00000000000..e69de29bb2d From bea2fb5ef765c80f8ad27e8a38a2f5fc1bd2f6c0 Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Mon, 11 Dec 2023 20:40:00 -0500 Subject: [PATCH 02/14] Add helm chart testing config and yaml lint config --- .ct.yml | 5 +++++ lintconf.yaml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .ct.yml create mode 100644 lintconf.yaml diff --git a/.ct.yml b/.ct.yml new file mode 100644 index 00000000000..68a9198e920 --- /dev/null +++ b/.ct.yml @@ -0,0 +1,5 @@ +# See: https://github.com/helm/chart-testing +target-branch: develop +chart-dirs: 'charts' +check-version-increment: false +validate-maintainers: false diff --git a/lintconf.yaml b/lintconf.yaml new file mode 100644 index 00000000000..ff37371d476 --- /dev/null +++ b/lintconf.yaml @@ -0,0 +1,46 @@ +--- +# Copied from: +# https://redhat-cop.github.io/ci/linting-testing-helm-charts.html +# with `min-spaces-from-content` changed to be compatible with prettier. +rules: + braces: + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + brackets: + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + colons: + max-spaces-before: 0 + max-spaces-after: 1 + commas: + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: + require-starting-space: true + min-spaces-from-content: 1 + document-end: disable + document-start: disable # No --- to start a file + empty-lines: + max: 2 + max-start: 0 + max-end: 0 + hyphens: + max-spaces-after: 1 + indentation: + spaces: consistent + indent-sequences: whatever # - list indentation will handle both indentation and without + check-multi-line-strings: false + key-duplicates: enable + line-length: disable # Lines can be any length + new-line-at-end-of-file: disable + new-lines: + type: unix + trailing-spaces: enable + truthy: + level: warning + From 110e413529ab46525c58ecc6e870653ff52a994a Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Mon, 11 Dec 2023 20:42:49 -0500 Subject: [PATCH 03/14] Exclude files generated during chart testing --- charts/chainlink-cluster/.gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 charts/chainlink-cluster/.gitignore diff --git a/charts/chainlink-cluster/.gitignore b/charts/chainlink-cluster/.gitignore new file mode 100644 index 00000000000..3ee791f740a --- /dev/null +++ b/charts/chainlink-cluster/.gitignore @@ -0,0 +1,3 @@ +# Helm +charts/ +requirements.lock From 45d7d2b42029765cd7489b94878394f7c9563cd0 Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Mon, 11 Dec 2023 20:43:11 -0500 Subject: [PATCH 04/14] Bump version and fix apiVersion --- charts/chainlink-cluster/Chart.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/chainlink-cluster/Chart.yaml b/charts/chainlink-cluster/Chart.yaml index 127f5b6e326..c89204267c2 100644 --- a/charts/chainlink-cluster/Chart.yaml +++ b/charts/chainlink-cluster/Chart.yaml @@ -1,10 +1,10 @@ -apiVersion: v1 +apiVersion: v2 name: chainlink-cluster description: Chainlink nodes cluster -version: 0.1.3 +version: 0.2.0 appVersion: "2.6.0" dependencies: - name: mockserver version: "5.14.0" repository: "@mockserver" - condition: mockserver.enabled \ No newline at end of file + condition: mockserver.enabled From efd359bad9c7f148af713fb4dd4f6444d3f3e133 Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Mon, 11 Dec 2023 20:43:42 -0500 Subject: [PATCH 05/14] Support optional ingress on helm chart --- .../chainlink-cluster/templates/ingress.yaml | 35 ++++++++++++++ charts/chainlink-cluster/values.yaml | 48 +++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/charts/chainlink-cluster/templates/ingress.yaml b/charts/chainlink-cluster/templates/ingress.yaml index e69de29bb2d..997635b8200 100644 --- a/charts/chainlink-cluster/templates/ingress.yaml +++ b/charts/chainlink-cluster/templates/ingress.yaml @@ -0,0 +1,35 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $.Release.Name }} + labels: + app: {{ $.Release.Name }} + release: {{ $.Release.Name }} + {{- range $key, $value := $.Values.labels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.ingress.annotations }} + annotations: + {{- toYaml .Values.ingress.annotations | nindent 4 }} + {{- end }} +spec: + {{- with .Values.ingress.ingressClassName }} + ingressClassName: {{ . }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host }} + http: + paths: + {{- range .http.paths }} + - path: {{ .path }} + pathType: {{ .pathType }} + backend: + service: + name: {{ .backend.service.name }} + port: + number: {{ .backend.service.port.number }} + {{- end }} + {{- end }} +{{- end -}} diff --git a/charts/chainlink-cluster/values.yaml b/charts/chainlink-cluster/values.yaml index feba1414444..c3a1bcbd2e7 100644 --- a/charts/chainlink-cluster/values.yaml +++ b/charts/chainlink-cluster/values.yaml @@ -135,6 +135,8 @@ geth: mockserver: enabled: true releasenameOverride: mockserver + service: + type: ClusterIP app: runAsUser: 999 readOnlyRootFilesystem: false @@ -178,6 +180,52 @@ runner: type: NodePort port: 8080 +ingress: + enabled: false + annotations: null # Pass in as multi-line string + ingressClassName: alb + hosts: + # must be string template with one %s for index + - host: chainlink-node-%s.local + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: chainlink-node-%s + port: + number: 6688 + - host: chainlink-geth-http.local + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: geth + port: + number: 8544 + - host: chainlink-geth-ws.local + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: geth + port: + number: 8546 + - host: chainlink-mockserver.local + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: mockserver + port: + number: 1080 # monitoring.coreos.com/v1 PodMonitor for each node prometheusMonitor: true From 85330a949b08a643fa45a2df5847954c489f9e57 Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Mon, 11 Dec 2023 21:05:30 -0500 Subject: [PATCH 06/14] Rename workflow --- .github/workflows/{helm-publish.yml => helm-chart-publish.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{helm-publish.yml => helm-chart-publish.yml} (100%) diff --git a/.github/workflows/helm-publish.yml b/.github/workflows/helm-chart-publish.yml similarity index 100% rename from .github/workflows/helm-publish.yml rename to .github/workflows/helm-chart-publish.yml From 98315175f6d2f640cdbbd72b4b568c365442fb2b Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Mon, 11 Dec 2023 21:05:40 -0500 Subject: [PATCH 07/14] Create GHA workflow to lint helm charts --- .github/workflows/helm-chart.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/helm-chart.yml diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml new file mode 100644 index 00000000000..085f1ec967b --- /dev/null +++ b/.github/workflows/helm-chart.yml @@ -0,0 +1,24 @@ +name: Helm Chart + +on: + pull_request: + paths: + - "charts/**" + +jobs: + ci-lint-helm-charts: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + actions: read + steps: + - name: ci-lint-helm-charts + uses: smartcontractkit/.github/actions/ci-lint-charts@9fd15fe8e698a5e28bfd06b3a91471c56568dcb3 # ci-lint-charts@0.1.1 + with: + # chart testing inputs + chart-testing-extra-args: "--lint-conf=lintconf.yaml" + # grafana inputs + metrics-job-name: ci-lint-helm-charts + gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} + gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }} From 0370a5e0c34efd52eea8e7f08d926c31c0149f59 Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Mon, 11 Dec 2023 21:11:51 -0500 Subject: [PATCH 08/14] Add explicit URL to mockserver Helm repository --- 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 c89204267c2..498b0670812 100644 --- a/charts/chainlink-cluster/Chart.yaml +++ b/charts/chainlink-cluster/Chart.yaml @@ -6,5 +6,5 @@ appVersion: "2.6.0" dependencies: - name: mockserver version: "5.14.0" - repository: "@mockserver" + repository: "https://www.mock-server.com" condition: mockserver.enabled From dbfb1c539a57640a839fb0c256fb6780c9712732 Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Mon, 11 Dec 2023 21:47:15 -0500 Subject: [PATCH 09/14] Include self in the paths filter --- .github/workflows/helm-chart.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml index 085f1ec967b..c988d14f30c 100644 --- a/.github/workflows/helm-chart.yml +++ b/.github/workflows/helm-chart.yml @@ -4,6 +4,7 @@ on: pull_request: paths: - "charts/**" + - ".github/workflows/helm-chart.yml" jobs: ci-lint-helm-charts: From 707ba6abeca8f214b7eadfb350b0ac0bd590708d Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:03:15 -0500 Subject: [PATCH 10/14] Render out annotations in key/value format --- charts/chainlink-cluster/templates/ingress.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/charts/chainlink-cluster/templates/ingress.yaml b/charts/chainlink-cluster/templates/ingress.yaml index 997635b8200..838c33e772d 100644 --- a/charts/chainlink-cluster/templates/ingress.yaml +++ b/charts/chainlink-cluster/templates/ingress.yaml @@ -11,7 +11,9 @@ metadata: {{- end }} {{- if .Values.ingress.annotations }} annotations: - {{- toYaml .Values.ingress.annotations | nindent 4 }} + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} {{- end }} spec: {{- with .Values.ingress.ingressClassName }} From f7224cbf2821082c8f7a7fc8707a75593230f0c9 Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:29:15 -0500 Subject: [PATCH 11/14] Spec out all 6 nodes in values for ingress hosts --- charts/chainlink-cluster/values.yaml | 55 ++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/charts/chainlink-cluster/values.yaml b/charts/chainlink-cluster/values.yaml index c3a1bcbd2e7..a2a3541b0f2 100644 --- a/charts/chainlink-cluster/values.yaml +++ b/charts/chainlink-cluster/values.yaml @@ -185,15 +185,64 @@ ingress: annotations: null # Pass in as multi-line string ingressClassName: alb hosts: - # must be string template with one %s for index - - host: chainlink-node-%s.local + - host: chainlink-node-1.local http: paths: - path: / pathType: ImplementationSpecific backend: service: - name: chainlink-node-%s + name: chainlink-node-1 + port: + number: 6688 + - host: chainlink-node-2.local + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: chainlink-node-2 + port: + number: 6688 + - host: chainlink-node-3.local + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: chainlink-node-3 + port: + number: 6688 + - host: chainlink-node-4.local + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: chainlink-node-4 + port: + number: 6688 + - host: chainlink-node-5.local + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: chainlink-node-5 + port: + number: 6688 + - host: chainlink-node-6.local + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: chainlink-node-6 port: number: 6688 - host: chainlink-geth-http.local From 200e0b1ba84229ead8fa6027da0a47a20d4f5dd4 Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:45:57 -0500 Subject: [PATCH 12/14] Hardcode standard ingress values --- charts/chainlink-cluster/templates/ingress.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/chainlink-cluster/templates/ingress.yaml b/charts/chainlink-cluster/templates/ingress.yaml index 838c33e772d..c606d8081cf 100644 --- a/charts/chainlink-cluster/templates/ingress.yaml +++ b/charts/chainlink-cluster/templates/ingress.yaml @@ -25,8 +25,8 @@ spec: http: paths: {{- range .http.paths }} - - path: {{ .path }} - pathType: {{ .pathType }} + - path: / + pathType: ImplementationSpecific backend: service: name: {{ .backend.service.name }} From 521030354780d464d6f60a47b823ca7c9fdf92e2 Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:46:13 -0500 Subject: [PATCH 13/14] Change annotations data type --- charts/chainlink-cluster/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/chainlink-cluster/values.yaml b/charts/chainlink-cluster/values.yaml index a2a3541b0f2..9394bda1213 100644 --- a/charts/chainlink-cluster/values.yaml +++ b/charts/chainlink-cluster/values.yaml @@ -182,7 +182,7 @@ runner: ingress: enabled: false - annotations: null # Pass in as multi-line string + annotations: {} ingressClassName: alb hosts: - host: chainlink-node-1.local From d8b6eda5ecf83990322ce470fed1e040b8c66eee Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:51:21 -0500 Subject: [PATCH 14/14] Use different values for ingress annotations and hardcode others --- charts/chainlink-cluster/templates/ingress.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/charts/chainlink-cluster/templates/ingress.yaml b/charts/chainlink-cluster/templates/ingress.yaml index c606d8081cf..f7d9791155b 100644 --- a/charts/chainlink-cluster/templates/ingress.yaml +++ b/charts/chainlink-cluster/templates/ingress.yaml @@ -9,9 +9,14 @@ metadata: {{- range $key, $value := $.Values.labels }} {{ $key }}: {{ $value | quote }} {{- end }} - {{- if .Values.ingress.annotations }} annotations: - {{- range $key, $value := .Values.ingress.annotations }} + alb.ingress.kubernetes.io/backend-protocol: HTTP + alb.ingress.kubernetes.io/certificate-arn: {{ $.Values.ingress.annotation_certificate_arn | quote }} + alb.ingress.kubernetes.io/group.name: {{ $.Values.ingress.annotation_group_name | quote }} + alb.ingress.kubernetes.io/scheme: internal + alb.ingress.kubernetes.io/target-type: ip + {{- if .Values.ingress.extra_annotations }} + {{- range $key, $value := .Values.ingress.extra_annotations }} {{ $key }}: {{ $value | quote }} {{- end }} {{- end }}