Skip to content

Commit

Permalink
Merge pull request #69 from juicedata/feature/dashboard
Browse files Browse the repository at this point in the history
chart for csi dashboard
  • Loading branch information
zwwhdls authored Nov 2, 2023
2 parents 47d5fed + 4de7875 commit 7add06d
Show file tree
Hide file tree
Showing 8 changed files with 315 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
# vendor/
.idea/
.DS_Store
values-*.yaml
2 changes: 1 addition & 1 deletion charts/juicefs-csi-driver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: juicefs-csi-driver
description: A Helm chart for JuiceFS CSI Driver
type: application
version: 0.18.1
version: 0.19.0-alpha1
appVersion: 0.22.1
kubeVersion: ">=1.14.0-0"
home: https://github.com/juicedata/juicefs-csi-driver
Expand Down
8 changes: 8 additions & 0 deletions charts/juicefs-csi-driver/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{- define "juicefs-csi.dashboard.serviceAccountName" -}}
{{- if .Values.serviceAccount.dashboard.create }}
{{- default (include "juicefs-csi.fullname" .) .Values.serviceAccount.dashboard.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.dashboard.name }}
{{- end }}
{{- end }}

{{/*
secret fullname
*/}}
Expand Down
71 changes: 71 additions & 0 deletions charts/juicefs-csi-driver/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{{- if and (.Values.dashboard.enabled) }}
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: dashboard
{{- include "juicefs-csi.labels" . | nindent 4 }}
name: juicefs-csi-dashboard
namespace: {{ .Release.Namespace | quote }}
spec:
replicas: {{ .Values.dashboard.replicas }}
selector:
matchLabels:
app: juicefs-csi-dashboard
{{- include "juicefs-csi.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app: juicefs-csi-dashboard
{{- include "juicefs-csi.selectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "juicefs-csi.dashboard.serviceAccountName" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: dashboard
image: {{ .Values.dashboardImage.repository }}:{{ .Values.dashboardImage.tag }}
{{- if .Values.dashboardImage.pullPolicy }}
imagePullPolicy: {{ .Values.dashboardImage.pullPolicy }}
{{- end }}
args:
- --static-dir=/dist
{{- if .Values.dashboard.leaderElection.enabled }}
- --leader-election
{{- if .Values.dashboard.leaderElection.leaderElectionNamespace }}
- --leader-election-namespace={{ .Values.dashboard.leaderElection.leaderElectionNamespace }}
{{- end }}
{{- if .Values.dashboard.leaderElection.leaseDuration }}
- --leader-election-lease-duration={{ .Values.dashboard.leaderElection.leaseDuration }}
{{- end }}
{{- end }}
env:
- name: SYS_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.dashboard.envs }}
{{ toYaml .Values.dashboard.envs | indent 12 }}
{{- end }}
ports:
- containerPort: 8088
resources:
{{- toYaml .Values.dashboard.resources | nindent 12 }}
{{- with .Values.dashboard.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.dashboard.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.dashboard.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.dashboard.hostNetwork }}
hostNetwork: true
{{- end }}
{{- end }}
63 changes: 63 additions & 0 deletions charts/juicefs-csi-driver/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{- if .Values.dashboard.ingress.enabled -}}
{{- $port := .Values.dashboard.service.port -}}
{{- if and .Values.dashboard.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.dashboard.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.dashboard.ingress.annotations "kubernetes.io/ingress.class" .Values.dashboard.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: juicefs-csi-dashboard
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "juicefs-csi.labels" . | nindent 4 }}
{{- with .Values.dashboard.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.dashboard.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.dashboard.ingress.className }}
{{- end }}
{{- if .Values.dashboard.ingress.tls }}
tls:
{{- range .Values.dashboard.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.dashboard.ingress.hosts }}
- http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: juicefs-csi-dashboard
port:
number: {{ $port }}
{{- else }}
serviceName: juicefs-csi-dashboard
servicePort: {{ $port }}
{{- end }}
{{- end }}
{{- if .host }}
host: {{ .host | quote }}
{{- end }}
{{- end }}
{{- end }}
22 changes: 22 additions & 0 deletions charts/juicefs-csi-driver/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if eq .Values.mountMode "sidecar" }}
---
apiVersion: v1
kind: Service
metadata:
Expand All @@ -16,3 +17,24 @@ spec:
app: juicefs-csi-controller
{{- include "juicefs-csi.selectorLabels" . | nindent 4 }}
{{ end }}
{{- if and (.Values.dashboard.enabled) }}
---
apiVersion: v1
kind: Service
metadata:
name: juicefs-csi-dashboard
namespace: {{ .Release.Namespace | quote }}
labels:
app.kubernetes.io/component: dashboard
{{- include "juicefs-csi.labels" . | nindent 4 }}
spec:
type: {{ .Values.dashboard.service.type }}
ports:
- port: {{ .Values.dashboard.service.port }}
targetPort: 8088
protocol: TCP
name: http
selector:
app: juicefs-csi-dashboard
{{- include "juicefs-csi.selectorLabels" . | nindent 4 }}
{{- end }}
90 changes: 90 additions & 0 deletions charts/juicefs-csi-driver/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,93 @@ subjects:
name: {{ include "juicefs-csi.node.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}

{{- if and .Values.dashboard.enabled .Values.serviceAccount.dashboard.create }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "juicefs-csi.dashboard.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "juicefs-csi.labels" . | nindent 4 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
{{- include "juicefs-csi.labels" . | nindent 4 }}
name: juicefs-csi-dashboard-role
rules:
- apiGroups:
- ""
resources:
- pods
- persistentvolumes
- persistentvolumeclaims
- persistentvolumeclaims/status
- nodes
verbs:
- get
- list
- watch
- apiGroups:
- storage.k8s.io
resources:
- storageclasses
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- pods/log
verbs:
- get
- apiGroups:
- batch
resources:
- jobs
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- nodes/proxy
verbs:
- '*'
- apiGroups:
- ""
resources:
- persistentvolumes
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
{{- include "juicefs-csi.labels" . | nindent 4 }}
name: juicefs-csi-dashboard-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: juicefs-csi-dashboard-role
subjects:
- kind: ServiceAccount
name: {{ include "juicefs-csi.dashboard.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
59 changes: 59 additions & 0 deletions charts/juicefs-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ image:
tag: "v0.22.1"
pullPolicy: ""

dashboardImage:
repository: juicedata/csi-dashboard
tag: "v0.23.0-alpha1"
pullPolicy: ""

sidecars:
livenessProbeImage:
repository: quay.io/k8scsi/livenessprobe
Expand Down Expand Up @@ -82,6 +87,13 @@ serviceAccount:
annotations: {}
# The name of the service account to use
name: "juicefs-csi-node-sa"
dashboard:
# Specifies whether a service account of dashboard should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use
name: "juicefs-csi-dashboard-sa"

controller:
enabled: true
Expand Down Expand Up @@ -163,6 +175,53 @@ node:
rollingUpdate:
maxUnavailable: 50%

dashboard:
# CSI Dashboard helps with CSI Driver observation, disabled by default
enabled: false
replicas: 2
leaderElection:
# Enable leader election for dashboard.
enabled: true
# The namespace where the leader election resource lives. Defaults to the pod namespace if not set
leaderElectionNamespace: ""
# The duration that non-leader candidates will wait to force acquire leadership. This is measured against time of last observed ack
# Defaults to 15s, if not set
leaseDuration: ""
# The duration that the acting control-plane will retry refreshing leadership before giving up
hostNetwork: false
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 100m
memory: 200Mi
affinity: {}
nodeSelector: {}
tolerations:
- key: CriticalAddonsOnly
operator: Exists
service:
port: 8088
type: ClusterIP
ingress:
enabled: false
className: "nginx"
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: ""
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
priorityClassName: system-node-critical
envs: []

# Override mount image, ref: https://juicefs.com/docs/csi/guide/custom-image/
defaultMountImage:
ce: ""
Expand Down

0 comments on commit 7add06d

Please sign in to comment.