Skip to content

Commit

Permalink
e2e: set performance profile cpus using env vars
Browse files Browse the repository at this point in the history
We've been observing lately that some tests that involve disabling load balancing are failing (like 32646) because the expected result does not have specific anticipated CPUs. After investigation, it turns out that one factor is the profile configuration of the CPU distribution.

PAO functional tests configure fixed CPU values under the PP. This is considered misconfiguration, especially when the system has more than 4 CPUs, and there is no guarantee that the functionality of the performance profile controller will work adequately with not all cpus reflected in the CPU section in the PP.

To resolve this complication, we are introducing new environment
variables RESERVED_CPU_SET, ISOLATED_CPU_SET, OFFLINED_CPU_SET, should be
set the profile would use them instead of the defaults.
  • Loading branch information
shajmakh committed Jan 9, 2024
1 parent 7820510 commit 8a1ceb9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
34 changes: 30 additions & 4 deletions test/e2e/performanceprofile/functests/0_config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package __performance_config
import (
"context"
"fmt"
"k8s.io/utils/cpuset"
"os"
"time"

Expand Down Expand Up @@ -65,11 +66,11 @@ var _ = Describe("[performance][config] Performance configuration", Ordered, fun

It("Should successfully deploy the performance profile", func() {

performanceProfile := testProfile()
performanceProfile, err := testProfile()
Expect(err).ToNot(HaveOccurred(), "failed to build performance profile: %v", err)
profileAlreadyExists := false

performanceManifest, foundOverride := os.LookupEnv("PERFORMANCE_PROFILE_MANIFEST_OVERRIDE")
var err error
if foundOverride {
performanceProfile, err = externalPerformanceProfile(performanceManifest)
Expect(err).ToNot(HaveOccurred(), "Failed overriding performance profile", performanceManifest)
Expand Down Expand Up @@ -158,9 +159,34 @@ func externalPerformanceProfile(performanceManifest string) (*performancev2.Perf
return profile, nil
}

func testProfile() *performancev2.PerformanceProfile {
func testProfile() (*performancev2.PerformanceProfile, error) {
reserved := performancev2.CPUSet("0")
isolated := performancev2.CPUSet("1-3")

customReserved, foundReserved := os.LookupEnv("RESERVED_CPU_SET")
customIsolated, foundIsolated := os.LookupEnv("ISOLATED_CPU_SET")
if foundReserved != foundIsolated {
return nil, fmt.Errorf("both reserved and isolated cpusets are required.")
}
if foundReserved {
if _, err := cpuset.Parse(customReserved); err != nil {
return nil, fmt.Errorf("failed to parse the provided reserved cpu set %s: %v. Using default values", customReserved, err)
}
reserved = performancev2.CPUSet(customReserved)

if _, err := cpuset.Parse(customIsolated); err != nil {
return nil, fmt.Errorf("failed to parse the provided isolated cpu set %s: %v. Using default values", customIsolated, err)
}
reserved = performancev2.CPUSet(customIsolated)
}
customOfflined, foundOfflined := os.LookupEnv("OFFLINED_CPU_SET")
if foundOfflined {
if _, err := cpuset.Parse(customOfflined); err != nil {
return nil, fmt.Errorf("failed to parse the provided offlined cpu set %s: %v. Using default values", customOfflined, err)
}
reserved = performancev2.CPUSet(customOfflined)
}

hugePagesSize := performancev2.HugePageSize("1G")

profile := &performancev2.PerformanceProfile{
Expand Down Expand Up @@ -215,5 +241,5 @@ func testProfile() *performancev2.PerformanceProfile {
"pools.operator.machineconfiguration.openshift.io/master": "",
}
}
return profile
return profile, nil
}
7 changes: 5 additions & 2 deletions test/e2e/performanceprofile/functests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ This deployment takes some time and requires reboot
Tests are executed in order of file-names
So be careful with renaming existing or adding new suites

DISCOVERY_MODE env variable to get an already deployed performanceProfile
Environment variables:
DISCOVERY_MODE: to get an already deployed performanceProfile.
If DISCOVERY_MODE set to true the suites will search for a PerformanceProfile on the cluster and use it.
If no PerformanceProfile is found, that suites will be skipped
If no PerformanceProfile is found, that suites will be skipped.

RESERVED_CPU_SET, ISOLATED_CPU_SET, OFFLINED_CPU_SET: strings that present the CPU sets distributed between reserved, isolated, and offlined CPU profile specifications. The runner is responsible for validating that these values are compatible with the testing environment.

0 comments on commit 8a1ceb9

Please sign in to comment.