From 8d7cc1f37994650af2edd515553e53f6091bf6ed Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Tue, 20 Feb 2024 15:49:02 +0100 Subject: [PATCH 1/5] feat: add blutgang (#287) * feat: add blutgang --- README.md | 1 + charts/blutgang/.helmignore | 23 ++ charts/blutgang/Chart.yaml | 13 + charts/blutgang/README.md | 84 +++++ charts/blutgang/README.md.gotmpl | 18 ++ charts/blutgang/ci/default-values.yaml | 63 ++++ charts/blutgang/templates/_helpers.tpl | 62 ++++ charts/blutgang/templates/configmap.yaml | 9 + charts/blutgang/templates/ingress.yaml | 61 ++++ charts/blutgang/templates/secret.yaml | 10 + .../blutgang/templates/service-headless.yaml | 22 ++ charts/blutgang/templates/service.yaml | 22 ++ charts/blutgang/templates/serviceaccount.yaml | 13 + charts/blutgang/templates/servicemonitor.yaml | 43 +++ charts/blutgang/templates/statefulset.yaml | 137 ++++++++ .../templates/tests/test-connection.yaml | 19 ++ charts/blutgang/values.yaml | 297 ++++++++++++++++++ 17 files changed, 897 insertions(+) create mode 100644 charts/blutgang/.helmignore create mode 100644 charts/blutgang/Chart.yaml create mode 100644 charts/blutgang/README.md create mode 100644 charts/blutgang/README.md.gotmpl create mode 100644 charts/blutgang/ci/default-values.yaml create mode 100644 charts/blutgang/templates/_helpers.tpl create mode 100644 charts/blutgang/templates/configmap.yaml create mode 100644 charts/blutgang/templates/ingress.yaml create mode 100644 charts/blutgang/templates/secret.yaml create mode 100644 charts/blutgang/templates/service-headless.yaml create mode 100644 charts/blutgang/templates/service.yaml create mode 100644 charts/blutgang/templates/serviceaccount.yaml create mode 100644 charts/blutgang/templates/servicemonitor.yaml create mode 100644 charts/blutgang/templates/statefulset.yaml create mode 100644 charts/blutgang/templates/tests/test-connection.yaml create mode 100644 charts/blutgang/values.yaml diff --git a/README.md b/README.md index ee59f8ff..1016e98d 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/charts/blutgang/.helmignore b/charts/blutgang/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/blutgang/.helmignore @@ -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/ diff --git a/charts/blutgang/Chart.yaml b/charts/blutgang/Chart.yaml new file mode 100644 index 00000000..52ee3779 --- /dev/null +++ b/charts/blutgang/Chart.yaml @@ -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 diff --git a/charts/blutgang/README.md b/charts/blutgang/README.md new file mode 100644 index 00000000..82833738 --- /dev/null +++ b/charts/blutgang/README.md @@ -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:** + +## Source Code + +* + +## 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 diff --git a/charts/blutgang/README.md.gotmpl b/charts/blutgang/README.md.gotmpl new file mode 100644 index 00000000..d50c8f06 --- /dev/null +++ b/charts/blutgang/README.md.gotmpl @@ -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 diff --git a/charts/blutgang/ci/default-values.yaml b/charts/blutgang/ci/default-values.yaml new file mode 100644 index 00000000..86c97ae0 --- /dev/null +++ b/charts/blutgang/ci/default-values.yaml @@ -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 diff --git a/charts/blutgang/templates/_helpers.tpl b/charts/blutgang/templates/_helpers.tpl new file mode 100644 index 00000000..5c552b32 --- /dev/null +++ b/charts/blutgang/templates/_helpers.tpl @@ -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 }} diff --git a/charts/blutgang/templates/configmap.yaml b/charts/blutgang/templates/configmap.yaml new file mode 100644 index 00000000..98471aa3 --- /dev/null +++ b/charts/blutgang/templates/configmap.yaml @@ -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 }} \ No newline at end of file diff --git a/charts/blutgang/templates/ingress.yaml b/charts/blutgang/templates/ingress.yaml new file mode 100644 index 00000000..885f8c47 --- /dev/null +++ b/charts/blutgang/templates/ingress.yaml @@ -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 }} diff --git a/charts/blutgang/templates/secret.yaml b/charts/blutgang/templates/secret.yaml new file mode 100644 index 00000000..5bd9e8cd --- /dev/null +++ b/charts/blutgang/templates/secret.yaml @@ -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 }} diff --git a/charts/blutgang/templates/service-headless.yaml b/charts/blutgang/templates/service-headless.yaml new file mode 100644 index 00000000..70b63790 --- /dev/null +++ b/charts/blutgang/templates/service-headless.yaml @@ -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 }} diff --git a/charts/blutgang/templates/service.yaml b/charts/blutgang/templates/service.yaml new file mode 100644 index 00000000..3e7b4814 --- /dev/null +++ b/charts/blutgang/templates/service.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "blutgang.fullname" . }} + labels: + {{- include "blutgang.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + 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 }} diff --git a/charts/blutgang/templates/serviceaccount.yaml b/charts/blutgang/templates/serviceaccount.yaml new file mode 100644 index 00000000..d746e5ff --- /dev/null +++ b/charts/blutgang/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "blutgang.serviceAccountName" . }} + labels: + {{- include "blutgang.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/blutgang/templates/servicemonitor.yaml b/charts/blutgang/templates/servicemonitor.yaml new file mode 100644 index 00000000..246c43ba --- /dev/null +++ b/charts/blutgang/templates/servicemonitor.yaml @@ -0,0 +1,43 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "blutgang.serviceAccountName" . }} + {{- if .Values.serviceMonitor.namespace }} + namespace: {{ .Values.serviceMonitor.namespace }} + {{- end }} + labels: + {{- include "blutgang.labels" . | nindent 4 }} + {{- if .Values.serviceMonitor.labels }} + {{- toYaml .Values.serviceMonitor.labels | nindent 4 }} + {{- end }} + {{- if .Values.serviceMonitor.annotations }} + annotations: + {{ toYaml .Values.serviceMonitor.annotations | nindent 4 }} + {{- end }} +spec: + endpoints: + - interval: {{ .Values.serviceMonitor.interval }} + {{- if .Values.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} + {{- end }} + honorLabels: true + port: metrics + path: {{ .Values.serviceMonitor.path }} + scheme: {{ .Values.serviceMonitor.scheme }} + {{- if .Values.serviceMonitor.tlsConfig }} + tlsConfig: + {{- toYaml .Values.serviceMonitor.tlsConfig | nindent 6 }} + {{- end }} + {{- if .Values.serviceMonitor.relabelings }} + relabelings: + {{- toYaml .Values.serviceMonitor.relabelings | nindent 4 }} + {{- end }} + jobLabel: "{{ .Release.Name }}" + selector: + matchLabels: + {{- include "blutgang.selectorLabels" . | nindent 8 }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} +{{- end }} diff --git a/charts/blutgang/templates/statefulset.yaml b/charts/blutgang/templates/statefulset.yaml new file mode 100644 index 00000000..03fc45ce --- /dev/null +++ b/charts/blutgang/templates/statefulset.yaml @@ -0,0 +1,137 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "blutgang.fullname" . }} + labels: + {{- include "blutgang.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.annotations | nindent 4 }} +spec: + podManagementPolicy: {{ .Values.podManagementPolicy }} + replicas: {{ .Values.replicas }} + selector: + matchLabels: + {{- include "blutgang.selectorLabels" . | nindent 6 }} + serviceName: {{ include "blutgang.fullname" . }}-headless + updateStrategy: + {{- toYaml .Values.updateStrategy | nindent 4 }} + template: + metadata: + labels: + {{- include "blutgang.selectorLabels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/secrets: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "blutgang.serviceAccountName" . }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} + securityContext: + {{- toYaml .Values.securityContext | nindent 8 }} + initContainers: + {{- if .Values.initContainers }} + {{- toYaml .Values.initContainers | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if gt (len .Values.customCommand) 0 }} + command: + {{- toYaml .Values.customCommand | nindent 12}} + {{- end }} + {{- if gt (len .Values.customArgs) 0 }} + args: + {{- toYaml .Values.customArgs | nindent 12}} + {{- end }} + securityContext: + {{- toYaml .Values.containerSecurityContext | nindent 12 }} + volumeMounts: + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 12}} + {{- end }} + - name: config + mountPath: "/app/config.toml" + subPath: config.toml + readOnly: true + - name: storage + mountPath: "/data" + ports: + - name: http + containerPort: {{ .Values.httpPort }} + protocol: TCP + - name: admin + containerPort: {{ .Values.adminPort }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + {{- range $key, $value := .Values.secretEnv }} + - name: {{ $key }} + valueFrom: + secretKeyRef: + name: {{ include "blutgang.fullname" $ }}-env + key: {{ $key }} + {{- end }} + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 12 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 8}} + {{- end }} + nodeSelector: + {{- toYaml .Values.nodeSelector | nindent 8 }} + affinity: + {{- toYaml .Values.affinity | nindent 8 }} + tolerations: + {{- toYaml .Values.tolerations | nindent 8 }} + topologySpreadConstraints: + {{- toYaml .Values.topologySpreadConstraints | nindent 8 }} + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} + volumes: + {{- if .Values.extraVolumes }} + {{ toYaml .Values.extraVolumes | nindent 8}} + {{- end }} + - name: config + configMap: + name: {{ include "blutgang.fullname" . }} + {{- if not .Values.persistence.enabled }} + - name: storage + emptyDir: {} + {{- else if .Values.persistence.existingClaim }} + - name: storage + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim }} + {{- else }} + volumeClaimTemplates: + - metadata: + name: storage + annotations: + {{- toYaml .Values.persistence.annotations | nindent 8 }} + spec: + accessModes: + {{- toYaml .Values.persistence.accessModes | nindent 8 }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} + storageClassName: {{ .Values.persistence.storageClassName }} + {{- if .Values.persistence.selector }} + selector: + {{- toYaml .Values.persistence.selector | nindent 8 }} + {{- end }} + {{- end }} diff --git a/charts/blutgang/templates/tests/test-connection.yaml b/charts/blutgang/templates/tests/test-connection.yaml new file mode 100644 index 00000000..e7101424 --- /dev/null +++ b/charts/blutgang/templates/tests/test-connection.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "blutgang.fullname" . }}-test-connection" + labels: + {{- include "blutgang.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: curl + image: curlimages/curl + command: ['curl'] + args: + - --location + - --request + - GET + - '{{ include "blutgang.fullname" . }}:{{ .Values.httpPort }}/' + restartPolicy: Never diff --git a/charts/blutgang/values.yaml b/charts/blutgang/values.yaml new file mode 100644 index 00000000..85af8e5d --- /dev/null +++ b/charts/blutgang/values.yaml @@ -0,0 +1,297 @@ +# -- Overrides the chart's name +nameOverride: "" + +# -- Overrides the chart's computed fullname +fullnameOverride: "" + +# -- Number of replicas +replicas: 1 + +image: + # -- blutgang container image repository + repository: makemake1337/blutgang + # -- blutgang container image tag + tag: "0.3.0" + # -- blutgang container pull policy + pullPolicy: IfNotPresent + +# -- Custom args for the blutgang container +customArgs: [] + #- -config-file=/somehwere-else.yaml + #- -output-dir=public + +# -- Command replacement for the blutgang container +customCommand: [] # Only change this if you need to change the default command + +# -- RPC list for the blutgang container +# CSV list of rpcs [default: ] +rpcList: [] + #- name: goerli-geth-teku + # url: http://goerli-geth-teku:8545 + # ws_url: ws://goerli-geth-teku:8545 + +# -- Config file +# @default -- See `values.yaml` +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:{{ .Values.httpPort}}" + # 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:{{ .Values.adminPort }}" + # 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 + + # Add seperate RPCs as TOML tables + # DO NOT name an rpc `blutgang`, `admin`, or `sled` + {{- range .Values.rpcList }} + [{{ .name }}] + url = {{ .url | quote }} + # 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 + {{- end }} + +ingress: + # -- Ingress resource for the HTTP API + enabled: false + # -- Annotations for Ingress + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # -- Ingress host + hosts: + - host: chart-example.local + paths: [] + # -- Ingress TLS + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +service: + # -- Service type + type: ClusterIP + +# -- Affinity configuration for pods +affinity: {} + +# -- Image pull secrets for Docker images +imagePullSecrets: [] + +# -- Annotations for the StatefulSet +annotations: {} + +# -- HTTP Port +# @default -- See `values.yaml` +httpPort: 3000 + +# -- Admin Port +# @default -- See `values.yaml` +adminPort: 5715 + +# -- Liveness probe +# @default -- See `values.yaml` +livenessProbe: + tcpSocket: + port: http + initialDelaySeconds: 60 + periodSeconds: 30 + +# -- Readiness probe +# @default -- See `values.yaml` +readinessProbe: + tcpSocket: + port: http + initialDelaySeconds: 10 + periodSeconds: 10 + +# -- Node selector for pods +nodeSelector: {} + +# -- Pod labels +podLabels: {} + +# -- Pod annotations +podAnnotations: {} + +# -- Pod management policy +podManagementPolicy: OrderedReady + +# -- Pod priority class +priorityClassName: null + +# -- Resource requests and limits +resources: {} +# limits: +# cpu: 500m +# memory: 2Gi +# requests: +# cpu: 300m +# memory: 1Gi + +# -- The security context for pods +# @default -- See `values.yaml` +securityContext: + fsGroup: 10001 + runAsGroup: 10001 + runAsNonRoot: true + runAsUser: 10001 + +# -- The security context for containers +# @default -- See `values.yaml` +containerSecurityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +serviceAccount: + # -- Specifies whether a service account should be created + create: true + # -- Annotations to add to the service account + annotations: {} + # -- The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# -- How long to wait until the pod is forcefully terminated +terminationGracePeriodSeconds: 30 + +# -- Tolerations for pods +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +tolerations: [] + +# -- Topology Spread Constraints for pods +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/ +topologySpreadConstraints: [] + +# -- Define the PodDisruptionBudget spec +# If not set then a PodDisruptionBudget will not be created +podDisruptionBudget: {} +# minAvailable: 1 +# maxUnavailable: 1 + +# -- Update stategy for the Statefulset +updateStrategy: + # -- Update stategy type + type: RollingUpdate + +# -- Additional init containers +initContainers: [] +# - name: my-init-container +# image: busybox:latest +# command: ['sh', '-c', 'echo hello'] + +# -- Additional containers +extraContainers: [] + +# -- Additional volumes +extraVolumes: [] + +# -- Additional volume mounts +extraVolumeMounts: [] + +# -- Additional ports. Useful when using extraContainers +extraPorts: [] + +# -- Additional env variables +extraEnv: + - name: RUST_BACKTRACE + value: "1" + +# -- Additional env variables injected via a created secret +secretEnv: {} + +serviceMonitor: + # -- If true, a ServiceMonitor CRD is created for a prometheus operator + # https://github.com/coreos/prometheus-operator + enabled: false + # -- Path to scrape + path: /metrics + # -- Alternative namespace for ServiceMonitor + namespace: null + # -- Additional ServiceMonitor labels + labels: {} + # -- Additional ServiceMonitor annotations + annotations: {} + # -- ServiceMonitor scrape interval + interval: 1m + # -- ServiceMonitor scheme + scheme: http + # -- ServiceMonitor TLS configuration + tlsConfig: {} + # -- ServiceMonitor scrape timeout + scrapeTimeout: 30s + # -- ServiceMonitor relabelings + relabelings: [] + +persistence: + # -- Uses an EmptyDir when not enabled + enabled: false + # -- Use an existing PVC when persistence.enabled + existingClaim: null + # -- Access mode for the volume claim template + accessModes: + - ReadWriteOnce + # -- Requested size for volume claim template + size: 1Gi + # -- 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) + storageClassName: null + # -- Annotations for volume claim template + annotations: {} + # -- Selector for volume claim template + selector: {} + # matchLabels: + # app.kubernetes.io/name: something From 0ae416f27694c008fd06740e661c4f7b5ef73f01 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Wed, 21 Feb 2024 09:46:42 +0100 Subject: [PATCH 2/5] fix: some blutgang fixes, and more customization (#289) * fix: some blutgang fixes, and more customization * fix typo --- README.md | 2 +- charts/blutgang/Chart.yaml | 2 +- charts/blutgang/README.md | 4 +- .../blutgang/templates/service-headless.yaml | 4 +- charts/blutgang/templates/service.yaml | 4 +- charts/blutgang/templates/statefulset.yaml | 4 +- charts/blutgang/values.yaml | 39 ++++++++++++------- 7 files changed, 38 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 1016e98d..42755eec 100644 --- a/README.md +++ b/README.md @@ -68,7 +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. +- [`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. diff --git a/charts/blutgang/Chart.yaml b/charts/blutgang/Chart.yaml index 52ee3779..44215491 100644 --- a/charts/blutgang/Chart.yaml +++ b/charts/blutgang/Chart.yaml @@ -7,7 +7,7 @@ icon: https://github.com/rainshowerLabs/blutgang/assets/55022497/ec668c7a-5f56-4 sources: - https://github.com/rainshowerLabs/blutgang type: application -version: 0.0.1 +version: 0.0.2 maintainers: - name: barnabasbusa email: busa.barnabas@gmail.com diff --git a/charts/blutgang/README.md b/charts/blutgang/README.md index 82833738..71c1a295 100644 --- a/charts/blutgang/README.md +++ b/charts/blutgang/README.md @@ -1,7 +1,7 @@ # 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) +![Version: 0.0.2](https://img.shields.io/badge/Version-0.0.2-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. @@ -15,7 +15,7 @@ Blutgang is a blazing fast, caching, minimalistic load balancer designed with Et | Key | Type | Default | Description | |-----|------|---------|-------------| -| adminPort | int | See `values.yaml` | Admin Port | +| adminNamespace | object | See `values.yaml` | Admin Namespace | | affinity | object | `{}` | Affinity configuration for pods | | annotations | object | `{}` | Annotations for the StatefulSet | | config | string | See `values.yaml` | Config file | diff --git a/charts/blutgang/templates/service-headless.yaml b/charts/blutgang/templates/service-headless.yaml index 70b63790..626a340e 100644 --- a/charts/blutgang/templates/service-headless.yaml +++ b/charts/blutgang/templates/service-headless.yaml @@ -11,10 +11,12 @@ spec: targetPort: http protocol: TCP name: http - - port: {{ .Values.adminPort }} + {{- if .Values.adminNamespace.enabled }} + - port: {{ .Values.adminNamespace.adminPort }} targetPort: admin protocol: TCP name: admin + {{- end }} {{- if .Values.extraPorts }} {{ toYaml .Values.extraPorts | nindent 4}} {{- end }} diff --git a/charts/blutgang/templates/service.yaml b/charts/blutgang/templates/service.yaml index 3e7b4814..1cac61e5 100644 --- a/charts/blutgang/templates/service.yaml +++ b/charts/blutgang/templates/service.yaml @@ -11,10 +11,12 @@ spec: targetPort: http protocol: TCP name: http - - port: {{ .Values.adminPort }} + {{- if .Values.adminNamespace.enabled }} + - port: {{ .Values.adminNamespace.adminPort }} targetPort: admin protocol: TCP name: admin + {{- end }} {{- if .Values.extraPorts }} {{ toYaml .Values.extraPorts | nindent 4}} {{- end }} diff --git a/charts/blutgang/templates/statefulset.yaml b/charts/blutgang/templates/statefulset.yaml index 03fc45ce..68281c78 100644 --- a/charts/blutgang/templates/statefulset.yaml +++ b/charts/blutgang/templates/statefulset.yaml @@ -71,9 +71,11 @@ spec: - name: http containerPort: {{ .Values.httpPort }} protocol: TCP + {{- if .Values.adminNamespace.enabled }} - name: admin - containerPort: {{ .Values.adminPort }} + containerPort: {{ .Values.adminNamespace.adminPort }} protocol: TCP + {{- end }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: diff --git a/charts/blutgang/values.yaml b/charts/blutgang/values.yaml index 85af8e5d..cf31550e 100644 --- a/charts/blutgang/values.yaml +++ b/charts/blutgang/values.yaml @@ -26,9 +26,11 @@ customCommand: [] # Only change this if you need to change the default command # -- RPC list for the blutgang container # CSV list of rpcs [default: ] rpcList: [] - #- name: goerli-geth-teku - # url: http://goerli-geth-teku:8545 - # ws_url: ws://goerli-geth-teku:8545 + # - name: goerli-geth-teku + # url: http://goerli-geth-teku:8545 + # ws_url: ws://goerli-geth-teku:8545 # Optional + # max_consecutive: 150 # Optional + # max_per_second: 200 # Optional # -- Config file # @default -- See `values.yaml` @@ -40,7 +42,7 @@ config: | # Clear the cache DB on startup do_clear = false # Where to bind blutgang to - address = "0.0.0.0:{{ .Values.httpPort}}" + address = "0.0.0.0:{{ .Values.httpPort }}" # Moving average length for the latency ma_length = 100 # Sort RPCs by latency on startup. Recommended to leave on. @@ -58,17 +60,17 @@ config: | # should not be exposed publicly. [admin] # Enable the admin namespace - enabled = false + enabled = {{ .Values.adminNamespace.enabled | default false }} # Address for the admin RPC - address = "0.0.0.0:{{ .Values.adminPort }}" + address = "0.0.0.0:{{ .Values.adminNamespace.adminPort | default 5715 }}" # Only allow read-only methods # Recommended `true` unless you 100% need write methods - readonly = true + readonly = {{ .Values.adminNamespace.readOnly | default true }} # Enable the use of JWT for auth # Should be on if exposing to the internet - jwt = false + jwt = {{ .Values.adminNamespace.jwt_enabled | default false }} # jwt token - key = "" + key = {{ .Values.adminNamespace.jwt_key | quote | default "" }} # Sled config # Sled is the database we use for our cache, for more info check their docs @@ -93,12 +95,24 @@ config: | {{- range .Values.rpcList }} [{{ .name }}] url = {{ .url | quote }} + {{- if .ws_url }} + ws_url = {{ .ws_url | quote }} + {{- end }} # The maximum ammount of time we can use this rpc in a row. - max_consecutive = 150 + max_consecutive = {{ .max_consecutive | default 150 }} # Max ammount of querries per second. - max_per_second = 200 + max_per_second = {{ .max_per_second | default 200 }} {{- end }} +# -- Admin Namespace +# @default -- See `values.yaml` +adminNamespace: + enabled: false + adminPort: 5715 + jwt_enabled: false + jwt_key: "" + readOnly: true + ingress: # -- Ingress resource for the HTTP API enabled: false @@ -133,9 +147,6 @@ annotations: {} # @default -- See `values.yaml` httpPort: 3000 -# -- Admin Port -# @default -- See `values.yaml` -adminPort: 5715 # -- Liveness probe # @default -- See `values.yaml` From 9f0d792d3fa8ab039b7f143e9a99c4b909609861 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Mon, 26 Feb 2024 18:13:08 +0100 Subject: [PATCH 3/5] fix: some blutgang fixes, and more customization v2 (#291) * fix: some blutgang fixes, and more customization --- charts/blutgang/Chart.yaml | 2 +- charts/blutgang/README.md | 5 +++-- charts/blutgang/values.yaml | 33 +++++++++++++++++++++++++-------- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/charts/blutgang/Chart.yaml b/charts/blutgang/Chart.yaml index 44215491..fbfe432a 100644 --- a/charts/blutgang/Chart.yaml +++ b/charts/blutgang/Chart.yaml @@ -7,7 +7,7 @@ icon: https://github.com/rainshowerLabs/blutgang/assets/55022497/ec668c7a-5f56-4 sources: - https://github.com/rainshowerLabs/blutgang type: application -version: 0.0.2 +version: 0.0.3 maintainers: - name: barnabasbusa email: busa.barnabas@gmail.com diff --git a/charts/blutgang/README.md b/charts/blutgang/README.md index 71c1a295..4db77b8d 100644 --- a/charts/blutgang/README.md +++ b/charts/blutgang/README.md @@ -1,7 +1,7 @@ # blutgang -![Version: 0.0.2](https://img.shields.io/badge/Version-0.0.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 0.0.3](https://img.shields.io/badge/Version-0.0.3-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. @@ -18,6 +18,7 @@ Blutgang is a blazing fast, caching, minimalistic load balancer designed with Et | adminNamespace | object | See `values.yaml` | Admin Namespace | | affinity | object | `{}` | Affinity configuration for pods | | annotations | object | `{}` | Annotations for the StatefulSet | +| blutgangNamespace | object | See `values.yaml` | Bluethang Namespace | | 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 | @@ -31,7 +32,7 @@ Blutgang is a blazing fast, caching, minimalistic load balancer designed with Et | 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 | +| image.tag | string | `"latest"` | 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 | diff --git a/charts/blutgang/values.yaml b/charts/blutgang/values.yaml index cf31550e..276efbb2 100644 --- a/charts/blutgang/values.yaml +++ b/charts/blutgang/values.yaml @@ -11,7 +11,7 @@ image: # -- blutgang container image repository repository: makemake1337/blutgang # -- blutgang container image tag - tag: "0.3.0" + tag: "latest" # -- blutgang container pull policy pullPolicy: IfNotPresent @@ -40,21 +40,25 @@ config: | # Config for blutgang goes here [blutgang] # Clear the cache DB on startup - do_clear = false + do_clear = {{ .Values.blutgangNamespace.do_clear | default false }} # Where to bind blutgang to address = "0.0.0.0:{{ .Values.httpPort }}" # Moving average length for the latency - ma_length = 100 + ma_length = {{ .Values.blutgangNamespace.ma_length | default 100 }} # Sort RPCs by latency on startup. Recommended to leave on. - sort_on_startup = true + sort_on_startup = {{ .Values.blutgangNamespace.sort_on_startup | default true }} # Enable health checking - health_check = true + health_check = {{ .Values.blutgangNamespace.health_check | default true }} # Acceptable time to wait for a response in ms - ttl = 30 + ttl = {{ .Values.blutgangNamespace.ttl | default 30 }} # How many times to retry a request before giving up - max_retries = 32 + max_retries = {{ .Values.blutgangNamespace.max_retries | default 32 }} + # Block time in ms, used as a sanity check when not receiving subscriptions + expected_block_time = {{ .Values.blutgangNamespace.expected_block_time | default 13000 }} # Time between health checks in ms - health_check_ttl = 1250 + health_check_ttl = {{ .Values.blutgangNamespace.health_check_ttl | default 400 }} + # Supress the health check running info messages + supress_rpc_check = {{ .Values.blutgangNamespace.supress_rpc_check | default false }} # Note: the admin namespace contains volatile functions and # should not be exposed publicly. @@ -104,6 +108,19 @@ config: | max_per_second = {{ .max_per_second | default 200 }} {{- end }} +# -- Bluethang Namespace +# @default -- See `values.yaml` +blutgangNamespace: + do_clear: false + ma_length: 100 + sort_on_startup: true + health_check: true + ttl: 30 + max_retries: 32 + expected_block_time: 13000 + health_check_ttl: 400 + supress_rpc_check: false + # -- Admin Namespace # @default -- See `values.yaml` adminNamespace: From cf9b7409375cd76fce8309b091947bb734875387 Mon Sep 17 00:00:00 2001 From: pk910 Date: Tue, 27 Feb 2024 12:26:01 +0100 Subject: [PATCH 4/5] Add assertoor helm chart (#290) * add assertoor helm chart * make linter happy * update default values * switch from StatefulSet to Deployment * fix --- charts/assertoor/.helmignore | 23 ++ charts/assertoor/Chart.yaml | 13 + charts/assertoor/README.md | 98 ++++++++ charts/assertoor/README.md.gotmpl | 54 ++++ charts/assertoor/templates/NOTES.txt | 22 ++ charts/assertoor/templates/_helpers.tpl | 66 +++++ charts/assertoor/templates/configmap.yaml | 21 ++ charts/assertoor/templates/deployment.yaml | 94 +++++++ charts/assertoor/templates/ingress.yaml | 61 +++++ charts/assertoor/templates/service.yaml | 18 ++ .../assertoor/templates/serviceaccount.yaml | 13 + .../templates/tests/test-connection.yaml | 19 ++ charts/assertoor/values.yaml | 236 ++++++++++++++++++ 13 files changed, 738 insertions(+) create mode 100644 charts/assertoor/.helmignore create mode 100644 charts/assertoor/Chart.yaml create mode 100644 charts/assertoor/README.md create mode 100644 charts/assertoor/README.md.gotmpl create mode 100644 charts/assertoor/templates/NOTES.txt create mode 100644 charts/assertoor/templates/_helpers.tpl create mode 100644 charts/assertoor/templates/configmap.yaml create mode 100644 charts/assertoor/templates/deployment.yaml create mode 100644 charts/assertoor/templates/ingress.yaml create mode 100644 charts/assertoor/templates/service.yaml create mode 100644 charts/assertoor/templates/serviceaccount.yaml create mode 100644 charts/assertoor/templates/tests/test-connection.yaml create mode 100644 charts/assertoor/values.yaml diff --git a/charts/assertoor/.helmignore b/charts/assertoor/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/assertoor/.helmignore @@ -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/ diff --git a/charts/assertoor/Chart.yaml b/charts/assertoor/Chart.yaml new file mode 100644 index 00000000..8ada6ba2 --- /dev/null +++ b/charts/assertoor/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v2 +name: assertoor +description: > + Testing tool that is capable of doing actions and checking conditions on ethereum pos networks. +home: https://github.com/ethpandaops/assertoor +sources: + - https://github.com/ethpandaops/assertoor +type: application +version: 0.0.1 +appVersion: "1.0.0" +maintainers: + - name: pk910 + email: philipp@pk910.de diff --git a/charts/assertoor/README.md b/charts/assertoor/README.md new file mode 100644 index 00000000..45b18432 --- /dev/null +++ b/charts/assertoor/README.md @@ -0,0 +1,98 @@ + +# assertoor + +![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) + +Testing tool that is capable of doing actions and checking conditions on ethereum pos networks. + +**Homepage:** + +## Source Code + +* + +# Usage + +Usage: assertoor --config config.yaml + +Helper: +```shell +Usage of ./assertoor: +--config string + Path to the assertoor config file +``` + +Example Configuration: +```yaml +endpoints: + - name: node1 + executionUrl: "http://execution-node:8545" + consensusUrl: "http://beacon-node:5052" + +globalVariables: + walletPrivkey: "feedbeef12340000feedbeef12340000feedbeef12340000feedbeef12340000" + +assertoorTests: + - file: "https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/block-proposal-check.yaml" + name: "Custom Block proposal check" + timeout: 48h + config: + validatorPairNames: ["geth", "besu"] + schedule: + cron: + - "0 */2 * * *" # every 2 hours + startup: true + - file: "https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/stability-check.yaml" + - file: "https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/all-opcodes-test.yaml" + - file: "https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/validator-lifecycle-test-small.yaml" + +``` + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | Affinity configuration for pods | +| annotations | object | `{}` | Annotations for the StatefulSet | +| assertoorApiEnabled | bool | `true` | Enable assertoor API | +| assertoorFrontendEnabled | bool | `true` | Enable assertoor UI | +| assertoorTests | list | `[]` | assertoor test configurations -- file is the only required field. All other fields default to the values provided in the test file, but can be overriden if needed. | +| config | string | See `values.yaml` | Config file | +| containerSecurityContext | object | See `values.yaml` | The security context for containers | +| customArgs | list | `["--config=/data/assertoor-config.yaml"]` | Custom args for the assertoor container | +| customCommand | list | `[]` | Command replacement for the assertoor container | +| endpoints | list | `[{"consensusHeaders":{"X-Test":"test","Y-Test":"test2"},"consensusUrl":"http://beacon-node:5052","executionHeaders":{"X-Test":"test","Y-Test":"test2"},"executionUrl":"http://execution-node:8545","name":"default-endpoint"}]` | An array of endpoints to use for assertoor -- executionUrl & consensusUrl are the only required fields | +| 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 | +| globalVariables | object | `{"walletPrivkey":"feedbeef12340000feedbeef12340000feedbeef12340000feedbeef12340000"}` | global assertoor variables -- global variables are passed to all tests. | +| httpPort | int | `8080` | HTTP port for assertoor interface | +| image.pullPolicy | string | `"IfNotPresent"` | assertoor container pull policy | +| image.repository | string | `"ethpandaops/assertoor"` | assertoor container image repository | +| image.tag | string | `"latest"` | assertoor 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 | +| 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 | +| validatorNamesInventory | string | `""` | This can be a url here for example: -- "https://config.dencun-devnet-8.ethpandaops.io/api/v1/nodes/validator-ranges" -- If you want to use a local range file define it in the values.yaml validatorNamesRanges section | +| validatorNamesRanges | string | `"0-1: test\n"` | | diff --git a/charts/assertoor/README.md.gotmpl b/charts/assertoor/README.md.gotmpl new file mode 100644 index 00000000..316fb417 --- /dev/null +++ b/charts/assertoor/README.md.gotmpl @@ -0,0 +1,54 @@ + +{{ 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: assertoor --config config.yaml + +Helper: +```shell +Usage of ./assertoor: +--config string + Path to the assertoor config file +``` + +Example Configuration: +```yaml +endpoints: + - name: node1 + executionUrl: "http://execution-node:8545" + consensusUrl: "http://beacon-node:5052" + +globalVariables: + walletPrivkey: "feedbeef12340000feedbeef12340000feedbeef12340000feedbeef12340000" + +assertoorTests: + - file: "https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/block-proposal-check.yaml" + name: "Custom Block proposal check" + timeout: 48h + config: + validatorPairNames: ["geth", "besu"] + schedule: + cron: + - "0 */2 * * *" # every 2 hours + startup: true + - file: "https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/stability-check.yaml" + - file: "https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/all-opcodes-test.yaml" + - file: "https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/validator-lifecycle-test-small.yaml" + +``` + +{{ template "chart.valuesSection" . }} diff --git a/charts/assertoor/templates/NOTES.txt b/charts/assertoor/templates/NOTES.txt new file mode 100644 index 00000000..cfd4af36 --- /dev/null +++ b/charts/assertoor/templates/NOTES.txt @@ -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 "assertoor.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 "assertoor.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "assertoor.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ include "assertoor.httpPort" . }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "assertoor.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 }} diff --git a/charts/assertoor/templates/_helpers.tpl b/charts/assertoor/templates/_helpers.tpl new file mode 100644 index 00000000..01d5b2d0 --- /dev/null +++ b/charts/assertoor/templates/_helpers.tpl @@ -0,0 +1,66 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "assertoor.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 "assertoor.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 "assertoor.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "assertoor.labels" -}} +helm.sh/chart: {{ include "assertoor.chart" . }} +{{ include "assertoor.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "assertoor.selectorLabels" -}} +app.kubernetes.io/name: {{ include "assertoor.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "assertoor.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "assertoor.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{- define "assertoor.httpPort" -}} +{{- printf "8080" -}} +{{- end -}} diff --git a/charts/assertoor/templates/configmap.yaml b/charts/assertoor/templates/configmap.yaml new file mode 100644 index 00000000..ef71e969 --- /dev/null +++ b/charts/assertoor/templates/configmap.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "assertoor.fullname" . }}-ranges + labels: + {{- include "assertoor.labels" . | nindent 4 }} +data: + ranges.yaml: | + {{- .Values.validatorNamesRanges | nindent 4 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "assertoor.fullname" . }}-config + labels: + {{- include "assertoor.labels" . | nindent 4 }} +data: + assertoor-config.yaml: | + {{- tpl .Values.config . | nindent 4 }} + + diff --git a/charts/assertoor/templates/deployment.yaml b/charts/assertoor/templates/deployment.yaml new file mode 100644 index 00000000..9170a9d6 --- /dev/null +++ b/charts/assertoor/templates/deployment.yaml @@ -0,0 +1,94 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "assertoor.fullname" . }} + labels: + {{- include "assertoor.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.annotations | nindent 4 }} +spec: + replicas: 1 + selector: + matchLabels: + {{- include "assertoor.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "assertoor.selectorLabels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "assertoor.serviceAccountName" . }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} + securityContext: + {{- toYaml .Values.securityContext | nindent 8 }} + initContainers: + {{- if .Values.initContainers }} + {{- toYaml .Values.initContainers | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if gt (len .Values.customCommand) 0 }} + command: + {{- toYaml .Values.customCommand | nindent 12}} + {{- end }} + {{- if gt (len .Values.customArgs) 0 }} + args: + {{- toYaml .Values.customArgs | nindent 12}} + {{- end }} + securityContext: + {{- toYaml .Values.containerSecurityContext | nindent 12 }} + volumeMounts: + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 12}} + {{- end }} + - name: config + mountPath: "/data/assertoor-config.yaml" + subPath: assertoor-config.yaml + readOnly: true + - name: ranges + mountPath: "/data/ranges.yaml" + subPath: ranges.yaml + readOnly: true + ports: + - name: http + containerPort: {{ include "assertoor.httpPort" . }} + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 12 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 8}} + {{- end }} + nodeSelector: + {{- toYaml .Values.nodeSelector | nindent 8 }} + affinity: + {{- toYaml .Values.affinity | nindent 8 }} + tolerations: + {{- toYaml .Values.tolerations | nindent 8 }} + topologySpreadConstraints: + {{- toYaml .Values.topologySpreadConstraints | nindent 8 }} + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} + volumes: + - name: config + configMap: + name: {{ include "assertoor.fullname" . }}-config + - name: ranges + configMap: + name: {{ include "assertoor.fullname" . }}-ranges + {{- if .Values.extraVolumes }} + {{ toYaml .Values.extraVolumes | nindent 8}} + {{- end }} diff --git a/charts/assertoor/templates/ingress.yaml b/charts/assertoor/templates/ingress.yaml new file mode 100644 index 00000000..be5aa9c0 --- /dev/null +++ b/charts/assertoor/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "assertoor.fullname" . -}} +{{- $svcPort := include "assertoor.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 "assertoor.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 }} diff --git a/charts/assertoor/templates/service.yaml b/charts/assertoor/templates/service.yaml new file mode 100644 index 00000000..5d048046 --- /dev/null +++ b/charts/assertoor/templates/service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "assertoor.fullname" . }} + labels: + {{- include "assertoor.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ include "assertoor.httpPort" . }} + targetPort: http + protocol: TCP + name: http + {{- if .Values.extraPorts }} + {{ toYaml .Values.extraPorts | nindent 4}} + {{- end }} + selector: + {{- include "assertoor.selectorLabels" . | nindent 4 }} diff --git a/charts/assertoor/templates/serviceaccount.yaml b/charts/assertoor/templates/serviceaccount.yaml new file mode 100644 index 00000000..dfcfa137 --- /dev/null +++ b/charts/assertoor/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "assertoor.serviceAccountName" . }} + labels: + {{- include "assertoor.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/assertoor/templates/tests/test-connection.yaml b/charts/assertoor/templates/tests/test-connection.yaml new file mode 100644 index 00000000..cfd651b0 --- /dev/null +++ b/charts/assertoor/templates/tests/test-connection.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "assertoor.fullname" . }}-test-connection" + labels: + {{- include "assertoor.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: curl + image: curlimages/curl + command: ['curl'] + args: + - --location + - --request + - GET + - '{{ include "assertoor.fullname" . }}:{{ include "assertoor.httpPort" . }}/' + restartPolicy: Never diff --git a/charts/assertoor/values.yaml b/charts/assertoor/values.yaml new file mode 100644 index 00000000..8fb875ad --- /dev/null +++ b/charts/assertoor/values.yaml @@ -0,0 +1,236 @@ +# -- Overrides the chart's name +nameOverride: "" + +# -- Overrides the chart's computed fullname +fullnameOverride: "" + +image: + # -- assertoor container image repository + repository: ethpandaops/assertoor + # -- assertoor container image tag + tag: "latest" + # -- assertoor container pull policy + pullPolicy: IfNotPresent + +# -- Custom args for the assertoor container +customArgs: + - --config=/data/assertoor-config.yaml + +# -- Command replacement for the assertoor container +customCommand: [] # Only change this if you need to change the default command + +ingress: + # -- Ingress resource for the HTTP API + enabled: false + # -- Annotations for Ingress + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # -- Ingress host + hosts: + - host: chart-example.local + paths: [] + # -- Ingress TLS + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +service: + # -- Service type + type: ClusterIP + +# -- Affinity configuration for pods +affinity: {} + +# -- Annotations for the StatefulSet +annotations: {} + +# -- Node selector for pods +nodeSelector: {} + +# -- Pod labels +podLabels: {} + +# -- Pod annotations +podAnnotations: {} + +# -- Pod priority class +priorityClassName: null + +# -- Resource requests and limits +resources: {} +# limits: +# cpu: 500m +# memory: 2Gi +# requests: +# cpu: 300m +# memory: 1Gi + +# -- The security context for pods +# @default -- See `values.yaml` +securityContext: + fsGroup: 10001 + runAsGroup: 10001 + runAsNonRoot: true + runAsUser: 10001 + +# -- The security context for containers +# @default -- See `values.yaml` +containerSecurityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + + +serviceAccount: + # -- Specifies whether a service account should be created + create: true + # -- Annotations to add to the service account + annotations: {} + # -- The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# -- How long to wait until the pod is forcefully terminated +terminationGracePeriodSeconds: 30 + +# -- Tolerations for pods +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +tolerations: [] + +# -- Topology Spread Constraints for pods +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/ +topologySpreadConstraints: [] + +# -- Define the PodDisruptionBudget spec +# If not set then a PodDisruptionBudget will not be created +podDisruptionBudget: {} +# minAvailable: 1 +# maxUnavailable: 1 + +# -- Additional init containers +initContainers: [] +# - name: my-init-container +# image: busybox:latest +# command: ['sh', '-c', 'echo hello'] + +# -- Additional containers +extraContainers: [] + +# -- Additional volumes +extraVolumes: [] + +# -- Additional volume mounts +extraVolumeMounts: [] + +# -- Additional ports. Useful when using extraContainers +extraPorts: [] + +# -- Additional env variables +extraEnv: [] + + +# -- HTTP port for assertoor interface +httpPort: 8080 + +# -- An array of endpoints to use for assertoor +# -- executionUrl & consensusUrl are the only required fields +endpoints: + - name: default-endpoint + executionUrl: "http://execution-node:8545" + executionHeaders: + "X-Test": "test" + "Y-Test": "test2" + consensusUrl: "http://beacon-node:5052" + consensusHeaders: + "X-Test": "test" + "Y-Test": "test2" + +# -- This can be a url here for example: +# -- "https://config.dencun-devnet-8.ethpandaops.io/api/v1/nodes/validator-ranges" +# -- If you want to use a local range file define it in the values.yaml validatorNamesRanges section +validatorNamesInventory: "" + +validatorNamesRanges: | + 0-1: test + +# -- Enable assertoor UI +assertoorFrontendEnabled: true + +# -- Enable assertoor API +assertoorApiEnabled: true + +# -- global assertoor variables +# -- global variables are passed to all tests. +globalVariables: + walletPrivkey: "feedbeef12340000feedbeef12340000feedbeef12340000feedbeef12340000" + +# -- assertoor test configurations +# -- file is the only required field. All other fields default to the values provided in the test file, but can be overriden if needed. +assertoorTests: [] + +# -- Config file +# @default -- See `values.yaml` +config: | + web: + server: + host: "0.0.0.0" + port: {{ .Values.httpPort }} + frontend: + enabled: {{ .Values.assertoorFrontendEnabled }} + api: + enabled: {{ .Values.assertoorApiEnabled }} + + # Endpoints + endpoints: + {{- range .Values.endpoints }} + - executionUrl: {{ .executionUrl | quote }} + consensusUrl: {{ .consensusUrl | quote }} + {{- if .name }} + name: {{ .name | quote }} + {{- end }} + {{- if .consensusHeaders }} + consensusHeaders: + {{- range $key, $value := .consensusHeaders }} + {{ $key | quote | default "" }}: {{ $value | quote | default ""}} + {{- end }} + {{- end }} + {{- if .executionHeaders }} + executionHeaders: + {{- range $key, $value := .executionHeaders }} + {{ $key | quote | default "" }}: {{ $value | quote | default ""}} + {{- end }} + {{- end }} + {{- end }} + + # Validator names + validatorNames: + inventoryYaml: "/data/ranges.yaml" + inventoryUrl: "{{ .Values.validatorNamesInventory }}" + + globalVars: + {{- toYaml .globalVariables | nindent 2 }} + + # Test definitions + externalTests: + {{- range .Values.assertoorTests }} + - file: {{ .file | quote }} + {{- if .name }} + name: {{ .name | quote }} + {{- end }} + {{- if .timeout }} + timeout: {{ .timeout | quote }} + {{- end }} + {{- if .config }} + config: + {{- toYaml .config | nindent 6 }} + {{- end }} + {{- if .schedule }} + schedule: + {{- toYaml .schedule | nindent 6 }} + {{- end }} + {{- end }} From ed43463fb0760e9a00d8357c585e76ecbc48fd2e Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Thu, 7 Mar 2024 12:37:52 +0100 Subject: [PATCH 5/5] feat: enable proper healthchecks for blutgang (#295) * feat: enable proper healthchecks for blutgang * make admin ns enabled by default * fix ci --- charts/blutgang/Chart.yaml | 2 +- charts/blutgang/README.md | 2 +- charts/blutgang/ci/default-values.yaml | 10 ++++++--- charts/blutgang/values.yaml | 28 ++++++++++++++------------ 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/charts/blutgang/Chart.yaml b/charts/blutgang/Chart.yaml index fbfe432a..1f8e9c7f 100644 --- a/charts/blutgang/Chart.yaml +++ b/charts/blutgang/Chart.yaml @@ -7,7 +7,7 @@ icon: https://github.com/rainshowerLabs/blutgang/assets/55022497/ec668c7a-5f56-4 sources: - https://github.com/rainshowerLabs/blutgang type: application -version: 0.0.3 +version: 0.0.4 maintainers: - name: barnabasbusa email: busa.barnabas@gmail.com diff --git a/charts/blutgang/README.md b/charts/blutgang/README.md index 4db77b8d..17fc66dd 100644 --- a/charts/blutgang/README.md +++ b/charts/blutgang/README.md @@ -1,7 +1,7 @@ # blutgang -![Version: 0.0.3](https://img.shields.io/badge/Version-0.0.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 0.0.4](https://img.shields.io/badge/Version-0.0.4-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. diff --git a/charts/blutgang/ci/default-values.yaml b/charts/blutgang/ci/default-values.yaml index 86c97ae0..00e3bf1f 100644 --- a/charts/blutgang/ci/default-values.yaml +++ b/charts/blutgang/ci/default-values.yaml @@ -14,17 +14,21 @@ config: | # Enable health checking health_check = true # Acceptable time to wait for a response in ms - ttl = 30 + ttl = 300 # How many times to retry a request before giving up max_retries = 32 + # Block time in ms, used as a sanity check when not receiving subscriptions + expected_block_time = 13000 # Time between health checks in ms - health_check_ttl = 1250 + health_check_ttl = 2000 + # Supress the health check running info messages + supress_rpc_check = false # Note: the admin namespace contains volatile functions and # should not be exposed publicly. [admin] # Enable the admin namespace - enabled = false + enabled = true # Address for the admin RPC address = "0.0.0.0:5715" # Only allow read-only methods diff --git a/charts/blutgang/values.yaml b/charts/blutgang/values.yaml index 276efbb2..fc381a4d 100644 --- a/charts/blutgang/values.yaml +++ b/charts/blutgang/values.yaml @@ -11,7 +11,7 @@ image: # -- blutgang container image repository repository: makemake1337/blutgang # -- blutgang container image tag - tag: "latest" + tag: latest # -- blutgang container pull policy pullPolicy: IfNotPresent @@ -50,13 +50,13 @@ config: | # Enable health checking health_check = {{ .Values.blutgangNamespace.health_check | default true }} # Acceptable time to wait for a response in ms - ttl = {{ .Values.blutgangNamespace.ttl | default 30 }} + ttl = {{ .Values.blutgangNamespace.ttl | default 300 }} # How many times to retry a request before giving up max_retries = {{ .Values.blutgangNamespace.max_retries | default 32 }} # Block time in ms, used as a sanity check when not receiving subscriptions expected_block_time = {{ .Values.blutgangNamespace.expected_block_time | default 13000 }} # Time between health checks in ms - health_check_ttl = {{ .Values.blutgangNamespace.health_check_ttl | default 400 }} + health_check_ttl = {{ .Values.blutgangNamespace.health_check_ttl | default 2000 }} # Supress the health check running info messages supress_rpc_check = {{ .Values.blutgangNamespace.supress_rpc_check | default false }} @@ -64,7 +64,7 @@ config: | # should not be exposed publicly. [admin] # Enable the admin namespace - enabled = {{ .Values.adminNamespace.enabled | default false }} + enabled = {{ .Values.adminNamespace.enabled | default true }} # Address for the admin RPC address = "0.0.0.0:{{ .Values.adminNamespace.adminPort | default 5715 }}" # Only allow read-only methods @@ -115,16 +115,16 @@ blutgangNamespace: ma_length: 100 sort_on_startup: true health_check: true - ttl: 30 + ttl: 300 max_retries: 32 expected_block_time: 13000 - health_check_ttl: 400 + health_check_ttl: 2000 supress_rpc_check: false # -- Admin Namespace # @default -- See `values.yaml` adminNamespace: - enabled: false + enabled: true adminPort: 5715 jwt_enabled: false jwt_key: "" @@ -168,16 +168,18 @@ httpPort: 3000 # -- Liveness probe # @default -- See `values.yaml` livenessProbe: - tcpSocket: - port: http - initialDelaySeconds: 60 - periodSeconds: 30 + httpGet: + path: /health + port: admin + initialDelaySeconds: 10 + periodSeconds: 10 # -- Readiness probe # @default -- See `values.yaml` readinessProbe: - tcpSocket: - port: http + httpGet: + path: /ready + port: admin initialDelaySeconds: 10 periodSeconds: 10