Skip to content

Commit 5b1291a

Browse files
committed
Move FloatingIP to Bastion spec
1 parent ca25160 commit 5b1291a

12 files changed

+82
-49
lines changed

api/v1alpha5/conversion.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,16 @@ func Convert_v1alpha5_PortOpts_To_v1alpha7_PortOpts(in *PortOpts, out *infrav1.P
238238
return nil
239239
}
240240

241+
func Convert_v1alpha5_OpenStackMachineSpec_To_v1alpha7_Bastion(in *OpenStackMachineSpec, out *infrav1.Bastion, _ conversion.Scope) error {
242+
out.FloatingIP = in.FloatingIP
243+
return nil
244+
}
245+
246+
func Convert_v1alpha7_Bastion_To_v1alpha5_OpenStackMachineSpec(in *infrav1.Bastion, out *OpenStackMachineSpec, _ conversion.Scope) error {
247+
out.FloatingIP = in.FloatingIP
248+
return nil
249+
}
250+
241251
func Convert_v1alpha5_Instance_To_v1alpha7_BastionStatus(in *Instance, out *infrav1.BastionStatus, _ conversion.Scope) error {
242252
// BastionStatus is the same as Instance with unused fields removed
243253
out.ID = in.ID
@@ -437,3 +447,7 @@ func Convert_v1alpha5_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(
437447
func Convert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in *infrav1.OpenStackMachineSpec, out *OpenStackMachineSpec, s conversion.Scope) error {
438448
return autoConvert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in, out, s)
439449
}
450+
451+
func Convert_v1alpha7_Bastion_To_v1alpha5_Bastion(in *infrav1.Bastion, out *Bastion, s conversion.Scope) error {
452+
return autoConvert_v1alpha7_Bastion_To_v1alpha5_Bastion(in, out, s)
453+
}

api/v1alpha5/zz_generated.conversion.go

Lines changed: 17 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha6/conversion.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,16 @@ func Convert_v1alpha7_PortOpts_To_v1alpha6_PortOpts(in *infrav1.PortOpts, out *P
472472
return nil
473473
}
474474

