Skip to content

Commit

Permalink
Add basic helm chart (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcgary authored Nov 14, 2024
2 parents 25ab03a + 73cbc92 commit f7e3eaf
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ RUN make deps

RUN make build

RUN mv /build/bin/sidecar /usr/local/bin/sidecar
FROM debian:testing-slim

RUN apt clean && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /build/bin/sidecar /build/bin/sidecar

ENTRYPOINT ["/usr/local/bin/sidecar"]
23 changes: 23 additions & 0 deletions charts/sidecar/.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/
9 changes: 9 additions & 0 deletions charts/sidecar/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
name: sidecar
description: A Helm chart for the EigenLayer sidecar

type: application

version: 0.1.0-beta.1

appVersion: "v1.0.0-beta.1"
45 changes: 45 additions & 0 deletions charts/sidecar/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

{{/*
Expand the name of the chart.
*/}}
{{- define "sidecar.name" -}}
{{- default .Chart.Name .Values.sidecar.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}


{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "sidecar.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}


{{/*
Common labels
*/}}
{{- define "sidecar.labels" -}}
helm.sh/chart: {{ include "sidecar.chart" . }}
{{ include "sidecar.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- with .Values.sidecar.additionalLabels }}
{{- toYaml . | nindent 0 }}
{{- end }}


{{- define "sidecar.selectorLabels" -}}
app.kubernetes.io/name: {{ include "sidecar.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}


{{- define "sidecar.metadataLabels" -}}
{{ include "sidecar.selectorLabels" . }}
{{- with .Values.sidecar.metadataLabels }}
{{- toYaml . | nindent 0 }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/sidecar/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.sidecar.secret.name }}
namespace: {{ .Release.Namespace }}
type: Opaque
data:
{{- range $key, $value := .Values.sidecar.secret.data }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/sidecar/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.sidecar.service.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "sidecar.name" . }}
labels:
{{- include "sidecar.labels" . | nindent 4 }}
spec:
ports:
{{- range $key, $port := .Values.sidecar.ports }}
-
{{ $port | toYaml | indent 4 }}
{{- end }}
clusterIP: None
selector:
{{- include "sidecar.selectorLabels" . | nindent 6 }}
{{- end }}
51 changes: 51 additions & 0 deletions charts/sidecar/templates/sidecarStatefulSet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "sidecar.name" . }}
labels:
{{- include "sidecar.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.sidecar.replicas }}
selector:
matchLabels:
{{- include "sidecar.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "sidecar.metadataLabels" . | nindent 8 }}
spec:
{{- if .Values.sidecar.serviceAccount }}
serviceAccountName: {{ .Values.sidecar.serviceAccount.name }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: {{ .Values.sidecar.args | toJson}}
{{- if .Values.sidecar.ports }}
ports:
{{- range $k, $v := .Values.sidecar.ports }}
- name: {{ $v.name }}
containerPort: {{ $v.containerPort }}
protocol: {{ $v.protocol }}
{{- end -}}
{{- end }}
{{- if .Values.sidecar.resources }}
resources:
{{- toYaml .Values.sidecar.resources | nindent 12 }}
{{- end }}
env:
{{- range $k, $v := .Values.sidecar.env }}
- name: {{ $k }}
value: '{{ $v }}'
{{- end }}
{{- if .Values.sidecar.secret.data }}
{{- range $k, $v := .Values.sidecar.secret.data }}
- name: {{ $k }}
valueFrom:
secretKeyRef:
name: {{ .Values.sidecar.secret.name }}
key: {{ $k }}
{{- end}}
{{ .Values.sidecar.additionalEnv | nindent 12 }}
{{- end}}
42 changes: 42 additions & 0 deletions charts/sidecar/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
image:
repository: public.ecr.aws/z6g0f8n7/sidecar
pullPolicy: Always
tag: "v1.0.0-beta.1"

sidecar:
replicas: 1
nameOverride: ''
additionalLabels: {}
args: ["run"]
env:
SIDECAR_CHAIN: "mainnet"
SIDECAR_DEBUG: "false"
SIDECAR_ETHEREUM_RPC_URL: ""
SIDECAR_DATABASE_HOST: ""
SIDECAR_DATABASE_PORT: "5432"
SIDECAR_DATABASE_USER: "sidecar"
SIDECAR_DATABASE_DB_NAME: "sidecar"
# SIDECAR_STATSD_URL: ""
additionalEnv: {}
# - name: ENV_NAME
# value: "env value"
ports:
- name: grpc
port: 7100
containerPort: 7100
protocol: TCP
- name: http
port: 7101
containerPort: 7101
protocol: TCP
resources: {}
metadataLabels: {}
serviceAccount:
name: default
secret:
name: sidecar-secrets
data: {}
# SIDECAR_DATABASE_PASSWORD: ""
service:
enabled: true

0 comments on commit f7e3eaf

Please sign in to comment.