Skip to content

Commit 4befde1

Browse files
authored
Merge pull request kubernetes-sigs#439 from shapeblue/support-routed-networks
Support routed networks
2 parents 8ccef79 + 4aec197 commit 4befde1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+194
-136
lines changed

.github/workflows/go-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- uses: actions/setup-go@v5
1616
with:
17-
go-version: 1.22
17+
go-version: 1.23
1818
- name: Run go test with coverage
1919
run: COVER_PROFILE=coverage.txt make test
2020
- name: Codecov upload

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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ type Network struct {
7272
// Cloudstack VPC the network belongs to.
7373
// +optional
7474
VPC *VPC `json:"vpc,omitempty"`
75+
76+
// Cloudstack Network's routing mode.
77+
// Routing mode can be Dynamic, or Static.
78+
// Empty value means the network mode is NATTED, not ROUTED.
79+
// +optional
80+
RoutingMode string `json:"routingMode,omitempty"`
7581
}
7682

7783
type VPC struct {

api/v1beta3/cloudstackisolatednetwork_types.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,25 @@ 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+
// 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"`
75+
7176
// Ready indicates the readiness of this provider resource.
7277
Ready bool `json:"ready"`
7378
}
7479

7580
func (n *CloudStackIsolatedNetwork) Network() *Network {
7681
return &Network{
77-
Name: n.Spec.Name,
78-
Type: "IsolatedNetwork",
79-
ID: n.Spec.ID,
80-
Gateway: n.Spec.Gateway,
81-
Netmask: n.Spec.Netmask,
82-
VPC: n.Spec.VPC,
83-
Offering: n.Spec.Offering,
82+
Name: n.Spec.Name,
83+
Type: "IsolatedNetwork",
84+
ID: n.Spec.ID,
85+
Gateway: n.Spec.Gateway,
86+
Netmask: n.Spec.Netmask,
87+
VPC: n.Spec.VPC,
88+
Offering: n.Spec.Offering,
89+
RoutingMode: n.Status.RoutingMode,
8490
}
8591
}
8692

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,12 @@ spec:
432432
isolated networks and "DefaultIsolatedNetworkOfferingForVpcNetworks"
433433
for VPC networks.
434434
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
435441
type:
436442
description: Cloudstack Network Type the cluster is
437443
built in.

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,12 @@ spec:
200200
isolated networks and "DefaultIsolatedNetworkOfferingForVpcNetworks"
201201
for VPC networks.
202202
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
203209
type:
204210
description: Cloudstack Network Type the cluster is built
205211
in.

0 commit comments

Comments
 (0)