-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added dugtrio helm chart * added dugtrio to README * fix README * make linter happy * fix README * added metrics config --------- Co-authored-by: Rafael Matias <rafael@skyle.net>
- Loading branch information
Showing
15 changed files
with
750 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v2 | ||
name: dugtrio | ||
description: > | ||
Fault tolerant load balancer for beacon chain RPC apis | ||
home: https://github.com/ethpandaops/dugtrio | ||
sources: | ||
- https://github.com/ethpandaops/dugtrio | ||
type: application | ||
version: 0.0.1 | ||
appVersion: "1.0.0" | ||
maintainers: | ||
- name: pk910 | ||
email: philipp@pk910.de |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
|
||
# dugtrio | ||
|
||
![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) | ||
|
||
Fault tolerant load balancer for beacon chain RPC apis | ||
|
||
**Homepage:** <https://github.com/ethpandaops/dugtrio> | ||
|
||
## Source Code | ||
|
||
* <https://github.com/ethpandaops/dugtrio> | ||
|
||
# Usage | ||
|
||
Usage: dugtrio-proxy -config config.yaml | ||
|
||
Helper: | ||
```shell | ||
Usage of ./dugtrio-proxy: | ||
-config string | ||
Path to the dugtrio config file | ||
``` | ||
|
||
Example Configuration: | ||
```yaml | ||
endpoints: | ||
- name: node1 | ||
url: "http://beacon-node1:5052" | ||
- name: node2 | ||
url: "http://beacon-node2:5052" | ||
``` | ||
## Values | ||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| 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 | `["-config=dugtrio-config.yaml"]` | Custom args for the dugtrio container | | ||
| customCommand | list | `[]` | Command replacement for the dugtrio container | | ||
| dugtrioFrontendEnabled | bool | `true` | Enable dugtrio UI | | ||
| dugtrioFrontendTitle | string | `"Dugtrio"` | Dugtrio UI title | | ||
| dugtrioMetricsEnabled | bool | `true` | Enable dugtrio metrics endpoint | | ||
| dugtrioPoolFollowDistance | int | `10` | number of blocks to keep in dugtrio cache to sort out forks | | ||
| dugtrioPoolMaxHeadDistance | int | `2` | max head distance for endpoints before not using them anymore | | ||
| dugtrioPoolScheduler | string | `"rr"` | dugtrio pool scheduler mode | | ||
| dugtrioProxyBlockedPaths | list | `[]` | blocked proxy paths (regular expressions, eg. "^/eth/v[0-9]+/debug/.*") | | ||
| dugtrioProxyCallRateBurst | int | `1000` | dugtrio call rate burst (burst number of calls per ip) | | ||
| dugtrioProxyCallRateLimit | int | `100` | dugtrio call rate limit (number of calls per second per ip) | | ||
| dugtrioProxyCallTimeout | string | `"55s"` | timeout for dugtrio proxy calls | | ||
| dugtrioProxyCount | int | `1` | number of HTTP proxies in front of dugtrio | | ||
| dugtrioProxySessionTimeout | string | `"10m"` | timeout for dugtrio sessions (used for rate limiting & endpoint stickiness) | | ||
| dugtrioProxyStickyEndpoint | bool | `true` | reuse the same endpoint for sessions as long as available | | ||
| endpoints | list | `[{"headers":{"X-Test":"test","Y-Test":"test2"},"name":"default-endpoint","url":"http://beacon-node:5052"}]` | An array of endpoints to use for dugtrio -- url is the only required field | | ||
| extraContainers | list | `[]` | Additional containers | | ||
| extraEnv | list | `[]` | 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 | `8080` | HTTP port for dugtrio interface | | ||
| image.pullPolicy | string | `"IfNotPresent"` | dugtrio container pull policy | | ||
| image.repository | string | `"ethpandaops/dugtrio"` | dugtrio container image repository | | ||
| image.tag | string | `"latest"` | dugtrio container image tag | | ||
| 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 | | ||
| nameOverride | string | `""` | Overrides the chart's name | | ||
| nodeSelector | object | `{}` | Node selector for pods | | ||
| 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 | | ||
| resources | object | `{}` | Resource requests and limits | | ||
| 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 | | ||
| 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
{{ template "chart.header" . }} | ||
{{ template "chart.deprecationWarning" . }} | ||
|
||
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }} | ||
|
||
{{ template "chart.description" . }} | ||
|
||
|
||
{{ template "chart.homepageLine" . }} | ||
|
||
{{ template "chart.sourcesSection" . }} | ||
|
||
{{ template "chart.requirementsSection" . }} | ||
|
||
|
||
# Usage | ||
|
||
Usage: dugtrio-proxy -config config.yaml | ||
|
||
Helper: | ||
```shell | ||
Usage of ./dugtrio-proxy: | ||
-config string | ||
Path to the dugtrio config file | ||
``` | ||
|
||
Example Configuration: | ||
```yaml | ||
endpoints: | ||
- name: node1 | ||
url: "http://beacon-node1:5052" | ||
- name: node2 | ||
url: "http://beacon-node2:5052" | ||
``` | ||
|
||
{{ template "chart.valuesSection" . }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range $host := .Values.ingress.hosts }} | ||
{{- range .paths }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} | ||
{{- end }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "dugtrio.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "dugtrio.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "dugtrio.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ include "dugtrio.httpPort" . }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "dugtrio.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "dugtrio.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 "dugtrio.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 "dugtrio.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "dugtrio.labels" -}} | ||
helm.sh/chart: {{ include "dugtrio.chart" . }} | ||
{{ include "dugtrio.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "dugtrio.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "dugtrio.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "dugtrio.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "dugtrio.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "dugtrio.httpPort" -}} | ||
{{- printf "8080" -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "dugtrio.fullname" . }} | ||
labels: | ||
{{- include "dugtrio.labels" . | nindent 4 }} | ||
data: | ||
dugtrio-config.yaml: | | ||
{{- tpl .Values.config . | nindent 4 }} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "dugtrio.fullname" . -}} | ||
{{- $svcPort := include "dugtrio.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 "dugtrio.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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "dugtrio.fullname" . }}-headless | ||
labels: | ||
{{- include "dugtrio.labels" . | nindent 4 }} | ||
spec: | ||
clusterIP: None | ||
ports: | ||
- port: {{ include "dugtrio.httpPort" . }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
{{- if .Values.extraPorts }} | ||
{{ toYaml .Values.extraPorts | nindent 4}} | ||
{{- end }} | ||
selector: | ||
{{- include "dugtrio.selectorLabels" . | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "dugtrio.fullname" . }} | ||
labels: | ||
{{- include "dugtrio.labels" . | nindent 4 }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ include "dugtrio.httpPort" . }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
{{- if .Values.extraPorts }} | ||
{{ toYaml .Values.extraPorts | nindent 4}} | ||
{{- end }} | ||
selector: | ||
{{- include "dugtrio.selectorLabels" . | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "dugtrio.serviceAccountName" . }} | ||
labels: | ||
{{- include "dugtrio.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end }} |
Oops, something went wrong.