Skip to content

Commit

Permalink
feat: add rpc-snooper (#310)
Browse files Browse the repository at this point in the history
* feat: add rpc-snooper

* fix newline

* yeet configmap

* fix http port

* fix legacy actions

* fix legacy actions

* fix legacy actions
  • Loading branch information
barnabasbusa authored Apr 19, 2024
1 parent 07ca262 commit e472e1a
Show file tree
Hide file tree
Showing 16 changed files with 595 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -22,7 +22,7 @@ jobs:
git config user.email "[email protected]"
- name: Set up Helm
uses: azure/setup-helm@v3
uses: azure/setup-helm@v4
with:
version: v3.7.0

Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/test-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ jobs:
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Fetch default branch
run: git fetch origin ${{ github.event.repository.default_branch }}:${{ github.event.repository.default_branch }}

- name: Set up Helm
uses: azure/setup-helm@v3
uses: azure/setup-helm@v4
with:
version: v3.7.0
version: v3.13.0

- uses: actions/setup-python@v3
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.12

- name: Run pre-commit hooks
uses: pre-commit/[email protected]
Expand All @@ -49,7 +50,7 @@ jobs:
--target-branch ${{ github.event.repository.default_branch }}
- name: Create kind cluster
uses: helm/kind-action@v1.5.0
uses: helm/kind-action@v1.9.0
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test-ethereum-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ jobs:
network: [sepolia, mainnet]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Fetch default branch
run: git fetch origin ${{ github.event.repository.default_branch }}:${{ github.event.repository.default_branch }}

- name: Set up Helm
uses: azure/setup-helm@v3
uses: azure/setup-helm@v4
with:
version: v3.7.0
version: v3.13.0

- uses: actions/setup-python@v3
- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.12

- name: Run pre-commit hooks
uses: pre-commit/[email protected]
Expand All @@ -57,7 +57,7 @@ jobs:
--charts charts/ethereum-node
- name: Create kind cluster
uses: helm/kind-action@v1.5.0
uses: helm/kind-action@v1.9.0
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Tooling
- [`ipfs-cluster`](charts/ipfs-cluster) - IPFS Cluster
- [`powfaucet`](charts/powfaucet) - Modularized faucet for EVM chains with different protection methods (Captcha, PoW Mining, IP Limits, Wallet Balances and more)
- [`rpc-proxy`](charts/rpc-proxy) - A proxy for web3 JSONRPC. Rate limiting and method filtering.
- [`rpc-snooper`](charts/rpc-snooper) - A tool to snoop on RPC calls and log them to stdout.
- [`smart-contract-verifier-http`](charts/smart-contract-verifier-http) - Smart contract verification service.
- [`stubbies`](charts/stubbies) - Ethereum execution client stub for consensus layer clients.
- [`testnet-faucet`](charts/testnet-faucet) - Web faucet that can be used to distribute testnet ETH to users.
Expand Down
23 changes: 23 additions & 0 deletions charts/rpc-snooper/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
11 changes: 11 additions & 0 deletions charts/rpc-snooper/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
name: rpc-snooper
description: Lightweight RPC proxy tool designed for debugging and monitoring RPC calls between Ethereum clients
home: https://github.com/ethpandaops/rpc-snooper
type: application
version: 0.0.1
maintainers:
- name: barnabasbusa
email: [email protected]
- name: pk910
email: [email protected]
69 changes: 69 additions & 0 deletions charts/rpc-snooper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

# rpc-snooper

![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)

Lightweight RPC proxy tool designed for debugging and monitoring RPC calls between Ethereum clients

**Homepage:** <https://github.com/ethpandaops/rpc-snooper>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity configuration for pods |
| annotations | object | `{}` | Annotations for the Deployment |
| containerSecurityContext | object | See `values.yaml` | The security context for containers |
| customArgs | list | `[]` | Custom args for the rpc-snooper container |
| customCommand | list | `[]` | Command replacement for the rpc-snooper container |
| 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 | `8555` | |
| image.pullPolicy | string | `"IfNotPresent"` | rpc-snooper container pull policy |
| image.repository | string | `"ethpandaops/rpc-snooper"` | rpc-snooper container image repository |
| image.tag | string | `"latest"` | rpc-snooper 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 |
| 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 |
| readinessProbe | object | See `values.yaml` | Readiness probe |
| replicas | int | `1` | Number of replicas |
| resources | object | `{}` | Resource requests and limits |
| secretEnv | object | `{}` | Secret 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 |
| 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 |
| url | string | `"http://geth:8545"` | Target RPC URL |

# Examples

## Defining the upstream node (required)

#### Engine snooper configuration (lives between consensus clients and execution clients)
```yaml
url: http://geth:8545
```
#### Beacon snooper configuration (lives between validator and consensus clients)
```yaml
url: http://lighthouse:5052
```
29 changes: 29 additions & 0 deletions charts/rpc-snooper/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

{{ 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

## Defining the upstream node (required)

#### Engine snooper configuration (lives between consensus clients and execution clients)
```yaml
url: http://geth:8545
```

#### Beacon snooper configuration (lives between validator and consensus clients)
```yaml
url: http://lighthouse:5052
```
66 changes: 66 additions & 0 deletions charts/rpc-snooper/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "rpc-snooper.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 "rpc-snooper.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 "rpc-snooper.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "rpc-snooper.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "rpc-snooper.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{- define "rpc-snooper.httpPort" -}}
{{ .Values.httpPort }}
{{- end -}}
Loading

0 comments on commit e472e1a

Please sign in to comment.