Skip to content

Commit

Permalink
feat: add beacon charts
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-bahjati committed Oct 11, 2023
1 parent bee9d6b commit d59844e
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 93 deletions.
8 changes: 4 additions & 4 deletions charts/beacon/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: hermes
description: Pyth cross-chain server
name: beacon
description: Highly available Wormhole RPC
type: application
version: 0.2.2
appVersion: v0.2.1
version: 0.1.0
appVersion: v0.1.0
27 changes: 12 additions & 15 deletions charts/beacon/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
# hermes
# beacon

![Version: 0.2.2](https://img.shields.io/badge/Version-0.2.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.2.1](https://img.shields.io/badge/AppVersion-v0.2.1-informational?style=flat-square)
![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) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square)

Pyth cross-chain server
Highly available Wormhole RPC

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| beacon.logLevel | string | `"warn"` | Beacon log level. Valid values are: trace, debug, info, warn, error |
| beacon.natsUrl | string | `nil` | NATS server URL. Must be set. Example: nats.nats:4222 |
| beacon.wormholeBootstrapAddrs | string | `"/dns4/wormhole-mainnet-v2-bootstrap.certus.one/udp/8999/quic/p2p/12D3KooWQp644DK27fd3d4Km3jr7gHiuJJ5ZGmy8hH4py7fP4FP7,/dns4/wormhole-v2-mainnet-bootstrap.xlabs.xyz/udp/8999/quic/p2p/12D3KooWNQ9tVrcb64tw6bNs2CaNrUGPM7yRrKvBBheQ5yCyPHKC"` | Wormhole bootstrap addresses |
| beacon.wormholeNetworkId | string | `"/wormhole/mainnet/2"` | Wormhole network id |
| beacon.writerBatchSize | string | `"1000"` | Batch size for the writer. When the batch size is reached, the writer will flush the batch to the NATS stream. |
| fullnameOverride | string | `""` | |
| hermes.benchmarks.enabled | bool | `true` | Enable benchmarks. Benchmarks endpoint does not support Hermes Beta yet and you need to disable it for that. |
| hermes.benchmarks.endpoint | string | `"https://benchmarks.pyth.network"` | Benchmarks endpoint. |
| hermes.logLevel | string | `"warn"` | Hermes log level. Valid values are: trace, debug, info, warn, error |
| hermes.pythnetHttpAddr | string | `nil` | Pythnet Http RPC address. Must be set. Example: http://localhost:8899 |
| hermes.pythnetWsAddr | string | `nil` | Pythnet Websocket RPC address. Must be set. Example: ws://localhost:8900 |
| hermes.rpcWsWhitelist | string | `nil` | Whitelisted ip network addresses (in CIDR notation) against websocket ratelimit (separated by comma). Example: 1.2.0.0/24,3.0.0.0/8 |
| hermes.wormholeBootstrapAddrs | string | `"/dns4/wormhole-mainnet-v2-bootstrap.certus.one/udp/8999/quic/p2p/12D3KooWQp644DK27fd3d4Km3jr7gHiuJJ5ZGmy8hH4py7fP4FP7,/dns4/wormhole-v2-mainnet-bootstrap.xlabs.xyz/udp/8999/quic/p2p/12D3KooWNQ9tVrcb64tw6bNs2CaNrUGPM7yRrKvBBheQ5yCyPHKC"` | Wormhole bootstrap addresses |
| hermes.wormholeContractAddr | string | `"H3fxXJ86ADW2PNuDDmZJg6mzTtPxkYCpNuQUTgmJ7AjU"` | Wormhole contract address |
| hermes.wormholeNetworkId | string | `"/wormhole/mainnet/2"` | Wormhole network id |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"public.ecr.aws/pyth-network/hermes"` | |
| image.repository | string | `"public.ecr.aws/pyth-network/beacon"` | |
| image.tag | string | `""` | |
| imagePullSecrets | list | `[]` | |
| ingress.annotations | object | `{}` | |
Expand All @@ -37,14 +33,15 @@ Pyth cross-chain server
| podSecurityContext.runAsGroup | int | `10001` | |
| podSecurityContext.runAsNonRoot | bool | `true` | |
| podSecurityContext.runAsUser | int | `10001` | |
| replicaCount | int | `1` | |
| replicaCount | int | `3` | Number of Beacon replicas |
| resources.limits | object | `{}` | |
| resources.requests.cpu | int | `1` | |
| resources.requests.memory | string | `"1Gi"` | |
| securityContext.allowPrivilegeEscalation | bool | `false` | |
| securityContext.capabilities.drop[0] | string | `"ALL"` | |
| securityContext.readOnlyRootFilesystem | bool | `true` | |
| service.port | int | `8080` | |
| service.grpcPort | int | `8080` | |
| service.metricsPort | int | `8081` | |
| service.type | string | `"ClusterIP"` | |
| tolerations | list | `[]` | |

Expand Down
8 changes: 4 additions & 4 deletions charts/beacon/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
{{- 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 "hermes.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "beacon.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 "hermes.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "hermes.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "beacon.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "beacon.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "hermes.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "beacon.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
Expand Down
16 changes: 8 additions & 8 deletions charts/beacon/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "hermes.name" -}}
{{- define "beacon.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ 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 "hermes.fullname" -}}
{{- define "beacon.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "hermes.chart" -}}
{{- define "beacon.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "hermes.labels" -}}
helm.sh/chart: {{ include "hermes.chart" . }}
{{ include "hermes.selectorLabels" . }}
{{- define "beacon.labels" -}}
helm.sh/chart: {{ include "beacon.chart" . }}
{{ include "beacon.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,7 +45,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "hermes.selectorLabels" -}}
app.kubernetes.io/name: {{ include "hermes.name" . }}
{{- define "beacon.selectorLabels" -}}
app.kubernetes.io/name: {{ include "beacon.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
76 changes: 51 additions & 25 deletions charts/beacon/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "hermes.fullname" . }}
name: {{ include "beacon.fullname" . }}
labels:
{{- include "hermes.labels" . | nindent 4 }}
{{- include "beacon.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "hermes.selectorLabels" . | nindent 6 }}
{{- include "beacon.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "hermes.selectorLabels" . | nindent 8 }}
{{- include "beacon.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand All @@ -29,49 +29,75 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- hermes
- beacon
- run
- --pythnet-http-addr
- {{ required "hermes.pythnetHttpAddr is required" .Values.hermes.pythnetHttpAddr }}
- {{ required "beacon.pythnetHttpAddr is required" .Values.beacon.pythnetHttpAddr }}
- --pythnet-ws-addr
- {{ required "hermes.pythnetWsAddr is required" .Values.hermes.pythnetWsAddr }}
- {{ required "beacon.pythnetWsAddr is required" .Values.beacon.pythnetWsAddr }}
- --rpc-listen-addr
- 0.0.0.0:8080
{{- if .Values.hermes.rpcWsWhitelist }}
{{- if .Values.beacon.rpcWsWhitelist }}
- --rpc-ws-whitelist
- {{ .Values.hermes.rpcWsWhitelist }}
- {{ .Values.beacon.rpcWsWhitelist }}
{{- end }}
- --wormhole-bootstrap-addrs
- {{ .Values.hermes.wormholeBootstrapAddrs }}
- {{ .Values.beacon.wormholeBootstrapAddrs }}
- --wormhole-network-id
- {{ .Values.hermes.wormholeNetworkId }}
- {{ .Values.beacon.wormholeNetworkId }}
- --wormhole-contract-addr
- {{ .Values.hermes.wormholeContractAddr }}
{{- if .Values.hermes.benchmarks.enabled }}
- {{ .Values.beacon.wormholeContractAddr }}
{{- if .Values.beacon.benchmarks.enabled }}
- --benchmarks-endpoint
- {{ .Values.hermes.benchmarks.endpoint }}
- {{ .Values.beacon.benchmarks.endpoint }}
{{- end }}
env:
- name: RUST_LOG
value: {{ .Values.hermes.logLevel }}
- name: WORMHOLE_LISTEN
value: /ip4/0.0.0.0/udp/30910/quic
- name: SERVER_URL
value: :8080
- name: METRICS_URL
value: :8081
- name: HEARTBEAT_URL
value: :9000
- name: HEARTBEAT_INTERVAL
value: 10
- name: LOG_LEVEL
value: {{ .Values.beacon.logLevel }}
- name: WORMHOLE_NETWORK_ID
value: {{ .Values.beacon.wormholeNetworkId }}
- name: WORMHOLE_BOOTSTRAP
value: {{ .Values.beacon.wormholeBootstrapAddrs }}
- name: NATS_URL
value: {{ .Values.beacon.natsUrl }}
- name: WRITER_BATCH_SIZE
value: {{ .Values.beacon.writerBatchSize }}
ports:
- name: http
containerPort: 8080
- containerPort: 7072
protocol: TCP
name: grpc
- containerPort: 8081
protocol: TCP
name: metrics
- containerPort: 9000
protocol: TCP
name: heartbeat
- containerPort: 30910
protocol: UDP
name: wormhole-listen
livenessProbe:
httpGet:
path: /ready
port: 8080
port: 9000
initialDelaySeconds: 30
periodSeconds: 5
failureThreshold: 1
readinessProbe:
livenessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 30
periodSeconds: 5
failureThreshold: 1
path: /
port: 9000
initialDelaySeconds: 5
periodSeconds: 3
resources:
{{- toYaml .Values.resources | nindent 12 }}
securityContext:
Expand Down
4 changes: 2 additions & 2 deletions charts/beacon/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "hermes.fullname" . -}}
{{- $fullName := include "beacon.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
Expand All @@ -17,7 +17,7 @@ kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "hermes.labels" . | nindent 4 }}
{{- include "beacon.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
16 changes: 10 additions & 6 deletions charts/beacon/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "hermes.fullname" . }}
name: {{ include "beacon.fullname" . }}
labels:
{{- include "hermes.labels" . | nindent 4 }}
{{- include "beacon.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
- port: {{ .Values.service.grpcPort }}
targetPort: grpc
protocol: TCP
name: http
name: grpc
- port: {{ .Values.service.metricsPort }}
targetPort: metrics
protocol: TCP
name: metrics
selector:
{{- include "hermes.selectorLabels" . | nindent 4 }}
{{- include "beacon.selectorLabels" . | nindent 4 }}
6 changes: 3 additions & 3 deletions charts/beacon/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "hermes.fullname" . }}-test-connection"
name: "{{ include "beacon.fullname" . }}-test-connection"
labels:
{{- include "hermes.labels" . | nindent 4 }}
{{- include "beacon.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "hermes.fullname" . }}:{{ .Values.service.port }}']
args: ['{{ include "beacon.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
44 changes: 18 additions & 26 deletions charts/beacon/values.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
# Default values for hermes application config. You should replace
# the pythnet endpoint values with your own.
hermes:
# -- Hermes log level. Valid values are: trace, debug, info, warn, error
# Default values for beacon application config.
beacon:
# -- Beacon log level. Valid values are: trace, debug, info, warn, error
logLevel: warn
# -- Pythnet Http RPC address. Must be set. Example: http://localhost:8899
pythnetHttpAddr:
# -- Pythnet Websocket RPC address. Must be set. Example: ws://localhost:8900
pythnetWsAddr:

benchmarks:
# -- Enable benchmarks. Benchmarks endpoint does not support Hermes Beta yet and you need to disable it for that.
enabled: true
# -- Benchmarks endpoint.
endpoint: https://benchmarks.pyth.network
# -- NATS server URL. Must be set. Example: nats.nats:4222
natsUrl:

# -- Whitelisted ip network addresses (in CIDR notation) against websocket ratelimit (separated by comma). Example: 1.2.0.0/24,3.0.0.0/8
rpcWsWhitelist:
# -- Batch size for the writer. When the batch size is reached, the writer will flush the batch to the NATS stream.
writerBatchSize: "1000"

# -- Wormhole bootstrap addresses
wormholeBootstrapAddrs: /dns4/wormhole-mainnet-v2-bootstrap.certus.one/udp/8999/quic/p2p/12D3KooWQp644DK27fd3d4Km3jr7gHiuJJ5ZGmy8hH4py7fP4FP7,/dns4/wormhole-v2-mainnet-bootstrap.xlabs.xyz/udp/8999/quic/p2p/12D3KooWNQ9tVrcb64tw6bNs2CaNrUGPM7yRrKvBBheQ5yCyPHKC
# -- Wormhole network id
wormholeNetworkId: /wormhole/mainnet/2
# -- Wormhole contract address
wormholeContractAddr: H3fxXJ86ADW2PNuDDmZJg6mzTtPxkYCpNuQUTgmJ7AjU

# The values below are the values for our Hermes Beta using testnet wormhole
# wormholeBootstrapAddrs: /dns4/wormhole-testnet-v2-bootstrap.certus.one/udp/8999/quic/p2p/12D3KooWAkB9ynDur1Jtoa97LBUp8RXdhzS5uHgAfdTquJbrbN7i
# -- Wormhole bootstrap addresses
wormholeBootstrapAddrs: /dns4/wormhole-mainnet-v2-bootstrap.certus.one/udp/8999/quic/p2p/12D3KooWQp644DK27fd3d4Km3jr7gHiuJJ5ZGmy8hH4py7fP4FP7,/dns4/wormhole-v2-mainnet-bootstrap.xlabs.xyz/udp/8999/quic/p2p/12D3KooWNQ9tVrcb64tw6bNs2CaNrUGPM7yRrKvBBheQ5yCyPHKC

# The values below are the values testnet Wormhole
# wormholeBootstrapAddrs: /dns4/wormhole-testnet-v2-bootstrap.certus.one/udp/8999/quic/p2p/12D3KooWAkB9ynDur1Jtoa97LBUp8RXdhzS5uHgAfdTquJbrbN7i,/dns4/t-guardian-01.nodes.stable.io/udp/8999/quic/p2p/12D3KooWCW3LGUtkCVkHZmVSZHzL3C4WRKWfqAiJPz1NR7dT9Bxh,/dns4/t-guardian-02.nodes.stable.io/udp/8999/quic/p2p/12D3KooWJXA6goBCiWM8ucjzc4jVUBSqL9Rri6UpjHbkMPErz5zK
# wormholeNetworkId: /wormhole/testnet/2/1
# wormholeContractAddr: EUrRARh92Cdc54xrDn6qzaqjA77NRrCcfbr8kPwoTL4z

# Default values for hermes production config
# Default values for beacon production config

replicaCount: 1
# -- Number of Beacon replicas
replicaCount: 3

image:
repository: public.ecr.aws/pyth-network/hermes
repository: public.ecr.aws/pyth-network/beacon
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
Expand All @@ -60,7 +51,8 @@ securityContext:

service:
type: ClusterIP
port: 8080
grpcPort: 8080
metricsPort: 8081

ingress:
enabled: false
Expand Down

0 comments on commit d59844e

Please sign in to comment.