Skip to content

Commit f4fe01a

Browse files
authored
smart-contract-verifier-http: add chart (ethpandaops#123)
* smart-contract-verifier-http: add new chart
1 parent b7bec3e commit f4fe01a

18 files changed

+819
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Tooling
6969
- [`ethereum-metrics-exporter`](charts/ethereum-metrics-exporter) - A prometheus exporter for Ethereum execution and consensus clients.
7070
- [`checkpointz`](charts/checkpointz) - A beacon chain Checkpoint Sync provider.
7171
- [`ethereum-address-metrics-exporter`](charts/ethereum-address-metrics-exporter) - A prometheus exporter for Ethereum externally owned account and contract addresses.
72+
- [`smart-contract-verifier-http`](charts/smart-contract-verifier-http) - Smart contract verification service.
7273

7374
## Development
7475

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/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v2
2+
name: smart-contract-verifier-http
3+
description: >
4+
Smart-contract verification service. Runs as an HTTP server and allows making verification requests through REST API.
5+
home: https://github.com/blockscout/blockscout-rs/tree/main/smart-contract-verifier-http
6+
sources:
7+
- https://github.com/blockscout/blockscout-rs/tree/main/smart-contract-verifier-http
8+
type: application
9+
version: 0.1.0
10+
maintainers:
11+
- name: skylenet
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
2+
# smart-contract-verifier-http
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+
Smart-contract verification service. Runs as an HTTP server and allows making verification requests through REST API.
7+
8+
**Homepage:** <https://github.com/blockscout/blockscout-rs/tree/main/smart-contract-verifier-http>
9+
10+
## Source Code
11+
12+
* <https://github.com/blockscout/blockscout-rs/tree/main/smart-contract-verifier-http>
13+
14+
## Values
15+
16+
| Key | Type | Default | Description |
17+
|-----|------|---------|-------------|
18+
| affinity | object | `{}` | Affinity configuration for pods |
19+
| annotations | object | `{}` | Annotations for the StatefulSet |
20+
| config | string | See `values.yaml` | Config file |
21+
| customArgs | list | `[]` | Custom args for the smart-contract-verifier-http container |
22+
| customCommand | list | `[]` | Command replacement for the smart-contract-verifier-http container |
23+
| extraContainers | list | `[]` | Additional containers |
24+
| extraEnv | list | `[]` | Additional env variables |
25+
| extraPorts | list | `[]` | Additional ports. Useful when using extraContainers |
26+
| extraVolumeMounts | list | `[]` | Additional volume mounts |
27+
| extraVolumes | list | `[]` | Additional volumes |
28+
| fullnameOverride | string | `""` | Overrides the chart's computed fullname |
29+
| image.pullPolicy | string | `"IfNotPresent"` | smart-contract-verifier-http container pull policy |
30+
| image.repository | string | `"ghcr.io/blockscout/smart-contract-verifier"` | smart-contract-verifier-http container image repository |
31+
| image.tag | string | `"main"` | smart-contract-verifier-http container image tag |
32+
| imagePullSecrets | list | `[]` | Image pull secrets for Docker images |
33+
| ingress.annotations | object | `{}` | Annotations for Ingress |
34+
| ingress.enabled | bool | `false` | Ingress resource for the HTTP API |
35+
| ingress.hosts[0].host | string | `"chart-example.local"` | |
36+
| ingress.hosts[0].paths | list | `[]` | |
37+
| ingress.tls | list | `[]` | Ingress TLS |
38+
| initContainers | list | `[]` | Additional init containers |
39+
| livenessProbe | object | See `values.yaml` | Liveness probe |
40+
| nameOverride | string | `""` | Overrides the chart's name |
41+
| nodeSelector | object | `{}` | Node selector for pods |
42+
| persistence.accessModes | list | `["ReadWriteOnce"]` | Access mode for the volume claim template |
43+
| persistence.annotations | object | `{}` | Annotations for volume claim template |
44+
| persistence.enabled | bool | `false` | Uses an EmptyDir when not enabled |
45+
| persistence.existingClaim | string | `nil` | Use an existing PVC when persistence.enabled |
46+
| persistence.selector | object | `{}` | Selector for volume claim template |
47+
| persistence.size | string | `"2Gi"` | Requested size for volume claim template |
48+
| 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) |
49+
| podAnnotations | object | `{}` | Pod annotations |
50+
| podDisruptionBudget | object | `{}` | Define the PodDisruptionBudget spec If not set then a PodDisruptionBudget will not be created |
51+
| podLabels | object | `{}` | Pod labels |
52+
| podManagementPolicy | string | `"OrderedReady"` | Pod management policy |
53+
| priorityClassName | string | `nil` | Pod priority class |
54+
| readinessProbe | object | See `values.yaml` | Readiness probe |
55+
| replicas | int | `1` | Number of replicas |
56+
| resources | object | `{}` | Resource requests and limits |
57+
| secretEnv | string | `nil` | Env variables injected via a created secret |
58+
| securityContext | object | See `values.yaml` | The security context for pods |
59+
| service.type | string | `"ClusterIP"` | Service type |
60+
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
61+
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
62+
| 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 |
63+
| serviceMonitor.annotations | object | `{}` | Additional ServiceMonitor annotations |
64+
| serviceMonitor.enabled | bool | `false` | If true, a ServiceMonitor CRD is created for a prometheus operator https://github.com/coreos/prometheus-operator |
65+
| serviceMonitor.interval | string | `"1m"` | ServiceMonitor scrape interval |
66+
| serviceMonitor.labels | object | `{}` | Additional ServiceMonitor labels |
67+
| serviceMonitor.namespace | string | `nil` | Alternative namespace for ServiceMonitor |
68+
| serviceMonitor.path | string | `"/metrics"` | Path to scrape |
69+
| serviceMonitor.relabelings | list | `[]` | ServiceMonitor relabelings |
70+
| serviceMonitor.scheme | string | `"http"` | ServiceMonitor scheme |
71+
| serviceMonitor.scrapeTimeout | string | `"30s"` | ServiceMonitor scrape timeout |
72+
| serviceMonitor.tlsConfig | object | `{}` | ServiceMonitor TLS configuration |
73+
| terminationGracePeriodSeconds | int | `30` | How long to wait until the pod is forcefully terminated |
74+
| tolerations | list | `[]` | Tolerations for pods |
75+
| updateStrategy | object | `{"type":"RollingUpdate"}` | Update stategy for the Statefulset |
76+
| updateStrategy.type | string | `"RollingUpdate"` | Update stategy type |
77+
78+
# Examples
79+
80+
## Setting the configuration via Env vars
81+
82+
```yaml
83+
secretEnv:
84+
HCAPTCHA_SECRET: "your_hcaptcha_secret"
85+
HCAPTCHA_SITEKEY: "your_hcaptcha_site_key"
86+
APP_ETHKEY: "key in hex format"
87+
APP_AMOUNT: "1000000000000000000" # 1 ETH
88+
APP_CHAINS: "5" # Comma separated chain IDs that you support
89+
APP_TITLE: "%CHAINNAME smart-contract-verifier-http"
90+
#APP_IMAGEURL:
91+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
{{ template "chart.header" . }}
3+
{{ template "chart.deprecationWarning" . }}
4+
5+
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}
6+
7+
{{ template "chart.description" . }}
8+
9+
{{ template "chart.homepageLine" . }}
10+
11+
{{ template "chart.sourcesSection" . }}
12+
13+
{{ template "chart.requirementsSection" . }}
14+
15+
{{ template "chart.valuesSection" . }}
16+
17+
# Examples
18+
19+
## Setting the configuration via Env vars
20+
21+
```yaml
22+
secretEnv:
23+
HCAPTCHA_SECRET: "your_hcaptcha_secret"
24+
HCAPTCHA_SITEKEY: "your_hcaptcha_site_key"
25+
APP_ETHKEY: "key in hex format"
26+
APP_AMOUNT: "1000000000000000000" # 1 ETH
27+
APP_CHAINS: "5" # Comma separated chain IDs that you support
28+
APP_TITLE: "%CHAINNAME smart-contract-verifier-http"
29+
#APP_IMAGEURL:
30+
```

charts/smart-contract-verifier-http/ci/default-values.yaml

Whitespace-only changes.
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 "smart-contract-verifier-http.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 "smart-contract-verifier-http.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "smart-contract-verifier-http.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ include "smart-contract-verifier-http.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 "smart-contract-verifier-http.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 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "smart-contract-verifier-http.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 "smart-contract-verifier-http.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 "smart-contract-verifier-http.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "smart-contract-verifier-http.labels" -}}
37+
helm.sh/chart: {{ include "smart-contract-verifier-http.chart" . }}
38+
{{ include "smart-contract-verifier-http.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 "smart-contract-verifier-http.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "smart-contract-verifier-http.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 "smart-contract-verifier-http.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "smart-contract-verifier-http.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
63+
64+
{{- define "smart-contract-verifier-http.httpPort" -}}
65+
{{- printf "8043" -}}
66+
{{- end -}}
67+
68+
{{- define "smart-contract-verifier-http.metricsPort" -}}
69+
{{- printf "6060" -}}
70+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "smart-contract-verifier-http.fullname" . }}
5+
labels:
6+
{{- include "smart-contract-verifier-http.labels" . | nindent 4 }}
7+
data:
8+
config.toml: |
9+
{{- tpl .Values.config . | nindent 4 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "smart-contract-verifier-http.fullname" . -}}
3+
{{- $svcPort := include "smart-contract-verifier-http.httpPort" . -}}
4+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5+
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
6+
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
7+
{{- end }}
8+
{{- end }}
9+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
10+
apiVersion: networking.k8s.io/v1
11+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
12+
apiVersion: networking.k8s.io/v1beta1
13+
{{- else -}}
14+
apiVersion: extensions/v1beta1
15+
{{- end }}
16+
kind: Ingress
17+
metadata:
18+
name: {{ $fullName }}
19+
labels:
20+
{{- include "smart-contract-verifier-http.labels" . | nindent 4 }}
21+
{{- with .Values.ingress.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 4 }}
24+
{{- end }}
25+
spec:
26+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.ingress.className }}
28+
{{- end }}
29+
{{- if .Values.ingress.tls }}
30+
tls:
31+
{{- range .Values.ingress.tls }}
32+
- hosts:
33+
{{- range .hosts }}
34+
- {{ . | quote }}
35+
{{- end }}
36+
secretName: {{ .secretName }}
37+
{{- end }}
38+
{{- end }}
39+
rules:
40+
{{- range .Values.ingress.hosts }}
41+
- host: {{ .host | quote }}
42+
http:
43+
paths:
44+
{{- range .paths }}
45+
- path: {{ .path }}
46+
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
47+
pathType: {{ .pathType }}
48+
{{- end }}
49+
backend:
50+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
51+
service:
52+
name: {{ $fullName }}
53+
port:
54+
number: {{ $svcPort }}
55+
{{- else }}
56+
serviceName: {{ $fullName }}
57+
servicePort: {{ $svcPort }}
58+
{{- end }}
59+
{{- end }}
60+
{{- end }}
61+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ include "smart-contract-verifier-http.fullname" . }}-env
5+
labels:
6+
{{- include "smart-contract-verifier-http.labels" . | nindent 4 }}
7+
data:
8+
{{- range $key, $value := .Values.secretEnv }}
9+
{{ $key }}: {{ $value | b64enc }}
10+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "smart-contract-verifier-http.fullname" . }}-headless
5+
labels:
6+
{{- include "smart-contract-verifier-http.labels" . | nindent 4 }}
7+
spec:
8+
clusterIP: None
9+
ports:
10+
- port: {{ include "smart-contract-verifier-http.httpPort" . }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
{{- if .Values.extraPorts }}
15+
{{ toYaml .Values.extraPorts | nindent 4}}
16+
{{- end }}
17+
selector:
18+
{{- include "smart-contract-verifier-http.selectorLabels" . | nindent 4 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "smart-contract-verifier-http.fullname" . }}
5+
labels:
6+
{{- include "smart-contract-verifier-http.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ include "smart-contract-verifier-http.httpPort" . }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
{{- if .Values.extraPorts }}
15+
{{ toYaml .Values.extraPorts | nindent 4}}
16+
{{- end }}
17+
selector:
18+
{{- include "smart-contract-verifier-http.selectorLabels" . | nindent 4 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "smart-contract-verifier-http.serviceAccountName" . }}
6+
labels:
7+
{{- include "smart-contract-verifier-http.labels" . | nindent 4 }}
8+
{{- with .Values.serviceAccount.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
namespace: {{ .Release.Namespace }}
13+
{{- end }}

0 commit comments

Comments
 (0)