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

fix failure in deref #34

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
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
11 changes: 9 additions & 2 deletions api/v1alpha1/ionoscloudcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ type IONOSCloudClusterSpec struct {
// +optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
// +optional
// +listType=map
// +listMapKey=name
Lans []IONOSLanSpec `json:"lans,omitempty"`
// +optional
LoadBalancer *IONOSLoadBalancerSpec `json:"loadBalancer,omitempty"`
Expand Down Expand Up @@ -190,7 +192,11 @@ func (c *IONOSCloudCluster) LanBy(id *int32) *IONOSLanSpec {
return nil
}
for i := range c.Spec.Lans {
if *c.Spec.Lans[i].LanID == *id {
lan := &c.Spec.Lans[i]
if lan.LanID == nil {
continue
}
if *lan.LanID == *id {
return &c.Spec.Lans[i]
}
}
Expand All @@ -203,7 +209,8 @@ func (c *IONOSCloudCluster) EnsureLan(spec IONOSLanSpec) {
}
for i := range c.Spec.Lans {
if c.Spec.Lans[i].Name == spec.Name {
c.Spec.Lans[i] = spec
c.Spec.Lans[i].LanID = spec.LanID
c.Spec.Lans[i].Public = spec.Public
return
}
}
Expand Down
3 changes: 2 additions & 1 deletion api/v1alpha1/ionoscloudmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ func (c *IONOSCloudMachine) EnsureNic(spec IONOSNicSpec) {
}
for i := range c.Spec.Nics {
if c.Spec.Nics[i].LanRef.Name == spec.LanRef.Name {
c.Spec.Nics[i] = spec
c.Spec.Nics[i].PrimaryIP = spec.PrimaryIP
c.Spec.Nics[i].LanRef = spec.LanRef
return
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ spec:
- public
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
loadBalancer:
properties:
id:
Expand Down
Loading