Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Enable 'revad' StatefulSet for stateful workloads (e.g. Storage Provider backends, etc) #19

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions revad/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
.idea/
*.tmproj
.vscode/
# chart-testing-action configurations
ci/
2 changes: 1 addition & 1 deletion revad/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: revad
description: The Reva daemon (revad) helm chart
type: application
version: 1.3.1
version: 1.4.0
appVersion: v1.7.0
kubeVersion: ">= 1.14.0"
icon: https://reva.link/logo.svg
Expand Down
6 changes: 6 additions & 0 deletions revad/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The following configurations may be set. It is recommended to use `values.yaml`
| `extraVolumeMounts` | Array of additional volume mounts. | `[]` |
| `extraVolumes` | Array of additional volumes. | `[]` |
| `emptyDir.sizeLimit` | `emptyDir` `sizeLimit` if a Persistent Volume is not used | `""` |
| `useStatefulSet` | If true, Revad will be deployed using a `StatefulSet` rather than the usual `Deployment`. | `false` |
| `persistentVolume.enabled` | If true, Revad will create a Persistent Volume Claim. | `false` |
| `persistentVolume.accessModes` | Revad data Persistent Volume access modes. | `[ReadWriteOnce]` |
| `persistentVolume.annotations` | Revad data Persistent Volume annotations. | `{}` |
Expand Down Expand Up @@ -71,3 +72,8 @@ The following configurations may be set. It is recommended to use `values.yaml`
$ helm install custom-reva cs3org/revad \
--set-file configFiles.revad\\.toml=custom-config.toml
```

### Stateful deployment

```console
```
2 changes: 2 additions & 0 deletions revad/ci/statefulset-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
useStatefulSet: true
replicaCount: 3
Empty file added revad/ci/values.yaml
Empty file.
53 changes: 44 additions & 9 deletions revad/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
apiVersion: apps/v1
kind: Deployment
kind: {{ if .Values.useStatefulSet }}{{ "StatefulSet" }}{{- else }}{{ "Deployment" }}{{- end }}
metadata:
name: {{ include "revad.fullname" . }}
labels:
{{- include "revad.labels" . | nindent 4 }}
spec:
{{- if .Values.useStatefulSet }}
serviceName: {{ include "revad.fullname" . }}
{{- end }}
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
Expand All @@ -31,7 +34,11 @@ spec:
- /go/bin/revad
args:
- "-c"
{{- if .Values.useStatefulSet }}
- "/etc/revad/$(HOSTNAME).toml"
{{- else }}
- "/etc/revad/revad.toml"
{{- end }}
- "-p"
- "/var/run/revad.pid"
volumeMounts:
Expand All @@ -43,8 +50,14 @@ spec:
{{- if .Values.extraVolumeMounts }}
{{ toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if or .Values.env .Values.extraEnv }}
{{- if or .Values.useStatefulSet (or .Values.env .Values.extraEnv) }}
env:
{{- if .Values.useStatefulSet }}
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: metadata.name
{{- end }}
{{- range $name, $value := .Values.env }}
- name: "{{ $name }}"
value: "{{ $value }}"
Expand All @@ -55,24 +68,46 @@ spec:
{{- end }}
{{- if .Values.envFrom }}
envFrom:
{{ toYaml .Values.envFrom | indent 12 }}
{{- toYaml .Values.envFrom | nindent 12 }}
{{- end }}
volumes:
- name: {{ include "revad.fullname" . }}-configfiles
configMap:
name: {{ template "revad.fullname" . }}-config
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- if .Values.persistentVolume.enabled }}
{{- if .Values.useStatefulSet }}
volumeClaimTemplates:
- metadata:
name: {{ include "revad.fullname" . }}-datadir
{{- if .Values.persistentVolume.annotations }}
annotations:
{{- toYaml .Values.persistentVolume.annotations | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- toYaml .Values.persistentVolume.accessModes | nindent 10 }}
resources:
requests:
storage: "{{ .Values.persistentVolume.size }}"
{{- if (eq "-" .Values.persistentVolume.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistentVolume.storageClass }}"
{{- end }}
{{- else }}
- name: {{ include "revad.fullname" . }}-datadir
{{- if .Values.persistentVolume.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistentVolume.existingClaim }}{{ .Values.persistentVolume.existingClaim }}{{- else }}{{ template "revad.fullname" . }}{{- end }}
{{- else }}
{{- end }}
{{- else }}
- name: {{ include "revad.fullname" . }}-datadir
emptyDir:
{{- if .Values.emptyDir.sizeLimit }}
sizeLimit: {{ .Values.emptyDir.sizeLimit }}
{{- else }}
{}
{{- end -}}
{{- end -}}
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- end }}
4 changes: 4 additions & 0 deletions revad/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ metadata:
labels:
{{- include "revad.labels" . | nindent 4 }}
spec:
{{- if .Values.useStatefulSet }}
clusterIP: None
{{- else }}
type: {{ .Values.service.type }}
{{- end }}
ports:
{{- if .Values.service.http }}
- port: {{ .Values.service.http.port }}
Expand Down
2 changes: 2 additions & 0 deletions revad/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ extraVolumes: []
emptyDir:
sizeLimit: ""

useStatefulSet: false

persistentVolume:
## If true, revad will create/use a Persistent Volume Claim
## If false, use emptyDir
Expand Down