From fd8b0be063fd25447b24f8333d0d2c6c396fff53 Mon Sep 17 00:00:00 2001 From: Jose Luis Ojosnegros Date: Wed, 24 Jan 2024 11:00:54 +0100 Subject: [PATCH] Export ValidateBasicFields for Hypershift (#916) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Hypershift we need to validate PerformanceProfile from NodePool controller. As a one-to-one relationship between NodePool and Performance Profile is already enforced there is no need ( and no easy way ) to check for PerformanceProfiles with duplicated selectors, so we just need to check the fields. Signed-off-by: Jose Luis Ojosnegros Manchón --- .../performanceprofile/v2/performanceprofile_validation.go | 4 ++-- .../v2/performanceprofile_validation_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/apis/performanceprofile/v2/performanceprofile_validation.go b/pkg/apis/performanceprofile/v2/performanceprofile_validation.go index a3fcec1b1..19d256746 100644 --- a/pkg/apis/performanceprofile/v2/performanceprofile_validation.go +++ b/pkg/apis/performanceprofile/v2/performanceprofile_validation.go @@ -65,7 +65,7 @@ func (r *PerformanceProfile) validateCreateOrUpdate() (admission.Warnings, error allErrs = append(allErrs, r.validateNodeSelectorDuplication(ppList)...) // validate basic fields - allErrs = append(allErrs, r.validateFields()...) + allErrs = append(allErrs, r.ValidateBasicFields()...) if len(allErrs) == 0 { return admission.Warnings{}, nil @@ -102,7 +102,7 @@ func (r *PerformanceProfile) validateNodeSelectorDuplication(ppList *Performance return allErrs } -func (r *PerformanceProfile) validateFields() field.ErrorList { +func (r *PerformanceProfile) ValidateBasicFields() field.ErrorList { var allErrs field.ErrorList allErrs = append(allErrs, r.validateCPUs()...) diff --git a/pkg/apis/performanceprofile/v2/performanceprofile_validation_test.go b/pkg/apis/performanceprofile/v2/performanceprofile_validation_test.go index ffbd955f6..87e51d86b 100644 --- a/pkg/apis/performanceprofile/v2/performanceprofile_validation_test.go +++ b/pkg/apis/performanceprofile/v2/performanceprofile_validation_test.go @@ -433,7 +433,7 @@ var _ = Describe("PerformanceProfile", func() { profile.Spec.Net.Devices[0].VendorID = pointer.String(invalidVendor) profile.Spec.Net.Devices[0].DeviceID = pointer.String(invalidDevice) - errors := profile.validateFields() + errors := profile.ValidateBasicFields() type void struct{} var member void