From 7d8cb6e61c596169bdb4df67f35bbbfd67e85ced Mon Sep 17 00:00:00 2001 From: Alexander Maslennikov Date: Mon, 28 Oct 2024 18:37:11 +0100 Subject: [PATCH] small fixes in documentation Signed-off-by: Alexander Maslennikov --- README.md | 3 +++ api/v1alpha1/nicconfigurationtemplate_types.go | 3 +++ pkg/host/configvalidation.go | 2 +- pkg/host/configvalidation_test.go | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2f99331..b80e396 100644 --- a/README.md +++ b/README.md @@ -97,9 +97,11 @@ spec: #### Configuration details * `numVFs`: if provided, configure SR-IOV VFs via nvconfig. + * This is a mandatory parameter. * E.g: if `numVFs=2` then `SRIOV_EN=1` and `SRIOV_NUM_OF_VFS=2`. * If `numVFs=0` then `SRIOV_EN=0` and `SRIOV_NUM_OF_VFS=0`. * `linkType`: if provided configure `linkType` for the NIC for all NIC ports. + * This is a mandatory parameter. * E.g `linkType = Infiniband` then set `LINK_TYPE_P1=IB` and `LINK_TYPE_P2=IB` if second PCI function is present * `pciPerformanceOptimized`: performs PCI performance optimizations. If enabled then by default the following will happen: * Set nvconfig `MAX_ACC_OUT_READ` nvconfig parameter. @@ -121,6 +123,7 @@ spec: * Set nvconfig `ATS_ENABLED=0` * Can only be enabled when `pciPerformanceOptimized` is enabled * `rawNvConfig`: a `map[string]string` which contains NVConfig parameters to apply for a NIC on all of its PFs. + * Both the numeric values and their string aliases, supported by NVConfig, are allowed (e.g. `REAL_TIME_CLOCK_ENABLE=False`, `REAL_TIME_CLOCK_ENABLE=0`). * For per port parameters (suffix `_P1`, `_P2`) parameters with `_P2` suffix are ignored if the device is single port. ### NicDevice diff --git a/api/v1alpha1/nicconfigurationtemplate_types.go b/api/v1alpha1/nicconfigurationtemplate_types.go index 1fe5783..b789466 100644 --- a/api/v1alpha1/nicconfigurationtemplate_types.go +++ b/api/v1alpha1/nicconfigurationtemplate_types.go @@ -80,9 +80,11 @@ type NvConfigParam struct { // ConfigurationTemplateSpec is a set of configurations for the NICs type ConfigurationTemplateSpec struct { // Number of VFs to be configured + // +required NumVfs int `json:"numVfs"` // LinkType to be configured, Ethernet|Infiniband // +kubebuilder:validation:Enum=Ethernet;Infiniband + // +required LinkType LinkTypeEnum `json:"linkType"` // PCI performance optimization settings PciPerformanceOptimized *PciPerformanceOptimizedSpec `json:"pciPerformanceOptimized,omitempty"` @@ -99,6 +101,7 @@ type NicConfigurationTemplateSpec struct { // NodeSelector contains labels required on the node NodeSelector map[string]string `json:"nodeSelector,omitempty"` // NIC selector configuration + // +required NicSelector *NicSelectorSpec `json:"nicSelector"` // ResetToDefault specifies whether node agent needs to perform a reset flow // The following operations will be performed: diff --git a/pkg/host/configvalidation.go b/pkg/host/configvalidation.go index 1dceb04..13ff940 100644 --- a/pkg/host/configvalidation.go +++ b/pkg/host/configvalidation.go @@ -104,7 +104,7 @@ func (v *configValidationImpl) ConstructNvParamMapFromTemplate( if port.NetworkInterface != "" && v.utils.GetLinkType(port.NetworkInterface) != desiredLinkType { err := types.IncorrectSpecError( fmt.Sprintf( - "device doesn't support link type change, wrong link type provided in the template, should be: %s", + "device does not support link type change, wrong link type provided in the template, should be: %s", v.utils.GetLinkType(port.NetworkInterface))) log.Log.Error(err, "incorrect spec", "device", device.Name) return desiredParameters, err diff --git a/pkg/host/configvalidation_test.go b/pkg/host/configvalidation_test.go index 49af653..193bf7c 100644 --- a/pkg/host/configvalidation_test.go +++ b/pkg/host/configvalidation_test.go @@ -367,7 +367,7 @@ var _ = Describe("ConfigValidationImpl", func() { defaultValues := map[string]string{} _, err := validator.ConstructNvParamMapFromTemplate(device, defaultValues) - Expect(err).To(MatchError("incorrect spec: device doesn't support link type change, wrong link type provided in the template, should be: Ethernet")) + Expect(err).To(MatchError("incorrect spec: device does not support link type change, wrong link type provided in the template, should be: Ethernet")) }) It("should not report an error when LinkType can be changed and template differs from the actual status", func() { mockHostUtils.On("GetLinkType", mock.Anything).Return(consts.Ethernet)