Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Adds IPAM support for floating ips in OpenStackMachine #1762

Merged
merged 1 commit into from
Mar 15, 2024
Merged
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
1 change: 1 addition & 0 deletions api/v1alpha5/zz_generated.conversion.go

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

1 change: 1 addition & 0 deletions api/v1alpha6/openstackmachine_conversion.go
Original file line number Diff line number Diff line change
@@ -161,6 +161,7 @@ func restorev1beta1MachineSpec(previous *infrav1.OpenStackMachineSpec, dst *infr
dst.AdditionalBlockDevices = previous.AdditionalBlockDevices
dst.ServerGroup = previous.ServerGroup
dst.Image = previous.Image
dst.FloatingIPPoolRef = previous.FloatingIPPoolRef
}

func convertNetworksToPorts(networks []NetworkParam, s apiconversion.Scope) ([]infrav1.PortOpts, error) {
1 change: 1 addition & 0 deletions api/v1alpha6/zz_generated.conversion.go

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

1 change: 1 addition & 0 deletions api/v1alpha7/openstackmachine_conversion.go
Original file line number Diff line number Diff line change
@@ -137,6 +137,7 @@ func restorev1beta1MachineSpec(previous *infrav1.OpenStackMachineSpec, dst *infr
restorev1beta1Port(&previous.Ports[i], &dst.Ports[i])
}
}
dst.FloatingIPPoolRef = previous.FloatingIPPoolRef
}

func Convert_v1alpha7_OpenStackMachineSpec_To_v1beta1_OpenStackMachineSpec(in *OpenStackMachineSpec, out *infrav1.OpenStackMachineSpec, s apiconversion.Scope) error {
1 change: 1 addition & 0 deletions api/v1alpha7/zz_generated.conversion.go

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

9 changes: 9 additions & 0 deletions api/v1beta1/conditions_consts.go
Original file line number Diff line number Diff line change
@@ -53,3 +53,12 @@ const (
// FloatingIPErrorReason used when the floating ip could not be created or attached.
FloatingIPErrorReason = "FloatingIPError"
)

const (
// FloatingAddressFromPoolReadyCondition reports on the current status of the Floating IPs from ipam pool.
FloatingAddressFromPoolReadyCondition clusterv1.ConditionType = "FloatingAddressFromPoolReady"
// WaitingForIpamProviderReason used when machine is waiting for ipam provider to be ready before proceeding.
FloatingAddressFromPoolWaitingForIpamProviderReason = "WaitingForIPAMProvider"
// FloatingAddressFromPoolErrorReason is used when there is an error attaching an IP from the pool to an machine.
FloatingAddressFromPoolErrorReason = "FloatingIPError"
)
9 changes: 8 additions & 1 deletion api/v1beta1/openstackmachine_types.go
Original file line number Diff line number Diff line change
@@ -27,7 +27,8 @@ import (
const (
// MachineFinalizer allows ReconcileOpenStackMachine to clean up OpenStack resources associated with OpenStackMachine before
// removing it from the apiserver.
MachineFinalizer = "openstackmachine.infrastructure.cluster.x-k8s.io"
MachineFinalizer = "openstackmachine.infrastructure.cluster.x-k8s.io"
IPClaimMachineFinalizer = "openstackmachine.infrastructure.cluster.x-k8s.io/ip-claim"
)

// OpenStackMachineSpec defines the desired state of OpenStackMachine.
@@ -89,6 +90,12 @@ type OpenStackMachineSpec struct {
// credentials specified in the cluster will be used.
// +optional
IdentityRef *OpenStackIdentityReference `json:"identityRef,omitempty"`

// floatingIPPoolRef is a reference to a IPPool that will be assigned
// to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
// will be assigned to the OpenStackMachine.
// +optional
FloatingIPPoolRef *corev1.TypedLocalObjectReference `json:"floatingIPPoolRef,omitempty"`
}

type ServerMetadata struct {
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
@@ -4996,6 +4996,29 @@ spec:
description: The flavor reference for the flavor for your
server instance.
type: string
floatingIPPoolRef:
description: |-
floatingIPPoolRef is a reference to a IPPool that will be assigned
to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
will be assigned to the OpenStackMachine.
properties:
apiGroup:
description: |-
APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
x-kubernetes-map-type: atomic
identityRef:
description: |-
IdentityRef is a reference to a secret holding OpenStack credentials
Original file line number Diff line number Diff line change
@@ -2421,6 +2421,31 @@ spec:
description: The flavor reference for the flavor for
your server instance.
type: string
floatingIPPoolRef:
description: |-
floatingIPPoolRef is a reference to a IPPool that will be assigned
to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
will be assigned to the OpenStackMachine.
properties:
apiGroup:
description: |-
APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being
referenced
type: string
name:
description: Name is the name of resource being
referenced
type: string
required:
- kind
- name
type: object
x-kubernetes-map-type: atomic
identityRef:
description: |-
IdentityRef is a reference to a secret holding OpenStack credentials
Original file line number Diff line number Diff line change
@@ -1784,6 +1784,29 @@ spec:
flavor:
description: The flavor reference for the flavor for your server instance.
type: string
floatingIPPoolRef:
description: |-
floatingIPPoolRef is a reference to a IPPool that will be assigned
to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
will be assigned to the OpenStackMachine.
properties:
apiGroup:
description: |-
APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
x-kubernetes-map-type: atomic
identityRef:
description: |-
IdentityRef is a reference to a secret holding OpenStack credentials
Original file line number Diff line number Diff line change
@@ -1457,6 +1457,29 @@ spec:
description: The flavor reference for the flavor for your
server instance.
type: string
floatingIPPoolRef:
description: |-
floatingIPPoolRef is a reference to a IPPool that will be assigned
to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
will be assigned to the OpenStackMachine.
properties:
apiGroup:
description: |-
APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
x-kubernetes-map-type: atomic
identityRef:
description: |-
IdentityRef is a reference to a secret holding OpenStack credentials
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -123,6 +123,7 @@ rules:
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
Loading