Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit aa30625

Browse files
authored
Merge pull request #70 from GDATASoftwareAG/ipaddressclaims
Use IPAddressClaims
2 parents 64ed187 + 5469b22 commit aa30625

File tree

8 files changed

+277
-2
lines changed

8 files changed

+277
-2
lines changed

api/v1alpha1/ionoscloudmachine_types.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,32 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20+
corev1 "k8s.io/api/core/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2223
)
2324

2425
const (
26+
// IPAddressCreatedCondition documents the claim of the IPAddress
27+
IPAddressCreatedCondition clusterv1.ConditionType = "IPAddressCreated"
28+
29+
// IPAddressCreationFailedReason (Severity=Error) documents a controller detecting
30+
// issues with the creation of the IP address.
31+
IPAddressCreationFailedReason = "IPAddressCreationFailed"
32+
2533
// ServerCreatedCondition documents the creation of the Server
2634
ServerCreatedCondition clusterv1.ConditionType = "ServerCreated"
2735

2836
// ServerCreationFailedReason (Severity=Error) documents a controller detecting
2937
// issues with the creation of the Server.
3038
ServerCreationFailedReason = "ServerCreationFailed"
39+
40+
// IPAddressClaimCreatedCondition documents the creation of the IP Address
41+
IPAddressClaimCreatedCondition clusterv1.ConditionType = "IPAddressClaimCreated"
42+
43+
// IPAddressClaimCreationFailedReason (Severity=Error) documents a controller detecting
44+
// issues with the creation of the IP address.
45+
IPAddressClaimCreationFailedReason = "IPAddressClaimCreationFailed"
3146
)
3247

3348
// IONOSCloudMachineSpec defines the desired state of IONOSCloudMachine
@@ -73,6 +88,10 @@ type IONOSVolumeSpec struct {
7388
type IONOSNicSpec struct {
7489
LanRef IONOSLanRefSpec `json:"lanRef"`
7590
PrimaryIP *string `json:"primaryIP,omitempty"`
91+
// PrimaryAddressFrom is an IPAddressPools that should be assigned
92+
// to an IPAddressClaims.
93+
// +optional
94+
PrimaryAddressFrom *corev1.TypedLocalObjectReference `json:"primaryAddressFrom,omitempty"`
7695
//NameTemplate string `json:"nameTemplate"`
7796
}
7897

api/v1alpha1/zz_generated.deepcopy.go

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

cmd/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
3838

3939
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
40+
ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1"
4041

4142
infrastructurev1alpha1 "github.com/GDATASoftwareAG/cluster-api-provider-ionoscloud/api/v1alpha1"
4243
"github.com/GDATASoftwareAG/cluster-api-provider-ionoscloud/internal/controller"
@@ -52,6 +53,7 @@ func init() {
5253
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
5354
utilruntime.Must(clusterv1.AddToScheme(scheme))
5455
utilruntime.Must(infrastructurev1alpha1.AddToScheme(scheme))
56+
utilruntime.Must(ipamv1.AddToScheme(scheme))
5557
//+kubebuilder:scaffold:scheme
5658
}
5759

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,27 @@ spec:
113113
required:
114114
- name
115115
type: object
116+
primaryAddressFrom:
117+
description: PrimaryAddressFrom is an IPAddressPools that should
118+
be assigned to an IPAddressClaims.
119+
properties:
120+
apiGroup:
121+
description: APIGroup is the group for the resource being
122+
referenced. If APIGroup is not specified, the specified
123+
Kind must be in the core API group. For any other third-party
124+
types, APIGroup is required.
125+
type: string
126+
kind:
127+
description: Kind is the type of resource being referenced
128+
type: string
129+
name:
130+
description: Name is the name of resource being referenced
131+
type: string
132+
required:
133+
- kind
134+
- name
135+
type: object
136+
x-kubernetes-map-type: atomic
116137
primaryIP:
117138
type: string
118139
required:

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,29 @@ spec:
114114
required:
115115
- name
116116
type: object
117+
primaryAddressFrom:
118+
description: PrimaryAddressFrom is an IPAddressPools
119+
that should be assigned to an IPAddressClaims.
120+
properties:
121+
apiGroup:
122+
description: APIGroup is the group for the resource
123+
being referenced. If APIGroup is not specified,
124+
the specified Kind must be in the core API group.
125+
For any other third-party types, APIGroup is required.
126+
type: string
127+
kind:
128+
description: Kind is the type of resource being
129+
referenced
130+
type: string
131+
name:
132+
description: Name is the name of resource being
133+
referenced
134+
type: string
135+
required:
136+
- kind
137+
- name
138+
type: object
139+
x-kubernetes-map-type: atomic
117140
primaryIP:
118141
type: string
119142
required:

config/rbac/role.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,27 @@ rules:
114114
- get
115115
- patch
116116
- update
117+
- apiGroups:
118+
- ipam.cluster.x-k8s.io
119+
resources:
120+
- ipaddressclaims
121+
verbs:
122+
- create
123+
- delete
124+
- get
125+
- list
126+
- patch
127+
- update
128+
- watch
129+
- apiGroups:
130+
- ipam.cluster.x-k8s.io
131+
resources:
132+
- ipaddresses
133+
verbs:
134+
- create
135+
- delete
136+
- get
137+
- list
138+
- patch
139+
- update
140+
- watch

0 commit comments

Comments
 (0)