Skip to content

Commit

Permalink
[node] Add default ingress rule (#345)
Browse files Browse the repository at this point in the history
* add default ingress rule

* add tpl

* update example
  • Loading branch information
BulatSaif authored Jun 5, 2024
1 parent 8f17629 commit 222376c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion charts/node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: node
description: A Helm chart to deploy Substrate/Polkadot nodes
type: application
version: 5.8.0
version: 5.9.0
maintainers:
- name: Parity
url: https://github.com/paritytech/helm-charts
Expand Down
7 changes: 4 additions & 3 deletions charts/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This is intended behaviour. Make sure to run `git add -A` once again to stage ch

# Substrate/Polkadot node Helm chart

![Version: 5.8.0](https://img.shields.io/badge/Version-5.8.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 5.9.0](https://img.shields.io/badge/Version-5.9.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

## Maintainers

Expand Down Expand Up @@ -302,10 +302,11 @@ If you're running a collator node:
| image.repository | string | `"parity/polkadot"` | Image repository |
| image.tag | string | `"latest"` | Image tag |
| imagePullSecrets | list | `[]` | Reference to one or more secrets to be used when pulling images. ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ |
| ingress | object | `{"annotations":{},"enabled":false,"rules":[],"tls":[]}` | Creates an ingress resource |
| ingress | object | `{"annotations":{},"enabled":false,"host":"chart-example.local","rules":[],"tls":[]}` | Creates an ingress resource |
| ingress.annotations | object | `{}` | Annotations to add to the Ingress |
| ingress.enabled | bool | `false` | Enable creation of Ingress |
| ingress.rules | list | `[]` | Ingress rules configuration |
| ingress.host | string | `"chart-example.local"` | hostname used for default rpc ingress rule, if .Values.ingress.rules is set host is not used. |
| ingress.rules | list | `[]` | Ingress rules configuration, empty = default rpc rule (send all requests to rps port) |
| ingress.tls | list | `[]` | Ingress TLS configuration |
| initContainers | object | `{"downloadChainSnapshot":{"cmdArgs":"","debug":false,"extraEnvVars":[],"image":{"repository":"docker.io/rclone/rclone","tag":"latest"},"resources":{}},"downloadChainspec":{"debug":false,"image":{"repository":"docker.io/alpine","tag":"latest"},"resources":{}},"downloadRuntime":{"debug":false,"image":{"repository":"paritytech/kubetools-kubectl","tag":"latest"},"resources":{}},"injectKeys":{"debug":false,"resources":{}},"persistGeneratedNodeKey":{"debug":false,"resources":{}},"retrieveServiceInfo":{"debug":false,"image":{"repository":"paritytech/kubetools-kubectl","tag":"latest"},"resources":{}}}` | Additional init containers |
| initContainers.downloadChainSnapshot.cmdArgs | string | `""` | Flags to add to the CLI command. We rely on rclone for downloading snapshots so make sure the flags are compatible. |
Expand Down
13 changes: 2 additions & 11 deletions charts/node/examples/local-rococo/bootnode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,14 @@ node:
- "--allow-private-ipv4"
- "--discover-local"

# RPC endpoint
ingress:
enabled: false
annotations:
kubernetes.io/ingress.class: TODO
external-dns.alpha.kubernetes.io/target: TODO
cert-manager.io/cluster-issuer: TODO
rules:
- host: local-rococo.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: bootnode
port:
number: 9944
host: local-rococo.example.com
tls:
- secretName: local-rococo.example.com
hosts:
Expand Down
14 changes: 3 additions & 11 deletions charts/node/examples/local-rococo/parachain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,15 @@ node:
flags:
- "--allow-private-ipv4"
- "--discover-local"

# RPC endpoint
ingress:
enabled: false
annotations:
kubernetes.io/ingress.class: TODO
external-dns.alpha.kubernetes.io/target: TODO
cert-manager.io/cluster-issuer: TODO
rules:
- host: parachain.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: parachain-node
port:
number: 9944
host: parachain.example.com
tls:
- secretName: parachain.example.com
hosts:
Expand Down
17 changes: 15 additions & 2 deletions charts/node/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,21 @@ metadata:
spec:
ingressClassName: {{ .Values.ingress.ingressClassName | quote }}
rules:
{{- with .Values.ingress.rules }}
{{- toYaml . | nindent 6 }}
{{- if .Values.ingress.rules }}
{{- with .Values.ingress.rules }}
{{- (tpl (toYaml .) $) | nindent 6 }}
{{- end }}
{{- else }}
- host: "{{ tpl .Values.ingress.host . }}"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
number: {{ .Values.node.perNodeServices.apiService.rpcPort }}
{{- end }}
tls:
{{- with .Values.ingress.tls }}
Expand Down
4 changes: 3 additions & 1 deletion charts/node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ ingress:
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# -- Ingress rules configuration
# -- hostname used for default rpc ingress rule, if .Values.ingress.rules is set host is not used.
host: chart-example.local
# -- Ingress rules configuration, empty = default rpc rule (send all requests to rps port)
rules: []
# - host: chart-example.local
# paths:
Expand Down

0 comments on commit 222376c

Please sign in to comment.