Skip to content

Commit 08d655a

Browse files
committed
Fix conversion errors
1 parent 55bdc5d commit 08d655a

14 files changed

+75
-44
lines changed

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)

hack/tools/go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module sigs.k8s.io/cluster-api-provider-cloudstack/hack/tools
22

3-
go 1.22.1
4-
5-
toolchain go1.23.2
3+
go 1.23.2
64

75
require (
86
github.com/a8m/envsubst v1.4.2

pkg/cloud/isolated_network.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (c *client) CreateIsolatedNetwork(fd *infrav1.CloudStackFailureDomain, isoN
148148
isoNet.Spec.ID = resp.Id
149149
isoNet.Spec.Gateway = resp.Gateway
150150
isoNet.Spec.Netmask = resp.Netmask
151-
isoNet.Status.NetworkMode = resp.Ip4routing
151+
isoNet.Status.RoutingMode = resp.Ip4routing
152152
return c.AddCreatedByCAPCTag(ResourceTypeNetwork, isoNet.Spec.ID)
153153
}
154154

@@ -173,7 +173,7 @@ func (c *client) OpenFirewallRules(isoNet *infrav1.CloudStackIsolatedNetwork) (r
173173
protocols := []string{NetworkProtocolTCP, NetworkProtocolUDP, NetworkProtocolICMP}
174174
for _, proto := range protocols {
175175
var err error
176-
if isoNet.Status.NetworkMode != "" {
176+
if isoNet.Status.RoutingMode != "" {
177177
p := c.cs.Firewall.NewCreateRoutingFirewallRuleParams(isoNet.Spec.ID, proto)
178178
if proto == "icmp" {
179179
p.SetIcmptype(-1)
@@ -310,7 +310,7 @@ func (c *client) GetOrCreateIsolatedNetwork(
310310
isoNet.Spec.ID = net.ID
311311
isoNet.Spec.Gateway = net.Gateway
312312
isoNet.Spec.Netmask = net.Netmask
313-
isoNet.Status.NetworkMode = net.NetworkMode
313+
isoNet.Status.RoutingMode = net.RoutingMode
314314
if net.VPC != nil && net.VPC.ID != "" {
315315
isoNet.Spec.VPC = net.VPC
316316
}
@@ -330,7 +330,7 @@ func (c *client) GetOrCreateIsolatedNetwork(
330330
}
331331

332332
// Handle control plane endpoint based on network type
333-
if isoNet.Status.NetworkMode == "" {
333+
if isoNet.Status.RoutingMode == "" {
334334
// For non-routed networks, use public IP and load balancer
335335
if err := c.AssociatePublicIPAddress(fd, isoNet, csCluster); err != nil {
336336
return errors.Wrapf(err, "associating public IP address to csCluster")

pkg/cloud/network.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (c *client) ResolveNetwork(net *infrav1.Network) (retErr error) {
6666
net.Gateway = netDetails.Gateway
6767
net.Netmask = netDetails.Netmask
6868
net.Offering = netDetails.Networkofferingname
69-
net.NetworkMode = netDetails.Ip4routing
69+
net.RoutingMode = netDetails.Ip4routing
7070
if netDetails.Vpcid != "" {
7171
if net.VPC == nil {
7272
net.VPC = &infrav1.VPC{}
@@ -91,7 +91,7 @@ func (c *client) ResolveNetwork(net *infrav1.Network) (retErr error) {
9191
net.Gateway = netDetails.Gateway
9292
net.Netmask = netDetails.Netmask
9393
net.Offering = netDetails.Networkofferingname
94-
net.NetworkMode = netDetails.Ip4routing
94+
net.RoutingMode = netDetails.Ip4routing
9595
if netDetails.Vpcid != "" {
9696
if net.VPC == nil {
9797
net.VPC = &infrav1.VPC{}

test/e2e/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ func DownloadMetricsFromCAPCManager(ctx context.Context, bootstrapKubeconfigPath
265265
}
266266

267267
func GetACSVersion(client *cloudstack.CloudStackClient) (string, error) {
268-
msServersResp, err := client.InfrastructureUsage.ListManagementServersMetrics(client.InfrastructureUsage.NewListManagementServersMetricsParams())
268+
msServersResp, err := client.Management.ListManagementServersMetrics(client.Management.NewListManagementServersMetricsParams())
269269
if err != nil {
270270
return "", err
271271
}

0 commit comments

Comments
 (0)