Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[erpc] Chart for erpc tool #147

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/helm-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Docker
uses: docker/setup-buildx-action@v2

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run helm-docs
run: docker run --rm --volume "$(pwd):/helm-docs" -u "$(id -u)" jnorwood/helm-docs:latest
run: |
TARGET_BRANCH=${{ github.event.pull_request.base.ref }}
TARGET_CHART_PATH=$(ct list-changed --target-branch "$TARGET_BRANCH" | head -n 1)
echo "Target chart path: $TARGET_CHART_PATH"
docker run --rm --volume "$(pwd)/${TARGET_CHART_PATH}:/helm-docs" -u "$(id -u)" jnorwood/helm-docs:latest

- name: Check for unstaged changes
run: |
Expand Down
23 changes: 23 additions & 0 deletions charts/erpc/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/erpc/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: file://../common
version: 1.0.1
digest: sha256:16871b89b082fb3f3fa0c9bb12fa86f144272c29639386c444322cbaa454e17b
generated: "2024-09-17T17:09:54.916794-04:00"
17 changes: 17 additions & 0 deletions charts/erpc/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v2
name: erpc
description: A Helm chart to deploy eRPC instances
version: 1.0.0
appVersion: "0.0.23"
type: application
keywords:
- rpcs
- erpc
home: https://docs.erpc.cloud
dependencies:
- name: common
repository: file://../common
version: 1.0.1
maintainers:
- name: cbermudez97
- name: AntiD2ta
70 changes: 70 additions & 0 deletions charts/erpc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# erpc

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

A Helm chart to deploy eRPC instances

