Skip to content

Commit

Permalink
Create first working but rough version of Helm chart
Browse files Browse the repository at this point in the history
This helm chart should install and work at this point only if you've built the slinky and web images locally and tagged them with label "0.3.0"

Plenty more work to be done to make this chart great

#52
  • Loading branch information
amoeba committed Aug 2, 2022
1 parent 7cfe25c commit d2f43b1
Show file tree
Hide file tree
Showing 16 changed files with 421 additions and 0 deletions.
2 changes: 2 additions & 0 deletions helm/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TODO
CHANGELOG
2 changes: 2 additions & 0 deletions helm/CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed volumes from worker pods since they aren't needed
Added version tags to all images (e.g., foo:0.3.0)
24 changes: 24 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: slinky
description: A Helm chart for Slinky

# 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: "0.3.0"
4 changes: 4 additions & 0 deletions helm/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Put Virtuoso password in a secret
- Remove TODO and CHANGELOG
- Do a pass over metadata (labels)
- Move image tags into values.yaml
1 change: 1 addition & 0 deletions helm/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hi, this is a TODO!
52 changes: 52 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "slinky-helm-chart.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 "slinky-helm-chart.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 "slinky-helm-chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Selector labels
*/}}
{{- define "slinky-helm-chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "slinky-helm-chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

8 changes: 8 additions & 0 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
data:
REDIS_URL: {{ .Values.urls.redis }}
VIRTUOSO_URL: {{ .Values.urls.virtuoso }}
RQ_DASHBOARD_REDIS_URL: {{ .Values.urls.rqdashboard }}
85 changes: 85 additions & 0 deletions helm/templates/redis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: redis-config
data:
redis-config: |
maxmemory 2mb
maxmemory-policy allkeys-lru
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
labels:
app: redis
spec:
selector:
matchLabels:
app: redis
role: master
tier: backend
replicas: 1
template:
metadata:
labels:
app: redis
role: master
tier: backend
spec:
containers:
- name: master
image: {{ .Values.image.redis }}
command: ["redis-server", "/redis-master/redis.conf"]
args: ["--protected-mode", "no"]
env:
- name: ALLOW_EMPTY_PASSWORD
value: "yes"
resources:
requests:
cpu: 100m
memory: 100Mi
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0
ports:
- containerPort: {{ .Values.port.redis }}
readinessProbe:
exec:
command:
- redis-cli
- ping
initialDelaySeconds: 5
timeoutSeconds: 5
volumeMounts:
- mountPath: /data
name: redis-volume
- mountPath: /redis-master
name: config
volumes:
- name: redis-volume
# persistentVolumeClaim:
# claimName: cephfs-slinky-pvc
- name: config
configMap:
name: redis-config
items:
- key: redis-config
path: redis.conf
---
apiVersion: v1
kind: Service
metadata:
name: redis
labels:
app: redis
role: master
tier: backend
spec:
ports:
- port: {{ .Values.port.redis }}
targetPort: {{ .Values.port.redis }}
selector:
app: redis
role: master
tier: backend
22 changes: 22 additions & 0 deletions helm/templates/rqdashboard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: rqdashboard
labels:
app: rqdashboard
spec:
replicas: 1
selector:
matchLabels:
app: rqdashboard
template:
metadata:
labels:
app: rqdashboard
spec:
containers:
- name: rqdashboard
image: eoranged/rq-dashboard
envFrom:
- configMapRef:
name: {{ .Release.Name }}-configmap
24 changes: 24 additions & 0 deletions helm/templates/rqscheduler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: rqscheduler
labels:
app: rqscheduler
spec:
selector:
matchLabels:
app: rqscheduler
template:
metadata:
labels:
app: rqscheduler
spec:
containers:
- name: rqscheduler
image: slinkythegraph/slinky:0.3.0
imagePullPolicy: IfNotPresent
command: ["/bin/sh","-c"]
args: ["rqscheduler --url $REDIS_URL -i 10"]
envFrom:
- configMapRef:
name: {{ .Release.Name }}-configmap
16 changes: 16 additions & 0 deletions helm/templates/schedule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: batch/v1
kind: Job
metadata:
name: schedule
spec:
template:
spec:
containers:
- name: schedule
image: slinkythegraph/slinky:0.3.0
command: ["slinky"]
args: ["schedule"]
envFrom:
- configMapRef:
name: {{ .Release.Name }}-configmap
restartPolicy: OnFailure
55 changes: 55 additions & 0 deletions helm/templates/virtuoso.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: virtuoso
labels:
app: virtuoso
spec:
selector:
matchLabels:
app: virtuoso
template:
metadata:
labels:
app: virtuoso
spec:
containers:
- name: virtuoso
image: slinkythegraph/virtuoso
env:
- name: DBA_PASSWORD
value: "dba"
ports:
- containerPort: {{ .Values.port.virtuoso }}
# readinessProbe:
# httpGet:
# scheme: HTTP
# path: /
# port: {{ .Values.port.virtuoso }}
# initialDelaySeconds: 10
# periodSeconds: 5
volumeMounts:
- mountPath: /data
name: virtuoso-volume
volumes:
- name: virtuoso-volume
# persistentVolumeClaim:
# claimName: cephfs-slinky-pvc
---
apiVersion: v1
kind: Service
metadata:
name: virtuoso
spec:
type: ClusterIP
ports:
- name: virtuoso
port: {{ .Values.port.virtuoso }}
targetPort: {{ .Values.port.virtuoso }}
selector:
app: virtuoso
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
42 changes: 42 additions & 0 deletions helm/templates/web.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
labels:
app: web
spec:
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: slinkythegraph/web:0.3.0
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: {{ .Release.Name }}-configmap
ports:
- containerPort: {{ .Values.port.web }}
---
apiVersion: v1
kind: Service
metadata:
name: web
spec:
type: ClusterIP
ports:
- name: web
port: {{ .Values.port.web }}
targetPort: {{ .Values.port.web }}
selector:
app: web
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
25 changes: 25 additions & 0 deletions helm/templates/worker_dataset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: worker-dataset
labels:
app: worker-dataset
spec:
selector:
matchLabels:
app: worker-dataset
template:
metadata:
labels:
app: worker-dataset
spec:
containers:
- name: worker-default
image: slinkythegraph/slinky:0.3.0
imagePullPolicy: IfNotPresent
command: ["slinky"]
args: ["work", "dataset"]
envFrom:
- configMapRef:
name: {{ .Release.Name }}-configmap
Loading

0 comments on commit d2f43b1

Please sign in to comment.