Skip to content

Commit 4aec197

Browse files
committed
Fix conversion errors
1 parent 55bdc5d commit 4aec197

17 files changed

+78
-56
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ lint: $(GOLANGCI_LINT) $(STATIC_CHECK) generate-mocks ## Run linting for the pro
129129

130130
.PHONY: modules
131131
modules: ## Runs go mod to ensure proper vendoring.
132-
go mod tidy -compat=1.22
133-
cd $(TOOLS_DIR); go mod tidy -compat=1.22
132+
go mod tidy -compat=1.23
133+
cd $(TOOLS_DIR); go mod tidy -compat=1.23
134134

135135
.PHONY: generate-all
136136
generate-all: generate-mocks generate-deepcopy generate-manifests

api/v1beta1/conversion.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,14 @@ func Convert_v1beta3_Network_To_v1beta1_Network(in *v1beta3.Network, out *Networ
185185
// Skip Gateway, Netmask, and VPC fields as they do not exist in v1beta1.Network
186186
return nil
187187
}
188+
189+
// Convert_v1beta3_CloudStackIsolatedNetworkStatus_To_v1beta1_CloudStackIsolatedNetworkStatus handles manual conversion of CloudStackIsolatedNetworkStatus from v1beta3 to v1beta1
190+
//
191+
//nolint:golint,revive,stylecheck
192+
func Convert_v1beta3_CloudStackIsolatedNetworkStatus_To_v1beta1_CloudStackIsolatedNetworkStatus(in *v1beta3.CloudStackIsolatedNetworkStatus, out *CloudStackIsolatedNetworkStatus, _ conv.Scope) error {
193+
out.PublicIPID = in.PublicIPID
194+
out.LBRuleID = in.LBRuleID
195+
out.Ready = in.Ready
196+
// RoutingMode field doesn't exist in v1beta1, so we ignore it during conversion
197+
return nil
198+
}

api/v1beta1/zz_generated.conversion.go

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

api/v1beta2/conversion.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,14 @@ func Convert_v1beta3_CloudStackIsolatedNetworkSpec_To_v1beta2_CloudStackIsolated
4343
// Skip Gateway, Netmask, and VPC fields as they do not exist in v1beta2.CloudStackIsolatedNetworkSpec
4444
return nil
4545
}
46+
47+
// Convert_v1beta3_CloudStackIsolatedNetworkStatus_To_v1beta2_CloudStackIsolatedNetworkStatus handles manual conversion of CloudStackIsolatedNetworkStatus from v1beta3 to v1beta2
48+
//
49+
//nolint:golint,revive,stylecheck
50+
func Convert_v1beta3_CloudStackIsolatedNetworkStatus_To_v1beta2_CloudStackIsolatedNetworkStatus(in *v1beta3.CloudStackIsolatedNetworkStatus, out *CloudStackIsolatedNetworkStatus, _ conv.Scope) error {
51+
out.PublicIPID = in.PublicIPID
52+
out.LBRuleID = in.LBRuleID
53+
out.Ready = in.Ready
54+
// RoutingMode field doesn't exist in v1beta2, so we ignore it during conversion
55+
return nil
56+
}

api/v1beta2/zz_generated.conversion.go

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

api/v1beta3/cloudstackfailuredomain_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ type Network struct {
7474
VPC *VPC `json:"vpc,omitempty"`
7575

7676
// Cloudstack Network's routing mode.
77+
// Routing mode can be Dynamic, or Static.
78+
// Empty value means the network mode is NATTED, not ROUTED.
7779
// +optional
78-
NetworkMode string `json:"networkMode,omitempty"`
80+
RoutingMode string `json:"routingMode,omitempty"`
7981
}
8082

