Skip to content

Commit 959b55f

Browse files
committed
Floating ip from IPPools in OpenStackMachine
1 parent 70494b6 commit 959b55f

14 files changed

+330
-45
lines changed

api/v1alpha5/conversion.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,14 @@ func Convert_v1alpha5_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(
434434
return nil
435435
}
436436

437+
func Convert_v1alpha5_OpenStackMachineStatus_To_v1alpha7_OpenStackMachineStatus(in *OpenStackMachineStatus, out *infrav1.OpenStackMachineStatus, s conversion.Scope) error {
438+
return autoConvert_v1alpha5_OpenStackMachineStatus_To_v1alpha7_OpenStackMachineStatus(in, out, s)
439+
}
440+
441+
func Convert_v1alpha7_OpenStackMachineStatus_To_v1alpha5_OpenStackMachineStatus(in *infrav1.OpenStackMachineStatus, out *OpenStackMachineStatus, s conversion.Scope) error {
442+
return autoConvert_v1alpha7_OpenStackMachineStatus_To_v1alpha5_OpenStackMachineStatus(in, out, s)
443+
}
444+
437445
func Convert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in *infrav1.OpenStackMachineSpec, out *OpenStackMachineSpec, s conversion.Scope) error {
438446
return autoConvert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in, out, s)
439447
}

api/v1alpha5/zz_generated.conversion.go

Lines changed: 12 additions & 20 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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,14 @@ func Convert_v1alpha7_OpenStackClusterSpec_To_v1alpha6_OpenStackClusterSpec(in *
435435
return autoConvert_v1alpha7_OpenStackClusterSpec_To_v1alpha6_OpenStackClusterSpec(in, out, s)
436436
}
437437

