Skip to content

Commit

Permalink
Export ValidateBasicFields for Hypershift (#916)
Browse files Browse the repository at this point in the history
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 <jojosneg@redhat.com>
  • Loading branch information
jlojosnegros committed Jan 24, 2024
1 parent fba5873 commit fd8b0be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -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
Expand Down Expand Up @@ -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()...)
Expand Down
Expand Up @@ -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
Expand Down

0 comments on commit fd8b0be

Please sign in to comment.