Skip to content

Commit f6fb753

Browse files
authored
Merge pull request #1762 from elastx/floating_ip_from_pool
✨ Adds IPAM support for floating ips in OpenStackMachine
2 parents e7d0e19 + 7dce82c commit f6fb753

18 files changed

+429
-8
lines changed

api/v1alpha5/zz_generated.conversion.go

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

api/v1alpha6/openstackmachine_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ func restorev1beta1MachineSpec(previous *infrav1.OpenStackMachineSpec, dst *infr
166166
dst.AdditionalBlockDevices = previous.AdditionalBlockDevices
167167
dst.ServerGroup = previous.ServerGroup
168168
dst.Image = previous.Image
169+
dst.FloatingIPPoolRef = previous.FloatingIPPoolRef
169170
}
170171

171172
func convertNetworksToPorts(networks []NetworkParam, s apiconversion.Scope) ([]infrav1.PortOpts, error) {

api/v1alpha6/zz_generated.conversion.go

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

api/v1alpha7/openstackmachine_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ func restorev1beta1MachineSpec(previous *infrav1.OpenStackMachineSpec, dst *infr
142142
restorev1beta1Port(&previous.Ports[i], &dst.Ports[i])
143143
}
144144
}
145+
dst.FloatingIPPoolRef = previous.FloatingIPPoolRef
145146
}
146147

147148
func Convert_v1alpha7_OpenStackMachineSpec_To_v1beta1_OpenStackMachineSpec(in *OpenStackMachineSpec, out *infrav1.OpenStackMachineSpec, s apiconversion.Scope) error {

api/v1alpha7/zz_generated.conversion.go

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

api/v1beta1/conditions_consts.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,12 @@ const (
5353
// FloatingIPErrorReason used when the floating ip could not be created or attached.
5454
FloatingIPErrorReason = "FloatingIPError"
5555
)
56+
57+
const (
58+
// FloatingAddressFromPoolReadyCondition reports on the current status of the Floating IPs from ipam pool.
59+
FloatingAddressFromPoolReadyCondition clusterv1.ConditionType = "FloatingAddressFromPoolReady"
60+
// WaitingForIpamProviderReason used when machine is waiting for ipam provider to be ready before proceeding.
61+
FloatingAddressFromPoolWaitingForIpamProviderReason = "WaitingForIPAMProvider"
62+
// FloatingAddressFromPoolErrorReason is used when there is an error attaching an IP from the pool to an machine.
63+
FloatingAddressFromPoolErrorReason = "FloatingIPError"
64+
)

api/v1beta1/openstackmachine_types.go

Lines changed: 8 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.
@@ -90,6 +91,12 @@ type OpenStackMachineSpec struct {
9091
// credentials specified in the cluster will be used.
9192
// +optional
9293
IdentityRef *OpenStackIdentityReference `json:"identityRef,omitempty"`
94+
95+
// floatingIPPoolRef is a reference to a IPPool that will be assigned
96+
// to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
97+
// will be assigned to the OpenStackMachine.
98+
// +optional
99+
FloatingIPPoolRef *corev1.TypedLocalObjectReference `json:"floatingIPPoolRef,omitempty"`
93100
}
94101

95102
type ServerMetadata struct {

api/v1beta1/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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4996,6 +4996,29 @@ spec:
49964996
description: The flavor reference for the flavor for your
49974997
server instance.
49984998
type: string
4999+
floatingIPPoolRef:
5000+
description: |-
5001+
floatingIPPoolRef is a reference to a IPPool that will be assigned
5002+
to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
5003+
will be assigned to the OpenStackMachine.
5004+
properties:
5005+
apiGroup:
5006+
description: |-
5007+
APIGroup is the group for the resource being referenced.
5008+
If APIGroup is not specified, the specified Kind must be in the core API group.
5009+
For any other third-party types, APIGroup is required.
5010+
type: string
5011+
kind:
5012+
description: Kind is the type of resource being referenced
5013+
type: string
5014+
name:
5015+
description: Name is the name of resource being referenced
5016+
type: string
5017+
required:
5018+
- kind
5019+
- name
5020+
type: object
5021+
x-kubernetes-map-type: atomic
49995022
identityRef:
50005023
description: |-
50015024
IdentityRef is a reference to a secret holding OpenStack credentials

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,6 +2421,31 @@ spec:
24212421
description: The flavor reference for the flavor for
24222422
your server instance.
24232423
type: string
2424+
floatingIPPoolRef:
2425+
description: |-
2426+
floatingIPPoolRef is a reference to a IPPool that will be assigned
2427+
to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
2428+
will be assigned to the OpenStackMachine.
2429+
properties:
2430+
apiGroup:
2431+
description: |-
2432+
APIGroup is the group for the resource being referenced.
2433+
If APIGroup is not specified, the specified Kind must be in the core API group.
2434+
For any other third-party types, APIGroup is required.
2435+
type: string
2436+
kind:
2437+
description: Kind is the type of resource being
2438+
referenced
2439+
type: string
2440+
name:
2441+
description: Name is the name of resource being
2442+
referenced
2443+
type: string
2444+
required:
2445+
- kind
2446+
- name
2447+
type: object
2448+
x-kubernetes-map-type: atomic
24242449
identityRef:
24252450
description: |-
24262451
IdentityRef is a reference to a secret holding OpenStack credentials

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,6 +1784,29 @@ spec:
17841784
flavor:
17851785
description: The flavor reference for the flavor for your server instance.
17861786
type: string
1787+
floatingIPPoolRef:
1788+
description: |-
1789+
floatingIPPoolRef is a reference to a IPPool that will be assigned
1790+
to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
1791+
will be assigned to the OpenStackMachine.
1792+
properties:
1793+
apiGroup:
1794+
description: |-
1795+
APIGroup is the group for the resource being referenced.
1796+
If APIGroup is not specified, the specified Kind must be in the core API group.
1797+
For any other third-party types, APIGroup is required.
1798+
type: string
1799+
kind:
1800+
description: Kind is the type of resource being referenced
1801+
type: string
1802+
name:
1803+
description: Name is the name of resource being referenced
1804+
type: string
1805+
required:
1806+
- kind
1807+
- name
1808+
type: object
1809+
x-kubernetes-map-type: atomic
17871810
identityRef:
17881811
description: |-
17891812
IdentityRef is a reference to a secret holding OpenStack credentials

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,29 @@ spec:
14571457
description: The flavor reference for the flavor for your
14581458
server instance.
14591459
type: string
1460+
floatingIPPoolRef:
1461+
description: |-
1462+
floatingIPPoolRef is a reference to a IPPool that will be assigned
1463+
to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
1464+
will be assigned to the OpenStackMachine.
1465+
properties:
1466+
apiGroup:
1467+
description: |-
1468+
APIGroup is the group for the resource being referenced.
1469+
If APIGroup is not specified, the specified Kind must be in the core API group.
1470+
For any other third-party types, APIGroup is required.
1471+
type: string
1472+
kind:
1473+
description: Kind is the type of resource being referenced
1474+
type: string
1475+
name:
1476+
description: Name is the name of resource being referenced
1477+
type: string
1478+
required:
1479+
- kind
1480+
- name
1481+
type: object
1482+
x-kubernetes-map-type: atomic
14601483
identityRef:
14611484
description: |-
14621485
IdentityRef is a reference to a secret holding OpenStack credentials

config/rbac/role.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ rules:
123123
- delete
124124
- get
125125
- list
126+
- patch
126127
- update
127128
- watch
128129
- apiGroups:

0 commit comments

Comments
 (0)