Skip to content

Commit

Permalink
Merge pull request #182 from zwwhdls/add_juicefs_chart
Browse files Browse the repository at this point in the history
add juicefs chart
  • Loading branch information
zheng1 authored Nov 11, 2021
2 parents 48509db + 8be3fae commit 35e805c
Show file tree
Hide file tree
Showing 11 changed files with 945 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/stable/juicefs/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
17 changes: 17 additions & 0 deletions src/stable/juicefs/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v2
name: juicefs
description: A Helm chart for JuiceFS CSI Driver
type: application
version: 0.6.1
appVersion: 0.10.6
kubeVersion: ">=1.14.0-0"
home: https://github.com/juicedata/juicefs
sources:
- https://github.com/juicedata/juicefs
icon: https://s.juicefs.com/static/jfs/logo.svg
maintainers:
- email: [email protected]
name: Juicedata Inc
keywords:
- juicefs
- csi
80 changes: 80 additions & 0 deletions src/stable/juicefs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# juicefs-csi-driver

![Version: 0.6.1](https://img.shields.io/badge/Version-0.6.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.10.6](https://img.shields.io/badge/AppVersion-0.10.6-informational?style=flat-square)

A Helm chart for JuiceFS CSI Driver

**Homepage:** <https://github.com/juicedata/juicefs-csi-driver>

## Source Code

* <https://github.com/juicedata/juicefs-csi-driver>

## Requirements

Kubernetes: `>=1.14.0-0`

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| controller.affinity | object | Hard node and soft zone anti-affinity | Affinity for controller pods. |
| controller.enabled | bool | `true` | |
| controller.nodeSelector | object | `{}` | Node selector for controller pods |
| controller.replicas | int | `1` | |
| controller.resources.limits.cpu | string | `"1000m"` | |
| controller.resources.limits.memory | string | `"1Gi"` | |
| controller.resources.requests.cpu | string | `"100m"` | |
| controller.resources.requests.memory | string | `"512Mi"` | |
| controller.service.port | int | `9909` | |
| controller.service.trpe | string | `"ClusterIP"` | |
| controller.terminationGracePeriodSeconds | int | `30` | Grace period to allow the controller to shutdown before it is killed |
| controller.tolerations | list | `[{"key":"CriticalAddonsOnly","operator":"Exists"}]` | Tolerations for controller pods |
| dnsConfig | object | `{}` | |
| dnsPolicy | string | `"ClusterFirstWithHostNet"` | |
| hostAliases | list | `[]` | |
| image.pullPolicy | string | `""` | |
| image.repository | string | `"juicedata/juicefs-csi-driver"` | |
| image.tag | string | `"v0.10.5"` | |
| jfsConfigDir | string | `"/var/lib/juicefs/config"` | |
| jfsMountDir | string | `"/var/lib/juicefs/volume"` | juicefs mount dir |
| jfsMountPriority | object | `{"enable":true,"name":"juicefs-mount-critical"}` | juicefs mount pod priority |
| kubeletDir | string | `"/var/lib/kubelet"` | kubelet working directory,can be set using `--root-dir` when starting kubelet |
| namespace | string | `"kube-system"` | |
| node.affinity | object | Hard node and soft zone anti-affinity | Affinity for node pods. |
| node.enabled | bool | `true` | |
| node.hostNetwork | bool | `false` | |
| node.nodeSelector | object | `{}` | Node selector for node pods |
| node.resources.limits.cpu | string | `"2000m"` | |
| node.resources.limits.memory | string | `"5Gi"` | |
| node.resources.requests.cpu | string | `"1000m"` | |
| node.resources.requests.memory | string | `"1Gi"` | |
| node.terminationGracePeriodSeconds | int | `30` | Grace period to allow the node pod to shutdown before it is killed |
| node.tolerations | list | `[{"key":"CriticalAddonsOnly","operator":"Exists"}]` | Tolerations for node pods |
| serviceAccount.controller.annotations | object | `{}` | |
| serviceAccount.controller.create | bool | `true` | |
| serviceAccount.controller.name | string | `"juicefs-csi-controller-sa"` | |
| serviceAccount.node.create | bool | `true` | |
| serviceAccount.node.name | string | `"juicefs-csi-node-sa"` | |
| sidecars.csiProvisionerImage.repository | string | `"quay.io/k8scsi/csi-provisioner"` | |
| sidecars.csiProvisionerImage.tag | string | `"v1.6.0"` | |
| sidecars.livenessProbeImage.repository | string | `"quay.io/k8scsi/livenessprobe"` | |
| sidecars.livenessProbeImage.tag | string | `"v1.1.0"` | |
| sidecars.nodeDriverRegistrarImage.repository | string | `"quay.io/k8scsi/csi-node-driver-registrar"` | |
| sidecars.nodeDriverRegistrarImage.tag | string | `"v1.1.0"` | |
| storageClasses[0].backend.accessKey | string | `""` | Access key for object storage |
| storageClasses[0].backend.bucket | string | `""` | Bucket URL. Read [this document](https://github.com/juicedata/juicefs/blob/main/docs/en/how_to_setup_object_storage.md) to learn how to setup different object storage. |
| storageClasses[0].backend.metaurl | string | `""` | Connection URL for metadata engine (e.g. Redis). Read [this document](https://github.com/juicedata/juicefs/blob/main/docs/en/databases_for_metadata.md) for more information. |
| storageClasses[0].backend.name | string | `"juice"` | The JuiceFS file system name. |
| storageClasses[0].backend.secretKey | string | `""` | Secret key for object storage |
| storageClasses[0].backend.storage | string | `""` | Object storage type, such as `s3`, `gs`, `oss`. Read [this document](https://github.com/juicedata/juicefs/blob/main/docs/en/how_to_setup_object_storage.md) for the full supported list. |
| storageClasses[0].enabled | bool | `true` | Default is true will create a new StorageClass. It will create Secret and StorageClass used by CSI driver |
| storageClasses[0].mountPod.resources.limits.cpu | string | `"5000m"` | |
| storageClasses[0].mountPod.resources.limits.memory | string | `"5Gi"` | |
| storageClasses[0].mountPod.resources.requests.cpu | string | `"1000m"` | |
| storageClasses[0].mountPod.resources.requests.memory | string | `"1Gi"` | |
| storageClasses[0].name | string | `"juicefs-sc"` | |
| storageClasses[0].reclaimPolicy | string | `"Delete"` | Either Delete or Retain. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
41 changes: 41 additions & 0 deletions src/stable/juicefs/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Examples on how to configure a storage class and start using the driver are here:
https://github.com/juicedata/juicefs-csi-driver/tree/master/examples
# You can refer demos in 'juicefs-csi-driver/examples'
For quickly test, you can use this file to test:

```
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: juicefs-pvc
namespace: {{ .Release.Namespace | quote }}
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Pi
storageClassName: {{ (index .Values.storageClasses 0).name }}
---
apiVersion: v1
kind: Pod
metadata:
name: juicefs-app
namespace: {{ .Release.Namespace | quote }}
spec:
containers:
- args:
- -c
- while true; do echo $(date -u) >> /data/out.txt; sleep 5; done
command:
- /bin/sh
image: busybox
name: app
volumeMounts:
- mountPath: /data
name: juicefs-pv
volumes:
- name: juicefs-pv
persistentVolumeClaim:
claimName: juicefs-pvc
```
80 changes: 80 additions & 0 deletions src/stable/juicefs/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "juicefs-csi.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 "juicefs-csi.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 "juicefs-csi.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "juicefs-csi.controller.serviceAccountName" -}}
{{- if .Values.serviceAccount.controller.create }}
{{- default (include "juicefs-csi.fullname" .) .Values.serviceAccount.controller.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.controller.name }}
{{- end }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "juicefs-csi.node.serviceAccountName" -}}
{{- if .Values.serviceAccount.node.create }}
{{- default (include "juicefs-csi.fullname" .) .Values.serviceAccount.node.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.node.name }}
{{- end }}
{{- end }}

{{/*
secret fullname
*/}}
{{- define "juicefs-csi.secretFullname" -}}
{{ include "juicefs-csi.fullname" . }}-secret
{{- end }}
135 changes: 135 additions & 0 deletions src/stable/juicefs/templates/controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{{- if .Values.controller.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app.kubernetes.io/component: controller
{{- include "juicefs-csi.labels" . | nindent 4 }}
name: juicefs-csi-controller
namespace: {{ .Release.Namespace | quote }}
spec:
replicas: {{ .Values.controller.replicas }}
selector:
matchLabels:
app: juicefs-csi-controller
{{- include "juicefs-csi.selectorLabels" . | nindent 6 }}
serviceName: juicefs-csi-controller
template:
metadata:
labels:
app: juicefs-csi-controller
{{- include "juicefs-csi.selectorLabels" . | nindent 8 }}
spec:
{{- if .Values.hostAliases }}
hostAliases:
{{- toYaml .Values.hostAliases | nindent 6 }}
{{- end }}
containers:
- name: juicefs-plugin
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
{{- if .Values.image.pullPolicy }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- end }}
args:
- --endpoint=$(CSI_ENDPOINT)
- --logtostderr
- --nodeid=$(NODE_ID)
- --v=5
env:
- name: CSI_ENDPOINT
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: JUICEFS_MOUNT_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: JUICEFS_MOUNT_PATH
value: {{ .Values.jfsMountDir }}
- name: JUICEFS_CONFIG_PATH
value: {{ .Values.jfsConfigDir }}
livenessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: healthz
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
resources:
{{- toYaml .Values.controller.resources | nindent 10 }}
ports:
- containerPort: 9909
name: healthz
protocol: TCP
securityContext:
capabilities:
add:
- SYS_ADMIN
privileged: true
volumeMounts:
- mountPath: /var/lib/csi/sockets/pluginproxy/
name: socket-dir
- mountPath: /jfs
mountPropagation: Bidirectional
name: jfs-dir
- mountPath: /root/.juicefs
mountPropagation: Bidirectional
name: jfs-root-dir
- name: csi-provisioner
image: {{ printf "%s:%s" .Values.sidecars.csiProvisionerImage.repository .Values.sidecars.csiProvisionerImage.tag }}
args:
- --csi-address=$(ADDRESS)
- --timeout=60s
- --v=5
env:
- name: ADDRESS
value: /var/lib/csi/sockets/pluginproxy/csi.sock
volumeMounts:
- mountPath: /var/lib/csi/sockets/pluginproxy/
name: socket-dir
- name: liveness-probe
image: {{ printf "%s:%s" .Values.sidecars.livenessProbeImage.repository .Values.sidecars.livenessProbeImage.tag }}
args:
- --csi-address=$(ADDRESS)
- --health-port=$(HEALTH_PORT)
env:
- name: ADDRESS
value: /csi/csi.sock
- name: HEALTH_PORT
value: "9909"
volumeMounts:
- mountPath: /csi
name: socket-dir
priorityClassName: system-cluster-critical
serviceAccount: {{ include "juicefs-csi.controller.serviceAccountName" . }}
{{- with .Values.controller.affinity }}
affinity:
{{- tpl . $ | nindent 8 }}
{{- end }}
{{- with .Values.controller.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.controller.tolerations }}
tolerations:
{{- toYaml . | nindent 6 }}
{{- end }}
volumes:
- emptyDir: {}
name: socket-dir
- hostPath:
path: {{ .Values.jfsMountDir }}
type: DirectoryOrCreate
name: jfs-dir
- hostPath:
path: {{ .Values.jfsConfigDir }}
type: DirectoryOrCreate
name: jfs-root-dir
{{- end }}
11 changes: 11 additions & 0 deletions src/stable/juicefs/templates/csidriver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: {{ ternary "storage.k8s.io/v1" "storage.k8s.io/v1beta1" (semverCompare ">=1.18.0-0" .Capabilities.KubeVersion.Version) }}
kind: CSIDriver
metadata:
name: csi.juicefs.com
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/resource-policy": keep
spec:
attachRequired: false
podInfoOnMount: false
Loading

0 comments on commit 35e805c

Please sign in to comment.