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

Commit cecdb2e

Browse files
authored
Merge pull request #34 from GDATASoftwareAG/fix-failure-in-deref
fix failure in deref
2 parents c2ac8c4 + 90a07c2 commit cecdb2e

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

api/v1alpha1/ionoscloudcluster_types.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ type IONOSCloudClusterSpec struct {
103103
// +optional
104104
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
105105
// +optional
106+
// +listType=map
107+
// +listMapKey=name
106108
Lans []IONOSLanSpec `json:"lans,omitempty"`
107109
// +optional
108110
LoadBalancer *IONOSLoadBalancerSpec `json:"loadBalancer,omitempty"`
@@ -190,7 +192,11 @@ func (c *IONOSCloudCluster) LanBy(id *int32) *IONOSLanSpec {
190192
return nil
191193
}
192194
for i := range c.Spec.Lans {
193-
if *c.Spec.Lans[i].LanID == *id {
195+
lan := &c.Spec.Lans[i]
196+
if lan.LanID == nil {
197+
continue
198+
}
199+
if *lan.LanID == *id {
194200
return &c.Spec.Lans[i]
195201
}
196202
}
@@ -203,7 +209,8 @@ func (c *IONOSCloudCluster) EnsureLan(spec IONOSLanSpec) {
203209
}
204210
for i := range c.Spec.Lans {
205211
if c.Spec.Lans[i].Name == spec.Name {
206-
c.Spec.Lans[i] = spec
212+
c.Spec.Lans[i].LanID = spec.LanID
213+
c.Spec.Lans[i].Public = spec.Public
207214
return
208215
}
209216
}

api/v1alpha1/ionoscloudmachine_types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ func (c *IONOSCloudMachine) EnsureNic(spec IONOSNicSpec) {
131131
}
132132
for i := range c.Spec.Nics {
133133
if c.Spec.Nics[i].LanRef.Name == spec.LanRef.Name {
134-
c.Spec.Nics[i] = spec
134+
c.Spec.Nics[i].PrimaryIP = spec.PrimaryIP
135+
c.Spec.Nics[i].LanRef = spec.LanRef
135136
return
136137
}
137138
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ spec:
7777
- public
7878
type: object
7979
type: array
80+
x-kubernetes-list-map-keys:
81+
- name
82+
x-kubernetes-list-type: map
8083
loadBalancer:
8184
properties:
8285
id:

0 commit comments

Comments
 (0)