Merge pull request #4714 from Madhu-1/log-level

CSI: Add LogLevel for csi templates
This commit is contained in:
Travis Nielsen authored and GitHub committed 2020-01-31 11:54:32 -07:00
commit 57fb7cda2e
12 files changed
+104 -72

No files matched your search

+53 -52
View File
@@ -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. | <none> |
| `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 | <none> |
| `discover.toleration` | Toleration for the discover pods | <none> |
| `discover.tolerationKey` | The specific key of the taint to tolerate | <none> |
| `discover.tolerations` | Array of tolerations in YAML format which will be added to discover deployment | <none> |
| `discover.nodeAffinity` | The node labels for affinity of `discover-agent` (***) | <none> |
| `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. | <none> |
| `csi.provisionerNodeAffinity` | The node labels for affinity of the CSI provisioner deployment (***) | <none> |
| `csi.pluginTolerations` | Array of tolerations in YAML format which will be added to Ceph CSI plugin DaemonSet | <none> |
| `csi.pluginNodeAffinity` | The node labels for affinity of the Ceph CSI plugin DaemonSet (***) | <none> |
| `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 (**) | <none> |
| `agent.mountSecurityMode` | Mount Security Mode for the agent. | `Any` |
| `agent.priorityClassName` | The priority class name to add to the agent pods | <none> |
| `agent.toleration` | Toleration for the agent pods | <none> |
| `agent.tolerationKey` | The specific key of the taint to tolerate | <none> |
| `agent.tolerations` | Array of tolerations in YAML format which will be added to agent deployment | <none> |
| `agent.nodeAffinity` | The node labels for affinity of `rook-agent` (***) | <none> |
| 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. | <none> |
| `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 | <none> |
| `discover.toleration` | Toleration for the discover pods | <none> |
| `discover.tolerationKey` | The specific key of the taint to tolerate | <none> |
| `discover.tolerations` | Array of tolerations in YAML format which will be added to discover deployment | <none> |
| `discover.nodeAffinity` | The node labels for affinity of `discover-agent` (***) | <none> |
| `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. | <none> |
| `csi.provisionerNodeAffinity` | The node labels for affinity of the CSI provisioner deployment (***) | <none> |
| `csi.pluginTolerations` | Array of tolerations in YAML format which will be added to Ceph CSI plugin DaemonSet | <none> |
| `csi.pluginNodeAffinity` | The node labels for affinity of the Ceph CSI plugin DaemonSet (***) | <none> |
| `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 (**) | <none> |
| `agent.mountSecurityMode` | Mount Security Mode for the agent. | `Any` |
| `agent.priorityClassName` | The priority class name to add to the agent pods | <none> |
| `agent.toleration` | Toleration for the agent pods | <none> |
| `agent.tolerationKey` | The specific key of the taint to tolerate | <none> |
| `agent.tolerations` | Array of tolerations in YAML format which will be added to agent deployment | <none> |
| `agent.nodeAffinity` | The node labels for affinity of `rook-agent` (***) | <none> |
&ast; For information on what to set `agent.flexVolumeDirPath` to, please refer to the [Rook flexvolume documentation](flexvolume.md)
@@ -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 }}"
+3
View File
@@ -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
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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
@@ -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
+16
View File
@@ -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 {