Skip to content

Commit

Permalink
Helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
sunu committed Sep 7, 2024
1 parent 7f3b3dd commit 4a1250a
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 0 deletions.
5 changes: 5 additions & 0 deletions helm/jupyter-home-nfs/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: jupyter-home-nfs
description: A Helm chart for an in-cluster NFS server with storage quota enforcement
version: 0.0.1
appVersion: "0.0.1"
11 changes: 11 additions & 0 deletions helm/jupyter-home-nfs/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
NFS Server has been deployed.
{{- if .Values.eks.enabled }}
Using EKS with volume ID: {{ .Values.eks.volumeId }}
{{- else if .Values.gke.enabled }}
Using GKE with volume ID: {{ .Values.gke.volumeId }}
{{- else }}
Using dynamic provisioning.
{{- end }}

Your NFS server is now available inside the cluster at the following address:
{{ .Release.Name }}-service.{{ .Release.Namespace }}.svc.cluster.local
41 changes: 41 additions & 0 deletions helm/jupyter-home-nfs/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nfs-server
template:
metadata:
labels:
app: nfs-server
spec:
containers:
- name: nfs-server
image: "{{ .Values.image.nfsServer.repository }}:{{ .Values.image.nfsServer.tag }}"
ports:
- name: nfs
containerPort: 2049
- name: mountd
containerPort: 20048
- name: rpcbind
containerPort: 111
securityContext:
privileged: true
volumeMounts:
- name: home-directories
mountPath: /export
- name: enforce-xfs-quota
image: "{{ .Values.image.quotaEnforcer.repository }}:{{ .Values.image.quotaEnforcer.tag }}"
command: ["/usr/local/bin/generate.py", "/export", "--hard-quota", "{{ .Values.quotaEnforcer.hardQuota }}"]
securityContext:
privileged: true
volumeMounts:
- name: home-directories
mountPath: /export
volumes:
- name: home-directories
persistentVolumeClaim:
claimName: {{ .Release.Name }}-home-directories-claim
15 changes: 15 additions & 0 deletions helm/jupyter-home-nfs/templates/persistent-volume-claim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Release.Name }}-home-directories-claim
spec:
accessModes:
{{- toYaml .Values.persistentVolume.accessModes | nindent 4 }}
volumeMode: Filesystem
resources:
requests:
storage: {{ .Values.persistentVolume.size }}
storageClassName: ""
{{- if or .Values.eks.enabled .Values.gke.enabled }}
volumeName: {{ .Release.Name }}-home-directories-volume
{{- end }}
34 changes: 34 additions & 0 deletions helm/jupyter-home-nfs/templates/persistent-volume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- if or .Values.eks.enabled .Values.gke.enabled -}}
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .Release.Name }}-home-directories-volume
spec:
capacity:
storage: {{ .Values.persistentVolume.size }}
volumeMode: Filesystem
accessModes:
{{- toYaml .Values.persistentVolume.accessModes | nindent 4 }}
persistentVolumeReclaimPolicy: Retain
storageClassName: ""
{{- if .Values.eks.enabled }}
csi:
driver: ebs.csi.aws.com
fsType: xfs
volumeHandle: {{ .Values.eks.volumeId }}
{{- else if .Values.gke.enabled }}
csi:
driver: pd.csi.storage.gke.io
fsType: xfs
volumeHandle: {{ .Values.gke.volumeId }}
{{- end }}
mountOptions:
- rw
- relatime
- nouuid
- attr2
- inode64
- logbufs=8
- logbsize=32k
- pquota
{{- end }}
15 changes: 15 additions & 0 deletions helm/jupyter-home-nfs/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-service
spec:
type: {{ .Values.service.type }}
ports:
- name: nfs
port: 2049
- name: mountd
port: 20048
- name: rpcbind
port: 111
selector:
app: nfs-server
30 changes: 30 additions & 0 deletions helm/jupyter-home-nfs/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
image:
nfsServer:
repository: ghcr.io/sunu/nfs-ganesha
tag: 402484a8540558e822b5eb092802fa65a09383cb
quotaEnforcer:
repository: ghcr.io/sunu/nfs-get-quota-your-home
tag: f9cf31cf51a1794b4c359dfa9aa7a6fe8a8f4c71

persistentVolume:
size: 10Gi
storageClass: ""
accessModes:
- ReadWriteOnce
annotations: {}

service:
type: ClusterIP

quotaEnforcer:
# quota in GB
hardQuota: "0.001"

# Cloud provider specific configurations
eks:
enabled: false
volumeId: "your-eks-volume-id"

gke:
enabled: false
volumeId: "your-gke-volume-id"

0 comments on commit 4a1250a

Please sign in to comment.