Skip to content

Commit

Permalink
Add optional ingress support for helm chart (#11534)
Browse files Browse the repository at this point in the history
* Create empty ingress for helm chart

* Add helm chart testing config and yaml lint config

* Exclude files generated during chart testing

* Bump version and fix apiVersion

* Support optional ingress on helm chart

* Rename workflow

* Create GHA workflow to lint helm charts

* Add explicit URL to mockserver Helm repository

* Include self in the paths filter

* Render out annotations in key/value format

* Spec out all 6 nodes in values for ingress hosts

* Hardcode standard ingress values

* Change annotations data type

* Use different values for ingress annotations and hardcode others
  • Loading branch information
chainchad authored Dec 20, 2023
1 parent 8795647 commit 14d5d3b
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .ct.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See: https://github.com/helm/chart-testing
target-branch: develop
chart-dirs: 'charts'
check-version-increment: false
validate-maintainers: false
File renamed without changes.
25 changes: 25 additions & 0 deletions .github/workflows/helm-chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Helm Chart

on:
pull_request:
paths:
- "charts/**"
- ".github/workflows/helm-chart.yml"

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 }}
3 changes: 3 additions & 0 deletions charts/chainlink-cluster/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Helm
charts/
requirements.lock
8 changes: 4 additions & 4 deletions charts/chainlink-cluster/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
repository: "https://www.mock-server.com"
condition: mockserver.enabled
42 changes: 42 additions & 0 deletions charts/chainlink-cluster/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- 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 }}
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 }}
spec:
{{- with .Values.ingress.ingressClassName }}
ingressClassName: {{ . }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host }}
http:
paths:
{{- range .http.paths }}
- path: /
pathType: ImplementationSpecific
backend:
service:
name: {{ .backend.service.name }}
port:
number: {{ .backend.service.port.number }}
{{- end }}
{{- end }}
{{- end -}}
97 changes: 97 additions & 0 deletions charts/chainlink-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ geth:
mockserver:
enabled: true
releasenameOverride: mockserver
service:
type: ClusterIP
app:
runAsUser: 999
readOnlyRootFilesystem: false
Expand Down Expand Up @@ -178,6 +180,101 @@ runner:
type: NodePort
port: 8080

ingress:
enabled: false
annotations: {}
ingressClassName: alb
hosts:
- host: chainlink-node-1.local
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
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
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

Expand Down
46 changes: 46 additions & 0 deletions lintconf.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 14d5d3b

Please sign in to comment.