Skip to content

Commit

Permalink
Merge pull request #2479 from Rei1010/supportNFS
Browse files Browse the repository at this point in the history
Add csi driver nfs charts
  • Loading branch information
learner0810 authored Sep 12, 2024
2 parents 2acc5fc + 75aae07 commit e8fbc99
Show file tree
Hide file tree
Showing 22 changed files with 2,999 additions and 0 deletions.
20 changes: 20 additions & 0 deletions charts/csi-driver-nfs/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export USE_OPENSOURCE_CHART=false

# must

export REPO_URL=https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts
export REPO_NAME=csi-driver-nfs
export CHART_NAME=csi-driver-nfs
export VERSION=v4.9.0

# pr, issue, none

export UPGRADE_METHOD=pr
export UPGRADE_REVIWER=rei1010
export TEST_ASSIGNER=liyuerich

# push to daocloud repo

export DAOCLOUD_REPO_PROJECT=addon
export CUSTOM_SHELL=custom.sh
export NO_TRIVY=true
6 changes: 6 additions & 0 deletions charts/csi-driver-nfs/csi-driver-nfs/.relok8s-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- "{{ .csi-driver-nfs.image.baseRepo }}/{{ .csi-driver-nfs.image.csiProvisioner.repository}}:{{ .csi-driver-nfs.image.csiProvisioner.tag }}"
- "{{ .csi-driver-nfs.image.baseRepo }}/{{ .csi-driver-nfs.image.csiSnapshotter.repository}}:{{ .csi-driver-nfs.image.csiSnapshotter.tag }}"
- "{{ .csi-driver-nfs.image.baseRepo }}/{{ .csi-driver-nfs.image.externalSnapshotter.repository}}:{{ .csi-driver-nfs.image.externalSnapshotter.tag }}"
- "{{ .csi-driver-nfs.image.baseRepo }}/{{ .csi-driver-nfs.image.livenessProbe.repository}}:{{ .csi-driver-nfs.image.livenessProbe.tag }}"
- "{{ .csi-driver-nfs.image.baseRepo }}/{{ .csi-driver-nfs.image.nfs.repository}}:{{ .csi-driver-nfs.image.nfs.tag }}"
- "{{ .csi-driver-nfs.image.baseRepo }}/{{ .csi-driver-nfs.image.nodeDriverRegistrar.repository}}:{{ .csi-driver-nfs.image.nodeDriverRegistrar.tag }}"
11 changes: 11 additions & 0 deletions charts/csi-driver-nfs/csi-driver-nfs/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
appVersion: v4.9.0
description: CSI NFS Driver for Kubernetes
name: csi-driver-nfs
version: v4.9.0
dependencies:
- name: csi-driver-nfs
version: "v4.9.0"
repository: "https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts"
keywords:
- storage
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: v4.9.0
description: CSI NFS Driver for Kubernetes
name: csi-driver-nfs
version: v4.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The CSI NFS Driver is getting deployed to your cluster.

To check CSI NFS Driver pods status, please run:

kubectl --namespace={{ .Release.Namespace }} get pods --selector="app.kubernetes.io/instance={{ .Release.Name }}" --watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{/* vim: set filetype=mustache: */}}

