From c424b3c42e05e7e257132aa2a0a4001fd5c0fa82 Mon Sep 17 00:00:00 2001 From: Shinya Hayashi Date: Thu, 10 Nov 2022 07:22:53 +0000 Subject: [PATCH] csi: add a parameter to modify the maxUnavailable value of rbd daemonset The default value of maxUnavailable of daemonset is 1. Sometimes the upgrade can be slow due to this setting. So I add a parameter to change the value for rbd daemonset. Signed-off-by: Shinya Hayashi Co-authored-by: Toshikuni Fukaya Co-authored-by: Yuji Ito (cherry picked from commit ac4b47d71a9ae5e605e02d31532bff20580d5a4f) # Conflicts: # Documentation/Helm-Charts/operator-chart.md --- Documentation/Helm-Charts/operator-chart.md | 102 ++++++++++++++++++ .../charts/rook-ceph/templates/configmap.yaml | 3 + deploy/charts/rook-ceph/values.yaml | 3 + deploy/examples/operator-openshift.yaml | 3 + deploy/examples/operator.yaml | 3 + pkg/operator/ceph/csi/csi.go | 3 + pkg/operator/ceph/csi/spec.go | 91 ++++++++-------- .../ceph/csi/template/rbd/csi-rbdplugin.yaml | 4 + 8 files changed, 167 insertions(+), 45 deletions(-) diff --git a/Documentation/Helm-Charts/operator-chart.md b/Documentation/Helm-Charts/operator-chart.md index 04acd4466..a30cd7586 100644 --- a/Documentation/Helm-Charts/operator-chart.md +++ b/Documentation/Helm-Charts/operator-chart.md @@ -41,6 +41,7 @@ For example settings, see the next section or [values.yaml](https://github.com/r The following tables lists the configurable parameters of the rook-operator chart and their default values. +<<<<<<< HEAD | Parameter | Description | Default | | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | | `image.repository` | Image | `rook/ceph` | @@ -139,6 +140,107 @@ The following tables lists the configurable parameters of the rook-operator char | `csi.csiRBDPluginVolumeMount` | The volume mounts of the CephCSI RBD plugin DaemonSet | `` | | `csi.csiCephFSPluginVolume` | The volume of the CephCSI CephFS plugin DaemonSet | `` | | `csi.csiCephFSPluginVolumeMount` | The volume mounts of the CephCSI CephFS plugin DaemonSet | `` | +======= +| Parameter | Description | Default | +| ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | +| `image.repository` | Image | `rook/ceph` | +| `image.tag` | Image tag | `master` | +| `image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `crds.enabled` | If true, the helm chart will create the Rook CRDs. Do NOT change to `false` in a running cluster or CRs will be deleted! | `true` | +| `rbacEnable` | If true, create & use RBAC resources | `true` | +| `pspEnable` | If true, create & use PSP resources | `false` | +| `resources` | Pod resource requests & limits | `{}` | +| `annotations` | Pod annotations | `{}` | +| `logLevel` | Global log level | `INFO` | +| `nodeSelector` | Kubernetes `nodeSelector` to add to the Deployment. | `` | +| `tolerations` | List of Kubernetes `tolerations` to add to the Deployment. | `[]` | +| `unreachableNodeTolerationSeconds` | Delay to use for the node.kubernetes.io/unreachable pod failure toleration to override the Kubernetes default of 5 minutes | `5s` | +| `currentNamespaceOnly` | Whether the operator should watch cluster CRD in its own namespace or not | `false` | +| `hostpathRequiresPrivileged` | Runs Ceph Pods as privileged to be able to write to `hostPath`s in OpenShift with SELinux restrictions. | `false` | +| `allowLoopDevices` | If true, loop devices are allowed to be used for osds in test clusters | `false` | +| `discover.priorityClassName` | The priority class name to add to the discover pods | `` | +| `discover.toleration` | Toleration for the discover pods | `` | +| `discover.tolerationKey` | The specific key of the taint to tolerate | `` | +| `discover.tolerations` | Array of tolerations in YAML format which will be added to discover deployment | `` | +| `discover.nodeAffinity` | The node labels for affinity of `discover-agent` [^1] | `` | +| `discover.podLabels` | Labels to add to the discover pods. | `` | +| `discover.resources` | Add resources to discover daemon pods. | `` | +| `csi.enableRbdDriver` | Enable Ceph CSI RBD driver. | `true` | +| `csi.enableCephfsDriver` | Enable Ceph CSI CephFS driver. | `true` | +| `csi.enableCephfsSnapshotter` | Enable Snapshotter in CephFS provisioner pod. | `true` | +| `csi.enableNFSSnapshotter` | Enable Snapshotter in NFS provisioner pod. | `true` | +| `csi.enableRBDSnapshotter` | Enable Snapshotter in RBD provisioner pod. | `true` | +| `csi.pluginPriorityClassName` | PriorityClassName to be set on csi driver plugin pods. | `` | +| `csi.provisionerPriorityClassName` | PriorityClassName to be set on csi driver provisioner pods. | `` | +| `csi.enableOMAPGenerator` | EnableOMAP generator deploys omap sidecar in CSI provisioner pod, to enable it set it to true | `false` | +| `csi.rbdFSGroupPolicy` | Policy for modifying a volume's ownership or permissions when the RBD PVC is being mounted | `ReadWriteOnceWithFSType` | +| `csi.cephFSFSGroupPolicy` | Policy for modifying a volume's ownership or permissions when the CephFS PVC is being mounted | `ReadWriteOnceWithFSType` | +| `csi.nfsFSGroupPolicy` | Policy for modifying a volume's ownership or permissions when the NFS PVC is being mounted | `ReadWriteOnceWithFSType` | +| `csi.enableMetadata` | Set volume metadata on the CephFS subvolumes and RBD images. | `false` | +| `csi.clusterName` | Cluster name identifier to set as metadata on the CephFS subvolumes and RBD images. | `` | +| `csi.logLevel` | Set logging level for cephCSI containers maintained by the cephCSI. Supported values from 0 to 5. 0 for general useful logs, 5 for trace level verbosity. | `0` | +| `csi.sidecarLogLevel` | Set logging level for cephCSI sidecar containers. Supported values from 0 to 5. 0 for general useful logs (the default), 5 for trace level verbosity. | `0` | +| `csi.grpcTimeoutInSeconds` | Set GRPC timeout for csi containers. | `150` | +| `csi.provisionerReplicas` | Set replicas for csi provisioner deployment. | `2` | +| `csi.enableGrpcMetrics` | Enable Ceph CSI GRPC Metrics. | `false` | +| `csi.enableCSIHostNetwork` | Enable Host Networking for Ceph CSI nodeplugins. | `false` | +| `csi.enablePluginSelinuxHostMount` | Enable Host mount for /etc/selinux directory for Ceph CSI nodeplugins. | `false` | +| `csi.enableCSIEncryption` | Enable Ceph CSI PVC encryption support. | `false` | +| `csi.provisionerTolerations` | Array of tolerations in YAML format which will be added to CSI provisioner deployment. | `` | +| `csi.provisionerNodeAffinity` | The node labels for affinity of the CSI provisioner deployment [^1] | `` | +| `csi.pluginTolerations` | Array of tolerations in YAML format which will be added to CephCSI plugin DaemonSet | `` | +| `csi.pluginNodeAffinity` | The node labels for affinity of the CephCSI plugin DaemonSet [^1] | `` | +| `csi.rbdProvisionerTolerations` | Array of tolerations in YAML format which will be added to CephCSI RBD provisioner deployment. | `` | +| `csi.rbdProvisionerNodeAffinity` | The node labels for affinity of the CephCSI RBD provisioner deployment [^1] | `` | +| `csi.rbdPluginTolerations` | Array of tolerations in YAML format which will be added to CephCSI RBD plugin DaemonSet | `` | +| `csi.rbdPluginNodeAffinity` | The node labels for affinity of the CephCSI RBD plugin DaemonSet [^1] | `` | +| `csi.cephFSProvisionerTolerations` | Array of tolerations in YAML format which will be added to CephCSI CephFS provisioner deployment. | `` | +| `csi.cephFSProvisionerNodeAffinity` | The node labels for affinity of the CephCSI CephFS provisioner deployment [^1] | `` | +| `csi.cephFSPluginTolerations` | Array of tolerations in YAML format which will be added to CephCSI CephFS plugin DaemonSet | `` | +| `csi.cephFSPluginNodeAffinity` | The node labels for affinity of the CephCSI CephFS plugin DaemonSet [^1] | `` | +| `csi.nfsProvisionerTolerations` | Array of tolerations in YAML format which will be added to CephCSI NFS provisioner deployment. | `` | +| `csi.nfsProvisionerNodeAffinity` | The node labels for affinity of the CephCSI NFS provisioner deployment [^1] | `` | +| `csi.nfsPluginTolerations` | Array of tolerations in YAML format which will be added to CephCSI NFS plugin DaemonSet | `` | +| `csi.nfsPluginNodeAffinity` | The node labels for affinity of the CephCSI NFS plugin DaemonSet [^1] | `` | +| `csi.csiRBDProvisionerResource` | CEPH CSI RBD provisioner resource requirement list. | `` | +| `csi.csiRBDPluginResource` | CEPH CSI RBD plugin resource requirement list. | `` | +| `csi.csiCephFSProvisionerResource` | CEPH CSI CephFS provisioner resource requirement list. | `` | +| `csi.csiCephFSPluginResource` | CEPH CSI CephFS plugin resource requirement list. | `` | +| `csi.csiNFSProvisionerResource` | CEPH CSI NFS provisioner resource requirement list. | `` | +| `csi.csiNFSPluginResource` | CEPH CSI NFS plugin resource requirement list. | `` | +| `csi.cephfsGrpcMetricsPort` | CSI CephFS driver GRPC metrics port. | `9091` | +| `csi.cephfsLivenessMetricsPort` | CSI CephFS driver metrics port. | `9081` | +| `csi.rbdGrpcMetricsPort` | Ceph CSI RBD driver GRPC metrics port. | `9090` | +| `csi.csiAddonsPort` | CSI Addons server port. | `9070` | +| `csi.rbdLivenessMetricsPort` | Ceph CSI RBD driver metrics port. | `8080` | +| `csi.enableLiveness` | Enable Ceph CSI Liveness sidecar deployment. | `false` | +| `csi.forceCephFSKernelClient` | Enable Ceph Kernel clients on kernel < 4.17 which support quotas for Cephfs. | `true` | +| `csi.kubeletDirPath` | Kubelet root directory path (if the Kubelet uses a different path for the `--root-dir` flag) | `/var/lib/kubelet` | +| `csi.cephcsi.image` | Ceph CSI image. | `quay.io/cephcsi/cephcsi:v3.7.2` | +| `csi.rbdPluginUpdateStrategy` | CSI Rbd plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. | `RollingUpdate` | +| `csi.rbdPluginUpdateStrategyMaxUnavailable` | A maxUnavailable parameter of CSI RBD plugin daemonset update strategy. | `1` | +| `csi.cephFSPluginUpdateStrategy` | CSI CephFS plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. | `RollingUpdate` | +| `csi.nfsPluginUpdateStrategy` | CSI NFS plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. | `RollingUpdate` | +| `csi.registrar.image` | Kubernetes CSI registrar image. | `registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.5.1` | +| `csi.resizer.image` | Kubernetes CSI resizer image. | `registry.k8s.io/sig-storage/csi-resizer:v1.6.0` | +| `csi.provisioner.image` | Kubernetes CSI provisioner image. | `registry.k8s.io/sig-storage/csi-provisioner:v3.3.0` | +| `csi.snapshotter.image` | Kubernetes CSI snapshotter image. | `registry.k8s.io/sig-storage/csi-snapshotter:v6.1.0` | +| `csi.attacher.image` | Kubernetes CSI Attacher image. | `registry.k8s.io/sig-storage/csi-attacher:v4.0.0` | +| `csi.cephfsPodLabels` | Labels to add to the CSI CephFS Pods. | `` | +| `csi.rbdPodLabels` | Labels to add to the CSI RBD Pods. | `` | +| `csi.csiAddons.enabled` | Enable CSIAddons | `false` | +| `csi.csiAddons.image` | CSIAddons Sidecar image. | `quay.io/csiaddons/k8s-sidecar:v0.5.0` | +| `csi.topology.enabled` | Enable topology based provisioning. | `false` | +| `csi.topology.domainLabels` | domainLabels define which node labels to use as domains for CSI nodeplugins to advertise their domains. | `` | +| `csi.nfs.enabled` | Enable nfs driver. | `false` | +| `admissionController.tolerations` | Array of tolerations in YAML format which will be added to admission controller deployment. | `` | +| `admissionController.nodeAffinity` | The node labels for affinity of the admission controller deployment [^1] | `` | +| `monitoring.enabled` | Create necessary RBAC rules for Rook to integrate with Prometheus monitoring in the operator namespace. Requires Prometheus to be pre-installed. | `false` | +| `csi.csiRBDPluginVolume` | The volume of the CephCSI RBD plugin DaemonSet | `` | +| `csi.csiRBDPluginVolumeMount` | The volume mounts of the CephCSI RBD plugin DaemonSet | `` | +| `csi.csiCephFSPluginVolume` | The volume of the CephCSI CephFS plugin DaemonSet | `` | +| `csi.csiCephFSPluginVolumeMount` | The volume mounts of the CephCSI CephFS plugin DaemonSet | `` | +>>>>>>> ac4b47d71 (csi: add a parameter to modify the maxUnavailable value of rbd daemonset) [^1]: `nodeAffinity` and `*NodeAffinity` options should have the format `"role=storage,rook; storage=ceph"` or `storage=;role=rook-example` or `storage=;` (_checks only for presence of key_) diff --git a/deploy/charts/rook-ceph/templates/configmap.yaml b/deploy/charts/rook-ceph/templates/configmap.yaml index 9ca512f23..4f16f6221 100644 --- a/deploy/charts/rook-ceph/templates/configmap.yaml +++ b/deploy/charts/rook-ceph/templates/configmap.yaml @@ -44,6 +44,9 @@ data: {{- if .Values.csi.rbdPluginUpdateStrategy }} CSI_RBD_PLUGIN_UPDATE_STRATEGY: {{ .Values.csi.rbdPluginUpdateStrategy | quote }} {{- end }} +{{- if .Values.csi.rbdPluginUpdateStrategyMaxUnavailable }} + CSI_RBD_PLUGIN_UPDATE_STRATEGY_MAX_UNAVAILABLE: {{ .Values.csi.rbdPluginUpdateStrategyMaxUnavailable | quote }} +{{- end }} {{- if .Values.csi.kubeletDirPath }} ROOK_CSI_KUBELET_DIR_PATH: {{ .Values.csi.kubeletDirPath | quote }} {{- end }} diff --git a/deploy/charts/rook-ceph/values.yaml b/deploy/charts/rook-ceph/values.yaml index cc8094da2..d9f0022d5 100644 --- a/deploy/charts/rook-ceph/values.yaml +++ b/deploy/charts/rook-ceph/values.yaml @@ -123,6 +123,9 @@ csi: # CSI RBD plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. # Default value is RollingUpdate. #rbdPluginUpdateStrategy: OnDelete + # A maxUnavailable parameter of CSI RBD plugin daemonset update strategy. + # Default value is 1. + #rbdPluginUpdateStrategyMaxUnavailable: "1" # CSI CephFS plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. # Default value is RollingUpdate. #cephFSPluginUpdateStrategy: OnDelete diff --git a/deploy/examples/operator-openshift.yaml b/deploy/examples/operator-openshift.yaml index d584f3739..c7cd1dd35 100644 --- a/deploy/examples/operator-openshift.yaml +++ b/deploy/examples/operator-openshift.yaml @@ -209,6 +209,9 @@ data: # CSI RBD plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. # Default value is RollingUpdate. # CSI_RBD_PLUGIN_UPDATE_STRATEGY: "OnDelete" + # A maxUnavailable parameter of CSI RBD plugin daemonset update strategy. + # Default value is 1. + # CSI_RBD_PLUGIN_UPDATE_STRATEGY_MAX_UNAVAILABLE: "1" # CSI NFS plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. # Default value is RollingUpdate. diff --git a/deploy/examples/operator.yaml b/deploy/examples/operator.yaml index 8505a3782..8ca334b51 100644 --- a/deploy/examples/operator.yaml +++ b/deploy/examples/operator.yaml @@ -129,6 +129,9 @@ data: # CSI RBD plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. # Default value is RollingUpdate. # CSI_RBD_PLUGIN_UPDATE_STRATEGY: "OnDelete" + # A maxUnavailable parameter of CSI RBD plugin daemonset update strategy. + # Default value is 1. + # CSI_RBD_PLUGIN_UPDATE_STRATEGY_MAX_UNAVAILABLE: "1" # CSI NFS plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. # Default value is RollingUpdate. diff --git a/pkg/operator/ceph/csi/csi.go b/pkg/operator/ceph/csi/csi.go index fc2e9e331..92c96fea7 100644 --- a/pkg/operator/ceph/csi/csi.go +++ b/pkg/operator/ceph/csi/csi.go @@ -201,10 +201,13 @@ func (r *ReconcileCSI) setParams(ver *version.Info) error { CSIParam.NFSPluginUpdateStrategy = rollingUpdate } + // Default values are based on Kubernetes official documentation. + // https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/#daemonset-update-strategy if strings.EqualFold(k8sutil.GetValue(r.opConfig.Parameters, "CSI_RBD_PLUGIN_UPDATE_STRATEGY", rollingUpdate), onDelete) { CSIParam.RBDPluginUpdateStrategy = onDelete } else { CSIParam.RBDPluginUpdateStrategy = rollingUpdate + CSIParam.RBDPluginUpdateStrategyMaxUnavailable = k8sutil.GetValue(r.opConfig.Parameters, "CSI_RBD_PLUGIN_UPDATE_STRATEGY_MAX_UNAVAILABLE", "1") } CSIParam.EnablePluginSelinuxHostMount = false diff --git a/pkg/operator/ceph/csi/spec.go b/pkg/operator/ceph/csi/spec.go index a19ac4d00..3f351831b 100644 --- a/pkg/operator/ceph/csi/spec.go +++ b/pkg/operator/ceph/csi/spec.go @@ -40,51 +40,52 @@ import ( ) type Param struct { - CSIPluginImage string - RegistrarImage string - ProvisionerImage string - AttacherImage string - SnapshotterImage string - ResizerImage string - DriverNamePrefix string - EnableCSIGRPCMetrics string - KubeletDirPath string - ForceCephFSKernelClient string - CephFSPluginUpdateStrategy string - NFSPluginUpdateStrategy string - RBDPluginUpdateStrategy string - PluginPriorityClassName string - ProvisionerPriorityClassName string - VolumeReplicationImage string - CSIAddonsImage string - ImagePullPolicy string - CSIClusterName string - CSIDomainLabels string - GRPCTimeout time.Duration - CSIEnableMetadata bool - EnablePluginSelinuxHostMount bool - EnableCSIHostNetwork bool - EnableOMAPGenerator bool - EnableRBDSnapshotter bool - EnableCephFSSnapshotter bool - EnableNFSSnapshotter bool - EnableCSIAddonsSideCar bool - MountCustomCephConf bool - EnableOIDCTokenProjection bool - EnableCSIEncryption bool - EnableCSITopology bool - EnableLiveness bool - LogLevel uint8 - SidecarLogLevel uint8 - CephFSGRPCMetricsPort uint16 - CephFSLivenessMetricsPort uint16 - RBDGRPCMetricsPort uint16 - CSIAddonsPort uint16 - RBDLivenessMetricsPort uint16 - ProvisionerReplicas int32 - CSICephFSPodLabels map[string]string - CSINFSPodLabels map[string]string - CSIRBDPodLabels map[string]string + CSIPluginImage string + RegistrarImage string + ProvisionerImage string + AttacherImage string + SnapshotterImage string + ResizerImage string + DriverNamePrefix string + EnableCSIGRPCMetrics string + KubeletDirPath string + ForceCephFSKernelClient string + CephFSPluginUpdateStrategy string + NFSPluginUpdateStrategy string + RBDPluginUpdateStrategy string + RBDPluginUpdateStrategyMaxUnavailable string + PluginPriorityClassName string + ProvisionerPriorityClassName string + VolumeReplicationImage string + CSIAddonsImage string + ImagePullPolicy string + CSIClusterName string + CSIDomainLabels string + GRPCTimeout time.Duration + CSIEnableMetadata bool + EnablePluginSelinuxHostMount bool + EnableCSIHostNetwork bool + EnableOMAPGenerator bool + EnableRBDSnapshotter bool + EnableCephFSSnapshotter bool + EnableNFSSnapshotter bool + EnableCSIAddonsSideCar bool + MountCustomCephConf bool + EnableOIDCTokenProjection bool + EnableCSIEncryption bool + EnableCSITopology bool + EnableLiveness bool + LogLevel uint8 + SidecarLogLevel uint8 + CephFSGRPCMetricsPort uint16 + CephFSLivenessMetricsPort uint16 + RBDGRPCMetricsPort uint16 + CSIAddonsPort uint16 + RBDLivenessMetricsPort uint16 + ProvisionerReplicas int32 + CSICephFSPodLabels map[string]string + CSINFSPodLabels map[string]string + CSIRBDPodLabels map[string]string } type templateParam struct { diff --git a/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin.yaml b/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin.yaml index 30a1769e1..6f70adaf7 100644 --- a/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin.yaml +++ b/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin.yaml @@ -9,6 +9,10 @@ spec: app: csi-rbdplugin updateStrategy: type: {{ .RBDPluginUpdateStrategy }} + {{ if eq .RBDPluginUpdateStrategy "RollingUpdate" }} + rollingUpdate: + maxUnavailable: {{ .RBDPluginUpdateStrategyMaxUnavailable }} + {{ end }} template: metadata: labels: