During disaster recovery/migration of a cluster, as part of the failover, the kubernetes artifacts like deployment, PVC, PV, etc will be restored to a new cluster by the admin. Even if the kubernetes objects are restored the corresponding RBD/CephFS subvolume cannot be retrieved during CSI operations as the clusterID and poolID are not the same in both clusters This PR creates a mapping between Cluster ID and RBD Pool ID between local cluster and peer cluster. Signed-off-by: Santosh Pillai <sapillai@redhat.com>
179 lines
5.9 KiB
YAML
179 lines
5.9 KiB
YAML
kind: DaemonSet
|
|
apiVersion: apps/v1
|
|
metadata:
|
|
name: csi-rbdplugin
|
|
namespace: {{ .Namespace }}
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: csi-rbdplugin
|
|
updateStrategy:
|
|
type: {{ .RBDPluginUpdateStrategy }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: csi-rbdplugin
|
|
contains: csi-rbdplugin-metrics
|
|
{{ range $key, $value := .CSIRBDPodLabels }}
|
|
{{ $key }}: "{{ $value }}"
|
|
{{ end }}
|
|
spec:
|
|
serviceAccountName: rook-csi-rbd-plugin-sa
|
|
{{ if .PluginPriorityClassName }}
|
|
priorityClassName: {{ .PluginPriorityClassName }}
|
|
{{ end }}
|
|
hostNetwork: {{ .EnableCSIHostNetwork }}
|
|
hostPID: true
|
|
# 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: {{ .RegistrarImage }}
|
|
args:
|
|
- "--v={{ .LogLevel }}"
|
|
- "--csi-address=/csi/csi.sock"
|
|
- "--kubelet-registration-path={{ .KubeletDirPath }}/plugins/{{ .DriverNamePrefix }}rbd.csi.ceph.com/csi.sock"
|
|
env:
|
|
- name: KUBE_NODE_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
volumeMounts:
|
|
- name: plugin-dir
|
|
mountPath: /csi
|
|
- name: registration-dir
|
|
mountPath: /registration
|
|
- name: csi-rbdplugin
|
|
securityContext:
|
|
privileged: true
|
|
capabilities:
|
|
add: ["SYS_ADMIN"]
|
|
allowPrivilegeEscalation: true
|
|
image: {{ .CSIPluginImage }}
|
|
args :
|
|
- "--nodeid=$(NODE_ID)"
|
|
- "--endpoint=$(CSI_ENDPOINT)"
|
|
- "--v={{ .LogLevel }}"
|
|
- "--type=rbd"
|
|
- "--nodeserver=true"
|
|
- "--drivername={{ .DriverNamePrefix }}rbd.csi.ceph.com"
|
|
- "--pidlimit=-1"
|
|
- "--metricsport={{ .RBDGRPCMetricsPort }}"
|
|
- "--metricspath=/metrics"
|
|
- "--enablegrpcmetrics={{ .EnableCSIGRPCMetrics }}"
|
|
- "--stagingpath={{ .KubeletDirPath }}/plugins/kubernetes.io/csi/pv/"
|
|
env:
|
|
- name: POD_IP
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: status.podIP
|
|
- name: NODE_ID
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
- name: POD_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
- name: CSI_ENDPOINT
|
|
value: unix:///csi/csi.sock
|
|
imagePullPolicy: "IfNotPresent"
|
|
volumeMounts:
|
|
- name: plugin-dir
|
|
mountPath: /csi
|
|
- name: pods-mount-dir
|
|
mountPath: "{{ .KubeletDirPath }}/pods"
|
|
mountPropagation: "Bidirectional"
|
|
- name: plugin-mount-dir
|
|
mountPath: "{{ .KubeletDirPath }}/plugins"
|
|
mountPropagation: "Bidirectional"
|
|
- mountPath: /dev
|
|
name: host-dev
|
|
- mountPath: /sys
|
|
name: host-sys
|
|
- mountPath: /lib/modules
|
|
name: lib-modules
|
|
readOnly: true
|
|
- name: ceph-csi-configs
|
|
mountPath: /etc/ceph-csi-config/
|
|
- name: keys-tmp-dir
|
|
mountPath: /tmp/csi/keys
|
|
- name: host-run-mount
|
|
mountPath: /run/mount
|
|
- name: liveness-prometheus
|
|
securityContext:
|
|
privileged: true
|
|
image: {{ .CSIPluginImage }}
|
|
args:
|
|
- "--type=liveness"
|
|
- "--endpoint=$(CSI_ENDPOINT)"
|
|
- "--metricsport={{ .RBDLivenessMetricsPort }}"
|
|
- "--metricspath=/metrics"
|
|
- "--polltime=60s"
|
|
- "--timeout=3s"
|
|
env:
|
|
- name: CSI_ENDPOINT
|
|
value: unix:///csi/csi.sock
|
|
- name: POD_IP
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: status.podIP
|
|
volumeMounts:
|
|
- name: plugin-dir
|
|
mountPath: /csi
|
|
imagePullPolicy: "IfNotPresent"
|
|
volumes:
|
|
- name: plugin-dir
|
|
hostPath:
|
|
path: "{{ .KubeletDirPath }}/plugins/{{ .DriverNamePrefix }}rbd.csi.ceph.com"
|
|
type: DirectoryOrCreate
|
|
- name: plugin-mount-dir
|
|
hostPath:
|
|
path: "{{ .KubeletDirPath }}/plugins"
|
|
type: Directory
|
|
- name: registration-dir
|
|
hostPath:
|
|
path: "{{ .KubeletDirPath }}/plugins_registry/"
|
|
type: Directory
|
|
- name: pods-mount-dir
|
|
hostPath:
|
|
path: "{{ .KubeletDirPath }}/pods"
|
|
type: Directory
|
|
- name: host-dev
|
|
hostPath:
|
|
path: /dev
|
|
- name: host-sys
|
|
hostPath:
|
|
path: /sys
|
|
- name: lib-modules
|
|
hostPath:
|
|
path: /lib/modules
|
|
- name: ceph-csi-configs
|
|
projected:
|
|
sources:
|
|
- name: ceph-csi-config
|
|
configMap:
|
|
name: rook-ceph-csi-config
|
|
items:
|
|
- key: csi-cluster-config-json
|
|
path: config.json
|
|
- name: ceph-csi-mapping-config
|
|
configMap:
|
|
name: rook-ceph-csi-mapping-config
|
|
items:
|
|
- key: csi-mapping-config-json
|
|
path: cluster-mapping.json
|
|
- name: keys-tmp-dir
|
|
emptyDir: {
|
|
medium: "Memory"
|
|
}
|
|
- name: host-run-mount
|
|
hostPath:
|
|
path: /run/mount
|