diff --git a/charts/csi-baremetal-deployment/templates/configmap/node-config.yaml b/charts/csi-baremetal-deployment/templates/configmap/node-config.yaml new file mode 100644 index 00000000..76d450c7 --- /dev/null +++ b/charts/csi-baremetal-deployment/templates/configmap/node-config.yaml @@ -0,0 +1,29 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + namespace: {{ .Release.Namespace }} + name: node-config + labels: + app: csi-baremetal-node +data: + wbt-config.yaml: |- + enable: true + wbt_lat_usec_value: 0 + acceptable_volume_options: + # Values - FS, RAW, RAWPART + # Block volumes don't take any impact from WBT + modes: + - FS + # Name from "kubectl get sc" + # It is risky to change WBT settings for LVG Volumes + storage_classes: + - csi-baremetal-sc-hdd + - csi-baremetal-sc-ssd + - csi-baremetal-sc-nvme + wbt-acceptable_kernels.yaml: |- + enable_for_all: false + # The list of acceptable kernel versions + # Used only if enable_for_all is false + node_kernel_versions: + # RHEL 8 + - 4.18.0-193.65.2.el8_2.x86_64 diff --git a/charts/csi-baremetal-deployment/templates/rbac/node-rbac.yaml b/charts/csi-baremetal-deployment/templates/rbac/node-rbac.yaml index 0cca8238..e3de71f3 100644 --- a/charts/csi-baremetal-deployment/templates/rbac/node-rbac.yaml +++ b/charts/csi-baremetal-deployment/templates/rbac/node-rbac.yaml @@ -30,6 +30,9 @@ rules: - apiGroups: [""] resources: ["events"] verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: [""] + resources: ["pods"] + verbs: ["get"] --- kind: ClusterRoleBinding diff --git a/pkg/node/node_daemonset.go b/pkg/node/node_daemonset.go index 0e2d1c1e..8cf8f82e 100644 --- a/pkg/node/node_daemonset.go +++ b/pkg/node/node_daemonset.go @@ -34,6 +34,9 @@ const ( mountPointDirVolume = "mountpoint-dir" csiPathVolume = "csi-path" driveConfigVolume = "drive-config" + nodeConfigVolume = "node-config" + nodeConfigMapName = "node-config" + nodeConfigPath = "/etc/node_config" ) // GetNodeDaemonsetPodsSelector returns a label-selector to use in the List method @@ -91,6 +94,7 @@ func createNodeDaemonSet(csi *csibaremetalv1.Deployment, platform *PlatformDescr func createNodeVolumes(csi *csibaremetalv1.Deployment) []corev1.Volume { directory := corev1.HostPathDirectory directoryOrCreate := corev1.HostPathDirectoryOrCreate + configMapMode := corev1.ConfigMapVolumeSourceDefaultMode unset := corev1.HostPathUnset volumes := make([]corev1.Volume, 0, 14) volumes = append(volumes, @@ -130,11 +134,19 @@ func createNodeVolumes(csi *csibaremetalv1.Deployment) []corev1.Volume { corev1.Volume{Name: csiPathVolume, VolumeSource: corev1.VolumeSource{ HostPath: &corev1.HostPathVolumeSource{Path: "/var/lib/kubelet/plugins/kubernetes.io/csi", Type: &unset}, }}, + corev1.Volume{ + Name: nodeConfigVolume, + VolumeSource: corev1.VolumeSource{ + ConfigMap: &corev1.ConfigMapVolumeSource{ + LocalObjectReference: corev1.LocalObjectReference{Name: nodeConfigMapName}, + DefaultMode: &configMapMode, + Optional: pointer.BoolPtr(true), + }, + }}, constant.CrashVolume, ) if isLoopbackMgr(csi.Spec.Driver.Node.DriveMgr.Image.Name) { - configMapMode := corev1.ConfigMapVolumeSourceDefaultMode volumes = append(volumes, corev1.Volume{ Name: driveConfigVolume, VolumeSource: corev1.VolumeSource{ @@ -187,6 +199,7 @@ func createNodeContainers(csi *csibaremetalv1.Deployment, platform *PlatformDesc {Name: mountPointDirVolume, MountPath: "/var/lib/kubelet/pods", MountPropagation: &bidirectional}, {Name: csiPathVolume, MountPath: "/var/lib/kubelet/plugins/kubernetes.io/csi", MountPropagation: &bidirectional}, {Name: hostRootVolume, MountPath: "/hostroot", MountPropagation: &bidirectional}, + {Name: nodeConfigMapName, MountPath: nodeConfigPath}, constant.CrashMountVolume, } return []corev1.Container{ @@ -282,6 +295,9 @@ func createNodeContainers(csi *csibaremetalv1.Deployment, platform *PlatformDesc {Name: "NAMESPACE", ValueFrom: &corev1.EnvVarSource{ FieldRef: &corev1.ObjectFieldSelector{APIVersion: "v1", FieldPath: "metadata.namespace"}, }}, + {Name: "POD_NAME", ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{APIVersion: "v1", FieldPath: "metadata.name"}, + }}, }, SecurityContext: &corev1.SecurityContext{Privileged: pointer.BoolPtr(true)}, VolumeMounts: nodeMounts,