diff --git a/api/v1alpha6/openstackcluster_conversion.go b/api/v1alpha6/openstackcluster_conversion.go index cb295c3147..1241469587 100644 --- a/api/v1alpha6/openstackcluster_conversion.go +++ b/api/v1alpha6/openstackcluster_conversion.go @@ -370,8 +370,8 @@ func restorev1beta1ClusterStatus(previous *infrav1.OpenStackClusterStatus, dst * if previous.Bastion != nil { dst.Bastion.ReferencedResources = previous.Bastion.ReferencedResources } - if previous.Bastion != nil && previous.Bastion.DependentResources.PortsStatus != nil { - dst.Bastion.DependentResources.PortsStatus = previous.Bastion.DependentResources.PortsStatus + if previous.Bastion != nil && previous.Bastion.DependentResources.Ports != nil { + dst.Bastion.DependentResources.Ports = previous.Bastion.DependentResources.Ports } } diff --git a/api/v1alpha7/openstackcluster_conversion.go b/api/v1alpha7/openstackcluster_conversion.go index f36ab2cf33..cd31d29f7f 100644 --- a/api/v1alpha7/openstackcluster_conversion.go +++ b/api/v1alpha7/openstackcluster_conversion.go @@ -355,8 +355,8 @@ func restorev1beta1ClusterStatus(previous *infrav1.OpenStackClusterStatus, dst * dst.Bastion.ReferencedResources = previous.Bastion.ReferencedResources } - if previous.Bastion != nil && previous.Bastion.DependentResources.PortsStatus != nil { - dst.Bastion.DependentResources.PortsStatus = previous.Bastion.DependentResources.PortsStatus + if previous.Bastion != nil && previous.Bastion.DependentResources.Ports != nil { + dst.Bastion.DependentResources.Ports = previous.Bastion.DependentResources.Ports } } diff --git a/api/v1beta1/types.go b/api/v1beta1/types.go index 6b643b2f46..4dccc85c7a 100644 --- a/api/v1beta1/types.go +++ b/api/v1beta1/types.go @@ -654,15 +654,15 @@ type ReferencedMachineResources struct { // +optional ImageID string `json:"imageID,omitempty"` - // portsOpts is the list of ports options to create for the machine. + // Ports is the fully resolved list of ports to create for the machine. // +optional - PortsOpts []PortOpts `json:"portsOpts,omitempty"` + Ports []PortOpts `json:"ports,omitempty"` } type DependentMachineResources struct { - // PortsStatus is the status of the ports created for the machine. + // Ports is the status of the ports created for the machine. // +optional - PortsStatus []PortStatus `json:"portsStatus,omitempty"` + Ports []PortStatus `json:"ports,omitempty"` } // ValueSpec represents a single value_spec key-value pair. diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index aa1a30e5eb..abd378418e 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -209,8 +209,8 @@ func (in *BlockDeviceVolume) DeepCopy() *BlockDeviceVolume { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DependentMachineResources) DeepCopyInto(out *DependentMachineResources) { *out = *in - if in.PortsStatus != nil { - in, out := &in.PortsStatus, &out.PortsStatus + if in.Ports != nil { + in, out := &in.Ports, &out.Ports *out = make([]PortStatus, len(*in)) copy(*out, *in) } @@ -1175,8 +1175,8 @@ func (in *PortStatus) DeepCopy() *PortStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ReferencedMachineResources) DeepCopyInto(out *ReferencedMachineResources) { *out = *in - if in.PortsOpts != nil { - in, out := &in.PortsOpts, &out.PortsOpts + if in.Ports != nil { + in, out := &in.Ports, &out.Ports *out = make([]PortOpts, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml index db67158b60..2e31f55442 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml @@ -6201,9 +6201,9 @@ spec: properties: dependentResources: properties: - portsStatus: - description: PortsStatus is the status of the ports created - for the machine. + ports: + description: Ports is the status of the ports created for + the machine. items: properties: id: @@ -6230,9 +6230,9 @@ spec: description: ImageID is the ID of the image to use for the machine and is calculated based on ImageFilter. type: string - portsOpts: - description: portsOpts is the list of ports options to create - for the machine. + ports: + description: Ports is the fully resolved list of ports to + create for the machine. items: properties: adminStateUp: diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml index 3bb1c4a4df..b47a3fe347 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml @@ -2396,9 +2396,9 @@ spec: description: DependentResources contains resolved dependent resources that were created by the machine. properties: - portsStatus: - description: PortsStatus is the status of the ports created for - the machine. + ports: + description: Ports is the status of the ports created for the + machine. items: properties: id: @@ -2449,8 +2449,8 @@ spec: description: ImageID is the ID of the image to use for the machine and is calculated based on ImageFilter. type: string - portsOpts: - description: portsOpts is the list of ports options to create + ports: + description: Ports is the fully resolved list of ports to create for the machine. items: properties: diff --git a/controllers/openstackcluster_controller.go b/controllers/openstackcluster_controller.go index 794047ca47..11e318ff31 100644 --- a/controllers/openstackcluster_controller.go +++ b/controllers/openstackcluster_controller.go @@ -293,18 +293,18 @@ func deleteBastion(scope *scope.WithLogger, cluster *clusterv1.Cluster, openStac } } - if openStackCluster.Status.Bastion != nil && len(openStackCluster.Status.Bastion.DependentResources.PortsStatus) > 0 { + if openStackCluster.Status.Bastion != nil && len(openStackCluster.Status.Bastion.DependentResources.Ports) > 0 { trunkSupported, err := networkingService.IsTrunkExtSupported() if err != nil { return err } - for _, port := range openStackCluster.Status.Bastion.DependentResources.PortsStatus { + for _, port := range openStackCluster.Status.Bastion.DependentResources.Ports { if err := networkingService.DeleteInstanceTrunkAndPort(openStackCluster, port, trunkSupported); err != nil { handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to delete port: %w", err)) return fmt.Errorf("failed to delete port: %w", err) } } - openStackCluster.Status.Bastion.DependentResources.PortsStatus = nil + openStackCluster.Status.Bastion.DependentResources.Ports = nil } scope.Logger().Info("Deleted Bastion for cluster %s", cluster.Name) @@ -375,7 +375,7 @@ func reconcileBastion(scope *scope.WithLogger, cluster *clusterv1.Cluster, openS // If ports options aren't in the status, we'll re-trigger the reconcile to get them // via adopting the referenced resources. - if len(openStackCluster.Status.Bastion.ReferencedResources.PortsOpts) == 0 { + if len(openStackCluster.Status.Bastion.ReferencedResources.Ports) == 0 { return reconcile.Result{}, nil } @@ -409,7 +409,7 @@ func reconcileBastion(scope *scope.WithLogger, cluster *clusterv1.Cluster, openS handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to get or create ports for bastion: %w", err)) return ctrl.Result{}, fmt.Errorf("failed to get or create ports for bastion: %w", err) } - bastionPortIDs := GetPortIDs(openStackCluster.Status.Bastion.DependentResources.PortsStatus) + bastionPortIDs := GetPortIDs(openStackCluster.Status.Bastion.DependentResources.Ports) var instanceStatus *compute.InstanceStatus if openStackCluster.Status.Bastion != nil && openStackCluster.Status.Bastion.ID != "" { @@ -555,12 +555,12 @@ func getOrCreateBastionPorts(scope *scope.WithLogger, cluster *clusterv1.Cluster openStackCluster.Status.Bastion = &infrav1.BastionStatus{} } - desiredPorts := openStackCluster.Status.Bastion.ReferencedResources.PortsOpts - portsToCreate := networking.MissingPorts(openStackCluster.Status.Bastion.DependentResources.PortsStatus, desiredPorts) + desiredPorts := openStackCluster.Status.Bastion.ReferencedResources.Ports + portsToCreate := networking.MissingPorts(openStackCluster.Status.Bastion.DependentResources.Ports, desiredPorts) // Sanity check that the number of desired ports is equal to the addition of ports to create and ports that already exist. - if len(desiredPorts) != len(portsToCreate)+len(openStackCluster.Status.Bastion.DependentResources.PortsStatus) { - return fmt.Errorf("length of desired ports (%d) is not equal to the length of ports to create (%d) + the length of ports that already exist (%d)", len(desiredPorts), len(portsToCreate), len(openStackCluster.Status.Bastion.DependentResources.PortsStatus)) + if len(desiredPorts) != len(portsToCreate)+len(openStackCluster.Status.Bastion.DependentResources.Ports) { + return fmt.Errorf("length of desired ports (%d) is not equal to the length of ports to create (%d) + the length of ports that already exist (%d)", len(desiredPorts), len(portsToCreate), len(openStackCluster.Status.Bastion.DependentResources.Ports)) } if len(portsToCreate) > 0 { @@ -570,12 +570,12 @@ func getOrCreateBastionPorts(scope *scope.WithLogger, cluster *clusterv1.Cluster return fmt.Errorf("failed to create ports for bastion %s: %w", bastionName(openStackCluster.Name), err) } - openStackCluster.Status.Bastion.DependentResources.PortsStatus = append(openStackCluster.Status.Bastion.DependentResources.PortsStatus, bastionPortsStatus...) + openStackCluster.Status.Bastion.DependentResources.Ports = append(openStackCluster.Status.Bastion.DependentResources.Ports, bastionPortsStatus...) } // Sanity check that the number of ports that have been put into PortsStatus is equal to the number of desired ports now that we have created them all. - if len(openStackCluster.Status.Bastion.DependentResources.PortsStatus) != len(desiredPorts) { - return fmt.Errorf("length of ports that already exist (%d) is not equal to the length of desired ports (%d)", len(openStackCluster.Status.Bastion.DependentResources.PortsStatus), len(desiredPorts)) + if len(openStackCluster.Status.Bastion.DependentResources.Ports) != len(desiredPorts) { + return fmt.Errorf("length of ports that already exist (%d) is not equal to the length of desired ports (%d)", len(openStackCluster.Status.Bastion.DependentResources.Ports), len(desiredPorts)) } return nil diff --git a/controllers/openstackcluster_controller_test.go b/controllers/openstackcluster_controller_test.go index 9688ffb968..5ab69b2d77 100644 --- a/controllers/openstackcluster_controller_test.go +++ b/controllers/openstackcluster_controller_test.go @@ -234,7 +234,7 @@ var _ = Describe("OpenStackCluster controller", func() { Bastion: &infrav1.BastionStatus{ ReferencedResources: infrav1.ReferencedMachineResources{ ImageID: "imageID", - PortsOpts: []infrav1.PortOpts{ + Ports: []infrav1.PortOpts{ { Network: &infrav1.NetworkFilter{ ID: "network-id", @@ -243,7 +243,7 @@ var _ = Describe("OpenStackCluster controller", func() { }, }, DependentResources: infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: "portID1", }, @@ -285,7 +285,7 @@ var _ = Describe("OpenStackCluster controller", func() { State: "ACTIVE", ReferencedResources: infrav1.ReferencedMachineResources{ ImageID: "imageID", - PortsOpts: []infrav1.PortOpts{ + Ports: []infrav1.PortOpts{ { Network: &infrav1.NetworkFilter{ ID: "network-id", @@ -294,7 +294,7 @@ var _ = Describe("OpenStackCluster controller", func() { }, }, DependentResources: infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: "portID1", }, @@ -326,7 +326,7 @@ var _ = Describe("OpenStackCluster controller", func() { ID: "adopted-fip-bastion-uuid", ReferencedResources: infrav1.ReferencedMachineResources{ ImageID: "imageID", - PortsOpts: []infrav1.PortOpts{ + Ports: []infrav1.PortOpts{ { Network: &infrav1.NetworkFilter{ ID: "network-id", @@ -335,7 +335,7 @@ var _ = Describe("OpenStackCluster controller", func() { }, }, DependentResources: infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: "portID1", }, @@ -370,7 +370,7 @@ var _ = Describe("OpenStackCluster controller", func() { State: "ACTIVE", ReferencedResources: infrav1.ReferencedMachineResources{ ImageID: "imageID", - PortsOpts: []infrav1.PortOpts{ + Ports: []infrav1.PortOpts{ { Network: &infrav1.NetworkFilter{ ID: "network-id", @@ -379,7 +379,7 @@ var _ = Describe("OpenStackCluster controller", func() { }, }, DependentResources: infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: "portID1", }, @@ -411,7 +411,7 @@ var _ = Describe("OpenStackCluster controller", func() { ID: "requeue-bastion-uuid", ReferencedResources: infrav1.ReferencedMachineResources{ ImageID: "imageID", - PortsOpts: []infrav1.PortOpts{ + Ports: []infrav1.PortOpts{ { Network: &infrav1.NetworkFilter{ ID: "network-id", @@ -420,7 +420,7 @@ var _ = Describe("OpenStackCluster controller", func() { }, }, DependentResources: infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: "portID1", }, @@ -449,7 +449,7 @@ var _ = Describe("OpenStackCluster controller", func() { State: "BUILD", ReferencedResources: infrav1.ReferencedMachineResources{ ImageID: "imageID", - PortsOpts: []infrav1.PortOpts{ + Ports: []infrav1.PortOpts{ { Network: &infrav1.NetworkFilter{ ID: "network-id", @@ -458,7 +458,7 @@ var _ = Describe("OpenStackCluster controller", func() { }, }, DependentResources: infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: "portID1", }, @@ -532,7 +532,7 @@ var _ = Describe("OpenStackCluster controller", func() { testCluster.Status = infrav1.OpenStackClusterStatus{ Bastion: &infrav1.BastionStatus{ DependentResources: infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: "port-id", }, @@ -616,7 +616,7 @@ var _ = Describe("OpenStackCluster controller", func() { testCluster.Status = infrav1.OpenStackClusterStatus{ Bastion: &infrav1.BastionStatus{ DependentResources: infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: "port-id", }, diff --git a/controllers/openstackmachine_controller.go b/controllers/openstackmachine_controller.go index 0195b007ee..4bc510cf9d 100644 --- a/controllers/openstackmachine_controller.go +++ b/controllers/openstackmachine_controller.go @@ -313,7 +313,7 @@ func (r *OpenStackMachineReconciler) reconcileDelete(scope *scope.WithLogger, cl return ctrl.Result{}, err } - portsStatus := openStackMachine.Status.DependentResources.PortsStatus + portsStatus := openStackMachine.Status.DependentResources.Ports for _, port := range portsStatus { if err := networkingService.DeleteInstanceTrunkAndPort(openStackMachine, port, trunkSupported); err != nil { return ctrl.Result{}, fmt.Errorf("failed to delete port %q: %w", port.ID, err) @@ -383,7 +383,7 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope if err != nil { return ctrl.Result{}, err } - portIDs := GetPortIDs(openStackMachine.Status.DependentResources.PortsStatus) + portIDs := GetPortIDs(openStackMachine.Status.DependentResources.Ports) instanceStatus, err := r.getOrCreateInstance(scope.Logger(), openStackCluster, machine, openStackMachine, computeService, userData, portIDs) if err != nil || instanceStatus == nil { @@ -498,12 +498,12 @@ func getOrCreateMachinePorts(scope *scope.WithLogger, openStackCluster *infrav1. var machinePortsStatus []infrav1.PortStatus var err error - desiredPorts := openStackMachine.Status.ReferencedResources.PortsOpts - portsToCreate := networking.MissingPorts(openStackMachine.Status.DependentResources.PortsStatus, desiredPorts) + desiredPorts := openStackMachine.Status.ReferencedResources.Ports + portsToCreate := networking.MissingPorts(openStackMachine.Status.DependentResources.Ports, desiredPorts) // Sanity check that the number of desired ports is equal to the addition of ports to create and ports that already exist. - if len(desiredPorts) != len(portsToCreate)+len(openStackMachine.Status.DependentResources.PortsStatus) { - return fmt.Errorf("length of desired ports (%d) is not equal to the length of ports to create (%d) + the length of ports that already exist (%d)", len(desiredPorts), len(portsToCreate), len(openStackMachine.Status.DependentResources.PortsStatus)) + if len(desiredPorts) != len(portsToCreate)+len(openStackMachine.Status.DependentResources.Ports) { + return fmt.Errorf("length of desired ports (%d) is not equal to the length of ports to create (%d) + the length of ports that already exist (%d)", len(desiredPorts), len(portsToCreate), len(openStackMachine.Status.DependentResources.Ports)) } if len(portsToCreate) > 0 { @@ -513,12 +513,12 @@ func getOrCreateMachinePorts(scope *scope.WithLogger, openStackCluster *infrav1. if err != nil { return fmt.Errorf("create ports: %w", err) } - openStackMachine.Status.DependentResources.PortsStatus = append(openStackMachine.Status.DependentResources.PortsStatus, machinePortsStatus...) + openStackMachine.Status.DependentResources.Ports = append(openStackMachine.Status.DependentResources.Ports, machinePortsStatus...) } // Sanity check that the number of ports that have been put into PortsStatus is equal to the number of desired ports now that we have created them all. - if len(openStackMachine.Status.DependentResources.PortsStatus) != len(desiredPorts) { - return fmt.Errorf("length of ports that already exist (%d) is not equal to the length of desired ports (%d)", len(openStackMachine.Status.DependentResources.PortsStatus), len(desiredPorts)) + if len(openStackMachine.Status.DependentResources.Ports) != len(desiredPorts) { + return fmt.Errorf("length of ports that already exist (%d) is not equal to the length of desired ports (%d)", len(openStackMachine.Status.DependentResources.Ports), len(desiredPorts)) } return nil diff --git a/docs/book/src/api/v1beta1/api.md b/docs/book/src/api/v1beta1/api.md index 38003ddb7b..ce660d5e0d 100644 --- a/docs/book/src/api/v1beta1/api.md +++ b/docs/book/src/api/v1beta1/api.md @@ -1396,7 +1396,7 @@ further information.

-portsStatus
+ports
[]PortStatus @@ -1405,7 +1405,7 @@ further information.

(Optional) -

PortsStatus is the status of the ports created for the machine.

+

Ports is the status of the ports created for the machine.

@@ -3895,7 +3895,7 @@ string -portsOpts
+ports
[]PortOpts @@ -3904,7 +3904,7 @@ string (Optional) -

portsOpts is the list of ports options to create for the machine.

+

Ports is the fully resolved list of ports to create for the machine.

diff --git a/pkg/cloud/services/compute/dependent_resources.go b/pkg/cloud/services/compute/dependent_resources.go index ab8bf67547..7a7d4e5b65 100644 --- a/pkg/cloud/services/compute/dependent_resources.go +++ b/pkg/cloud/services/compute/dependent_resources.go @@ -30,7 +30,7 @@ func ResolveDependentMachineResources(scope *scope.WithLogger, openStackMachine return changed, err } - return networkingService.AdoptMachinePorts(scope, openStackMachine, openStackMachine.Status.ReferencedResources.PortsOpts) + return networkingService.AdoptMachinePorts(scope, openStackMachine, openStackMachine.Status.ReferencedResources.Ports) } func ResolveDependentBastionResources(scope *scope.WithLogger, openStackCluster *infrav1.OpenStackCluster, bastionName string) (changed bool, err error) { diff --git a/pkg/cloud/services/compute/dependent_resources_test.go b/pkg/cloud/services/compute/dependent_resources_test.go index e1e91f27f3..e25caba053 100644 --- a/pkg/cloud/services/compute/dependent_resources_test.go +++ b/pkg/cloud/services/compute/dependent_resources_test.go @@ -73,7 +73,7 @@ func Test_ResolveDependentMachineResources(t *testing.T) { }, openStackMachineStatus: infrav1.OpenStackMachineStatus{ DependentResources: infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: portID, }, @@ -81,7 +81,7 @@ func Test_ResolveDependentMachineResources(t *testing.T) { }, }, want: &infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: portID, }, @@ -167,7 +167,7 @@ func TestResolveDependentBastionResources(t *testing.T) { Status: infrav1.OpenStackClusterStatus{ Bastion: &infrav1.BastionStatus{ DependentResources: infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: portID, }, @@ -182,7 +182,7 @@ func TestResolveDependentBastionResources(t *testing.T) { }, }, want: &infrav1.DependentMachineResources{ - PortsStatus: []infrav1.PortStatus{ + Ports: []infrav1.PortStatus{ { ID: portID, }, diff --git a/pkg/cloud/services/compute/referenced_resources.go b/pkg/cloud/services/compute/referenced_resources.go index 657a14f93a..8fad1bf36b 100644 --- a/pkg/cloud/services/compute/referenced_resources.go +++ b/pkg/cloud/services/compute/referenced_resources.go @@ -62,7 +62,7 @@ func ResolveReferencedMachineResources(scope *scope.WithLogger, openStackCluster } // Network resources are required in order to get ports options. - if len(resources.PortsOpts) == 0 && openStackCluster.Status.Network != nil { + if len(resources.Ports) == 0 && openStackCluster.Status.Network != nil { // For now we put this here but realistically an OpenStack administrator could enable/disable trunk // support at any time, so we should probably check this on every reconcile. trunkSupported, err := networkingService.IsTrunkExtSupported() @@ -73,7 +73,7 @@ func ResolveReferencedMachineResources(scope *scope.WithLogger, openStackCluster if err != nil { return changed, err } - resources.PortsOpts = portsOpts + resources.Ports = portsOpts changed = true } diff --git a/pkg/cloud/services/compute/referenced_resources_test.go b/pkg/cloud/services/compute/referenced_resources_test.go index e4107ba302..a62ce19e2f 100644 --- a/pkg/cloud/services/compute/referenced_resources_test.go +++ b/pkg/cloud/services/compute/referenced_resources_test.go @@ -133,7 +133,7 @@ func Test_ResolveReferencedMachineResources(t *testing.T) { }, want: &infrav1.ReferencedMachineResources{ ImageID: imageID1, - PortsOpts: []infrav1.PortOpts{ + Ports: []infrav1.PortOpts{ { Network: &infrav1.NetworkFilter{ ID: "test-network-id", diff --git a/pkg/cloud/services/networking/port.go b/pkg/cloud/services/networking/port.go index e651ba992c..6ca2d38e77 100644 --- a/pkg/cloud/services/networking/port.go +++ b/pkg/cloud/services/networking/port.go @@ -532,7 +532,7 @@ func (s *Service) AdoptMachinePorts(scope *scope.WithLogger, openStackMachine *i // We can skip adoption if the instance is ready because OpenStackMachine is immutable once ready // or if the ports are already in the status - if openStackMachine.Status.Ready && len(openStackMachine.Status.DependentResources.PortsStatus) == len(desiredPorts) { + if openStackMachine.Status.Ready && len(openStackMachine.Status.DependentResources.Ports) == len(desiredPorts) { scope.Logger().V(5).Info("OpenStackMachine is ready, skipping the adoption of ports") return changed, nil } @@ -544,7 +544,7 @@ func (s *Service) AdoptMachinePorts(scope *scope.WithLogger, openStackMachine *i // We can therefore stop searching for ports once we find one that doesn't exist. for i, port := range desiredPorts { // check if the port is in status first and if it is, skip it - if i < len(openStackMachine.Status.DependentResources.PortsStatus) { + if i < len(openStackMachine.Status.DependentResources.Ports) { scope.Logger().V(5).Info("Port already in status, skipping it", "port index", i) continue } @@ -570,7 +570,7 @@ func (s *Service) AdoptMachinePorts(scope *scope.WithLogger, openStackMachine *i // The desired port was found, so we add it to the status scope.Logger().V(5).Info("Port found, adding it to the status", "port index", i) - openStackMachine.Status.DependentResources.PortsStatus = append(openStackMachine.Status.DependentResources.PortsStatus, infrav1.PortStatus{ID: ports[0].ID}) + openStackMachine.Status.DependentResources.Ports = append(openStackMachine.Status.DependentResources.Ports, infrav1.PortStatus{ID: ports[0].ID}) changed = true } @@ -594,10 +594,10 @@ func (s *Service) AdoptBastionPorts(scope *scope.WithLogger, openStackCluster *i openStackCluster.Status.Bastion = &infrav1.BastionStatus{} } - desiredPorts := openStackCluster.Status.Bastion.ReferencedResources.PortsOpts + desiredPorts := openStackCluster.Status.Bastion.ReferencedResources.Ports // We can skip adoption if the ports are already in the status - if len(desiredPorts) == len(openStackCluster.Status.Bastion.DependentResources.PortsStatus) { + if len(desiredPorts) == len(openStackCluster.Status.Bastion.DependentResources.Ports) { return changed, nil } @@ -608,7 +608,7 @@ func (s *Service) AdoptBastionPorts(scope *scope.WithLogger, openStackCluster *i // We can therefore stop searching for ports once we find one that doesn't exist. for i, port := range desiredPorts { // check if the port is in status first and if it is, skip it - if i < len(openStackCluster.Status.Bastion.DependentResources.PortsStatus) { + if i < len(openStackCluster.Status.Bastion.DependentResources.Ports) { scope.Logger().V(5).Info("Port already in status, skipping it", "port index", i) continue } @@ -634,7 +634,7 @@ func (s *Service) AdoptBastionPorts(scope *scope.WithLogger, openStackCluster *i // The desired port was found, so we add it to the status scope.Logger().V(5).Info("Port found, adding it to the status", "port index", i) - openStackCluster.Status.Bastion.DependentResources.PortsStatus = append(openStackCluster.Status.Bastion.DependentResources.PortsStatus, infrav1.PortStatus{ID: ports[0].ID}) + openStackCluster.Status.Bastion.DependentResources.Ports = append(openStackCluster.Status.Bastion.DependentResources.Ports, infrav1.PortStatus{ID: ports[0].ID}) changed = true }