Skip to content

Commit

Permalink
Finish a first full version of Slinky helm chart
Browse files Browse the repository at this point in the history
Ref #52
  • Loading branch information
amoeba committed Aug 2, 2022
1 parent d2f43b1 commit 86fc579
Show file tree
Hide file tree
Showing 17 changed files with 142 additions and 69 deletions.
2 changes: 0 additions & 2 deletions helm/.helmignore

This file was deleted.

2 changes: 0 additions & 2 deletions helm/CHANGELOG

This file was deleted.

37 changes: 37 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Slinky Helm Chart

## Installation

### Pre-requisites

- A Kubernetes cluster
- Helm

### Quick-Start

```sh
helm install slinky .
```

### Ingress

The Slinky chart supports setting up an Ingress, provided your cluster is set up to create and set up Ingress resources.

To install the chart with Ingress, you must provide the following values in your `helm install` command:

- `ingress.enabled`
- `ingress.host`
- `ingress.tls.secretName`
- `ingress.clusterIssuer`

As an example,

```sh
helm install \
--set ingress.enabled=true \
--set ingress.host=api.example.org \
--set ingress.tls.secretName=my-tls-secret-name \
--set ingress.clusterIssuer=my-cluster-issuer \
slinky .
```

4 changes: 0 additions & 4 deletions helm/TODO

This file was deleted.

22 changes: 21 additions & 1 deletion helm/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
Hi, this is a TODO!
-------------------------------------------------------------------------------
_ _ _
___| (_)_ __ | | ___ _
/ __| | | '_ \| |/ / | | |
\__ \ | | | | | <| |_| |
|___/_|_|_| |_|_|\_\\__, |
|___/
-------------------------------------------------------------------------------
version: {{ .Chart.AppVersion }}

** Please be patient while the chart is being deployed and services are available **
You can check their status with kubectl get pods
{{- if .Values.ingress.enabled }}

Ingress enabled at https://{{ .Values.ingress.host }}/slinky

{{- else}}

Ingress not enabled. Use `kubectl port-forward` to inspect services.

