rancher-partner-charts/charts/csi-wekafs/templates/controllerserver.yaml

243 lines
7.8 KiB
YAML

apiVersion: v1
kind: ServiceAccount
imagePullSecrets:
- name: {{ .Release.Name }}-creds
metadata:
name: {{ .Release.Name }}-controller
namespace: {{ .Release.Namespace }}
---
# cluster role
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-controller
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: [""]
resources: ["persistentvolumeclaims/status"]
verbs: ["update", "patch"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: ["storage.k8s.io"]
resources: ["csinodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments/status"]
verbs: ["patch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["csinodeinfos"]
verbs: ["get", "list", "watch"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["create", "list", "watch", "delete", "get", "update"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["create", "get", "list", "watch", "update", "delete", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents/status"]
verbs: ["update", "create", "get", "list", "watch", "delete", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots"]
verbs: ["get", "list", "watch", "update", "create", "delete", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots/status"]
verbs: ["get", "list", "watch", "update", "create", "delete", "patch"]
---
# cluster role binding
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-controller
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-controller
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ .Release.Name }}-controller
apiGroup: rbac.authorization.k8s.io
---
# stateful set of controller
---
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: {{ .Release.Name }}-controller
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-controller
serviceName: {{ .Release.Name }}-controller
replicas: 1
template:
metadata:
labels:
app: {{ .Release.Name }}-controller
spec:
serviceAccountName: {{ .Release.Name }}-controller
containers:
- name: csi-attacher
image: {{ required "csi attacher sidercar image." .Values.images.attachersidecar }}
securityContext:
privileged: true
args:
- "--csi-address=$(ADDRESS)"
- "--v=5"
env:
- name: ADDRESS
value: unix:///csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: csi-provisioner
image: {{ required "csi provisioner sidecar container image." .Values.images.provisionersidecar }}
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
- "--feature-gates=Topology=true"
env:
- name: ADDRESS
value: unix:///csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: "/csi"
- name: csi-resizer
image: {{ required "csi attacher sidercar image." .Values.images.resizersidecar }}
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
env:
- name: ADDRESS
value: unix:///csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: wekafs
securityContext:
privileged: true
image: {{ .Values.images.csidriver }}:v{{ .Values.images.csidriverTag }}
imagePullPolicy: Always
args:
- "--drivername=$(CSI_DRIVER_NAME)"
- "--v=5"
- "--endpoint=$(CSI_ENDPOINT)"
- "--nodeid=$(KUBE_NODE_NAME)"
- "--dynamic-path=$(CSI_DYNAMIC_PATH)"
- "--csimode=$(X_CSI_MODE)"
ports:
- containerPort: 9898
name: healthz
protocol: TCP
livenessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: healthz
initialDelaySeconds: 10
timeoutSeconds: 3
periodSeconds: 2
env:
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
- name: CSI_DRIVER_NAME
value: {{ required "Provide CSI Driver Name" .Values.csiDriverName }}
- name: CSI_DRIVER_VERSION
value: {{ required "Provide CSI Driver version" .Values.csiDriverVersion }}
- name: X_CSI_MODE
value: controller
- name: CSI_DYNAMIC_PATH
value: {{ required "Provide CSI Driver Dynamic Volume Creation Path" .Values.dynamicProvisionPath }}
- name: X_CSI_DEBUG
value: "false"
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- mountPath: /csi
name: socket-dir
- mountPath: /var/lib/kubelet/pods
mountPropagation: Bidirectional
name: mountpoint-dir
- mountPath: /var/lib/kubelet/plugins
mountPropagation: Bidirectional
name: plugins-dir
- mountPath: /var/lib/csi-wekafs-data
name: csi-data-dir
- mountPath: /dev
name: dev-dir
- name: liveness-probe
volumeMounts:
- mountPath: /csi
name: socket-dir
image: {{ required "Provide Liveness Probe image." .Values.images.livenessprobesidecar }}
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
- "--health-port=$(HEALTH_PORT)"
env:
- name: ADDRESS
value: unix:///csi/csi.sock
- name: HEALTH_PORT
value: "9898"
{{- with .Values.controllerPluginTolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- hostPath:
path: /var/lib/kubelet/plugins/csi-wekafs
type: DirectoryOrCreate
name: socket-dir
- hostPath:
path: /var/lib/kubelet/pods
type: DirectoryOrCreate
name: mountpoint-dir
- hostPath:
path: /var/lib/kubelet/plugins_registry
type: Directory
name: registration-dir
- hostPath:
path: /var/lib/kubelet/plugins
type: Directory
name: plugins-dir
- hostPath:
# 'path' is where PV data is persisted on host.
# using /tmp is also possible while the PVs will not available after plugin container recreation or host reboot
path: /var/lib/csi-wekafs-data/
type: DirectoryOrCreate
name: csi-data-dir
- hostPath:
path: /dev
type: Directory
name: dev-dir