8183
type VPC struct {

api/v1beta3/cloudstackisolatednetwork_types.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ type CloudStackIsolatedNetworkStatus struct {
6868
// The ID of the lb rule used to assign VMs to the lb.
6969
LBRuleID string `json:"loadBalancerRuleID,omitempty"`
7070

71-
// Network mode of the network.
72-
NetworkMode string `json:"networkMode,omitempty"`
71+
// Routing mode of the network.
72+
// Routing mode can be Dynamic, or Static.
73+
// Empty value means the network mode is NATTED, not ROUTED.
74+
RoutingMode string `json:"routingMode,omitempty"`
7375

7476
// Ready indicates the readiness of this provider resource.
7577
Ready bool `json:"ready"`
@@ -84,7 +86,7 @@ func (n *CloudStackIsolatedNetwork) Network() *Network {
8486
Netmask: n.Spec.Netmask,
8587
VPC: n.Spec.VPC,
8688
Offering: n.Spec.Offering,
87-
NetworkMode: n.Status.NetworkMode,
89+
RoutingMode: n.Status.RoutingMode,
8890
}
8991
}
9092

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,16 +425,19 @@ spec:
425425
description: Cloudstack Network Netmask the cluster
426426
is built in.
427427
type: string
428-
networkMode:
429-
description: Cloudstack Network's routing mode.
430-
type: string
431428
offering:
432429
description: |-
433430
Cloudstack Network Offering the cluster is built in.
434431
Default is "DefaultIsolatedNetworkOfferingWithSourceNatService" for
435432
isolated networks and "DefaultIsolatedNetworkOfferingForVpcNetworks"
436433
for VPC networks.
437434
type: string
435+
routingMode:
436+
description: |-
437+
Cloudstack Network's routing mode.
438+
Routing mode can be Dynamic, or Static.
439+
Empty value means the network mode is NATTED, not ROUTED.
440+
type: string
438441
type:
439442
description: Cloudstack Network Type the cluster is
440443
built in.

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,19 @@ spec:
193193
description: Cloudstack Network Netmask the cluster is built
194194
in.
195195
type: string
196-
networkMode:
197-
description: Cloudstack Network's routing mode.
198-
type: string
199196
offering:
200197
description: |-
201198
Cloudstack Network Offering the cluster is built in.
202199
Default is "DefaultIsolatedNetworkOfferingWithSourceNatService" for
203200
isolated networks and "DefaultIsolatedNetworkOfferingForVpcNetworks"
204201
for VPC networks.
205202
type: string
203+
routingMode:
204+
description: |-
205+
Cloudstack Network's routing mode.
206+
Routing mode can be Dynamic, or Static.
207+
Empty value means the network mode is NATTED, not ROUTED.
208+
type: string
206209
type:
207210
description: Cloudstack Network Type the cluster is built
208211
in.

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,18 @@ spec:
254254
loadBalancerRuleID:
255255
description: The ID of the lb rule used to assign VMs to the lb.
256256
type: string
257-
networkMode:
258-
description: Network mode of the network.
259-
type: string
260257
publicIPID:
261258
description: The CS public IP ID to use for the k8s endpoint.
262259
type: string
263260
ready:
264261
description: Ready indicates the readiness of this provider resource.
265262
type: boolean
263+
routingMode:
264+
description: |-
265+
Routing mode of the network.
266+
Routing mode can be Dynamic, or Static.
267+
Empty value means the network mode is NATTED, not ROUTED.
268+
type: string
266269
required:
267270
- ready
268271
type: object

controllers/cloudstackmachine_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func (r *CloudStackMachineReconciliationRunner) AddToLBIfNeeded() (retRes ctrl.R
299299
return r.RequeueWithMessage("Could not get required Isolated Network for VM, requeueing.")
300300
}
301301

302-
if r.IsoNet.Status.NetworkMode == "" {
302+
if r.IsoNet.Status.RoutingMode == "" {
303303
// For non-routed networks, use load balancer
304304
r.Log.Info("Assigning VM to load balancer rule.")
305305
err := r.CSUser.AssignVMToLoadBalancerRule(r.IsoNet, *r.ReconciliationSubject.Spec.InstanceID)

0 commit comments

Comments
 (0)