Skip to content

Commit

Permalink
[rpc-node] adding ingress for consensus
Browse files Browse the repository at this point in the history
  • Loading branch information
nzenchik committed Jun 17, 2024
1 parent 92d4431 commit 7adcb26
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/rpc-node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.3.2
version: 0.3.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
61 changes: 61 additions & 0 deletions charts/rpc-node/templates/consensus-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.consensus.ingress.enabled -}}
{{- $fullName := include "rpc-node.fullname" . -}}
{{- if and .Values.consensus.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.consensus.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.consensus.ingress.annotations "kubernetes.io/ingress.class" .Values.consensus.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-consensus
labels:
{{- include "rpc-node.labels" . | nindent 4 }}
{{- with .Values.consensus.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.consensus.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.consensus.ingress.className }}
{{- end }}
{{- if .Values.consensus.ingress.tls }}
tls:
{{- range .Values.consensus.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.consensus.ingress.hosts }}
{{- $port := .port }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-consensus-cluster
port:
number: {{ $port }}
{{- else }}
serviceName: {{ $fullName }}-consensus-cluster
servicePort: {{ $port }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/rpc-node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,22 @@ consensus:
- name: p2p-udp
port: 9909
protocol: UDP
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
port: 8545
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

command: "lighthouse bn"
args: []
Expand Down

0 comments on commit 7adcb26

Please sign in to comment.