diff --git a/Documentation/helm-operator.md b/Documentation/helm-operator.md index 5eb1c5094..131502f46 100644 --- a/Documentation/helm-operator.md +++ b/Documentation/helm-operator.md @@ -79,6 +79,7 @@ The following tables lists the configurable parameters of the rook-operator char | `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.logLevel` | Set logging level for csi containers. Supported values from 0 to 5. 0 for general useful logs, 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` | diff --git a/deploy/charts/rook-ceph/templates/configmap.yaml b/deploy/charts/rook-ceph/templates/configmap.yaml index f5ec06fad..c39c6ee61 100644 --- a/deploy/charts/rook-ceph/templates/configmap.yaml +++ b/deploy/charts/rook-ceph/templates/configmap.yaml @@ -172,6 +172,9 @@ data: {{- if .Values.csi.logLevel }} CSI_LOG_LEVEL: {{ .Values.csi.logLevel | quote }} {{- end }} +{{- if .Values.csi.grpcTimeoutInSeconds }} + CSI_GRPC_TIMEOUT_SECONDS: {{ .Values.csi.grpcTimeoutInSeconds | quote }} +{{- end }} {{- if .Values.csi.provisionerReplicas }} CSI_PROVISIONER_REPLICAS: {{ .Values.csi.provisionerReplicas | quote }} {{- end }} diff --git a/deploy/charts/rook-ceph/values.yaml b/deploy/charts/rook-ceph/values.yaml index b28ecc0a4..9294e4952 100644 --- a/deploy/charts/rook-ceph/values.yaml +++ b/deploy/charts/rook-ceph/values.yaml @@ -110,6 +110,8 @@ csi: # CSI NFS plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. # Default value is RollingUpdate. #nfsPluginUpdateStrategy: OnDelete + # The CSI GRPC timeout value (in seconds). It should be >= 120. If this variable is not set or is an invalid value, it's default to 150. + grpcTimeoutInSeconds: 150 # Allow starting unsupported ceph-csi image allowUnsupportedVersion: false diff --git a/deploy/examples/operator-openshift.yaml b/deploy/examples/operator-openshift.yaml index ad0a83a80..d00d62485 100644 --- a/deploy/examples/operator-openshift.yaml +++ b/deploy/examples/operator-openshift.yaml @@ -494,6 +494,8 @@ data: # Enable the csi addons sidecar. CSI_ENABLE_CSIADDONS: "false" # ROOK_CSIADDONS_IMAGE: "quay.io/csiaddons/k8s-sidecar:v0.2.1" + # The GCSI RPC timeout value (in seconds). It should be >= 120. If this variable is not set or is an invalid value, it's default to 150. + CSI_GRPC_TIMEOUT_SECONDS: "150" --- # The deployment for the rook operator # OLM: BEGIN OPERATOR DEPLOYMENT diff --git a/deploy/examples/operator.yaml b/deploy/examples/operator.yaml index 966c0948d..568bd9958 100644 --- a/deploy/examples/operator.yaml +++ b/deploy/examples/operator.yaml @@ -416,6 +416,8 @@ data: # Enable the csi addons sidecar. CSI_ENABLE_CSIADDONS: "false" # ROOK_CSIADDONS_IMAGE: "quay.io/csiaddons/k8s-sidecar:v0.2.1" + # The CSI GRPC timeout value (in seconds). It should be >= 120. If this variable is not set or is an invalid value, it's default to 150. + CSI_GRPC_TIMEOUT_SECONDS: "150" --- # OLM: BEGIN OPERATOR DEPLOYMENT apiVersion: apps/v1 diff --git a/pkg/operator/ceph/csi/spec.go b/pkg/operator/ceph/csi/spec.go index 6511a02be..4949a6fde 100644 --- a/pkg/operator/ceph/csi/spec.go +++ b/pkg/operator/ceph/csi/spec.go @@ -54,6 +54,7 @@ type Param struct { ProvisionerPriorityClassName string VolumeReplicationImage string CSIAddonsImage string + GRPCTimeout time.Duration EnablePluginSelinuxHostMount bool EnableCSIHostNetwork bool EnableOMAPGenerator bool @@ -197,6 +198,9 @@ const ( // default log level for csi containers defaultLogLevel uint8 = 0 + // GRPC timeout. + defaultGRPCTimeout = 150 + grpcTimeout = "CSI_GRPC_TIMEOUT_SECONDS" // default provisioner replicas defaultProvisionerReplicas int32 = 2 @@ -286,6 +290,19 @@ func (r *ReconcileCSI) startDrivers(ver *version.Info, ownerInfo *k8sutil.OwnerI tp.ForceCephFSKernelClient = "true" } + // parese RPC timeout + timeout := k8sutil.GetValue(r.opConfig.Parameters, grpcTimeout, "150") + timeoutSeconds, err := strconv.Atoi(timeout) + if err != nil { + logger.Errorf("failed to parse %q. Defaulting to %d. %v", grpcTimeout, defaultGRPCTimeout, err) + timeoutSeconds = defaultGRPCTimeout + } + if timeoutSeconds < 120 { + logger.Warningf("%s is %q but it should be >= 120, setting the default value %d", grpcTimeout, timeout, defaultGRPCTimeout) + timeoutSeconds = defaultGRPCTimeout + } + tp.GRPCTimeout = time.Duration(timeoutSeconds) * time.Second + // parse GRPC and Liveness ports tp.CephFSGRPCMetricsPort, err = getPortFromConfig(r.opConfig.Parameters, "CSI_CEPHFS_GRPC_METRICS_PORT", DefaultCephFSGRPCMerticsPort) if err != nil { diff --git a/pkg/operator/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml b/pkg/operator/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml index e12918461..702cb948b 100644 --- a/pkg/operator/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml +++ b/pkg/operator/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml @@ -28,7 +28,7 @@ spec: - "--v={{ .LogLevel }}" - "--csi-address=$(ADDRESS)" - "--leader-election=true" - - "--timeout=150s" + - "--timeout={{ .GRPCTimeout }}" - "--leader-election-namespace={{ .Namespace }}" env: - name: ADDRESS @@ -43,7 +43,7 @@ spec: args: - "--csi-address=$(ADDRESS)" - "--v={{ .LogLevel }}" - - "--timeout=150s" + - "--timeout={{ .GRPCTimeout }}" - "--leader-election=true" - "--leader-election-namespace={{ .Namespace }}" env: @@ -59,7 +59,7 @@ spec: args: - "--csi-address=$(ADDRESS)" - "--v={{ .LogLevel }}" - - "--timeout=150s" + - "--timeout={{ .GRPCTimeout }}" - "--leader-election" - "--leader-election-namespace={{ .Namespace }}" - "--handle-volume-inuse-error=false" @@ -75,7 +75,7 @@ spec: args: - "--csi-address=$(ADDRESS)" - "--v={{ .LogLevel }}" - - "--timeout=150s" + - "--timeout={{ .GRPCTimeout }}" - "--retry-interval-start=500ms" - "--leader-election=true" - "--leader-election-namespace={{ .Namespace }}" diff --git a/pkg/operator/ceph/csi/template/nfs/csi-nfsplugin-provisioner-dep.yaml b/pkg/operator/ceph/csi/template/nfs/csi-nfsplugin-provisioner-dep.yaml index d9ab7b292..22ddb1938 100644 --- a/pkg/operator/ceph/csi/template/nfs/csi-nfsplugin-provisioner-dep.yaml +++ b/pkg/operator/ceph/csi/template/nfs/csi-nfsplugin-provisioner-dep.yaml @@ -26,7 +26,7 @@ spec: args: - "--csi-address=$(ADDRESS)" - "--v={{ .LogLevel }}" - - "--timeout=150s" + - "--timeout={{ .GRPCTimeout }}" - "--retry-interval-start=500ms" - "--leader-election=true" - "--leader-election-namespace={{ .Namespace }}" diff --git a/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml b/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml index f0432742e..f24abd18a 100644 --- a/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml +++ b/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml @@ -27,7 +27,7 @@ spec: args: - "--csi-address=$(ADDRESS)" - "--v={{ .LogLevel }}" - - "--timeout=150s" + - "--timeout={{ .GRPCTimeout }}" - "--retry-interval-start=500ms" - "--leader-election=true" - "--leader-election-namespace={{ .Namespace }}" @@ -45,7 +45,7 @@ spec: args: - "--csi-address=$(ADDRESS)" - "--v={{ .LogLevel }}" - - "--timeout=150s" + - "--timeout={{ .GRPCTimeout }}" - "--leader-election" - "--leader-election-namespace={{ .Namespace }}" - "--handle-volume-inuse-error=false" @@ -60,7 +60,7 @@ spec: image: {{ .AttacherImage }} args: - "--v={{ .LogLevel }}" - - "--timeout=150s" + - "--timeout={{ .GRPCTimeout }}" - "--csi-address=$(ADDRESS)" - "--leader-election=true" - "--leader-election-namespace={{ .Namespace }}" @@ -77,7 +77,7 @@ spec: args: - "--csi-address=$(ADDRESS)" - "--v={{ .LogLevel }}" - - "--timeout=150s" + - "--timeout={{ .GRPCTimeout }}" - "--leader-election=true" - "--leader-election-namespace={{ .Namespace }}" env: @@ -116,7 +116,7 @@ spec: - "--leader-election-namespace={{ .Namespace }}" - "--driver-name={{ .DriverNamePrefix }}rbd.csi.ceph.com" - "--csi-address=$(ADDRESS)" - - "--rpc-timeout=150s" + - "--rpc-timeout={{ .GRPCTimeout }}" - "--health-probe-bind-address=:9998" - "--leader-elect=true" env: