Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ linters:
- bidichk
- bodyclose
- cyclop
- depguard
# - depguard
- dogsled
- dupword
- durationcheck
Expand Down
7 changes: 5 additions & 2 deletions api/v1alpha6/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ func Convert_v1alpha6_OpenStackMachineSpec_To_v1alpha7_OpenStackMachineSpec(in *
func convertNetworksToPorts(networks []NetworkParam) []infrav1.PortOpts {
var ports []infrav1.PortOpts

for _, network := range networks {
for i := range networks {
network := networks[i]

// This will remain null if the network is not specified in NetworkParam
var networkFilter *infrav1.NetworkFilter

Expand Down Expand Up @@ -378,7 +380,8 @@ func convertNetworksToPorts(networks []NetworkParam) []infrav1.PortOpts {
ports = append(ports, infrav1.PortOpts{Network: networkFilter})
} else {
// If the network has explicit subnets then we create a separate port for each subnet.
for _, subnet := range network.Subnets {
for i := range network.Subnets {
subnet := network.Subnets[i]
if subnet.UUID != "" {
ports = append(ports, infrav1.PortOpts{
Network: networkFilter,
Expand Down
2 changes: 1 addition & 1 deletion controllers/openstackcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func deleteBastion(scope scope.Scope, cluster *clusterv1.Cluster, openStackClust
return nil
}

func reconcileNormal(scope scope.Scope, cluster *clusterv1.Cluster, openStackCluster *infrav1.OpenStackCluster) (ctrl.Result, error) {
func reconcileNormal(scope scope.Scope, cluster *clusterv1.Cluster, openStackCluster *infrav1.OpenStackCluster) (ctrl.Result, error) { //nolint:unparam
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make the unused param(s) _ instead to make it more obvious?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

um... from code all 3 params are used , not sure why need such update to make CI happy

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah now I see... the issue is that the returned ctrl.Result is always empty == nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I thought about this one a bit. We could remove the ctrl.Result return from this function, but:

  • That would make it different to all other reconcile methods (and therefore Surprising)
  • It might encourage lazy programming when we inevitably want to add it back

scope.Logger().Info("Reconciling Cluster")

// If the OpenStackCluster doesn't have our finalizer, add it.
Expand Down
2 changes: 1 addition & 1 deletion controllers/openstackmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func (r *OpenStackMachineReconciler) SetupWithManager(ctx context.Context, mgr c
Complete(r)
}

func (r *OpenStackMachineReconciler) reconcileDelete(scope scope.Scope, cluster *clusterv1.Cluster, openStackCluster *infrav1.OpenStackCluster, machine *clusterv1.Machine, openStackMachine *infrav1.OpenStackMachine) (ctrl.Result, error) {
func (r *OpenStackMachineReconciler) reconcileDelete(scope scope.Scope, cluster *clusterv1.Cluster, openStackCluster *infrav1.OpenStackCluster, machine *clusterv1.Machine, openStackMachine *infrav1.OpenStackMachine) (ctrl.Result, error) { //nolint:unparam
scope.Logger().Info("Reconciling Machine delete")

clusterName := fmt.Sprintf("%s-%s", cluster.ObjectMeta.Namespace, cluster.Name)
Expand Down
2 changes: 1 addition & 1 deletion hack/tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
ROOT_DIR_RELATIVE := ../..
include $(ROOT_DIR_RELATIVE)/common.mk

GOLANGCI_LINT_VERSION := v1.52.2
GOLANGCI_LINT_VERSION := v1.54.2

UNAME := $(shell uname -s)

Expand Down
3 changes: 2 additions & 1 deletion pkg/cloud/services/networking/port_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@ func Test_GetOrCreatePort(t *testing.T) {
}

eventObject := &infrav1.OpenStackMachine{}
for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
mockClient := mock.NewMockNetworkClient(mockCtrl)
Expand Down
3 changes: 2 additions & 1 deletion pkg/cloud/services/networking/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ func (s *Service) setRouterExternalIPs(openStackCluster *infrav1.OpenStackCluste
},
}

for _, externalRouterIP := range openStackCluster.Spec.ExternalRouterIPs {
for i := range openStackCluster.Spec.ExternalRouterIPs {
externalRouterIP := openStackCluster.Spec.ExternalRouterIPs[i]
subnetID := externalRouterIP.Subnet.ID
if subnetID == "" {
subnet, err := s.GetSubnetByFilter(&externalRouterIP.Subnet)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/shared/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
OpenStackCloudYAMLFile = "OPENSTACK_CLOUD_YAML_FILE"
OpenStackCloud = "OPENSTACK_CLOUD"
OpenStackCloudAdmin = "OPENSTACK_CLOUD_ADMIN"
OpenStackFailureDomain = "OPENSTACK_FAILURE_DOMAIN"
OpenStackFailureDomain = "OPENSTACK_FAILURE_DOMAIN" //nolint:gosec // Linter thinks this could be credentials...
OpenStackFailureDomainAlt = "OPENSTACK_FAILURE_DOMAIN_ALT"
OpenStackVolumeTypeAlt = "OPENSTACK_VOLUME_TYPE_ALT"
OpenStackImageName = "OPENSTACK_IMAGE_NAME"
Expand Down