Skip to content

Commit

Permalink
chore: add helm example
Browse files Browse the repository at this point in the history
  • Loading branch information
mariocao committed Oct 28, 2024
1 parent 3d0cfdb commit 896eb98
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 0 deletions.
23 changes: 23 additions & 0 deletions helm/.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/
5 changes: 5 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: seda-data-proxy
description: A Helm chart for Kubernetes to deploy the SEDA Data Proxy.
version: 0.1.0
appVersion: "1.0"
31 changes: 31 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{/*
Generate a full name for the resources, optionally including the release name.
*/}}
{{- define "seda-data-proxy.fullname" -}}
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{/*
Common labels
*/}}
{{- define "seda-data-proxy.labels" -}}
app.kubernetes.io/name: {{ include "seda-data-proxy.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

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

{{/*
Template for the name of the application
*/}}
{{- define "seda-data-proxy.name" -}}
{{- .Chart.Name -}}
{{- end }}
15 changes: 15 additions & 0 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "seda-data-proxy.fullname" . }}-config
data:
config.json: |
{
"routes": [
{
"path": "/*",
"upstreamUrl": "https://swapi.dev/api/",
"methods": ["GET"]
}
]
}
49 changes: 49 additions & 0 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "seda-data-proxy.fullname" . }}
labels:
{{- include "seda-data-proxy.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "seda-data-proxy.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "seda-data-proxy.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.port }}
env:
{{- range .Values.envVars }}
- name: {{ .name }}
value: {{ .value }}
{{- end }}
- name: SEDA_DATA_PROXY_PRIVATE_KEY
valueFrom:
secretKeyRef:
name: {{ include "seda-data-proxy.fullname" . }}-secrets
key: SEDA_DATA_PROXY_PRIVATE_KEY
args: ["run", {{ .Values.sedaProxyFlags }} ]
readinessProbe:
httpGet:
path: /status/health
port: {{ .Values.service.port }}
livenessProbe:
httpGet:
path: /status/health
port: {{ .Values.service.port }}
volumeMounts:
- name: config-volume
mountPath: /app/config.json
subPath: config.json
volumes:
- name: config-volume
configMap:
name: {{ include "seda-data-proxy.fullname" . }}-config
Empty file added helm/templates/ingress.yaml
Empty file.
9 changes: 9 additions & 0 deletions helm/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "seda-data-proxy.fullname" . }}-secrets
labels:
{{- include "seda-data-proxy.labels" . | nindent 4 }}
type: Opaque
data:
SEDA_DATA_PROXY_PRIVATE_KEY: {{ .Values.secret.sedaDataProxyPrivateKey | b64enc | quote }}
13 changes: 13 additions & 0 deletions helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "seda-data-proxy.fullname" . }}
labels:
{{- include "seda-data-proxy.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.port }}
selector:
{{- include "seda-data-proxy.selectorLabels" . | nindent 4 }}
18 changes: 18 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
image:
repository: ghcr.io/sedaprotocol/seda-data-proxy
tag: "v0.0.2"
pullPolicy: IfNotPresent

service:
type: ClusterIP
port: 5384

replicaCount: 1

# export SEDA_PRIVATE_KEY=<KEY>
# helm install my-release ./chart-name --set secret.sedaDataProxyPrivateKey=$SEDA_PRIVATE_KEY
secret:
sedaDataProxyPrivateKey: ""

# Uncomment for testing (itdisables request verification)
# sedaProxyFlags: "--disable-proof"

0 comments on commit 896eb98

Please sign in to comment.