438+
func Convert_v1alpha6_OpenStackMachineStatus_To_v1alpha7_OpenStackMachineStatus(in *OpenStackMachineStatus, out *infrav1.OpenStackMachineStatus, s apiconversion.Scope) error {
439+
return autoConvert_v1alpha6_OpenStackMachineStatus_To_v1alpha7_OpenStackMachineStatus(in, out, s)
440+
}
441+
442+
func Convert_v1alpha7_OpenStackMachineStatus_To_v1alpha6_OpenStackMachineStatus(in *infrav1.OpenStackMachineStatus, out *OpenStackMachineStatus, s apiconversion.Scope) error {
443+
return autoConvert_v1alpha7_OpenStackMachineStatus_To_v1alpha6_OpenStackMachineStatus(in, out, s)
444+
}
445+
438446
func Convert_v1alpha6_PortOpts_To_v1alpha7_PortOpts(in *PortOpts, out *infrav1.PortOpts, s apiconversion.Scope) error {
439447
err := autoConvert_v1alpha6_PortOpts_To_v1alpha7_PortOpts(in, out, s)
440448
if err != nil {

api/v1alpha6/zz_generated.conversion.go

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

api/v1alpha7/conditions_consts.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,17 @@ const (
4747
const (
4848
// APIServerIngressReadyCondition reports on the current status of the network ingress (Loadbalancer, Floating IP) for Control Plane machines. Ready indicates that the instance can receive requests.
4949
APIServerIngressReadyCondition clusterv1.ConditionType = "APIServerIngressReadyCondition"
50-
5150
// LoadBalancerMemberErrorReason used when the instance could not be added as a loadbalancer member.
5251
LoadBalancerMemberErrorReason = "LoadBalancerMemberError"
5352
// FloatingIPErrorReason used when the floating ip could not be created or attached.
5453
FloatingIPErrorReason = "FloatingIPError"
5554
)
55+
56+
const (
57+
// FloatingAddressFromPoolReadyCondition reports on the current status of the Floating IPs from ipam pool.
58+
FloatingAddressFromPoolReadyCondition clusterv1.ConditionType = "FloatingAddressFromPoolReady"
59+
// WaitingForIpamProviderReason used when machine is waiting for ipam provider to be ready before proceeding.
60+
FloatingAddressFromPoolWaitingForIpamProviderReason = "WaitingForIpamProvider"
61+
// FloatingAddressFromPoolErrorReason is used when FloatingAddressFromPool is used when there is and error attaching an IP from the pool.
62+
FloatingAddressFromPoolErrorReason = "FloatingIPError"
63+
)

api/v1alpha7/openstackmachine_types.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ import (
2727
const (
2828
// MachineFinalizer allows ReconcileOpenStackMachine to clean up OpenStack resources associated with OpenStackMachine before
2929
// removing it from the apiserver.
30-
MachineFinalizer = "openstackmachine.infrastructure.cluster.x-k8s.io"
30+
MachineFinalizer = "openstackmachine.infrastructure.cluster.x-k8s.io"
31+
IPClaimMachineFinalizer = "openstackmachine.infrastructure.cluster.x-k8s.io/ip-claim"
3132
)
3233

3334
// OpenStackMachineSpec defines the desired state of OpenStackMachine.
@@ -96,6 +97,12 @@ type OpenStackMachineSpec struct {
9697
// IdentityRef is a reference to a identity to be used when reconciling this cluster
9798
// +optional
9899
IdentityRef *OpenStackIdentityReference `json:"identityRef,omitempty"`
100+
101+
// FloatingAddressFromPool is a reference to a IPPool that will be assigned
102+
// to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
103+
// will be assigned to the OpenStackMachine.
104+
// +optional
105+
FloatingAddressFromPool *corev1.TypedLocalObjectReference `json:"floatingAddressFromPool,omitempty"`
99106
}
100107

101108
// OpenStackMachineStatus defines the observed state of OpenStackMachine.
@@ -104,6 +111,10 @@ type OpenStackMachineStatus struct {
104111
// +optional
105112
Ready bool `json:"ready"`
106113

114+
// FloatingAddressFromPoolReady is true when the FloatingIP is ready.
115+
// +optional
116+
FloatingAddressFromPoolReady bool `json:"floatingAddressFromPoolReady"`
117+
107118
// Addresses contains the OpenStack instance associated addresses.
108119
Addresses []corev1.NodeAddress `json:"addresses,omitempty"`
109120

api/v1alpha7/zz_generated.deepcopy.go

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3842,6 +3842,28 @@ spec:
38423842
description: The flavor reference for the flavor for your
38433843
server instance.
38443844
type: string
3845+
floatingAddressFromPool:
3846+
description: FloatingAddressFromPool is a reference to a IPPool
3847+
that will be assigned to an IPAddressClaim. Once the IPAddressClaim
3848+
is fulfilled, the FloatingIP will be assigned to the OpenStackMachine.
3849+
properties:
3850+
apiGroup:
3851+
description: APIGroup is the group for the resource being
3852+
referenced. If APIGroup is not specified, the specified
3853+
Kind must be in the core API group. For any other third-party
3854+
types, APIGroup is required.
3855+
type: string
3856+
kind:
3857+
description: Kind is the type of resource being referenced
3858+
type: string
3859+
name:
3860+
description: Name is the name of resource being referenced
3861+
type: string
3862+
required:
3863+
- kind
3864+
- name
3865+
type: object
3866+
x-kubernetes-map-type: atomic
38453867
floatingIP:
38463868
description: The floatingIP which will be associated to the
38473869
machine, only used for master. The floatingIP should have

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,32 @@ spec:
16881688
description: The flavor reference for the flavor for
16891689
your server instance.
16901690
type: string
1691+
floatingAddressFromPool:
1692+
description: FloatingAddressFromPool is a reference
1693+
to a IPPool that will be assigned to an IPAddressClaim.
1694+
Once the IPAddressClaim is fulfilled, the FloatingIP
1695+
will be assigned to the OpenStackMachine.
1696+
properties:
1697+
apiGroup:
1698+
description: APIGroup is the group for the resource
1699+
being referenced. If APIGroup is not specified,
1700+
the specified Kind must be in the core API group.
1701+
For any other third-party types, APIGroup is
1702+
required.
1703+
type: string
1704+
kind:
1705+
description: Kind is the type of resource being
1706+
referenced
1707+
type: string
1708+
name:
1709+
description: Name is the name of resource being
1710+
referenced
1711+
type: string
1712+
required:
1713+
- kind
1714+
- name
1715+
type: object
1716+
x-kubernetes-map-type: atomic
16911717
floatingIP:
16921718
description: The floatingIP which will be associated
16931719
to the machine, only used for master. The floatingIP

0 commit comments

Comments
 (0)