mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-23 13:30:23 +00:00
b6a88dd728
Problem: ------- For rbd nbd userspace mounter backends, after a restart of the nodeplugin all the mounts will start seeing IO errors. This is because, for rbd-nbd backends there will be a userspace mount daemon running per volume, post restart of the nodeplugin pod, there is no way to restore the daemons back to life. Solution: -------- The volume healer is a one-time activity that is triggered at the startup time of the rbd nodeplugin. It navigates through the list of volume attachments on the node and acts accordingly. For now, it is limited to nbd type storage only, but it is flexible and can be extended in the future for other backend types as needed. From a few feets above: This solves a severe problem for nbd backed csi volumes. The healer while going through the list of volume attachments on the node, if finds the volume is in attached state and is of type nbd, then it will attempt to fix the rbd-nbd volumes by sending a NodeStageVolume request with the required volume attributes like secrets, device name, image attributes, and etc.. which will finally help start the required rbd-nbd daemons in the nodeplugin csi-rbdplugin container. This will allow reattaching the backend images with the right nbd device, thus allowing the applications to perform IO without any interruptions even after a nodeplugin restart. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
208 lines
7.5 KiB
YAML
208 lines
7.5 KiB
YAML
kind: DaemonSet
|
|
apiVersion: apps/v1
|
|
metadata:
|
|
name: {{ include "ceph-csi-rbd.nodeplugin.fullname" . }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels:
|
|
app: {{ include "ceph-csi-rbd.name" . }}
|
|
chart: {{ include "ceph-csi-rbd.chart" . }}
|
|
component: {{ .Values.nodeplugin.name }}
|
|
release: {{ .Release.Name }}
|
|
heritage: {{ .Release.Service }}
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: {{ include "ceph-csi-rbd.name" . }}
|
|
component: {{ .Values.nodeplugin.name }}
|
|
release: {{ .Release.Name }}
|
|
updateStrategy:
|
|
type: {{ .Values.nodeplugin.updateStrategy }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{ include "ceph-csi-rbd.name" . }}
|
|
chart: {{ include "ceph-csi-rbd.chart" . }}
|
|
component: {{ .Values.nodeplugin.name }}
|
|
release: {{ .Release.Name }}
|
|
heritage: {{ .Release.Service }}
|
|
spec:
|
|
serviceAccountName: {{ include "ceph-csi-rbd.serviceAccountName.nodeplugin" . }}
|
|
hostNetwork: true
|
|
hostPID: true
|
|
{{- if .Values.nodeplugin.priorityClassName }}
|
|
priorityClassName: {{ .Values.nodeplugin.priorityClassName }}
|
|
{{- end }}
|
|
# to use e.g. Rook orchestrated cluster, and mons' FQDN is
|
|
# resolved through k8s service, set dns policy to cluster first
|
|
dnsPolicy: ClusterFirstWithHostNet
|
|
containers:
|
|
- name: driver-registrar
|
|
# This is necessary only for systems with SELinux, where
|
|
# non-privileged sidecar containers cannot access unix domain socket
|
|
# created by privileged CSI driver container.
|
|
securityContext:
|
|
privileged: true
|
|
image: "{{ .Values.nodeplugin.registrar.image.repository }}:{{ .Values.nodeplugin.registrar.image.tag }}"
|
|
imagePullPolicy: {{ .Values.nodeplugin.registrar.image.pullPolicy }}
|
|
args:
|
|
- "--v={{ .Values.logLevel }}"
|
|
- "--csi-address=/csi/{{ .Values.pluginSocketFile }}"
|
|
- "--kubelet-registration-path={{ .Values.kubeletDir }}/plugins/{{ .Values.driverName }}/{{ .Values.pluginSocketFile }}"
|
|
env:
|
|
- name: KUBE_NODE_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
volumeMounts:
|
|
- name: socket-dir
|
|
mountPath: /csi
|
|
- name: registration-dir
|
|
mountPath: /registration
|
|
resources:
|
|
{{ toYaml .Values.nodeplugin.registrar.resources | indent 12 }}
|
|
- name: csi-rbdplugin
|
|
image: "{{ .Values.nodeplugin.plugin.image.repository }}:{{ .Values.nodeplugin.plugin.image.tag }}"
|
|
imagePullPolicy: {{ .Values.nodeplugin.plugin.image.pullPolicy }}
|
|
args:
|
|
- "--nodeid=$(NODE_ID)"
|
|
- "--pluginpath={{ .Values.kubeletDir }}/plugins"
|
|
- "--stagingpath={{ .Values.kubeletDir }}/plugins/kubernetes.io/csi/pv/"
|
|
- "--type=rbd"
|
|
- "--nodeserver=true"
|
|
- "--pidlimit=-1"
|
|
- "--endpoint=$(CSI_ENDPOINT)"
|
|
- "--v={{ .Values.logLevel }}"
|
|
- "--drivername=$(DRIVER_NAME)"
|
|
{{- if .Values.topology.enabled }}
|
|
- "--domainlabels={{ .Values.topology.domainLabels | join "," }}"
|
|
{{- end }}
|
|
{{- if .Values.nodeplugin.profiling.enabled }}
|
|
- "--enableprofiling={{ .Values.nodeplugin.profiling.enabled }}"
|
|
{{- end }}
|
|
env:
|
|
- name: POD_IP
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: status.podIP
|
|
- name: DRIVER_NAME
|
|
value: {{ .Values.driverName }}
|
|
- name: NODE_ID
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
- name: CSI_ENDPOINT
|
|
value: "unix:///csi/{{ .Values.pluginSocketFile }}"
|
|
securityContext:
|
|
privileged: true
|
|
capabilities:
|
|
add: ["SYS_ADMIN"]
|
|
allowPrivilegeEscalation: true
|
|
volumeMounts:
|
|
- name: socket-dir
|
|
mountPath: /csi
|
|
- mountPath: /dev
|
|
name: host-dev
|
|
- mountPath: /run/mount
|
|
name: host-mount
|
|
- mountPath: /sys
|
|
name: host-sys
|
|
- mountPath: /lib/modules
|
|
name: lib-modules
|
|
readOnly: true
|
|
- name: ceph-csi-config
|
|
mountPath: /etc/ceph-csi-config/
|
|
- name: ceph-csi-encryption-kms-config
|
|
mountPath: /etc/ceph-csi-encryption-kms-config/
|
|
- name: plugin-dir
|
|
mountPath: {{ .Values.kubeletDir }}/plugins
|
|
mountPropagation: "Bidirectional"
|
|
- name: mountpoint-dir
|
|
mountPath: {{ .Values.kubeletDir }}/pods
|
|
mountPropagation: "Bidirectional"
|
|
- name: keys-tmp-dir
|
|
mountPath: /tmp/csi/keys
|
|
resources:
|
|
{{ toYaml .Values.nodeplugin.plugin.resources | indent 12 }}
|
|
{{- if .Values.nodeplugin.httpMetrics.enabled }}
|
|
- name: liveness-prometheus
|
|
securityContext:
|
|
privileged: true
|
|
image: "{{ .Values.nodeplugin.plugin.image.repository }}:{{ .Values.nodeplugin.plugin.image.tag }}"
|
|
imagePullPolicy: {{ .Values.nodeplugin.plugin.image.pullPolicy }}
|
|
args:
|
|
- "--type=liveness"
|
|
- "--endpoint=$(CSI_ENDPOINT)"
|
|
- "--metricsport={{ .Values.nodeplugin.httpMetrics.containerPort }}"
|
|
- "--metricspath=/metrics"
|
|
- "--polltime=60s"
|
|
- "--timeout=3s"
|
|
env:
|
|
- name: CSI_ENDPOINT
|
|
value: "unix:///csi/{{ .Values.pluginSocketFile }}"
|
|
- name: POD_IP
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: status.podIP
|
|
volumeMounts:
|
|
- name: socket-dir
|
|
mountPath: /csi
|
|
resources:
|
|
{{ toYaml .Values.nodeplugin.plugin.resources | indent 12 }}
|
|
{{- end }}
|
|
volumes:
|
|
- name: socket-dir
|
|
hostPath:
|
|
path: "{{ .Values.kubeletDir }}/plugins/{{ .Values.driverName }}"
|
|
type: DirectoryOrCreate
|
|
- name: registration-dir
|
|
hostPath:
|
|
path: {{ .Values.kubeletDir }}/plugins_registry
|
|
type: Directory
|
|
- name: plugin-dir
|
|
hostPath:
|
|
path: {{ .Values.kubeletDir }}/plugins
|
|
type: Directory
|
|
- name: mountpoint-dir
|
|
hostPath:
|
|
path: {{ .Values.kubeletDir }}/pods
|
|
type: DirectoryOrCreate
|
|
- name: host-dev
|
|
hostPath:
|
|
path: /dev
|
|
- name: host-mount
|
|
hostPath:
|
|
path: /run/mount
|
|
- name: host-sys
|
|
hostPath:
|
|
path: /sys
|
|
- name: lib-modules
|
|
hostPath:
|
|
path: /lib/modules
|
|
- name: ceph-csi-config
|
|
configMap:
|
|
name: {{ .Values.configMapName | quote }}
|
|
{{- if .Values.configMapKey }}
|
|
items:
|
|
- key: {{ .Values.configMapKey | quote }}
|
|
path: config.json
|
|
{{- end }}
|
|
- name: ceph-csi-encryption-kms-config
|
|
configMap:
|
|
name: {{ .Values.kmsConfigMapName | quote }}
|
|
- name: keys-tmp-dir
|
|
emptyDir: {
|
|
medium: "Memory"
|
|
}
|
|
{{- if .Values.nodeplugin.affinity }}
|
|
affinity:
|
|
{{ toYaml .Values.nodeplugin.affinity | indent 8 -}}
|
|
{{- end -}}
|
|
{{- if .Values.nodeplugin.nodeSelector }}
|
|
nodeSelector:
|
|
{{ toYaml .Values.nodeplugin.nodeSelector | indent 8 -}}
|
|
{{- end -}}
|
|
{{- if .Values.nodeplugin.tolerations }}
|
|
tolerations:
|
|
{{ toYaml .Values.nodeplugin.tolerations | indent 8 -}}
|
|
{{- end -}}
|