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
19 changes: 0 additions & 19 deletions api/v1alpha5/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,6 @@ func Convert_v1alpha5_PortOpts_To_v1alpha7_PortOpts(in *PortOpts, out *infrav1.P
return nil
}

func Convert_v1alpha5_OpenStackMachineSpec_To_v1alpha7_Bastion(in *OpenStackMachineSpec, out *infrav1.Bastion, _ conversion.Scope) error {
out.FloatingIP = in.FloatingIP
return nil
}

func Convert_v1alpha7_Bastion_To_v1alpha5_OpenStackMachineSpec(in *infrav1.Bastion, out *OpenStackMachineSpec, _ conversion.Scope) error {
out.FloatingIP = in.FloatingIP
return nil
}

func Convert_v1alpha5_Instance_To_v1alpha7_BastionStatus(in *Instance, out *infrav1.BastionStatus, _ conversion.Scope) error {
// BastionStatus is the same as Instance with unused fields removed
out.ID = in.ID
Expand Down Expand Up @@ -447,12 +437,3 @@ func Convert_v1alpha5_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(
func Convert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in *infrav1.OpenStackMachineSpec, out *OpenStackMachineSpec, s conversion.Scope) error {
return autoConvert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in, out, s)
}

func Convert_v1alpha7_Bastion_To_v1alpha5_Bastion(in *infrav1.Bastion, out *Bastion, s conversion.Scope) error {
err := autoConvert_v1alpha7_Bastion_To_v1alpha5_Bastion(in, out, s)
if err != nil {
return err
}
in.FloatingIP = out.Instance.FloatingIP
return nil
}
29 changes: 12 additions & 17 deletions api/v1alpha5/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 0 additions & 23 deletions api/v1alpha6/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ func restorev1alpha6MachineSpec(previous *OpenStackMachineSpec, dst *OpenStackMa
dst.Networks = previous.Networks
dst.Ports = previous.Ports
dst.SecurityGroups = previous.SecurityGroups

// FloatingIP is removed from v1alpha7 with no replacement, so can't be
// losslessly converted. Restore the previously stored value on down-conversion.
dst.FloatingIP = previous.FloatingIP
}

