Skip to content

Commit

Permalink
charts: initial commit for csi-driver-lvm
Browse files Browse the repository at this point in the history
Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
  • Loading branch information
Vicente-Cheng committed Jul 11, 2024
1 parent e0cf1a5 commit 44a6d9e
Show file tree
Hide file tree
Showing 7 changed files with 459 additions and 0 deletions.
27 changes: 27 additions & 0 deletions charts/harvester-csi-driver-lvm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v2
name: harvester-csi-driver-lvm
description: A Helm chart for Harvester LVM CSI Driver

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.0-dev

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: 0.1.0

maintainers:
- name: harvester
39 changes: 39 additions & 0 deletions charts/harvester-csi-driver-lvm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{- define "externalImages.csiAttacher" -}}
{{- if .Values.customCSISidecars.enabled -}}
{{- print .Values.customCSISidecars.attacher -}}
{{- else -}}
{{- print "registry.k8s.io/sig-storage/csi-attacher:v4.4.2" -}}
{{- end -}}
{{- end -}}

{{- define "externalImages.csiProvisioner" -}}
{{- if .Values.customCSISidecars.enabled -}}
{{- print .Values.customCSISidecars.provisioner -}}
{{- else -}}
{{- print "registry.k8s.io/sig-storage/csi-provisioner:v3.6.2" -}}
{{- end -}}
{{- end -}}

{{- define "externalImages.csiLivenessprobe" -}}
{{- if .Values.customCSISidecars.enabled -}}
{{- print .Values.customCSISidecars.livenessprobe -}}
{{- else -}}
{{- print "registry.k8s.io/sig-storage/livenessprobe:v2.12.0" -}}
{{- end -}}
{{- end -}}

{{- define "externalImages.csiResizer" -}}
{{- if .Values.customCSISidecars.enabled -}}
{{- print .Values.customCSISidecars.resizer -}}
{{- else -}}
{{- print "registry.k8s.io/sig-storage/csi-resizer:v1.9.2" -}}
{{- end -}}
{{- end -}}

