Merge pull request #335 from andyzhangx/node-serviceAccount

fix: add serviceAccount for driver daemonset running on the node
This commit is contained in:
Andy Zhang 2022-05-11 14:55:44 +08:00 committed by GitHub
commit e9ceb486bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 3 deletions

View File

@ -24,6 +24,7 @@ spec:
{{- end }} {{- end }}
hostNetwork: true # original nfs connection would be broken without hostNetwork setting hostNetwork: true # original nfs connection would be broken without hostNetwork setting
dnsPolicy: {{ .Values.controller.dnsPolicy }} dnsPolicy: {{ .Values.controller.dnsPolicy }}
serviceAccountName: csi-nfs-node-sa
nodeSelector: nodeSelector:
kubernetes.io/os: linux kubernetes.io/os: linux
{{- with .Values.node.tolerations }} {{- with .Values.node.tolerations }}

View File

@ -7,6 +7,13 @@ metadata:
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
{{ include "nfs.labels" . | indent 2 }} {{ include "nfs.labels" . | indent 2 }}
--- ---
apiVersion: v1
kind: ServiceAccount
metadata:
name: csi-{{ .Values.rbac.name }}-node-sa
namespace: {{ .Release.Namespace }}
{{ include "nfs.labels" . | indent 2 }}
---
{{- end -}} {{- end -}}
{{- if .Values.rbac.create -}} {{- if .Values.rbac.create -}}

View File

@ -19,6 +19,7 @@ spec:
spec: spec:
hostNetwork: true # original nfs connection would be broken without hostNetwork setting hostNetwork: true # original nfs connection would be broken without hostNetwork setting
dnsPolicy: Default # available values: Default, ClusterFirstWithHostNet, ClusterFirst dnsPolicy: Default # available values: Default, ClusterFirstWithHostNet, ClusterFirst
serviceAccountName: csi-nfs-node-sa
nodeSelector: nodeSelector:
kubernetes.io/os: linux kubernetes.io/os: linux
tolerations: tolerations:

View File

@ -34,7 +34,7 @@ if [ $ver != "master" ]; then
fi fi
echo "Installing NFS CSI driver, version: $ver ..." echo "Installing NFS CSI driver, version: $ver ..."
kubectl apply -f $repo/rbac-csi-nfs-controller.yaml kubectl apply -f $repo/rbac-csi-nfs.yaml
kubectl apply -f $repo/csi-nfs-driverinfo.yaml kubectl apply -f $repo/csi-nfs-driverinfo.yaml
kubectl apply -f $repo/csi-nfs-controller.yaml kubectl apply -f $repo/csi-nfs-controller.yaml
kubectl apply -f $repo/csi-nfs-node.yaml kubectl apply -f $repo/csi-nfs-node.yaml

View File

@ -4,7 +4,12 @@ kind: ServiceAccount
metadata: metadata:
name: csi-nfs-controller-sa name: csi-nfs-controller-sa
namespace: kube-system namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: csi-nfs-node-sa
namespace: kube-system
--- ---
kind: ClusterRole kind: ClusterRole

View File

@ -37,5 +37,5 @@ echo "Uninstalling NFS driver, version: $ver ..."
kubectl delete -f $repo/csi-nfs-controller.yaml --ignore-not-found kubectl delete -f $repo/csi-nfs-controller.yaml --ignore-not-found
kubectl delete -f $repo/csi-nfs-node.yaml --ignore-not-found kubectl delete -f $repo/csi-nfs-node.yaml --ignore-not-found
kubectl delete -f $repo/csi-nfs-driverinfo.yaml --ignore-not-found kubectl delete -f $repo/csi-nfs-driverinfo.yaml --ignore-not-found
kubectl delete -f $repo/rbac-csi-nfs-controller.yaml --ignore-not-found kubectl delete -f $repo/rbac-csi-nfs.yaml --ignore-not-found
echo 'Uninstalled NFS driver successfully.' echo 'Uninstalled NFS driver successfully.'