Skip to content

Commit

Permalink
[helm] Sets custom csi name and add topology fields
Browse files Browse the repository at this point in the history
  • Loading branch information
pbabilas committed Jan 9, 2023
1 parent ac52782 commit 94d0d7f
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 37 deletions.
66 changes: 39 additions & 27 deletions helm/esdk/templates/huawei-csi-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ apiVersion: v1
kind: ServiceAccount
metadata:
labels:
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
name: huawei-csi-controller
namespace: {{ .Values.kubernetes.namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
name: huawei-csi-attacher-role-cfg
namespace: {{ .Values.kubernetes.namespace }}
roleRef:
Expand All @@ -27,7 +27,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
name: huawei-csi-attacher-cfg
namespace: {{ .Values.kubernetes.namespace }}
rules:
Expand All @@ -47,7 +47,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
name: huawei-csi-provisioner-role-cfg
namespace: {{ .Values.kubernetes.namespace }}
roleRef:
Expand All @@ -63,7 +63,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
name: huawei-csi-provisioner-cfg
namespace: {{ .Values.kubernetes.namespace }}
rules:
Expand Down Expand Up @@ -118,12 +118,12 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
provisioner: csi.huawei.com
name: huawei-csi-provisioner-role
provisioner: {{.Values.csi_driver.driverName }}
name: {{.Values.kubernetes.namespace }}-provisioner-role
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: huawei-csi-provisioner-runner
name: {{.Values.kubernetes.namespace }}-provisioner-runner
subjects:
- kind: ServiceAccount
name: huawei-csi-controller
Expand Down Expand Up @@ -218,8 +218,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
provisioner: csi.huawei.com
name: huawei-csi-attacher-role
provisioner: {{.Values.csi_driver.driverName }}
name: {{.Values.kubernetes.namespace }}-attacher-role
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down Expand Up @@ -276,7 +276,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
name: huawei-csi-csi-resizer-role-cfg
namespace: {{ .Values.kubernetes.namespace }}
roleRef:
Expand All @@ -292,7 +292,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
name: huawei-csi-resizer-cfg
namespace: {{ .Values.kubernetes.namespace }}
rules:
Expand All @@ -312,8 +312,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
provisioner: csi.huawei.com
name: huawei-csi-csi-resizer-role
provisioner: {{.Values.csi_driver.driverName }}
name: {{.Values.kubernetes.namespace }}-csi-resizer-role
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -327,8 +327,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
provisioner: csi.huawei.com
name: huawei-csi-resizer-runner
provisioner: {{.Values.csi_driver.driverName }}
name: {{.Values.kubernetes.namespace }}-resizer-runner
rules:
- apiGroups:
- ""
Expand Down Expand Up @@ -380,8 +380,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
provisioner: csi.huawei.com
name: huawei-csi-csi-snapshotter-role
provisioner: {{.Values.csi_driver.driverName }}
name: {{.Values.kubernetes.namespace }}-csi-snapshotter-role
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -395,8 +395,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
provisioner: csi.huawei.com
name: huawei-csi-snapshotter-runner
provisioner: {{.Values.csi_driver.driverName }}
name: {{.Values.kubernetes.namespace }}-snapshotter-runner
rules:
- apiGroups:
- ""
Expand Down Expand Up @@ -440,8 +440,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
provisioner: csi.huawei.com
name: huawei-csi-snapshot-controller-role
provisioner: {{.Values.csi_driver.driverName }}
name: {{.Values.kubernetes.namespace }}-snapshot-controller-role
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -455,8 +455,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
provisioner: csi.huawei.com
name: huawei-csi-snapshot-controller-runner
provisioner: {{.Values.csi_driver.driverName }}
name: {{.Values.kubernetes.namespace }}-snapshot-controller-runner
rules:
- apiGroups:
- ""
Expand Down Expand Up @@ -550,20 +550,20 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
name: huawei-csi-controller
namespace: {{ .Values.kubernetes.namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: huawei-csi-controller
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
template:
metadata:
labels:
app: huawei-csi-controller
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
spec:
containers:
- args:
Expand Down Expand Up @@ -673,6 +673,18 @@ spec:
name: secret
hostNetwork: true
serviceAccount: huawei-csi-controller
{{- with .Values.topology.huaweiCsiNodeSelector }}
nodeSelector:
{{ toYaml . |nindent 8}}
{{- end}}
{{- with .Values.topology.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.huaweiImagePullSecrets}}
imagePullSecrets:
{{ toYaml . |nindent 8}}
{{- end}}
volumes:
- emptyDir: null
name: socket-dir
Expand Down
6 changes: 6 additions & 0 deletions helm/esdk/templates/huawei-csi-driver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: {{ .Values.csi_driver.driverName }}
spec:
fsGroupPolicy: {{ .Values.csi_driver.fsGroupPolicy }}
32 changes: 22 additions & 10 deletions helm/esdk/templates/huawei-csi-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ apiVersion: v1
kind: ServiceAccount
metadata:
labels:
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
name: huawei-csi-node
namespace: {{ .Values.kubernetes.namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
provisioner: csi.huawei.com
name: huawei-csi-driver-registrar-role
provisioner: {{.Values.csi_driver.driverName }}
name: {{.Values.kubernetes.namespace }}-driver-registrar-role
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -26,8 +26,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
provisioner: csi.huawei.com
name: huawei-csi-driver-registrar-runner
provisioner: {{.Values.csi_driver.driverName }}
name: {{.Values.kubernetes.namespace }}-driver-registrar-runner
rules:
- apiGroups:
- ""
Expand Down Expand Up @@ -64,19 +64,19 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
name: huawei-csi-node
namespace: {{ .Values.kubernetes.namespace }}
spec:
selector:
matchLabels:
app: huawei-csi-node
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
template:
metadata:
labels:
app: huawei-csi-node
provisioner: csi.huawei.com
provisioner: {{.Values.csi_driver.driverName }}
spec:
containers:
- args:
Expand All @@ -90,7 +90,7 @@ spec:
name: socket-dir
- args:
- --csi-address=/csi/csi.sock
- --kubelet-registration-path=/var/lib/kubelet/plugins/csi.huawei.com/csi.sock
- --kubelet-registration-path=/var/lib/kubelet/plugins/{{.Values.csi_driver.driverName}}/csi.sock
image: {{ .Values.images.sidecar.registrar }}
imagePullPolicy: {{ .Values.sidecarImagePullPolicy }}
name: csi-node-driver-registrar
Expand Down Expand Up @@ -173,9 +173,21 @@ spec:
hostNetwork: true
hostPID: true
serviceAccountName: huawei-csi-node
{{- with .Values.topology.huaweiCsiNodeSelector }}
nodeSelector:
{{ toYaml . |nindent 8}}
{{- end}}
{{- with .Values.topology.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.huaweiImagePullSecrets}}
imagePullSecrets:
{{ toYaml . |nindent 8}}
{{- end}}
volumes:
- hostPath:
path: /var/lib/kubelet/plugins/csi.huawei.com
path: /var/lib/kubelet/plugins/{{.Values.csi_driver.driverName}}
type: DirectoryOrCreate
name: socket-dir
- hostPath:
Expand Down
14 changes: 14 additions & 0 deletions helm/esdk/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ kubernetes:
csi_driver:
# Driver name, it is strongly recommended not to modify this parameter
driverName: csi.huawei.com
# indicate whether or not they support modifying a volume's ownership or permissions when the volume is being mounted.
fsGroupPolicy: ReadWriteOnceWithFSType
# Endpoint, it is strongly recommended not to modify this parameter
endpoint: /csi/csi.sock
# Maximum number of concurrent disk scans or detaches, support 1~10
Expand Down Expand Up @@ -84,5 +86,17 @@ csi_driver:
# Maximum number of log files that can be backed up.
maxBackups: 9

# Number of huawei-csi-controllers
huaweiCsiController:
# Currently, the value can only be set to 1
replicas: 1
topology:
huaweiCsiNodeSelector: {}
tolerations: []

# Image pull secret if image stored in private repository
huaweiImagePullSecrets: []

# Flag to enable or disable resize (Optional)
resizer:
enable: true

0 comments on commit 94d0d7f

Please sign in to comment.