-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added daemonset for inspecting nodes configuration
On hypershift there is no MCO, hence there are no machine-config-daemon pods. A different resolution is needed for accessing the underlying node for inspecting configurations. This commit adds a daemonset that will start upon test suites - on every node we will deploy a pod with escalated privileges and host fs mounted. This API will be used for both hypershift and non-hypershift systems. Signed-off-by: Ronny Baturov <[email protected]>
- Loading branch information
Showing
12 changed files
with
302 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,7 +135,7 @@ var _ = Describe("[rfe_id:27368][performance]", Ordered, func() { | |
|
||
It("[test_id:31198] Should set CPU affinity kernel argument", func() { | ||
for _, node := range workerRTNodes { | ||
cmdline, err := nodes.ExecCommandOnMachineConfigDaemon(context.TODO(), &node, []string{"cat", "/proc/cmdline"}) | ||
cmdline, err := nodes.ExecCommandOnTestingDaemonPod(context.TODO(), &node, []string{"cat", "/proc/cmdline"}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
// since systemd.cpu_affinity is calculated on node level using tuned we can check only the key in this context. | ||
Expect(string(cmdline)).To(ContainSubstring("systemd.cpu_affinity=")) | ||
|
@@ -144,7 +144,7 @@ var _ = Describe("[rfe_id:27368][performance]", Ordered, func() { | |
|
||
It("[test_id:32702] Should set CPU isolcpu's kernel argument managed_irq flag", func() { | ||
for _, node := range workerRTNodes { | ||
cmdline, err := nodes.ExecCommandOnMachineConfigDaemon(context.TODO(), &node, []string{"cat", "/proc/cmdline"}) | ||
cmdline, err := nodes.ExecCommandOnTestingDaemonPod(context.TODO(), &node, []string{"cat", "/proc/cmdline"}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
if profile.Spec.CPU.BalanceIsolated != nil && *profile.Spec.CPU.BalanceIsolated == false { | ||
Expect(string(cmdline)).To(ContainSubstring("isolcpus=domain,managed_irq,")) | ||
|
@@ -157,7 +157,7 @@ var _ = Describe("[rfe_id:27368][performance]", Ordered, func() { | |
It("[test_id:27081][crit:high][vendor:[email protected]][level:acceptance] Should set workqueue CPU mask", func() { | ||
for _, node := range workerRTNodes { | ||
By(fmt.Sprintf("Getting tuned.non_isolcpus kernel argument on %q", node.Name)) | ||
cmdline, err := nodes.ExecCommandOnMachineConfigDaemon(context.TODO(), &node, []string{"cat", "/proc/cmdline"}) | ||
cmdline, err := nodes.ExecCommandOnTestingDaemonPod(context.TODO(), &node, []string{"cat", "/proc/cmdline"}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
re := regexp.MustCompile(`tuned.non_isolcpus=\S+`) | ||
nonIsolcpusFullArgument := re.FindString(string(cmdline)) | ||
|
@@ -178,13 +178,13 @@ var _ = Describe("[rfe_id:27368][performance]", Ordered, func() { | |
} | ||
|
||
By(fmt.Sprintf("Getting the virtual workqueue mask (/sys/devices/virtual/workqueue/cpumask) on %q", node.Name)) | ||
workqueueMaskData, err := nodes.ExecCommandOnMachineConfigDaemon(context.TODO(), &node, []string{"cat", "/sys/devices/virtual/workqueue/cpumask"}) | ||
workqueueMaskData, err := nodes.ExecCommandOnTestingDaemonPod(context.TODO(), &node, []string{"cat", "/sys/devices/virtual/workqueue/cpumask"}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
workqueueMask := getTrimmedMaskFromData("virtual", workqueueMaskData) | ||
expectMasksEqual(nonIsolcpusMaskNoDelimiters, workqueueMask) | ||
|
||
By(fmt.Sprintf("Getting the writeback workqueue mask (/sys/bus/workqueue/devices/writeback/cpumask) on %q", node.Name)) | ||
workqueueWritebackMaskData, err := nodes.ExecCommandOnMachineConfigDaemon(context.TODO(), &node, []string{"cat", "/sys/bus/workqueue/devices/writeback/cpumask"}) | ||
workqueueWritebackMaskData, err := nodes.ExecCommandOnTestingDaemonPod(context.TODO(), &node, []string{"cat", "/sys/bus/workqueue/devices/writeback/cpumask"}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
workqueueWritebackMask := getTrimmedMaskFromData("workqueue", workqueueWritebackMaskData) | ||
expectMasksEqual(nonIsolcpusMaskNoDelimiters, workqueueWritebackMask) | ||
|
@@ -193,12 +193,12 @@ var _ = Describe("[rfe_id:27368][performance]", Ordered, func() { | |
|
||
It("[test_id:32375][crit:high][vendor:[email protected]][level:acceptance] initramfs should not have injected configuration", func() { | ||
for _, node := range workerRTNodes { | ||
rhcosId, err := nodes.ExecCommandOnMachineConfigDaemon(context.TODO(), &node, []string{"awk", "-F", "/", "{printf $3}", "/rootfs/proc/cmdline"}) | ||
rhcosId, err := nodes.ExecCommandOnTestingDaemonPod(context.TODO(), &node, []string{"awk", "-F", "/", "{printf $3}", "/rootfs/proc/cmdline"}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
initramfsImagesPath, err := nodes.ExecCommandOnMachineConfigDaemon(context.TODO(), &node, []string{"find", filepath.Join("/rootfs/boot/ostree", string(rhcosId)), "-name", "*.img"}) | ||
initramfsImagesPath, err := nodes.ExecCommandOnTestingDaemonPod(context.TODO(), &node, []string{"find", filepath.Join("/rootfs/boot/ostree", string(rhcosId)), "-name", "*.img"}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
modifiedImagePath := strings.TrimPrefix(strings.TrimSpace(string(initramfsImagesPath)), "/rootfs") | ||
initrd, err := nodes.ExecCommandOnMachineConfigDaemon(context.TODO(), &node, []string{"chroot", "/rootfs", "lsinitrd", modifiedImagePath}) | ||
initrd, err := nodes.ExecCommandOnTestingDaemonPod(context.TODO(), &node, []string{"chroot", "/rootfs", "lsinitrd", modifiedImagePath}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(string(initrd)).ShouldNot(ContainSubstring("'/etc/systemd/system.conf /etc/systemd/system.conf.d/setAffinity.conf'")) | ||
} | ||
|
@@ -272,7 +272,7 @@ var _ = Describe("[rfe_id:27368][performance]", Ordered, func() { | |
It("[test_id:28611][crit:high][vendor:[email protected]][level:acceptance] Should set additional kernel arguments on the machine", func() { | ||
if profile.Spec.AdditionalKernelArgs != nil { | ||
for _, node := range workerRTNodes { | ||
cmdline, err := nodes.ExecCommandOnMachineConfigDaemon(context.TODO(), &node, []string{"cat", "/proc/cmdline"}) | ||
cmdline, err := nodes.ExecCommandOnTestingDaemonPod(context.TODO(), &node, []string{"cat", "/proc/cmdline"}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
for _, arg := range profile.Spec.AdditionalKernelArgs { | ||
Expect(string(cmdline)).To(ContainSubstring(arg)) | ||
|
@@ -1004,7 +1004,7 @@ var _ = Describe("[rfe_id:27368][performance]", Ordered, func() { | |
|
||
It("[test_id:54083] Should have kernel param rcutree.kthread", func() { | ||
for _, node := range workerRTNodes { | ||
cmdline, err := nodes.ExecCommandOnMachineConfigDaemon(context.TODO(), &node, []string{"cat", "/proc/cmdline"}) | ||
cmdline, err := nodes.ExecCommandOnTestingDaemonPod(context.TODO(), &node, []string{"cat", "/proc/cmdline"}) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to read /proc/cmdline") | ||
Expect(string(cmdline)).To(ContainSubstring("rcutree.kthread_prio=11"), "Boot Parameters should contain rctree.kthread_prio=11") | ||
} | ||
|
@@ -1294,7 +1294,7 @@ func execSysctlOnWorkers(ctx context.Context, workerNodes []corev1.Node, sysctlM | |
for _, node := range workerNodes { | ||
for param, expected := range sysctlMap { | ||
By(fmt.Sprintf("executing the command \"sysctl -n %s\"", param)) | ||
out, err = nodes.ExecCommandOnMachineConfigDaemon(ctx, &node, []string{"sysctl", "-n", param}) | ||
out, err = nodes.ExecCommandOnTestingDaemonPod(ctx, &node, []string{"sysctl", "-n", param}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(strings.TrimSpace(string(out))).Should(Equal(expected), "parameter %s value is not %s.", param, expected) | ||
} | ||
|
@@ -1309,7 +1309,7 @@ func checkSchedKnobs(ctx context.Context, workerNodes []corev1.Node, schedKnobs | |
for param, expected := range schedKnobs { | ||
By(fmt.Sprintf("Checking scheduler knob %s", param)) | ||
knob := fmt.Sprintf("/rootfs/sys/kernel/debug/sched/%s", param) | ||
out, err = nodes.ExecCommandOnMachineConfigDaemon(ctx, &node, []string{"cat", knob}) | ||
out, err = nodes.ExecCommandOnTestingDaemonPod(ctx, &node, []string{"cat", knob}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(strings.TrimSpace(string(out))).Should(Equal(expected), "parameter %s value is not %s.", param, expected) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
test/e2e/performanceprofile/functests/utils/clusterrole/clusterrole.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package clusterrole | ||
|
||
import ( | ||
rbacv1 "k8s.io/api/rbac/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// GetClusterRole returns a ClusterRole object with the specified parameters | ||
func GetClusterRole(name string) *rbacv1.ClusterRole { | ||
return &rbacv1.ClusterRole{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: name, | ||
}, | ||
} | ||
} | ||
|
||
func WithRules(rules []rbacv1.PolicyRule) func(*rbacv1.ClusterRole) { | ||
return func(cr *rbacv1.ClusterRole) { | ||
cr.Rules = rules | ||
} | ||
} | ||
|
||
func Make(name string, opts ...func(cr *rbacv1.ClusterRole)) *rbacv1.ClusterRole { | ||
cr := GetClusterRole(name) | ||
for _, opt := range opts { | ||
opt(cr) | ||
} | ||
return cr | ||
} |
28 changes: 28 additions & 0 deletions
28
test/e2e/performanceprofile/functests/utils/clusterrolebinding/clusterrolebinding.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package clusterrolebinding | ||
|
||
import ( | ||
rbacv1 "k8s.io/api/rbac/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// GetRoleBinding returns a RoleBinding object with the specified parameters | ||
func GetRoleBinding(name, namespace, serviceAccountName, clusterRoleName string) *rbacv1.RoleBinding { | ||
return &rbacv1.RoleBinding{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: name, | ||
Namespace: namespace, | ||
}, | ||
Subjects: []rbacv1.Subject{ | ||
{ | ||
Kind: "ServiceAccount", | ||
Name: serviceAccountName, | ||
Namespace: namespace, | ||
}, | ||
}, | ||
RoleRef: rbacv1.RoleRef{ | ||
Kind: "ClusterRole", | ||
Name: clusterRoleName, | ||
APIGroup: "rbac.authorization.k8s.io", | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.