func restorev1alpha6ClusterStatus(previous *OpenStackClusterStatus, dst *OpenStackClusterStatus) {
Expand Down Expand Up @@ -476,16 +472,6 @@ func Convert_v1alpha7_PortOpts_To_v1alpha6_PortOpts(in *infrav1.PortOpts, out *P
return nil
}

func Convert_v1alpha6_OpenStackMachineSpec_To_v1alpha7_Bastion(in *OpenStackMachineSpec, out *infrav1.Bastion, _ apiconversion.Scope) error {
out.FloatingIP = in.FloatingIP
return nil
}

func Convert_v1alpha7_Bastion_To_v1alpha6_OpenStackMachineSpec(in *infrav1.Bastion, out *OpenStackMachineSpec, _ apiconversion.Scope) error {
out.FloatingIP = in.FloatingIP
return nil
}

func Convert_v1alpha6_Instance_To_v1alpha7_BastionStatus(in *Instance, out *infrav1.BastionStatus, _ apiconversion.Scope) error {
// BastionStatus is the same as Instance with unused fields removed
out.ID = in.ID
Expand Down Expand Up @@ -673,12 +659,3 @@ func Convert_v1alpha6_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(
func Convert_v1alpha7_OpenStackMachineSpec_To_v1alpha6_OpenStackMachineSpec(in *infrav1.OpenStackMachineSpec, out *OpenStackMachineSpec, s apiconversion.Scope) error {
return autoConvert_v1alpha7_OpenStackMachineSpec_To_v1alpha6_OpenStackMachineSpec(in, out, s)
}

func Convert_v1alpha7_Bastion_To_v1alpha6_Bastion(in *infrav1.Bastion, out *Bastion, s apiconversion.Scope) error {
err := autoConvert_v1alpha7_Bastion_To_v1alpha6_Bastion(in, out, s)
if err != nil {
return err
}
in.FloatingIP = out.Instance.FloatingIP
return nil
}
29 changes: 12 additions & 17 deletions api/v1alpha6/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/v1alpha7/openstackmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ type OpenStackMachineSpec struct {
// If not specified a default port will be added for the default cluster network.
Ports []PortOpts `json:"ports,omitempty"`

// The floatingIP which will be associated to the machine, only used for master.
// The floatingIP should have been created and haven't been associated.
FloatingIP string `json:"floatingIP,omitempty"`

// The names of the security groups to assign to the instance
SecurityGroups []SecurityGroupFilter `json:"securityGroups,omitempty"`

Expand Down
5 changes: 0 additions & 5 deletions api/v1alpha7/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,6 @@ type Bastion struct {

//+optional
AvailabilityZone string `json:"availabilityZone,omitempty"`

// FloatingIP which will be associated to the bastion machine.
// The floating IP should already exist and should not be associated with a port.
//+optional
FloatingIP string `json:"floatingIP,omitempty"`
}

type APIServerLoadBalancer struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3767,11 +3767,6 @@ spec:
type: string
enabled:
type: boolean
floatingIP:
description: FloatingIP which will be associated to the bastion
machine. The floating IP should already exist and should not
be associated with a port.
type: string
instance:
description: Instance for the bastion itself
properties:
Expand Down Expand Up @@ -3847,6 +3842,11 @@ spec:
description: The flavor reference for the flavor for your
server instance.
type: string
floatingIP:
description: The floatingIP which will be associated to the
machine, only used for master. The floatingIP should have
been created and haven't been associated.
type: string
identityRef:
description: IdentityRef is a reference to a identity to be
used when reconciling this cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1607,11 +1607,6 @@ spec:
type: string
enabled:
type: boolean
floatingIP:
description: FloatingIP which will be associated to the
bastion machine. The floating IP should already exist
and should not be associated with a port.
type: string
instance:
description: Instance for the bastion itself
properties:
Expand Down Expand Up @@ -1693,6 +1688,11 @@ spec:
description: The flavor reference for the flavor for
your server instance.
type: string
floatingIP:
description: The floatingIP which will be associated
to the machine, only used for master. The floatingIP
should have been created and haven't been associated.
type: string
identityRef:
description: IdentityRef is a reference to a identity
to be used when reconciling this cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,11 @@ spec:
flavor:
description: The flavor reference for the flavor for your server instance.
type: string
floatingIP:
description: The floatingIP which will be associated to the machine,
only used for master. The floatingIP should have been created and
haven't been associated.
type: string
identityRef:
description: IdentityRef is a reference to a identity to be used when
reconciling this cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,11 @@ spec:
description: The flavor reference for the flavor for your
server instance.
type: string
floatingIP:
description: The floatingIP which will be associated to the
machine, only used for master. The floatingIP should have
been created and haven't been associated.
type: string
identityRef:
description: IdentityRef is a reference to a identity to be
used when reconciling this cluster
Expand Down
2 changes: 1 addition & 1 deletion controllers/openstackcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func reconcileBastion(scope scope.Scope, cluster *clusterv1.Cluster, openStackCl
return err
}
clusterName := fmt.Sprintf("%s-%s", cluster.Namespace, cluster.Name)
fp, err := networkingService.GetOrCreateFloatingIP(openStackCluster, openStackCluster, clusterName, openStackCluster.Spec.Bastion.FloatingIP)
fp, err := networkingService.GetOrCreateFloatingIP(openStackCluster, openStackCluster, clusterName, openStackCluster.Spec.Bastion.Instance.FloatingIP)
if err != nil {
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to get or create floating IP for bastion: %w", err))
return fmt.Errorf("failed to get or create floating IP for bastion: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/clusteropenstack/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ spec:
...
bastion:
...
floatingIP: <Floating IP address>
floatingIP: <Floating IP address>
```

If `managedSecurityGroups: true`, security group rule opening 22/tcp is added to security groups for bastion, controller, and worker nodes respectively. Otherwise, you have to add `securityGroups` to the `bastion` in `OpenStackCluster` spec and `OpenStackMachineTemplate` spec template respectively.
Expand Down
33 changes: 0 additions & 33 deletions docs/book/src/topics/crd-changes/v1alpha6-to-v1alpha7.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
- [`OpenStackMachine`](#openstackmachine)
- [⚠️ Removal of networks](#-removal-of-networks)
- [Removal of subnet](#removal-of-subnet)
- [Change to floatingIP](#change-to-floatingip)
- [Change to securityGroups](#change-to-securitygroups)
- [Changes to ports](#changes-to-ports)
- [Change to securityGroupFilters](#change-to-securitygroupfilters)
Expand Down Expand Up @@ -122,38 +121,6 @@ to set the `accessIPv4` field on Nova servers. This feature was not widely
used, difficult to use, and could not be extended to support IPv6. It is
removed without replacement.

#### Change to floatingIP

The `OpenStackMachineSpec.FloatingIP` field has moved to `OpenStackClusterSpec.Bastion.FloatingIP`.
For example, if you had the following `OpenStackMachineTemplate`:

```yaml
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
kind: OpenStackMachineTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
spec:
template:
spec:
..
floatingIP: "1.2.3.4"
```

This will safely converted to use `Bastion.FloatingIP` when upgrading to version 0.8.

To use the new `Bastion.FloatingIP` field, here is an example:

```yaml
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
kind: OpenStackCluster
metadata:
name: ${CLUSTER_NAME}
spec:
..
bastion:
floatingIP: "1.2.3.4"
```

#### Change to securityGroups

`securityGroups` has been simplified by the removal of a separate filter parameter. It was previously:
Expand Down