diff --git a/.golangci.yml b/.golangci.yml index ca69a11..5936305 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,6 +16,10 @@ issues: linters: - dupl - lll + - path: "pkg/*" + linters: + - dupl + - lll linters: disable-all: true enable: diff --git a/api/v1alpha1/nicconfigurationtemplate_types.go b/api/v1alpha1/nicconfigurationtemplate_types.go index 7530cd1..1fe5783 100644 --- a/api/v1alpha1/nicconfigurationtemplate_types.go +++ b/api/v1alpha1/nicconfigurationtemplate_types.go @@ -34,7 +34,7 @@ type NicSelectorSpec struct { // +enum type LinkTypeEnum string -// PciPerformanceOptimizedSpec specifies PCI performace optimization settings +// PciPerformanceOptimizedSpec specifies PCI performance optimization settings type PciPerformanceOptimizedSpec struct { // Specifies whether to enable PCI performance optimization Enabled bool `json:"enabled"` diff --git a/internal/controller/nicconfigurationtemplate_controller.go b/internal/controller/nicconfigurationtemplate_controller.go index e129cc5..4e42d60 100644 --- a/internal/controller/nicconfigurationtemplate_controller.go +++ b/internal/controller/nicconfigurationtemplate_controller.go @@ -90,11 +90,13 @@ func (r *NicConfigurationTemplateReconciler) Reconcile(ctx context.Context, req nodeMap := map[string]*v1.Node{} for _, node := range nodeList.Items { + node := node nodeMap[node.Name] = &node } templates := []*v1alpha1.NicConfigurationTemplate{} for _, template := range templateList.Items { + template := template templates = append(templates, &template) } @@ -109,7 +111,7 @@ func (r *NicConfigurationTemplateReconciler) Reconcile(ctx context.Context, req for _, template := range templates { if !deviceMatchesSelectors(&device, template, node) { - r.dropDeviceFromStatus(ctx, device.Name, template) + r.dropDeviceFromStatus(device.Name, template) continue } @@ -130,7 +132,7 @@ func (r *NicConfigurationTemplateReconciler) Reconcile(ctx context.Context, req if len(matchingTemplates) > 1 { for _, template := range matchingTemplates { - r.dropDeviceFromStatus(ctx, device.Name, template) + r.dropDeviceFromStatus(device.Name, template) } templateNames := []string{} @@ -172,7 +174,7 @@ func (r *NicConfigurationTemplateReconciler) Reconcile(ctx context.Context, req return ctrl.Result{}, nil } -func (r *NicConfigurationTemplateReconciler) dropDeviceFromStatus(ctx context.Context, deviceName string, template *v1alpha1.NicConfigurationTemplate) { +func (r *NicConfigurationTemplateReconciler) dropDeviceFromStatus(deviceName string, template *v1alpha1.NicConfigurationTemplate) { index := slices.Index(template.Status.NicDevices, deviceName) if index != -1 { // Device no longer matches template, drop it from the template's status