**Homepage:** <https://docs.erpc.cloud>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| cbermudez97 | | |
| AntiD2ta | | |

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| file://../common | common | 1.0.1 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| erpc.config.database.evmJsonRpcCache.driver | string | `""` | Cache driver to be used. One of `memory` or `redis`. Other drivers configurations will be ignored. DynamoDB and Postgres drivers are not supported at the moment. Ref: https://docs.erpc.cloud/config/database |
| erpc.config.database.evmJsonRpcCache.maxItems | int | `10000` | Maximum number of items to be cached. |
| erpc.config.database.evmJsonRpcCache.redis.addr | string | `""` | Redis server address. |
| erpc.config.database.evmJsonRpcCache.redis.db | string | `""` | Redis database to be used. |
| erpc.config.database.evmJsonRpcCache.redis.password | object | `{"secret":{"key":"","name":""}}` | Redis server password. |
| erpc.config.logLevel | string | `"warn"` | Erpc log level. |
| erpc.config.metrics | object | `{"enabled":true,"hostV4":"0.0.0.0","hostV6":"[::]","listenV4":true,"listenV6":false,"port":4001}` | Erpc prometheus metrics server configuration. |
| erpc.config.projects[0].auth | object | `{"secretKey":"","type":"secret"}` | Project authentication strategies. Ref: https://docs.erpc.cloud/config/auth. Only `secret` strategy is supported at the moment. |
| erpc.config.projects[0].id | string | `""` | |
| erpc.config.projects[0].networks | list | `[{"chainId":1,"failsafe":{},"type":"evm"}]` | Project networks to be used. |
| erpc.config.projects[0].networks[0].failsafe | object | `{}` | Failsafe policies to be used for this network. Ref: https://docs.erpc.cloud/config/failsafe |
| erpc.config.projects[0].networks[0].type | string | `"evm"` | Chain type to be used. Only `evm` is supported at the moment. |
| erpc.config.projects[0].upstreams[0].chainId | int | `1` | Upstream chain id to be used. |
| erpc.config.projects[0].upstreams[0].endpoint | object | `{"secret":{"enabled":false,"key":""},"value":""}` | Upstream endpoint to be used. |
| erpc.config.projects[0].upstreams[0].endpoint.secret | object | `{"enabled":false,"key":""}` | Optional secret key to be used. This key is taken from the configured `erpc.secret` resource. |
| erpc.config.projects[0].upstreams[0].endpoint.value | string | `""` | Optional endpoint value. Ignored if the endpoint is using the `secret` configuration. |
| erpc.config.projects[0].upstreams[0].failsafe | object | `{}` | Failsafe policies to be used for this upstream. Ref: https://docs.erpc.cloud/config/failsafe |
| erpc.config.projects[0].upstreams[0].id | string | `""` | |
| erpc.config.projects[0].upstreams[0].type | string | `"evm"` | Upstream type to be used. |
| erpc.config.server | object | `{"httpHostV4":"0.0.0.0","httpHostV6":"[::]","httpPort":4000,"listenV4":true,"listenV6":false}` | Erpc json-rpc server configuration. |
| erpc.image | object | `{"pullPolicy":"IfNotPresent","repository":"ghcr.io/erpc/erpc","tag":"0.0.23"}` | Erpc image to be used. |
| erpc.replicaCount | int | `3` | Erpc deployment replica count. |
| erpc.resources | object | `{"limits":{"cpu":"2","memory":"3Gi"},"requests":{"cpu":"2","memory":"3Gi"}}` | Erpc container resources. |
| erpc.secret | object | `{"name":""}` | Erpc required secret used for the init container. All keys used for configurations secrets must be defined inside this secret resource. |
| global.namespaceOverride | string | `""` | |
| global.serviceAccount | object | `{"annotations":{},"create":false}` | Service account. Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ |
| global.suffix | string | `""` | |
| ingress.annotations | object | `{}` | |
| ingress.className | string | `""` | Ingress class name. |
| ingress.enabled | bool | `false` | Enable Ingress. |
| ingress.hosts | list | `[]` | Hostnames. Can be provided if Ingress is enabled. |
| ingress.labels | object | `{}` | |
| ingress.routePrefix | string | `"/"` | Route prefix. Can skip it if any item of path has the path defined. |
| ingress.tls | list | `[]` | TLS configuration for Ingress Secret must be manually created in the namespace |
| initImage | object | `{"pullPolicy":"IfNotPresent","repository":"bash","tag":"5.2"}` | Init image is used to generate the erpc config file. |
| service.annotations | object | `{}` | Erpc Service annotations. |
| service.metricsPort | int | `9000` | Erpc Service metrics port. |
| service.port | int | `80` | Erpc Service port. |
| service.type | string | `"ClusterIP"` | Erpc Service type. |
| serviceAccount | object | `{"annotations":{},"name":""}` | Service account. Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account. |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
91 changes: 91 additions & 0 deletions charts/erpc/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" $ }}-init-config-script
labels:
{{- include "common.labels.standard" $ | nindent 4 }}
data:
init.sh: |
#!/bin/bash
template=$1
output=$2
set -e
echo "Initializing config from template $template to $output..."
envsubst < $template > $output
echo "Config initialized!"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" $ }}-config-template
labels:
{{- include "common.labels.standard" $ | nindent 4 }}
data:
erpc.yaml: |
logLevel: {{ .Values.erpc.config.logLevel }}
{{- if .Values.erpc.config.database }}
{{- with .Values.erpc.config.database.evmJsonRpcCache }}
{{- if eq .driver "redis" }}
database:
evmJsonRpcCache:
redis:
addr: {{ .redis.addr }}
password: '${ERPC_REDIS_PASSWORD}'
db: {{ .redis.db }}
{{- else if eq .driver "memory" }}
database:
evmJsonRpcCache:
maxItems: {{ .maxItems }}
{{- end }}
{{- end }}
{{- end }}
server:
{{- toYaml .Values.erpc.config.server | nindent 6 }}
metrics:
{{- toYaml .Values.erpc.config.metrics | nindent 6 }}
projects:
{{- range $i, $project := .Values.erpc.config.projects }}
- id: {{ $project.id }}
{{- with $project.auth }}
{{- if eq .type "secret" }}
auth:
strategies:
- type: secret
secret:
value: {{ "'${" }}{{ .secretKey }}{{ "}'" }}
{{- end }}
{{- end }}
networks:
{{- range $j, $network := $project.networks }}
{{- if eq $network.type "evm" }}
- architecture: evm
evm:
chainId: {{ $network.chainId }}
{{- if $network.failsafe }}
failsafe:
{{- toYaml $network.failsafe | nindent 14 }}
{{- end }}
{{- end }}
{{- end }}
upstreams:
{{- range $i, $upstream := $project.upstreams }}
- id: {{ $upstream.id }}
{{- if eq $upstream.type "evm" }}
type: evm
evm:
chainId: {{ $upstream.chainId }}
{{- end }}
endpoint: >-
{{- if $upstream.endpoint.secret.enabled }}
{{ "${" }}{{ $upstream.endpoint.secret.variable }}{{ "}" }}
{{- else }}
{{ $upstream.endpoint.value }}
{{- end }}
{{- if $upstream.failsafe }}
failsafe:
{{- toYaml $upstream.failsafe | nindent 14 }}
{{- end }}
{{- end }}
{{- end }}

