Skip to content

Commit

Permalink
feat: add blutgang (#287)
Browse files Browse the repository at this point in the history
* feat: add blutgang
  • Loading branch information
barnabasbusa committed Feb 20, 2024
1 parent c8d26b5 commit 8d7cc1f
Show file tree
Hide file tree
Showing 17 changed files with 897 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Tooling
- [`blobscan-indexer`](charts/blobscan-indexer) - Blobscan-Indexer indexes blobs in MongoDB for use with Blobscan.
- [`blobscan`](charts/blobscan) - Blobscan is the first blockchain explorer that helps to navigate and visualize those EIP-4844 blobs.
- [`blockscout`](charts/blockscout) - Execution layer block explorer.
- ['blutgang'](charts/blutgang) - The wd40 of ethereum load balancers.
- [`checkpointz`](charts/checkpointz) - A beacon chain Checkpoint Sync provider.
- [`consensus-monitor`](charts/consensus-monitor) - Web UI to check your ethereum consensus layer nodes via their beacon APIs.
- [`dora`](charts/dora) - Lightweight Beaconchain explorer.
Expand Down
23 changes: 23 additions & 0 deletions charts/blutgang/.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/
13 changes: 13 additions & 0 deletions charts/blutgang/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
name: blutgang
description: >
Blutgang is a blazing fast, caching, minimalistic load balancer designed with Ethereum's JSON-RPC in mind. Historical RPC queries are cached in a local database, bypassing the need for slow, repeating calls to your node.
home: https://github.com/rainshowerLabs/blutgang
icon: https://github.com/rainshowerLabs/blutgang/assets/55022497/ec668c7a-5f56-4b26-8386-f112c2f176ce
sources:
- https://github.com/rainshowerLabs/blutgang
type: application
version: 0.0.1
maintainers:
- name: barnabasbusa
email: busa.barnabas@gmail.com
84 changes: 84 additions & 0 deletions charts/blutgang/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

# blutgang

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

Blutgang is a blazing fast, caching, minimalistic load balancer designed with Ethereum's JSON-RPC in mind. Historical RPC queries are cached in a local database, bypassing the need for slow, repeating calls to your node.

**Homepage:** <https://github.com/rainshowerLabs/blutgang>

## Source Code

* <https://github.com/rainshowerLabs/blutgang>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| adminPort | int | See `values.yaml` | Admin Port |
| affinity | object | `{}` | Affinity configuration for pods |
| annotations | object | `{}` | Annotations for the StatefulSet |
| config | string | See `values.yaml` | Config file |
| containerSecurityContext | object | See `values.yaml` | The security context for containers |
| customArgs | list | `[]` | Custom args for the blutgang container |
| customCommand | list | `[]` | Command replacement for the blutgang container |
| extraContainers | list | `[]` | Additional containers |
| extraEnv | list | `[{"name":"RUST_BACKTRACE","value":"1"}]` | Additional env variables |
| extraPorts | list | `[]` | Additional ports. Useful when using extraContainers |
| extraVolumeMounts | list | `[]` | Additional volume mounts |
| extraVolumes | list | `[]` | Additional volumes |
| fullnameOverride | string | `""` | Overrides the chart's computed fullname |
| httpPort | int | See `values.yaml` | HTTP Port |
| image.pullPolicy | string | `"IfNotPresent"` | blutgang container pull policy |
| image.repository | string | `"makemake1337/blutgang"` | blutgang container image repository |
| image.tag | string | `"0.3.0"` | blutgang container image tag |
| imagePullSecrets | list | `[]` | Image pull secrets for Docker images |
| ingress.annotations | object | `{}` | Annotations for Ingress |
| ingress.enabled | bool | `false` | Ingress resource for the HTTP API |
| ingress.hosts[0].host | string | `"chart-example.local"` | |
| ingress.hosts[0].paths | list | `[]` | |
| ingress.tls | list | `[]` | Ingress TLS |
| initContainers | list | `[]` | Additional init containers |
| livenessProbe | object | See `values.yaml` | Liveness probe |
| nameOverride | string | `""` | Overrides the chart's name |
| nodeSelector | object | `{}` | Node selector for pods |
| persistence.accessModes | list | `["ReadWriteOnce"]` | Access mode for the volume claim template |
| persistence.annotations | object | `{}` | Annotations for volume claim template |
| persistence.enabled | bool | `false` | Uses an EmptyDir when not enabled |
| persistence.existingClaim | string | `nil` | Use an existing PVC when persistence.enabled |
| persistence.selector | object | `{}` | Selector for volume claim template |
| persistence.size | string | `"1Gi"` | Requested size for volume claim template |
| persistence.storageClassName | string | `nil` | Use a specific storage class E.g 'local-path' for local storage to achieve best performance Read more (https://github.com/rancher/local-path-provisioner) |
| podAnnotations | object | `{}` | Pod annotations |
| podDisruptionBudget | object | `{}` | Define the PodDisruptionBudget spec If not set then a PodDisruptionBudget will not be created |
| podLabels | object | `{}` | Pod labels |
| podManagementPolicy | string | `"OrderedReady"` | Pod management policy |
| priorityClassName | string | `nil` | Pod priority class |
| readinessProbe | object | See `values.yaml` | Readiness probe |
| replicas | int | `1` | Number of replicas |
| resources | object | `{}` | Resource requests and limits |
| rpcList | list | `[]` | RPC list for the blutgang container CSV list of rpcs [default: ] |
| secretEnv | object | `{}` | Additional env variables injected via a created secret |
| securityContext | object | See `values.yaml` | The security context for pods |
| service.type | string | `"ClusterIP"` | Service type |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| 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 |
| serviceMonitor.annotations | object | `{}` | Additional ServiceMonitor annotations |
| serviceMonitor.enabled | bool | `false` | If true, a ServiceMonitor CRD is created for a prometheus operator https://github.com/coreos/prometheus-operator |
| serviceMonitor.interval | string | `"1m"` | ServiceMonitor scrape interval |
| serviceMonitor.labels | object | `{}` | Additional ServiceMonitor labels |
| serviceMonitor.namespace | string | `nil` | Alternative namespace for ServiceMonitor |
| serviceMonitor.path | string | `"/metrics"` | Path to scrape |
| serviceMonitor.relabelings | list | `[]` | ServiceMonitor relabelings |
| serviceMonitor.scheme | string | `"http"` | ServiceMonitor scheme |
| serviceMonitor.scrapeTimeout | string | `"30s"` | ServiceMonitor scrape timeout |
| serviceMonitor.tlsConfig | object | `{}` | ServiceMonitor TLS configuration |
| terminationGracePeriodSeconds | int | `30` | How long to wait until the pod is forcefully terminated |
| tolerations | list | `[]` | Tolerations for pods |
| topologySpreadConstraints | list | `[]` | Topology Spread Constraints for pods |
| updateStrategy | object | `{"type":"RollingUpdate"}` | Update stategy for the Statefulset |
| updateStrategy.type | string | `"RollingUpdate"` | Update stategy type |

# Examples
## TODO
18 changes: 18 additions & 0 deletions charts/blutgang/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}

{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

{{ template "chart.sourcesSection" . }}

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesSection" . }}

# Examples
## TODO
63 changes: 63 additions & 0 deletions charts/blutgang/ci/default-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
config: |
# To use the config file, use the -c/--config option pointing to the path of a config file
# Config for blutgang goes here
[blutgang]
# Clear the cache DB on startup
do_clear = false
# Where to bind blutgang to
address = "0.0.0.0:3000"
# Moving average length for the latency
ma_length = 100
# Sort RPCs by latency on startup. Recommended to leave on.
sort_on_startup = true
# Enable health checking
health_check = true
# Acceptable time to wait for a response in ms
ttl = 30
# How many times to retry a request before giving up
max_retries = 32
# Time between health checks in ms
health_check_ttl = 1250
# Note: the admin namespace contains volatile functions and
# should not be exposed publicly.
[admin]
# Enable the admin namespace
enabled = false
# Address for the admin RPC
address = "0.0.0.0:5715"
# Only allow read-only methods
# Recommended `true` unless you 100% need write methods
readonly = true
# Enable the use of JWT for auth
# Should be on if exposing to the internet
jwt = false
# jwt token
key = ""
# Sled config
# Sled is the database we use for our cache, for more info check their docs
[sled]
# Path to db
db_path = "/data/blutgang-cache"
# sled mode. Can be HighThroughput/LowSpace
mode = "HighThroughput"
# Cache size in bytes.
cache_capacity = 1000000000
# Use zstd compression. Reduces size 60-70%,
# and increases CPU and latency by around 10% for db writes and 2% for reads.
# If storage constrained, it's fine to have it be on.
compression = false
# Print DB profile when dropped. Doesn't do anything for now.
print_profile = false
# Frequency of flushes in ms
flush_every_ms = 24000
[merkle]
url = "https://eth.merkle.io"
ws_url = "wss://eth.merkle.io"
# The maximum ammount of time we can use this rpc in a row.
max_consecutive = 150
# Max ammount of querries per second.
max_per_second = 200
62 changes: 62 additions & 0 deletions charts/blutgang/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "blutgang.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "blutgang.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "blutgang.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "blutgang.labels" -}}
helm.sh/chart: {{ include "blutgang.chart" . }}
{{ include "blutgang.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "blutgang.selectorLabels" -}}
app.kubernetes.io/name: {{ include "blutgang.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "blutgang.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "blutgang.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/blutgang/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "blutgang.fullname" . }}
labels:
{{- include "blutgang.labels" . | nindent 4 }}
data:
config.toml: |
{{- tpl .Values.config . | nindent 4 }}
61 changes: 61 additions & 0 deletions charts/blutgang/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "blutgang.fullname" . -}}
{{- $svcPort := .Values.httpPort -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.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 }}
labels:
{{- include "blutgang.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- 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 }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/blutgang/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "blutgang.fullname" . }}-env
labels:
{{- include "blutgang.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.secretEnv }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
22 changes: 22 additions & 0 deletions charts/blutgang/templates/service-headless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "blutgang.fullname" . }}-headless
labels:
{{- include "blutgang.labels" . | nindent 4 }}
spec:
clusterIP: None
ports:
- port: {{ .Values.httpPort }}
targetPort: http
protocol: TCP
name: http
- port: {{ .Values.adminPort }}
targetPort: admin
protocol: TCP
name: admin
{{- if .Values.extraPorts }}
{{ toYaml .Values.extraPorts | nindent 4}}
{{- end }}
selector:
{{- include "blutgang.selectorLabels" . | nindent 4 }}
Loading

0 comments on commit 8d7cc1f

Please sign in to comment.