{{- define "externalImages.csiNodeDriverRegistrar" -}}
{{- if .Values.customCSISidecars.enabled -}}
{{- print .Values.customCSISidecars.registrar -}}
{{- else -}}
{{- print "registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.9.2" -}}
{{- end -}}
{{- end -}}
12 changes: 12 additions & 0 deletions charts/harvester-csi-driver-lvm/templates/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: {{ .Values.lvm.driverName }}
annotations:
lvm.driver.harvesterhci.io/version: {{ .Chart.AppVersion }}
spec:
volumeLifecycleModes:
- Persistent
podInfoOnMount: true
attachRequired: false
79 changes: 79 additions & 0 deletions charts/harvester-csi-driver-lvm/templates/controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: harvester-csi-driver-lvm-controller
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
serviceName: harvester-csi-driver-lvm-controller
replicas: 1
selector:
matchLabels:
app: harvester-csi-driver-lvm-controller
template:
metadata:
labels:
app: harvester-csi-driver-lvm-controller
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- harvester-csi-driver-lvm-plugin
topologyKey: kubernetes.io/hostname
{{- if .Values.nodeSelector.provisioner }}
nodeSelector:
{{ toYaml .Values.nodeSelector.provisioner | indent 8 }}
{{- end }}
{{- if .Values.tolerations.provisioner }}
tolerations:
{{ toYaml .Values.tolerations.provisioner | indent 8 }}
{{- end }}
serviceAccountName: harvester-csi-driver-lvm
containers:
- name: csi-attacher
image: {{ template "externalImages.csiAttacher" . }}
imagePullPolicy: IfNotPresent
args:
- --v=5
- --csi-address=/csi/csi.sock
securityContext:
privileged: true
volumeMounts:
- mountPath: /csi
name: socket-dir
- name: csi-provisioner
image: {{ template "externalImages.csiProvisioner" . }}
imagePullPolicy: IfNotPresent
args:
- -v=5
- --csi-address=/csi/csi.sock
- --feature-gates=Topology=true
securityContext:
privileged: true
volumeMounts:
- mountPath: /csi
name: socket-dir
- name: csi-resizer
image: {{ template "externalImages.csiResizer" . }}
imagePullPolicy: IfNotPresent
args:
- -v=5
- -csi-address=/csi/csi.sock
securityContext:
privileged: true
volumeMounts:
- mountPath: /csi
name: socket-dir
volumes:
- hostPath:
path: {{ .Values.kubernetes.kubeletPath }}/plugins/{{ .Values.lvm.driverName }}
type: DirectoryOrCreate
name: socket-dir
---
164 changes: 164 additions & 0 deletions charts/harvester-csi-driver-lvm/templates/csi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: harvester-csi-driver-lvm-plugin
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
revisionHistoryLimit: 10
selector:
matchLabels:
app: harvester-csi-driver-lvm-plugin
template:
metadata:
labels:
app: harvester-csi-driver-lvm-plugin
spec:
serviceAccountName: harvester-csi-driver-lvm
{{- if .Values.tolerations.plugin }}
tolerations:
{{ toYaml .Values.tolerations.plugin | indent 8 }}
{{- end }}
{{- if .Values.nodeSelector.plugin }}
nodeSelector:
{{ toYaml .Values.nodeSelector.plugin | indent 8 }}
{{- end }}
containers:
- name: node-driver-registrar
args:
- --v=5
- --csi-address=/csi/csi.sock
- --kubelet-registration-path={{ .Values.kubernetes.kubeletPath }}/plugins/{{ .Values.lvm.driverName }}/csi.sock
env:
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
image: {{ template "externalImages.csiNodeDriverRegistrar" . }}
imagePullPolicy: IfNotPresent
resources: {}
securityContext:
privileged: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /csi
name: socket-dir
- mountPath: /registration
name: registration-dir
- name: harvester-csi-driver-lvm-plugin
args:
- --drivername={{ .Values.lvm.driverName }}
- --endpoint=unix:///csi/csi.sock
- --hostwritepath={{ .Values.lvm.hostWritePath }}
- --nodeid=$(KUBE_NODE_NAME)
- --namespace={{ .Release.Namespace }}
- --provisionerimage={{ .Values.provisionerImage.repository }}:{{ .Values.provisionerImage.tag }}
- --pullpolicy={{ .Values.provisionerImage.pullPolicy }}
env:
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
image: "{{ .Values.pluginImage.repository }}:{{ .Values.pluginImage.tag }}"
imagePullPolicy: {{ .Values.pluginImage.pullPolicy }}
livenessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: healthz
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 2
successThreshold: 1
timeoutSeconds: 3
ports:
- containerPort: 9898
name: healthz
protocol: TCP
resources: {}
securityContext:
privileged: true
terminationMessagePath: /termination.log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /csi
name: socket-dir
- mountPath: {{ .Values.kubernetes.kubeletPath }}/pods
mountPropagation: Bidirectional
name: mountpoint-dir
- mountPath: {{ .Values.kubernetes.kubeletPath }}/plugins
mountPropagation: Bidirectional
name: plugins-dir
- mountPath: /dev
name: dev-dir
mountPropagation: Bidirectional
- mountPath: /lib/modules
name: mod-dir
- mountPath: /etc/lvm/backup
name: lvmbackup
mountPropagation: Bidirectional
- mountPath: /etc/lvm/cache
name: lvmcache
mountPropagation: Bidirectional
- mountPath: /run/lock/lvm
name: lvmlock
mountPropagation: Bidirectional
- name: liveness-probe
args:
- --csi-address=/csi/csi.sock
- --health-port=9898
image: {{ template "externalImages.csiLivenessprobe" . }}
imagePullPolicy: IfNotPresent
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /csi
name: socket-dir
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- hostPath:
path: {{ .Values.kubernetes.kubeletPath }}/plugins/{{ .Values.lvm.driverName }}
type: DirectoryOrCreate
name: socket-dir
- hostPath:
path: {{ .Values.kubernetes.kubeletPath }}/pods
type: DirectoryOrCreate
name: mountpoint-dir
- hostPath:
path: {{ .Values.kubernetes.kubeletPath }}/plugins_registry
type: Directory
name: registration-dir
- hostPath:
path: {{ .Values.kubernetes.kubeletPath }}/plugins
type: Directory
name: plugins-dir
- hostPath:
path: /dev
type: Directory
name: dev-dir
- hostPath:
path: /lib/modules
name: mod-dir
- hostPath:
path: {{ .Values.lvm.hostWritePath }}/backup
type: DirectoryOrCreate
name: lvmbackup
- hostPath:
path: {{ .Values.lvm.hostWritePath }}/cache
type: DirectoryOrCreate
name: lvmcache
- hostPath:
path: {{ .Values.lvm.hostWritePath }}/lock
type: DirectoryOrCreate
name: lvmlock
---
49 changes: 49 additions & 0 deletions charts/harvester-csi-driver-lvm/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: harvester-csi-driver-lvm
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: harvester-csi-driver-lvm
rules:
- apiGroups: [""]
resources: ["persistentvolumes", "persistentvolumeclaims", "persistentvolumeclaims/status"]
verbs: ["*"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["list", "get", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list", "get", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["csinodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
verbs: ["get", "list", "watch", "patch"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments/status"]
verbs: ["patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: harvester-csi-driver-lvm
subjects:
- kind: ServiceAccount
name: harvester-csi-driver-lvm
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: harvester-csi-driver-lvm
apiGroup: rbac.authorization.k8s.io
---
Loading

0 comments on commit 44a6d9e

Please sign in to comment.