Skip to content

Commit 52e4d8c

Browse files
authored
feat(eth-faucet): Initial eth-faucet (ethpandaops#154)
* feat(eth-faucet): Initial eth-faucet chart * feat(eth-faucet): Initial eth-faucet chart * feat: Linting fixes and readme example * feat: Linting fixes and readme example * feat: Linting fixes and readme example * feat: Linting fixes and readme example * feat(eth-faucet): Add a throw-away private key * feat(eth-faucet): Add a throw-away private key * ignore eth-faucet from chart-testing
1 parent 6dc52a4 commit 52e4d8c

14 files changed

+597
-0
lines changed

.github/workflows/lint-test.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ jobs:
4747
--excluded-charts beaconchain-explorer
4848
--excluded-charts blockscout
4949
--excluded-charts fauceth
50+
--excluded-charts eth-faucet

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Tooling
6464
- [`dshackle`](charts/dshackle) - Fault tolerant load balancer for blockchain apis, including Ethereum RPC.
6565
- [`eth2-fork-mon`](charts/eth2-fork-mon) - Fork monitor for a configurable set of beacon nodes.
6666
- [`ethstats`](charts/ethstats) - Web UI to track execution layer node status.
67+
- [`eth-faucet`](charts/eth-faucet) - Ether faucet server built with Go and Svelte.
6768
- [`fauceth`](charts/fauceth) - EIP1559 compatible web faucet using Hcaptcha.
6869
- [`forkmon`](charts/forkmon) - Fork monitor for execution layer nodes.
6970
- [`ganache`](charts/ganache) - Simulator for development and testing purposes of the execution layer.

charts/eth-faucet/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/eth-faucet/Chart.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v2
2+
name: eth-faucet
3+
description: Ether faucet server built with Go and Svelte.
4+
home: https://github.com/chainflag/eth-faucet
5+
type: application
6+
version: 0.1.0
7+
maintainers:
8+
- name: samcm
9+

charts/eth-faucet/README.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
2+
# eth-faucet
3+
4+
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
5+
6+
Ether faucet server built with Go and Svelte.
7+
8+
**Homepage:** <https://github.com/chainflag/eth-faucet>
9+
10+
## Example Configuration
11+
12+
[Upstream docs](https://github.com/chainflag/eth-faucet#configuration)
13+
14+
```yaml
15+
secretEnv:
16+
PRIVATE_KEY: "your_private_key"
17+
18+
extraEnv:
19+
- name: WEB3_PROVIDER
20+
value: "http://your-rpc-provider:8545"
21+
22+
## Optional flags
23+
extraArgs:
24+
- -faucet.amount=32.05
25+
```
26+
27+
## Values
28+
29+
| Key | Type | Default | Description |
30+
|-----|------|---------|-------------|
31+
| affinity | object | `{}` | Affinity configuration for pods |
32+
| annotations | object | `{}` | Annotations for the Deployment |
33+
| args | list | `[]` | Command arguments |
34+
| containerSecurityContext | object | See `values.yaml` | The security context for containers |
35+
| customArgs | list | `[]` | Custom args for the eth-faucet container |
36+
| customCommand | list | `[]` | Command replacement for the eth-faucet container |
37+
| extraContainers | list | `[]` | Additional containers |
38+
| extraEnv | list | `[{"name":"WEB3_PROVIDER","value":"http://rpc-provider:8545"}]` | Additional env variables |
39+
| extraPodPorts | list | `[]` | Extra Pod ports |
40+
| extraPorts | list | `[]` | Additional ports. Useful when using extraContainers |
41+
| extraVolumeMounts | list | `[]` | Additional volume mounts |
42+
| extraVolumes | list | `[]` | Additional volumes |
43+
| fullnameOverride | string | `""` | Overrides the chart's computed fullname |
44+
| httpPort | int | `8080` | Ports |
45+
| image.pullPolicy | string | `"IfNotPresent"` | eth-faucet container pull policy |
46+
| image.repository | string | `"chainflag/eth-faucet"` | eth-faucet container image repository |
47+
| image.tag | string | `"latest"` | eth-faucet container image tag |
48+
| imagePullSecrets | list | `[]` | Image pull secrets for Docker images |
49+
| ingress.annotations | object | `{}` | Annotations for Ingress |
50+
| ingress.enabled | bool | `false` | Ingress resource for the HTTP API |
51+
| ingress.hosts[0].host | string | `"chart-example.local"` | |
52+
| ingress.hosts[0].paths | list | `[]` | |
53+
| ingress.tls | list | `[]` | Ingress TLS |
54+
| initContainers | list | `[]` | Additional init containers |
55+
| livenessProbe | object | See `values.yaml` | Liveness probe |
56+
| nameOverride | string | `""` | Overrides the chart's name |
57+
| nodeSelector | object | `{}` | Node selector for pods |
58+
| podAnnotations | object | `{}` | Pod annotations |
59+
| podDisruptionBudget | object | `{}` | Define the PodDisruptionBudget spec If not set then a PodDisruptionBudget will not be created |
60+
| podLabels | object | `{}` | Pod labels |
61+
| priorityClassName | string | `nil` | Pod priority class |
62+
| readinessProbe | object | See `values.yaml` | Readiness probe |
63+
| replicas | int | `1` | Number of replicas |
64+
| resources | object | `{}` | Resource requests and limits |
65+
| secretEnv | object | `{"PRIVATE_KEY":"52f81d18fd7c51ec151a72b7dfd13cddc39e01ef75b724ce0092c34962e59d5b"}` | Secret env variables injected via a created secret |
66+
| securityContext | object | See `values.yaml` | The security context for pods |
67+
| service.type | string | `"ClusterIP"` | Service type |
68+
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
69+
| serviceAccount.create | bool | `false` | Specifies whether a service account should be created |
70+
| 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 |
71+
| terminationGracePeriodSeconds | int | `30` | How long to wait until the pod is forcefully terminated |
72+
| tolerations | list | `[]` | Tolerations for pods |

charts/eth-faucet/README.md.gotmpl

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
{{ template "chart.header" . }}
3+
{{ template "chart.deprecationWarning" . }}
4+
5+
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}
6+
7+
{{ template "chart.description" . }}
8+
9+
10+
{{ template "chart.homepageLine" . }}
11+
12+
{{ template "chart.sourcesSection" . }}
13+
14+
{{ template "chart.requirementsSection" . }}
15+
16+
17+
## Example Configuration
18+
19+
[Upstream docs](https://github.com/chainflag/eth-faucet#configuration)
20+
21+
```yaml
22+
secretEnv:
23+
PRIVATE_KEY: "your_private_key"
24+
25+
extraEnv:
26+
- name: WEB3_PROVIDER
27+
value: "http://your-rpc-provider:8545"
28+
29+
## Optional flags
30+
extraArgs:
31+
- -faucet.amount=32.05
32+
```
33+
34+
{{ template "chart.valuesSection" . }}

charts/eth-faucet/templates/NOTES.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "eth-faucet.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "eth-faucet.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "eth-faucet.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ include "eth-faucet.httpPort" . }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "eth-faucet.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:8080 to use your application"
21+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
22+
{{- end }}
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "eth-faucet.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "eth-faucet.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "eth-faucet.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "eth-faucet.labels" -}}
37+
helm.sh/chart: {{ include "eth-faucet.chart" . }}
38+
{{ include "eth-faucet.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "eth-faucet.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "eth-faucet.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "eth-faucet.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "eth-faucet.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
63+
64+
{{- define "eth-faucet.httpPort" -}}
65+
{{ .Values.httpPort | default "8080" }}
66+
{{- end }}
+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "eth-faucet.fullname" . }}
5+
labels:
6+
{{- include "eth-faucet.labels" . | nindent 4 }}
7+
annotations:
8+
{{- toYaml .Values.annotations | nindent 4 }}
9+
spec:
10+
replicas: {{ .Values.replicas }}
11+
selector:
12+
matchLabels:
13+
{{- include "eth-faucet.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
labels:
17+
{{- include "eth-faucet.selectorLabels" . | nindent 8 }}
18+
{{- with .Values.podLabels }}
19+
{{- toYaml . | nindent 8 }}
20+
{{- end }}
21+
annotations:
22+
checksum/secrets: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
23+
{{- with .Values.podAnnotations }}
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
26+
spec:
27+
serviceAccountName: {{ include "eth-faucet.serviceAccountName" . }}
28+
{{- if .Values.priorityClassName }}
29+
priorityClassName: {{ .Values.priorityClassName }}
30+
{{- end }}
31+
securityContext:
32+
{{- toYaml .Values.securityContext | nindent 8 }}
33+
initContainers:
34+
{{- if .Values.initContainers }}
35+
{{- toYaml .Values.initContainers | nindent 8 }}
36+
{{- end }}
37+
{{- with .Values.imagePullSecrets }}
38+
imagePullSecrets:
39+
{{- toYaml . | nindent 8 }}
40+
{{- end }}
41+
containers:
42+
- name: {{ .Chart.Name }}
43+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
44+
imagePullPolicy: {{ .Values.image.pullPolicy }}
45+
command:
46+
{{- if gt (len .Values.customCommand) 0 }}
47+
{{- toYaml .Values.customCommand | nindent 12}}
48+
{{- else }}
49+
- /app/eth-faucet
50+
- -httpport={{ include "eth-faucet.httpPort" . }}
51+
{{- if gt (len .Values.args) 0 }}
52+
{{- toYaml .Values.args | nindent 12}}
53+
{{- end }}
54+
{{- end }}
55+
{{- if gt (len .Values.customArgs) 0 }}
56+
args:
57+
{{- toYaml .Values.customArgs | nindent 12}}
58+
{{- end }}
59+
securityContext:
60+
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
61+
volumeMounts:
62+
{{- if .Values.extraVolumeMounts }}
63+
{{ toYaml .Values.extraVolumeMounts | nindent 12 }}
64+
{{- end }}
65+
ports:
66+
- name: http
67+
containerPort: {{ include "eth-faucet.httpPort" . }}
68+
protocol: TCP
69+
{{- if .Values.extraPodPorts }}
70+
{{ toYaml .Values.extraPodPorts | nindent 10 }}
71+
{{- end }}
72+
livenessProbe:
73+
{{- toYaml .Values.livenessProbe | nindent 12 }}
74+
readinessProbe:
75+
{{- toYaml .Values.readinessProbe | nindent 12 }}
76+
resources:
77+
{{- toYaml .Values.resources | nindent 12 }}
78+
env:
79+
{{- range $key, $value := .Values.secretEnv }}
80+
- name: {{ $key }}
81+
valueFrom:
82+
secretKeyRef:
83+
name: {{ include "eth-faucet.fullname" $ }}-env
84+
key: {{ $key }}
85+
{{- end }}
86+
{{- if .Values.extraEnv }}
87+
{{- toYaml .Values.extraEnv | nindent 12 }}
88+
{{- end }}
89+
{{- if .Values.extraContainers }}
90+
{{ toYaml .Values.extraContainers | nindent 8}}
91+
{{- end }}
92+
nodeSelector:
93+
{{- toYaml .Values.nodeSelector | nindent 8 }}
94+
affinity:
95+
{{- toYaml .Values.affinity | nindent 8 }}
96+
tolerations:
97+
{{- toYaml .Values.tolerations | nindent 8 }}
98+
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
99+
volumes:
100+
{{- if .Values.extraVolumes }}
101+
{{ toYaml .Values.extraVolumes | nindent 8}}
102+
{{- end }}

0 commit comments

Comments
 (0)