{{- end}}
16 changes: 8 additions & 8 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "slinky-helm-chart.name" -}}
{{- define "slinky.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ 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" -}}
{{- define "slinky.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "slinky-helm-chart.chart" -}}
{{- define "slinky.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" . }}
{{- define "slinky.labels" -}}
helm.sh/chart: {{ include "slinky.chart" . }}
{{ include "slinky.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,8 +45,8 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "slinky-helm-chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "slinky-helm-chart.name" . }}
{{- define "slinky.selectorLabels" -}}
app.kubernetes.io/name: {{ include "slinky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

1 change: 1 addition & 0 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
labels: {{- include "slinky.labels" . | nindent 4 }}
data:
REDIS_URL: {{ .Values.urls.redis }}
VIRTUOSO_URL: {{ .Values.urls.virtuoso }}
Expand Down
39 changes: 39 additions & 0 deletions helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{- if .Values.ingress.enabled }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: slinky
labels: {{- include "slinky.labels" . | nindent 4 }}
annotations:
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/cors-allow-methods: "GET, POST, OPTIONS"
nginx.ingress.kubernetes.io/cors-allow-origin: '$http_origin'
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
cert-manager.io/cluster-issuer: {{ .Values.ingress.clusterIssuer}}
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.enabled }}
ingressClassName: {{ .Values.ingress.className }}
tls:
- hosts:
- {{ .Values.ingress.host }}
secretName: {{ .Values.ingress.tls.secretName }}
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /slinky(/|$)(.*)
pathType: Prefix
backend:
service:
name: web
port:
number: {{ .Values.port.web }}
{{- end}}
{{- end}}
3 changes: 2 additions & 1 deletion helm/templates/redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: redis-config
labels: {{- include "slinky.labels" . | nindent 4 }}
data:
redis-config: |
maxmemory 2mb
Expand Down Expand Up @@ -29,7 +30,7 @@ spec:
spec:
containers:
- name: master
image: {{ .Values.image.redis }}
image: "{{ .Values.image.redis.name }}:{{ .Values.image.redis.tag }}"
command: ["redis-server", "/redis-master/redis.conf"]
args: ["--protected-mode", "no"]
env:
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/rqdashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: rqdashboard
labels:
labels: {{- include "slinky.labels" . | nindent 4 }}
app: rqdashboard
spec:
replicas: 1
Expand Down
6 changes: 4 additions & 2 deletions helm/templates/rqscheduler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: rqscheduler
labels:
labels: {{- include "slinky.labels" . | nindent 4 }}
app: rqscheduler
spec:
selector:
Expand All @@ -15,10 +15,12 @@ spec:
spec:
containers:
- name: rqscheduler
image: slinkythegraph/slinky:0.3.0
image: "{{ .Values.image.slinky.name }}:{{ default .Chart.AppVersion .Values.image.slinky.tag }}"
imagePullPolicy: IfNotPresent
command: ["/bin/sh","-c"]
args: ["rqscheduler --url $REDIS_URL -i 10"]
envFrom:
- configMapRef:
name: {{ .Release.Name }}-configmap
restartPolicy: OnFailure

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ apiVersion: batch/v1
kind: Job
metadata:
name: schedule
labels: {{- include "slinky.labels" . | nindent 4 }}
spec:
template:
spec:
containers:
- name: schedule
image: slinkythegraph/slinky:0.3.0
image: "{{ .Values.image.slinky.name }}:{{ default .Chart.AppVersion .Values.image.slinky.tag }}"
command: ["slinky"]
args: ["schedule"]
envFrom:
Expand Down
23 changes: 6 additions & 17 deletions helm/templates/virtuoso.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: virtuoso
labels:
labels: {{- include "slinky.labels" . | nindent 4 }}
app: virtuoso
spec:
selector:
Expand All @@ -22,34 +22,23 @@ spec:
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
{{- if hasKey $.Values "pvc" }}
persistentVolumeClaim:
claimName: {{ .Values.pvc }}
{{- end}}
---
apiVersion: v1
kind: Service
metadata:
name: virtuoso
spec:
type: ClusterIP
type: {{ .Values.service.type }}
ports:
- name: virtuoso
port: {{ .Values.port.virtuoso }}
targetPort: {{ .Values.port.virtuoso }}
selector:
app: virtuoso
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
10 changes: 2 additions & 8 deletions helm/templates/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: web
labels:
labels: {{- include "slinky.labels" . | nindent 4 }}
app: web
spec:
selector:
Expand All @@ -29,14 +29,8 @@ kind: Service
metadata:
name: web
spec:
type: ClusterIP
type: {{ .Values.service.type }}
ports:
- name: web
port: {{ .Values.port.web }}
targetPort: {{ .Values.port.web }}
selector:
app: web
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
4 changes: 2 additions & 2 deletions helm/templates/worker_dataset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: worker-dataset
labels:
labels: {{- include "slinky.labels" . | nindent 4 }}
app: worker-dataset
spec:
selector:
Expand All @@ -16,7 +16,7 @@ spec:
spec:
containers:
- name: worker-default
image: slinkythegraph/slinky:0.3.0
image: "{{ .Values.image.slinky.name }}:{{ default .Chart.AppVersion .Values.image.slinky.tag }}"
imagePullPolicy: IfNotPresent
command: ["slinky"]
args: ["work", "dataset"]
Expand Down
6 changes: 3 additions & 3 deletions helm/templates/worker_default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: worker-default
labels:
app: worker
labels: {{- include "slinky.labels" . | nindent 4 }}
app: worker-default
spec:
selector:
matchLabels:
Expand All @@ -16,7 +16,7 @@ spec:
spec:
containers:
- name: worker-default
image: slinkythegraph/slinky:0.3.0
image: "{{ .Values.image.slinky.name }}:{{ default .Chart.AppVersion .Values.image.slinky.tag }}"
imagePullPolicy: IfNotPresent
command: ["slinky"]
args: ["work", "default"]
Expand Down
31 changes: 14 additions & 17 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
namespace: slinky

# TODO Labels
# service: slinky
# separate db from workers from monitoring?
image:
slinky:
name: slinkythegraph/slinky
redis:
name: bitnami/redis
tag: "7.0.4"

service:
type: ClusterIP

urls:
redis: "redis://redis:6379"
Expand All @@ -12,23 +18,14 @@ urls:
port:
redis: 6379
virtuoso: 8890
rqdashboard: 9181
web: 8080

image:
redis: "bitnami/redis:7.0.4"

# Placeholder values for ingress
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
host: ""
tls:
secretName: ""

0 comments on commit 86fc579

Please sign in to comment.