From 48a6e493e86255687f5de8f5898f25352da194e6 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Fri, 17 Jan 2020 12:27:35 +0530 Subject: [PATCH] CSI: Add LogLevel for csi templates Currently there is no option to turn on and off the log level verbosity in csi containers, This PR adds the functionality to select logging levels for csi containers. Fixes: #4690 Signed-off-by: Madhu Rajanna --- Documentation/helm-operator.md | 105 +++++++++--------- .../rook-ceph/templates/deployment.yaml | 4 + cluster/charts/rook-ceph/values.yaml | 3 + .../csi-cephfsplugin-provisioner-dep.yaml | 8 +- .../csi-cephfsplugin-provisioner-sts.yaml | 6 +- .../csi/template/cephfs/csi-cephfsplugin.yaml | 4 +- .../rbd/csi-rbdplugin-provisioner-dep.yaml | 10 +- .../rbd/csi-rbdplugin-provisioner-sts.yaml | 8 +- .../ceph/csi/template/rbd/csi-rbdplugin.yaml | 4 +- .../kubernetes/ceph/operator-openshift.yaml | 4 + .../examples/kubernetes/ceph/operator.yaml | 4 + pkg/operator/ceph/csi/spec.go | 16 +++ 12 files changed, 104 insertions(+), 72 deletions(-) diff --git a/Documentation/helm-operator.md b/Documentation/helm-operator.md index 1c3fbc06f..bae7ed902 100644 --- a/Documentation/helm-operator.md +++ b/Documentation/helm-operator.md @@ -95,58 +95,59 @@ The command removes all the Kubernetes components associated with the chart and The following tables lists the configurable parameters of the rook-operator chart and their default values. -| Parameter | Description | Default | -| -------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | -| `image.repository` | Image | `rook/ceph` | -| `image.tag` | Image tag | `master` | -| `image.pullPolicy` | Image pull policy | `IfNotPresent` | -| `rbacEnable` | If true, create & use RBAC resources | `true` | -| `pspEnable` | If true, create & use PSP resources | `true` | -| `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. | `[]` | -| `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` | -| `mon.healthCheckInterval` | The frequency for the operator to check the mon health | `45s` | -| `mon.monOutTimeout` | The time to wait before failing over an unhealthy mon | `600s` | -| `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` (***) | | -| `csi.enableRbdDriver` | Enable Ceph CSI RBD driver. | `true` | -| `csi.enableCephfsDriver` | Enable Ceph CSI CephFS driver. | `true` | -| `csi.enableGrpcMetrics` | Enable Ceph CSI GRPC Metrics. | `true` | -| `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 (***) | | -| `csi.pluginTolerations` | Array of tolerations in YAML format which will be added to Ceph CSI plugin DaemonSet | | -| `csi.pluginNodeAffinity` | The node labels for affinity of the Ceph CSI plugin DaemonSet (***) | | -| `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.rbdLivenessMetricsPort` | Ceph CSI RBD driver metrics port. | `8080` | -| `csi.enableSnapshotter` | Enable deployment of snapshotter container in ceph-csi provisioner. | `true` | -| `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:v2.0.0` | -| `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` | -| `agent.flexVolumeDirPath` | Path where the Rook agent discovers the flex volume plugins (*) | `/usr/libexec/kubernetes/kubelet-plugins/volume/exec/` | -| `agent.libModulesDirPath` | Path where the Rook agent should look for kernel modules (*) | `/lib/modules` | -| `agent.mounts` | Additional paths to be mounted in the agent container (**) | | -| `agent.mountSecurityMode` | Mount Security Mode for the agent. | `Any` | -| `agent.priorityClassName` | The priority class name to add to the agent pods | | -| `agent.toleration` | Toleration for the agent pods | | -| `agent.tolerationKey` | The specific key of the taint to tolerate | | -| `agent.tolerations` | Array of tolerations in YAML format which will be added to agent deployment | | -| `agent.nodeAffinity` | The node labels for affinity of `rook-agent` (***) | | +| Parameter | Description | Default | +| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | +| `image.repository` | Image | `rook/ceph` | +| `image.tag` | Image tag | `master` | +| `image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `rbacEnable` | If true, create & use RBAC resources | `true` | +| `pspEnable` | If true, create & use PSP resources | `true` | +| `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. | `[]` | +| `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` | +| `mon.healthCheckInterval` | The frequency for the operator to check the mon health | `45s` | +| `mon.monOutTimeout` | The time to wait before failing over an unhealthy mon | `600s` | +| `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` (***) | | +| `csi.enableRbdDriver` | Enable Ceph CSI RBD driver. | `true` | +| `csi.enableCephfsDriver` | Enable Ceph CSI CephFS driver. | `true` | +| `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.enableGrpcMetrics` | Enable Ceph CSI GRPC Metrics. | `true` | +| `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 (***) | | +| `csi.pluginTolerations` | Array of tolerations in YAML format which will be added to Ceph CSI plugin DaemonSet | | +| `csi.pluginNodeAffinity` | The node labels for affinity of the Ceph CSI plugin DaemonSet (***) | | +| `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.rbdLivenessMetricsPort` | Ceph CSI RBD driver metrics port. | `8080` | +| `csi.enableSnapshotter` | Enable deployment of snapshotter container in ceph-csi provisioner. | `true` | +| `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:v2.0.0` | +| `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` | +| `agent.flexVolumeDirPath` | Path where the Rook agent discovers the flex volume plugins (*) | `/usr/libexec/kubernetes/kubelet-plugins/volume/exec/` | +| `agent.libModulesDirPath` | Path where the Rook agent should look for kernel modules (*) | `/lib/modules` | +| `agent.mounts` | Additional paths to be mounted in the agent container (**) | | +| `agent.mountSecurityMode` | Mount Security Mode for the agent. | `Any` | +| `agent.priorityClassName` | The priority class name to add to the agent pods | | +| `agent.toleration` | Toleration for the agent pods | | +| `agent.tolerationKey` | The specific key of the taint to tolerate | | +| `agent.tolerations` | Array of tolerations in YAML format which will be added to agent deployment | | +| `agent.nodeAffinity` | The node labels for affinity of `rook-agent` (***) | | * For information on what to set `agent.flexVolumeDirPath` to, please refer to the [Rook flexvolume documentation](flexvolume.md) diff --git a/cluster/charts/rook-ceph/templates/deployment.yaml b/cluster/charts/rook-ceph/templates/deployment.yaml index 010e177aa..f80634f18 100644 --- a/cluster/charts/rook-ceph/templates/deployment.yaml +++ b/cluster/charts/rook-ceph/templates/deployment.yaml @@ -194,6 +194,10 @@ spec: - name: CSI_FORCE_CEPHFS_KERNEL_CLIENT value: {{ .Values.csi.forceCephFSKernelClient | quote }} {{- end }} +{{- if .Values.csi.logLevel }} + - name: CSI_LOG_LEVEL + value: {{ .Values.csi.logLevel | quote }} +{{- end }} {{- end }} - name: ROOK_ENABLE_FLEX_DRIVER value: "{{ .Values.enableFlexDriver }}" diff --git a/cluster/charts/rook-ceph/values.yaml b/cluster/charts/rook-ceph/values.yaml index 7ee24c0e4..d1c233c0a 100644 --- a/cluster/charts/rook-ceph/values.yaml +++ b/cluster/charts/rook-ceph/values.yaml @@ -58,6 +58,9 @@ csi: enableCephfsDriver: true enableGrpcMetrics: true enableSnapshotter: true + # Set logging level for csi containers. + # Supported values from 0 to 5. 0 for general useful logs, 5 for trace level verbosity. + #logLevel: 0 # CSI CephFS plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. # Default value is RollingUpdate. #rbdPluginUpdateStrategy: OnDelete diff --git a/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml b/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml index fdd06f4fe..1962c7439 100644 --- a/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml +++ b/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml @@ -19,7 +19,7 @@ spec: - name: csi-attacher image: {{ .AttacherImage }} args: - - "--v=5" + - "--v={{ .LogLevel }}" - "--csi-address=$(ADDRESS)" - "--leader-election=true" - "--timeout=150s" @@ -35,7 +35,7 @@ spec: image: {{ .ResizerImage }} args: - "--csi-address=$(ADDRESS)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--csiTimeout=150s" - "--leader-election" - "--leader-election-namespace={{ .Namespace }}" @@ -50,7 +50,7 @@ spec: image: {{ .ProvisionerImage }} args: - "--csi-address=$(ADDRESS)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--timeout=150s" - "--retry-interval-start=500ms" - "--enable-leader-election=true" @@ -69,7 +69,7 @@ spec: - "--nodeid=$(NODE_ID)" - "--type=cephfs" - "--endpoint=$(CSI_ENDPOINT)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--controllerserver=true" - "--drivername={{ .DriverNamePrefix }}cephfs.csi.ceph.com" - "--metadatastorage=k8s_configmap" diff --git a/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-sts.yaml b/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-sts.yaml index 6f10fdc93..cd79e0e8a 100644 --- a/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-sts.yaml +++ b/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-sts.yaml @@ -20,7 +20,7 @@ spec: - name: csi-attacher image: {{ .AttacherImage }} args: - - "--v=5" + - "--v={{ .LogLevel }}" - "--timeout=150s" - "--csi-address=$(ADDRESS)" env: @@ -34,7 +34,7 @@ spec: image: {{ .ProvisionerImage }} args: - "--csi-address=$(ADDRESS)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--timeout=150s" - "--retry-interval-start=500ms" env: @@ -50,7 +50,7 @@ spec: - "--nodeid=$(NODE_ID)" - "--type=cephfs" - "--endpoint=$(CSI_ENDPOINT)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--controllerserver=true" - "--drivername={{ .DriverNamePrefix }}cephfs.csi.ceph.com" - "--metadatastorage=k8s_configmap" diff --git a/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin.yaml b/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin.yaml index 5c3e66ba7..ed42a7a6f 100644 --- a/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin.yaml +++ b/cluster/examples/kubernetes/ceph/csi/template/cephfs/csi-cephfsplugin.yaml @@ -29,7 +29,7 @@ spec: privileged: true image: {{ .RegistrarImage }} args: - - "--v=5" + - "--v={{ .LogLevel }}" - "--csi-address=/csi/csi.sock" - "--kubelet-registration-path={{ .KubeletDirPath }}/plugins/{{ .DriverNamePrefix }}cephfs.csi.ceph.com/csi.sock" lifecycle: @@ -57,7 +57,7 @@ spec: - "--nodeid=$(NODE_ID)" - "--type=cephfs" - "--endpoint=$(CSI_ENDPOINT)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--nodeserver=true" - "--drivername={{ .DriverNamePrefix }}cephfs.csi.ceph.com" - "--metadatastorage=k8s_configmap" diff --git a/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml b/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml index 42e4958a6..233c61c68 100644 --- a/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml +++ b/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml @@ -20,7 +20,7 @@ spec: image: {{ .ProvisionerImage }} args: - "--csi-address=$(ADDRESS)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--timeout=150s" - "--retry-interval-start=500ms" - "--enable-leader-election=true" @@ -37,7 +37,7 @@ spec: image: {{ .ResizerImage }} args: - "--csi-address=$(ADDRESS)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--csiTimeout=150s" - "--leader-election" - "--leader-election-namespace={{ .Namespace }}" @@ -51,7 +51,7 @@ spec: - name: csi-rbdplugin-attacher image: {{ .AttacherImage }} args: - - "--v=5" + - "--v={{ .LogLevel }}" - "--timeout=150s" - "--csi-address=$(ADDRESS)" - "--leader-election=true" @@ -68,7 +68,7 @@ spec: image: {{ .SnapshotterImage }} args: - "--csi-address=$(ADDRESS)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--timeout=150s" - "--leader-election=true" - "--leader-election-namespace={{ .Namespace }}" @@ -85,7 +85,7 @@ spec: args : - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--type=rbd" - "--controllerserver=true" - "--drivername={{ .DriverNamePrefix }}rbd.csi.ceph.com" diff --git a/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin-provisioner-sts.yaml b/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin-provisioner-sts.yaml index cc6bed865..8d4c8056f 100644 --- a/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin-provisioner-sts.yaml +++ b/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin-provisioner-sts.yaml @@ -21,7 +21,7 @@ spec: image: {{ .ProvisionerImage }} args: - "--csi-address=$(ADDRESS)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--timeout=150s" - "--retry-interval-start=500ms" env: @@ -34,7 +34,7 @@ spec: - name: csi-rbdplugin-attacher image: {{ .AttacherImage }} args: - - "--v=5" + - "--v={{ .LogLevel }}" - "--timeout=150s" - "--csi-address=$(ADDRESS)" env: @@ -49,7 +49,7 @@ spec: image: {{ .SnapshotterImage }} args: - "--csi-address=$(ADDRESS)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--timeout=150s" env: - name: ADDRESS @@ -64,7 +64,7 @@ spec: args : - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--type=rbd" - "--controllerserver=true" - "--drivername={{ .DriverNamePrefix }}rbd.csi.ceph.com" diff --git a/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin.yaml b/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin.yaml index 655581c5b..d6cda8efa 100644 --- a/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin.yaml +++ b/cluster/examples/kubernetes/ceph/csi/template/rbd/csi-rbdplugin.yaml @@ -30,7 +30,7 @@ spec: privileged: true image: {{ .RegistrarImage }} args: - - "--v=5" + - "--v={{ .LogLevel }}" - "--csi-address=/csi/csi.sock" - "--kubelet-registration-path={{ .KubeletDirPath }}/plugins/{{ .DriverNamePrefix }}rbd.csi.ceph.com/csi.sock" lifecycle: @@ -57,7 +57,7 @@ spec: args : - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" - - "--v=5" + - "--v={{ .LogLevel }}" - "--type=rbd" - "--nodeserver=true" - "--drivername={{ .DriverNamePrefix }}rbd.csi.ceph.com" diff --git a/cluster/examples/kubernetes/ceph/operator-openshift.yaml b/cluster/examples/kubernetes/ceph/operator-openshift.yaml index ec767de99..11acd8f9a 100644 --- a/cluster/examples/kubernetes/ceph/operator-openshift.yaml +++ b/cluster/examples/kubernetes/ceph/operator-openshift.yaml @@ -235,6 +235,10 @@ spec: # Enable deployment of snapshotter container in ceph-csi provisioner - name: CSI_ENABLE_SNAPSHOTTER value: "true" + # Set logging level for csi containers. + # Supported values from 0 to 5. 0 for general useful logs, 5 for trace level verbosity. + #- name: CSI_LOG_LEVEL + # value: "0" # Enable Ceph Kernel clients on kernel < 4.17 which support quotas for Cephfs # If you disable the kernel client, your application may be disrupted during upgrade. # See the upgrade guide: https://rook.io/docs/rook/v1.2/ceph-upgrade.html diff --git a/cluster/examples/kubernetes/ceph/operator.yaml b/cluster/examples/kubernetes/ceph/operator.yaml index 67f26a3ac..66c68108e 100644 --- a/cluster/examples/kubernetes/ceph/operator.yaml +++ b/cluster/examples/kubernetes/ceph/operator.yaml @@ -185,6 +185,10 @@ spec: # Enable deployment of snapshotter container in ceph-csi provisioner. - name: CSI_ENABLE_SNAPSHOTTER value: "true" + # Set logging level for csi containers. + # Supported values from 0 to 5. 0 for general useful logs, 5 for trace level verbosity. + #- name: CSI_LOG_LEVEL + # value: "0" # Enable Ceph Kernel clients on kernel < 4.17 which support quotas for Cephfs # If you disable the kernel client, your application may be disrupted during upgrade. # See the upgrade guide: https://rook.io/docs/rook/v1.2/ceph-upgrade.html diff --git a/pkg/operator/ceph/csi/spec.go b/pkg/operator/ceph/csi/spec.go index bcba29721..9b32cbf0d 100644 --- a/pkg/operator/ceph/csi/spec.go +++ b/pkg/operator/ceph/csi/spec.go @@ -19,6 +19,7 @@ package csi import ( "fmt" "os" + "strconv" "strings" "github.com/pkg/errors" @@ -48,6 +49,7 @@ type Param struct { ForceCephFSKernelClient string CephFSPluginUpdateStrategy string RBDPluginUpdateStrategy string + LogLevel uint8 CephFSGRPCMetricsPort uint16 CephFSLivenessMetricsPort uint16 RBDGRPCMetricsPort uint16 @@ -131,6 +133,9 @@ const ( DefaultCephFSLivenessMerticsPort uint16 = 9081 DefaultRBDGRPCMerticsPort uint16 = 9090 DefaultRBDLivenessMerticsPort uint16 = 9080 + + // default log level for csi containers + defaultLogLevel uint8 = 0 ) func CSIEnabled() bool { @@ -259,6 +264,17 @@ func StartCSIDrivers(namespace string, clientset kubernetes.Interface, ver *vers logger.Warning("CSI Block volume expansion requires Kubernetes version >=1.16.0") } + logLevel := os.Getenv("CSI_LOG_LEVEL") + tp.LogLevel = defaultLogLevel + if logLevel != "" { + l, err := strconv.ParseUint(logLevel, 10, 8) + if err != nil { + logger.Errorf("failed to parse CSI_LOG_LEVEL. Defaulting to %d. %v", defaultLogLevel, err) + } else { + tp.LogLevel = uint8(l) + } + } + if EnableRBD { rbdPlugin, err = templateToDaemonSet("rbdplugin", RBDPluginTemplatePath, tp) if err != nil {