79 changes: 79 additions & 0 deletions charts/erpc/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
apiVersion: {{ include "common.capabilities.deployment.apiVersion" $ }}
kind: Deployment
metadata:
name: "{{ include "common.names.fullname" $ }}"
{{- with $.Values.global.namespaceOverride }}
namespace: {{ . }}
{{- end }}
spec:
serviceName: "{{ include "common.names.fullname" $ }}"
replicas: {{ .Values.erpc.replicaCount }}
selector:
matchLabels:
{{- include "common.labels.matchLabels" $ | nindent 6 }}
app: erpc
template:
metadata:
labels:
{{- include "common.labels.matchLabels" $ | nindent 8 }}
app: erpc
spec:
serviceAccountName: {{ include "common.names.serviceAccountName" $ }}
initContainers:
- name: init-erpc-config
image: "{{ .Values.initImage.repository }}:{{ .Values.initImage.tag }}"
imagePullPolicy: {{ .Values.initImage.pullPolicy }}
env:
{{- if .Values.erpc.config.database }}
{{- with .Values.erpc.config.database.evmJsonRpcCache }}
{{- if eq .driver "redis" }}
- name: ERPC_REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .redis.password.secret.name }}
key: {{ .redis.password.secret.key }}
{{- end }}
{{- end }}
{{- end }}
envFrom:
- secretRef:
name: {{ .Values.erpc.secret.name }}
command:
- /bin/bash
- /scripts/init.sh
- /templates/erpc.yaml
- /etc/erpc/erpc.yaml
volumeMounts:
- name: erpc-config
mountPath: /etc/erpc
- name: erpc-config-template
mountPath: /templates
- name: erpc-config-init-script
mountPath: /scripts
containers:
- name: erpc
image: "{{ .Values.erpc.image.repository }}:{{ .Values.erpc.image.tag }}"
imagePullPolicy: {{ .Values.erpc.image.pullPolicy }}
command:
- /root/erpc-server
resources:
{{- toYaml .Values.erpc.resources | nindent 12 }}
ports:
- name: http-jsonrpc
containerPort: {{ .Values.erpc.config.server.httpPort }}
- name: http-metrics
containerPort: {{ .Values.erpc.config.metrics.port }}
volumeMounts:
- name: erpc-config
mountPath: /root/erpc.yaml
subPath: erpc.yaml
volumes:
- name: erpc-config
emptyDir: {}
- name: erpc-config-template
configMap:
name: {{ include "common.names.fullname" $ }}-config-template
- name: erpc-config-init-script
configMap:
name: {{ include "common.names.fullname" $ }}-init-config-script
48 changes: 48 additions & 0 deletions charts/erpc/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{- if .Values.ingress.enabled -}}
---
{{- $baseServiceName := include "common.names.fullname" . -}}
{{- $routePrefix := .Values.ingress.routePrefix | default "/" -}}
{{- $defaultPath := list (dict "path" $routePrefix "port" 8000 "pathType" "ImplementationSpecific") -}}
{{- $paths := .Values.ingress.paths | default $defaultPath -}}
apiVersion: {{ include "common.capabilities.ingress.apiVersion" $ }}
kind: Ingress
metadata:
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
{{- with .Values.ingress.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $.Values.global.namespaceOverride }}
namespace: {{ . }}
{{- end }}
spec:
{{- with .Values.ingress.className }}
ingressClassName: {{ . }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: {{ .pathType }}
backend:
service:
name: {{ .serviceName | default $baseServiceName }}
port:
number: {{ .port }}
{{- end }}
{{- with .host }}
host: {{ . | quote }}
{{- end }}
{{- end }}
{{- with .Values.ingress.tls }}
tls:
{{ tpl (toYaml . | indent 4) . }}
{{- end }}
{{- end }}
30 changes: 30 additions & 0 deletions charts/erpc/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
apiVersion: v1
kind: Service
metadata:
name: "{{ include "common.names.fullname" $ }}"
labels:
{{- include "common.labels.standard" $ | nindent 4 }}
pod: "{{ include "common.names.fullname" $ }}"
app: erpc
{{- with $.Values.service.annotations }}
annotations:
{{ toYaml . | nindent 4 | trim }}
{{- end }}
{{- with $.Values.global.namespaceOverride }}
namespace: {{ . }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
- name: http-jsonrpc
port: {{ .Values.service.port }}
targetPort: {{ .Values.erpc.config.server.httpPort }}
protocol: TCP
- name: http-metrics
port: {{ .Values.service.metricsPort }}
targetPort: {{ .Values.erpc.config.metrics.port }}
protocol: TCP
selector:
{{- include "common.labels.matchLabels" $ | nindent 4 }}
app: erpc
Loading
Loading