Skip to content

Commit

Permalink
feat(helm): Build updater chart
Browse files Browse the repository at this point in the history
  • Loading branch information
oyyblin committed Oct 31, 2024
1 parent 53f271e commit 762ca2c
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 0 deletions.
5 changes: 5 additions & 0 deletions charts/updater/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.gz
*.tar
*.tar.gz
tmp/
temp/
6 changes: 6 additions & 0 deletions charts/updater/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: drand-oracle-updater
description: A Helm chart for Kubernetes to deploy the Drand Oracle Updater application
type: application
version: 0.1.0
appVersion: 0.1.0
32 changes: 32 additions & 0 deletions charts/updater/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/*
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).
*/}}
{{- define "updater.fullname" -}}
drand-oracle-updater
{{- end -}}

{{/*
Common labels
*/}}
{{- define "updater.labels" -}}
app.kubernetes.io/name: {{ include "updater.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/managed-by: Helm
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "updater.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "updater.selectorLabels" -}}
app.kubernetes.io/name: {{ include "updater.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
13 changes: 13 additions & 0 deletions charts/updater/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{include "updater.fullname" .}}
labels: {{- include "updater.labels" . | nindent 4}}
data:
DRAND_URLS: "{{ .Values.config.drandUrls }}"
CHAIN_HASH: "{{ .Values.config.chainHash }}"
DRAND_ORACLE_ADDRESS: "{{ .Values.config.drandOracleAddress }}"
RPC: "{{ .Values.config.rpc }}"
CHAIN_ID: "{{ .Values.config.chainId }}"
SET_RANDOMNESS_GAS_LIMIT: "{{ .Values.config.setRandomnessGasLimit }}"
GENESIS_ROUND: "{{ .Values.config.genesisRound }}"
27 changes: 27 additions & 0 deletions charts/updater/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "updater.fullname" . }}
labels:
{{- include "updater.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "updater.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "updater.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "updater.fullname" . }}
- secretRef:
name: {{ if .Values.useExistingSecrets }}{{ .Values.existingSecretName }}{{ else }}{{ include "updater.fullname" . }}{{ end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
10 changes: 10 additions & 0 deletions charts/updater/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if not .Values.useExistingSecrets }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "updater.fullname" . }}
type: Opaque
data:
SIGNER_PRIVATE_KEY: {{ .Values.secrets.signerPrivateKey | b64enc }}
SENDER_PRIVATE_KEY: {{ .Values.secrets.senderPrivateKey | b64enc }}
{{- end }}
32 changes: 32 additions & 0 deletions charts/updater/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
replicaCount: 1

image:
repository: ghcr.io/galxe/drand-oracle/drand-oracle-updater
pullPolicy: IfNotPresent
tag: "latest"

resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi

config:
drandUrls: "https://api.drand.sh,https://drand.cloudflare.com"
chainHash: "8990e7a9aaed2ffed73dbd7092123d6f289930540d7651336225dc172e51b2ce"
drandOracleAddress: "0xF3C4a5FeEDA8eBd439f9C22DEF3f1a3Cb326540A"
rpc: "http://localhost:8545"
chainId: "31337"
genesisRound: "4496672"
setRandomnessGasLimit: "500000"

useExistingSecrets: false
existingSecretName: ""

# Only used if useExistingSecrets is false
secrets:
# Below example keys are from Anvil. Do not use them in production.
signerPrivateKey: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
senderPrivateKey: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"

0 comments on commit 762ca2c

Please sign in to comment.