475+
func Convert_v1alpha6_OpenStackMachineSpec_To_v1alpha7_Bastion(in *OpenStackMachineSpec, out *infrav1.Bastion, _ apiconversion.Scope) error {
476+
out.FloatingIP = in.FloatingIP
477+
return nil
478+
}
479+
480+
func Convert_v1alpha7_Bastion_To_v1alpha6_OpenStackMachineSpec(in *infrav1.Bastion, out *OpenStackMachineSpec, _ apiconversion.Scope) error {
481+
out.FloatingIP = in.FloatingIP
482+
return nil
483+
}
484+
475485
func Convert_v1alpha6_Instance_To_v1alpha7_BastionStatus(in *Instance, out *infrav1.BastionStatus, _ apiconversion.Scope) error {
476486
// BastionStatus is the same as Instance with unused fields removed
477487
out.ID = in.ID
@@ -659,3 +669,7 @@ func Convert_v1alpha6_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(
659669
func Convert_v1alpha7_OpenStackMachineSpec_To_v1alpha6_OpenStackMachineSpec(in *infrav1.OpenStackMachineSpec, out *OpenStackMachineSpec, s apiconversion.Scope) error {
660670
return autoConvert_v1alpha7_OpenStackMachineSpec_To_v1alpha6_OpenStackMachineSpec(in, out, s)
661671
}
672+
673+
func Convert_v1alpha7_Bastion_To_v1alpha6_Bastion(in *infrav1.Bastion, out *Bastion, s apiconversion.Scope) error {
674+
return autoConvert_v1alpha7_Bastion_To_v1alpha6_Bastion(in, out, s)
675+
}

api/v1alpha6/zz_generated.conversion.go

Lines changed: 17 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha7/openstackmachine_types.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ type OpenStackMachineSpec struct {
6060
// If not specified a default port will be added for the default cluster network.
6161
Ports []PortOpts `json:"ports,omitempty"`
6262

63-
// The floatingIP which will be associated to the machine, only used for master.
64-
// The floatingIP should have been created and haven't been associated.
65-
FloatingIP string `json:"floatingIP,omitempty"`
66-
6763
// The names of the security groups to assign to the instance
6864
SecurityGroups []SecurityGroupFilter `json:"securityGroups,omitempty"`
6965

api/v1alpha7/types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ type Bastion struct {
344344

345345
//+optional
346346
AvailabilityZone string `json:"availabilityZone,omitempty"`
347+
348+
// FloatingIP which will be associated to the bastion machine.
349+
// The floating IP should already exist and should not be associated with a port.
350+
//+optional
351+
FloatingIP string `json:"floatingIP,omitempty"`
347352
}
348353

349354
type APIServerLoadBalancer struct {

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3767,6 +3767,11 @@ spec:
37673767
type: string
37683768
enabled:
37693769
type: boolean
3770+
floatingIP:
3771+
description: FloatingIP which will be associated to the bastion
3772+
machine. The floating IP should already exist and should not
3773+
be associated with a port.
3774+
type: string
37703775
instance:
37713776
description: Instance for the bastion itself
37723777
properties:
@@ -3842,11 +3847,6 @@ spec:
38423847
description: The flavor reference for the flavor for your
38433848
server instance.
38443849
type: string
3845-
floatingIP:
3846-
description: The floatingIP which will be associated to the
3847-
machine, only used for master. The floatingIP should have
3848-
been created and haven't been associated.
3849-
type: string
38503850
identityRef:
38513851
description: IdentityRef is a reference to a identity to be
38523852
used when reconciling this cluster

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,6 +1607,11 @@ spec:
16071607
type: string
16081608
enabled:
16091609
type: boolean
1610+
floatingIP:
1611+
description: FloatingIP which will be associated to the
1612+
bastion machine. The floating IP should already exist
1613+
and should not be associated with a port.
1614+
type: string
16101615
instance:
16111616
description: Instance for the bastion itself
16121617
properties:
@@ -1688,11 +1693,6 @@ spec:
16881693
description: The flavor reference for the flavor for
16891694
your server instance.
16901695
type: string
1691-
floatingIP:
1692-
description: The floatingIP which will be associated
1693-
to the machine, only used for master. The floatingIP
1694-
should have been created and haven't been associated.
1695-
type: string
16961696
identityRef:
16971697
description: IdentityRef is a reference to a identity
16981698
to be used when reconciling this cluster

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,11 +1226,6 @@ spec:
12261226
flavor:
12271227
description: The flavor reference for the flavor for your server instance.
12281228
type: string
1229-
floatingIP:
1230-
description: The floatingIP which will be associated to the machine,
1231-
only used for master. The floatingIP should have been created and
1232-
haven't been associated.
1233-
type: string
12341229
identityRef:
12351230
description: IdentityRef is a reference to a identity to be used when
12361231
reconciling this cluster

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,11 +1030,6 @@ spec:
10301030
description: The flavor reference for the flavor for your
10311031
server instance.
10321032
type: string
1033-
floatingIP:
1034-
description: The floatingIP which will be associated to the
1035-
machine, only used for master. The floatingIP should have
1036-
been created and haven't been associated.
1037-
type: string
10381033
identityRef:
10391034
description: IdentityRef is a reference to a identity to be
10401035
used when reconciling this cluster

controllers/openstackcluster_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func reconcileBastion(scope scope.Scope, cluster *clusterv1.Cluster, openStackCl
359359
return err
360360
}
361361
clusterName := fmt.Sprintf("%s-%s", cluster.Namespace, cluster.Name)
362-
fp, err := networkingService.GetOrCreateFloatingIP(openStackCluster, openStackCluster, clusterName, openStackCluster.Spec.Bastion.Instance.FloatingIP)
362+
fp, err := networkingService.GetOrCreateFloatingIP(openStackCluster, openStackCluster, clusterName, openStackCluster.Spec.Bastion.FloatingIP)
363363
if err != nil {
364364
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to get or create floating IP for bastion: %w", err))
365365
return fmt.Errorf("failed to get or create floating IP for bastion: %w", err)

docs/book/src/topics/crd-changes/v1alpha6-to-v1alpha7.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ known to cause some issues in some environments.
258258

259259
### `OpenStackCluster`
260260

261+
#### ⚠️ Change to floatingIP
262+
263+
The `floatingIP` field has moved from the `OpenStackMachineSpec` to the `OpenStackClusterSpec` into the `Bastion` spec.
264+
261265
#### Change to externalRouterIPs.subnet
262266

263267
The `uuid` field is renamed to `id`, and all fields from `filter` are moved directly into the `subnet`.

0 commit comments

Comments
 (0)