{{/* Expand the name of the chart.*/}}
{{- define "nfs.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/* labels for helm resources */}}
{{- define "nfs.labels" -}}
labels:
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ template "nfs.name" . }}"
app.kubernetes.io/version: "{{ .Chart.AppVersion }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels | indent 2 -}}
{{- end }}
{{- end -}}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: {{ .Values.controller.name }}
namespace: {{ .Release.Namespace }}
{{ include "nfs.labels" . | indent 2 }}
spec:
replicas: {{ .Values.controller.replicas }}
selector:
matchLabels:
app: {{ .Values.controller.name }}
strategy:
type: {{ .Values.controller.strategyType }}
template:
metadata:
{{ include "nfs.labels" . | indent 6 }}
app: {{ .Values.controller.name }}
spec:
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
hostNetwork: true # controller also needs to mount nfs to create dir
dnsPolicy: {{ .Values.controller.dnsPolicy }}
serviceAccountName: {{ .Values.serviceAccount.controller }}
{{- with .Values.controller.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
nodeSelector:
kubernetes.io/os: linux
{{- if .Values.controller.runOnMaster}}
node-role.kubernetes.io/master: ""
{{- end}}
{{- if .Values.controller.runOnControlPlane}}
node-role.kubernetes.io/control-plane: ""
{{- end}}
{{- with .Values.controller.nodeSelector }}
{{ toYaml . | indent 8 }}
{{- end }}
priorityClassName: {{ .Values.controller.priorityClassName }}
securityContext:
seccompProfile:
type: RuntimeDefault
{{- with .Values.controller.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
containers:
- name: csi-provisioner
{{- if hasPrefix "/" .Values.image.csiProvisioner.repository }}
image: "{{ .Values.image.baseRepo }}/{{.Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}"
{{- else }}
image: "{{ .Values.image.baseRepo }}/{{.Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}"
{{- end }}
args:
- "-v=2"
- "--csi-address=$(ADDRESS)"
- "--leader-election"
- "--leader-election-namespace={{ .Release.Namespace }}"
- "--extra-create-metadata=true"
- "--feature-gates=HonorPVReclaimPolicy=true"
- "--timeout=1200s"
env:
- name: ADDRESS
value: /csi/csi.sock
imagePullPolicy: {{ .Values.image.csiProvisioner.pullPolicy }}
volumeMounts:
- mountPath: /csi
name: socket-dir
resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }}
securityContext:
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
- name: csi-snapshotter
{{- if hasPrefix "/" .Values.image.csiSnapshotter.repository }}
image: "{{ .Values.image.baseRepo }}/{{.Values.image.csiSnapshotter.repository }}:{{ .Values.image.csiSnapshotter.tag }}"
{{- else }}
image: "{{ .Values.image.baseRepo }}/{{.Values.image.csiSnapshotter.repository }}:{{ .Values.image.csiSnapshotter.tag }}"
{{- end }}
args:
- "--v=2"
- "--csi-address=$(ADDRESS)"
- "--leader-election-namespace={{ .Release.Namespace }}"
- "--leader-election"
- "--timeout=1200s"
env:
- name: ADDRESS
value: /csi/csi.sock
imagePullPolicy: {{ .Values.image.csiSnapshotter.pullPolicy }}
resources: {{- toYaml .Values.controller.resources.csiSnapshotter | nindent 12 }}
volumeMounts:
- name: socket-dir
mountPath: /csi
securityContext:
capabilities:
drop:
- ALL
- name: liveness-probe
{{- if hasPrefix "/" .Values.image.livenessProbe.repository }}
image: "{{ .Values.image.baseRepo }}/{{.Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}"
{{- else }}
image: "{{ .Values.image.baseRepo }}/{{.Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}"
{{- end }}
args:
- --csi-address=/csi/csi.sock
- --probe-timeout=3s
- --http-endpoint=localhost:{{ .Values.controller.livenessProbe.healthPort }}
- --v=2
imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }}
volumeMounts:
- name: socket-dir
mountPath: /csi
resources: {{- toYaml .Values.controller.resources.livenessProbe | nindent 12 }}
securityContext:
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
- name: nfs
{{- if hasPrefix "/" .Values.image.nfs.repository }}
image: "{{ .Values.image.baseRepo }}/{{.Values.image.nfs.repository }}:{{ .Values.image.nfs.tag }}"
{{- else }}
image: "{{ .Values.image.baseRepo }}/{{.Values.image.nfs.repository }}:{{ .Values.image.nfs.tag }}"
{{- end }}
securityContext:
privileged: true
capabilities:
add: ["SYS_ADMIN"]
drop:
- ALL
allowPrivilegeEscalation: true
imagePullPolicy: {{ .Values.image.nfs.pullPolicy }}
args:
- "--v={{ .Values.controller.logLevel }}"
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--drivername={{ .Values.driver.name }}"
- "--mount-permissions={{ .Values.driver.mountPermissions }}"
- "--working-mount-dir={{ .Values.controller.workingMountDir }}"
- "--default-ondelete-policy={{ .Values.controller.defaultOnDeletePolicy }}"
env:
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
livenessProbe:
failureThreshold: 5
httpGet:
host: localhost
path: /healthz
port: {{ .Values.controller.livenessProbe.healthPort }}
initialDelaySeconds: 30
timeoutSeconds: 10
periodSeconds: 30
volumeMounts:
- name: pods-mount-dir
mountPath: {{ .Values.kubeletDir }}/pods
mountPropagation: "Bidirectional"
- mountPath: /csi
name: socket-dir
resources: {{- toYaml .Values.controller.resources.nfs | nindent 12 }}
volumes:
- name: pods-mount-dir
hostPath:
path: {{ .Values.kubeletDir }}/pods
type: Directory
- name: socket-dir
emptyDir: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: {{ .Values.driver.name }}
spec:
attachRequired: false
volumeLifecycleModes:
- Persistent
{{- if .Values.feature.enableInlineVolume}}
- Ephemeral
{{- end}}
{{- if .Values.feature.enableFSGroupPolicy}}
fsGroupPolicy: File
{{- end}}
Loading

0 comments on commit e8fbc99

Please sign in to comment.