Skip to content

Commit

Permalink
add substreams-sink-clickhouse
Browse files Browse the repository at this point in the history
  • Loading branch information
coutug committed Mar 18, 2024
1 parent 9f78219 commit 90fe8e4
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 0 deletions.
25 changes: 25 additions & 0 deletions charts/substreams-sink-clickhouse/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v2
name: substreams-sink-clickhouse
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v0.3.10"

62 changes: 62 additions & 0 deletions charts/substreams-sink-clickhouse/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "substreams-sink-clickhouse.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
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 "substreams-sink-clickhouse.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

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

{{/*
Common labels
*/}}
{{- define "substreams-sink-clickhouse.labels" -}}
helm.sh/chart: {{ include "substreams-sink-clickhouse.chart" . }}
{{ include "substreams-sink-clickhouse.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "substreams-sink-clickhouse.selectorLabels" -}}
app.kubernetes.io/name: {{ include "substreams-sink-clickhouse.name" . }}
app.kubernetes.io/instance: {{ include "substreams-sink-clickhouse.fullname" . }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "substreams-sink-clickhouse.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "substreams-sink-clickhouse.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
32 changes: 32 additions & 0 deletions charts/substreams-sink-clickhouse/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "substreams-sink-clickhouse.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Release.Name }}
spec:
selector:
matchLabels:
app: {{ .Release.Name }}
replicas: 1
template:
metadata:
labels:
app: {{ .Release.Name }}
spec:
containers:
- name: {{ .Release.Name }}
image: {{ .Values.image -}} : {{- .Values.tag }}
ports:
- containerPort: {{ .Values.env.port }}
envFrom:
- configMapRef:
name: env
livenessProbe:
httpGet:
path: /health
port: {{ .Values.env.port }}
initialDelaySeconds: 20
timeoutSeconds: 2
periodSeconds: 5
9 changes: 9 additions & 0 deletions charts/substreams-sink-clickhouse/templates/env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: env
namespace: {{ .Release.Namespace }}
data:
{{- range $key, $val := .Values.env }}
{{ $key | upper }}: {{ $val | quote }}
{{- end }}
13 changes: 13 additions & 0 deletions charts/substreams-sink-clickhouse/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
type: {{ .Values.service.type }}
selector:
app: {{ .Release.Name }}
ports:
- protocol: TCP
port: {{ .Values.env.port }}
targetPort: {{ .Values.env.port }}
21 changes: 21 additions & 0 deletions charts/substreams-sink-clickhouse/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
nameOverride: ""
fullnameOverride: ""

replicaCount: 1
image: ghcr.io/pinax-network/substreams-sink-clickhouse
tag: v0.3.10

env:
# PUBLIC_KEY: ""
hostname: 0.0.0.0
port: 3000
host: http://clickhouse:8123
database: antelope
username: default
password: ""
table: ""
max_limit: 500
verbose: true

service:
type: ClusterIP

0 comments on commit 90fe8e4

Please sign in to comment.