Skip to content

Commit

Permalink
[ISSUE-635] Support WBT disabling (#103)
Browse files Browse the repository at this point in the history
Signed-off-by: safronovD <danil_safronov@dell.com>
  • Loading branch information
safronovD authored Dec 15, 2021
1 parent 3af3d6f commit 8504a5c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions charts/csi-baremetal-deployment/templates/rbac/node-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get"]

---
kind: ClusterRoleBinding
Expand Down
18 changes: 17 additions & 1 deletion pkg/node/node_daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8504a5c

Please sign in to comment.