CSI: Add support for CSI volume expansion
This PR makes the necessary changes required for volume expansion support for both cephfs and rbd. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
1 parent
8c1a90ca01
commit
cf16184899
14 files changed
+94
-7
No files matched your search
@@ -19,8 +19,6 @@ For documentation on consuming the storage:
|
||||
* RBD: See the [Block Storage](ceph-block.md) topic
|
||||
* CephFS: See the [Shared Filesystem](ceph-filesystem.md) topic
|
||||
|
||||
The remainder of this topic is on the snapshotting feature of the RBD driver.
|
||||
|
||||
## RBD Snapshots
|
||||
|
||||
Since this feature is still in [alpha
|
||||
@@ -138,3 +136,22 @@ csi_liveness 1
|
||||
|
||||
Check the [monitoring doc](ceph-monitoring.md) to see how to integrate CSI
|
||||
liveness and grpc metrics into ceph monitoring.
|
||||
|
||||
## Dynamically Expand Volume
|
||||
|
||||
### Prerequisite
|
||||
|
||||
* For filesystem resize to be supported for your Kubernetes cluster, the
|
||||
kubernetes version running in your cluster should be >= v1.15 and for block
|
||||
volume resize support the Kubernetes version should be >= v1.16. Also,
|
||||
`ExpandCSIVolumes` feature gate has to be enabled for the volume resize
|
||||
functionality to work.
|
||||
|
||||
To expand the PVC the controlling StorageClass must have `allowVolumeExpansion`
|
||||
set to `true`. `csi.storage.k8s.io/controller-expand-secret-name` and
|
||||
`csi.storage.k8s.io/controller-expand-secret-namespace` values set in
|
||||
storageclass. Now expand the PVC by editing the PVC
|
||||
`pvc.spec.resource.requests.storage` to a higher values than the current size.
|
||||
Once PVC is expanded on backend and same is reflected size is reflected on
|
||||
application mountpoint, the status capacity `pvc.status.capacity.storage` of
|
||||
PVC will be updated to new size.
|
||||
@@ -134,6 +134,7 @@ The following tables lists the configurable parameters of the rook-operator char
|
||||
| `csi.rbdPluginUpdateStrategy` | CSI Rbd plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. | `OnDelete` |
|
||||
| `csi.cephFSPluginUpdateStrategy` | CSI CephFS plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. | `OnDelete` |
|
||||
| `csi.registrar.image` | Kubernetes CSI registrar image. | `quay.io/k8scsi/csi-node-driver-registrar:v1.2.0` |
|
||||
| `csi.resizer.image` | Kubernetes CSI resizer image. | `quay.io/k8scsi/csi-resizer:v0.4.0` |
|
||||
| `csi.provisioner.image` | Kubernetes CSI provisioner image. | `quay.io/k8scsi/csi-provisioner:v1.4.0` |
|
||||
| `csi.snapshotter.image` | Kubernetes CSI snapshotter image. | `quay.io/k8scsi/csi-snapshotter:v1.2.2` |
|
||||
| `csi.attacher.image` | Kubernetes CSI Attacher image. | `quay.io/k8scsi/csi-attacher:v2.1.0` |
|
||||
|
||||
@@ -152,6 +152,12 @@ spec:
|
||||
value: {{ .Values.csi.attacher.image | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.csi.resizer }}
|
||||
{{- if .Values.csi.resizer.image }}
|
||||
- name: ROOK_CSI_RESIZER_IMAGE
|
||||
value: {{ .Values.csi.resizer.image | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.csi.provisionerTolerations }}
|
||||
- name: CSI_PROVISIONER_TOLERATIONS
|
||||
value: {{ toYaml .Values.csi.provisionerTolerations | quote }}
|
||||
|
||||
@@ -98,6 +98,8 @@ csi:
|
||||
#image: quay.io/k8scsi/csi-snapshotter:v1.2.2
|
||||
#attacher:
|
||||
#image: quay.io/k8scsi/csi-attacher:v2.1.0
|
||||
#resizer:
|
||||
#image: quay.io/k8scsi/csi-resizer:v0.4.0
|
||||
|
||||
enableFlexDriver: false
|
||||
enableDiscoveryDaemon: true
|
||||
|
||||
@@ -1377,7 +1377,7 @@ rules:
|
||||
verbs: ["get", "list"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumes"]
|
||||
verbs: ["get", "list", "watch", "create", "delete", "update"]
|
||||
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims"]
|
||||
verbs: ["get", "list", "watch", "update"]
|
||||
@@ -1393,6 +1393,9 @@ rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["nodes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims/status"]
|
||||
verbs: ["update", "patch"]
|
||||
# OLM: END CSI CEPHFS CLUSTER ROLE
|
||||
# OLM: BEGIN CSI CEPHFS CLUSTER ROLEBINDING
|
||||
---
|
||||
@@ -1557,7 +1560,7 @@ rules:
|
||||
verbs: ["get", "list"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumes"]
|
||||
verbs: ["get", "list", "watch", "create", "delete", "update"]
|
||||
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims"]
|
||||
verbs: ["get", "list", "watch", "update"]
|
||||
@@ -1588,6 +1591,9 @@ rules:
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshots/status"]
|
||||
verbs: ["update"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims/status"]
|
||||
verbs: ["update", "patch"]
|
||||
# OLM: END CSI RBD CLUSTER ROLE
|
||||
# OLM: BEGIN CSI RBD CLUSTER ROLEBINDING
|
||||
---
|
||||
|
||||
@@ -22,6 +22,8 @@ parameters:
|
||||
# in the same namespace as the cluster.
|
||||
csi.storage.k8s.io/provisioner-secret-name: rook-csi-cephfs-provisioner
|
||||
csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
|
||||
csi.storage.k8s.io/controller-expand-secret-name: rook-csi-cephfs-provisioner
|
||||
csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph
|
||||
csi.storage.k8s.io/node-stage-secret-name: rook-csi-cephfs-node
|
||||
csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph
|
||||
|
||||
@@ -30,6 +32,7 @@ parameters:
|
||||
# or by setting the default mounter explicitly via --volumemounter command-line argument.
|
||||
# mounter: kernel
|
||||
reclaimPolicy: Delete
|
||||
allowVolumeExpansion: true
|
||||
mountOptions:
|
||||
# uncomment the following line for debugging
|
||||
#- debug
|
||||
@@ -31,6 +31,8 @@ parameters:
|
||||
# in the same namespace as the cluster.
|
||||
csi.storage.k8s.io/provisioner-secret-name: rook-csi-rbd-provisioner
|
||||
csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
|
||||
csi.storage.k8s.io/controller-expand-secret-name: rook-csi-rbd-provisioner
|
||||
csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph
|
||||
csi.storage.k8s.io/node-stage-secret-name: rook-csi-rbd-node
|
||||
csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph
|
||||
# Specify the filesystem type of the volume. If not specified, csi-provisioner
|
||||
@@ -38,4 +40,5 @@ parameters:
|
||||
csi.storage.k8s.io/fstype: ext4
|
||||
# uncomment the following to use rbd-nbd as mounter on supported nodes
|
||||
#mounter: rbd-nbd
|
||||
allowVolumeExpansion: true
|
||||
reclaimPolicy: Delete
|
||||
@@ -31,6 +31,8 @@ parameters:
|
||||
# in the same namespace as the cluster.
|
||||
csi.storage.k8s.io/provisioner-secret-name: rook-csi-rbd-provisioner
|
||||
csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
|
||||
csi.storage.k8s.io/controller-expand-secret-name: rook-csi-rbd-provisioner
|
||||
csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph
|
||||
csi.storage.k8s.io/node-stage-secret-name: rook-csi-rbd-node
|
||||
csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph
|
||||
# Specify the filesystem type of the volume. If not specified, csi-provisioner
|
||||
@@ -41,4 +43,5 @@ parameters:
|
||||
# issue that causes the mount to be disconnected. You will need to follow special upgrade steps
|
||||
# to restart your application pods. Therefore, this option is not recommended.
|
||||
#mounter: rbd-nbd
|
||||
allowVolumeExpansion: true
|
||||
reclaimPolicy: Delete
|
||||
+15
@@ -31,6 +31,21 @@ spec:
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
- name: csi-resizer
|
||||
image: {{ .ResizerImage }}
|
||||
args:
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- "--v=5"
|
||||
- "--csiTimeout=150s"
|
||||
- "--leader-election"
|
||||
- "--leader-election-namespace={{ .Namespace }}"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: unix:///csi/csi-provisioner.sock
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
- name: csi-provisioner
|
||||
image: {{ .ProvisionerImage }}
|
||||
args:
|
||||
|
||||
@@ -33,6 +33,21 @@ spec:
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
- name: csi-resizer
|
||||
image: {{ .ResizerImage }}
|
||||
args:
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- "--v=5"
|
||||
- "--csiTimeout=150s"
|
||||
- "--leader-election"
|
||||
- "--leader-election-namespace={{ .Namespace }}"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: unix:///csi/csi-provisioner.sock
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
- name: csi-rbdplugin-attacher
|
||||
image: {{ .AttacherImage }}
|
||||
args:
|
||||
|
||||
@@ -247,6 +247,8 @@ spec:
|
||||
# value: "quay.io/cephcsi/cephcsi:v2.0.0"
|
||||
#- name: ROOK_CSI_REGISTRAR_IMAGE
|
||||
# value: "quay.io/k8scsi/csi-node-driver-registrar:v1.2.0"
|
||||
#- name: ROOK_CSI_RESIZER_IMAGE
|
||||
# value: "quay.io/k8scsi/csi-resizer:v0.4.0"
|
||||
#- name: ROOK_CSI_PROVISIONER_IMAGE
|
||||
# value: "quay.io/k8scsi/csi-provisioner:v1.4.0"
|
||||
#- name: ROOK_CSI_SNAPSHOTTER_IMAGE
|
||||
|
||||
@@ -205,6 +205,8 @@ spec:
|
||||
# value: "quay.io/cephcsi/cephcsi:v2.0.0"
|
||||
#- name: ROOK_CSI_REGISTRAR_IMAGE
|
||||
# value: "quay.io/k8scsi/csi-node-driver-registrar:v1.2.0"
|
||||
#- name: ROOK_CSI_RESIZER_IMAGE
|
||||
# value: "quay.io/k8scsi/csi-resizer:v0.4.0"
|
||||
#- name: ROOK_CSI_PROVISIONER_IMAGE
|
||||
# value: "quay.io/k8scsi/csi-provisioner:v1.4.0"
|
||||
#- name: ROOK_CSI_SNAPSHOTTER_IMAGE
|
||||
|
||||
@@ -10,7 +10,7 @@ rules:
|
||||
verbs: ["get", "list"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumes"]
|
||||
verbs: ["get", "list", "watch", "create", "delete", "update"]
|
||||
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims"]
|
||||
verbs: ["get", "list", "watch", "update"]
|
||||
@@ -26,6 +26,9 @@ rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["nodes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims/status"]
|
||||
verbs: ["update", "patch"]
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
@@ -39,7 +42,7 @@ rules:
|
||||
verbs: ["get", "list"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumes"]
|
||||
verbs: ["get", "list", "watch", "create", "delete", "update"]
|
||||
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims"]
|
||||
verbs: ["get", "list", "watch", "update"]
|
||||
@@ -70,4 +73,6 @@ rules:
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshots/status"]
|
||||
verbs: ["update"]
|
||||
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims/status"]
|
||||
verbs: ["update", "patch"]
|
||||
@@ -40,6 +40,7 @@ type Param struct {
|
||||
ProvisionerImage string
|
||||
AttacherImage string
|
||||
SnapshotterImage string
|
||||
ResizerImage string
|
||||
DriverNamePrefix string
|
||||
EnableSnapshotter string
|
||||
EnableCSIGRPCMetrics string
|
||||
@@ -95,6 +96,7 @@ var (
|
||||
DefaultProvisionerImage = "quay.io/k8scsi/csi-provisioner:v1.4.0"
|
||||
DefaultAttacherImage = "quay.io/k8scsi/csi-attacher:v2.1.0"
|
||||
DefaultSnapshotterImage = "quay.io/k8scsi/csi-snapshotter:v1.2.2"
|
||||
defaultResizerImage = "quay.io/k8scsi/csi-resizer:v0.4.0"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -243,6 +245,11 @@ func StartCSIDrivers(namespace string, clientset kubernetes.Interface, ver *vers
|
||||
deployProvSTS = true
|
||||
}
|
||||
|
||||
tp.ResizerImage = os.Getenv("ROOK_CSI_RESIZER_IMAGE")
|
||||
if tp.ResizerImage == "" {
|
||||
tp.ResizerImage = defaultResizerImage
|
||||
}
|
||||
|
||||
if EnableRBD {
|
||||
rbdPlugin, err = templateToDaemonSet("rbdplugin", RBDPluginTemplatePath, tp)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user